Skip to content

Commit e0b51c6

Browse files
Merge branch 'jumpei-yamauchi-master' into dev
2 parents fcbb7be + de40c55 commit e0b51c6

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

docs/documentation/docs/controls/DynamicForm.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ The `DynamicForm` can be configured with the following properties:
3636
| listId | string | yes | Guid of the list.|
3737
| listItemId | number | no | list item ID. |
3838
| contentTypeId | string | no | content type ID |
39-
| disabled | boolean | no | Option allow to be enable or disable. Default value is `false`|
39+
| disabled | boolean | no | Allows form to be disabled. Default value is `false`|
40+
| disabledFields | string[] | no | InternalName of fields that should be disabled. Default value is `false`|
4041
| onBeforeSubmit | (listItemData: any) => Promise<boolean> | no | Before submit handler. Allows to modify the object to be submitted or cancel the submission. |
4142
| onSubmitted | (listItemData: any, listItem?: IItem) => void | no | Method that returns listItem data JSON object and PnPJS list item instance (`IItem`). |
4243
| onSubmitError | (listItemData: any, error: Error) => void | no | Handler of submission error. |

src/controls/dynamicForm/DynamicForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
290290

291291
//getting all the fields information as part of get ready process
292292
private getFieldInformations = async (): Promise<void> => {
293-
const { context, listId, listItemId } = this.props;
293+
const { context, listId, listItemId, disabledFields } = this.props;
294294
let contentTypeId = this.props.contentTypeId;
295295
//let arrayItems: { key: string; name: string }[] = [];
296296
try {
@@ -453,7 +453,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
453453
fieldTitle: field.Title,
454454
fieldDefaultValue: defaultValue,
455455
context: this.props.context,
456-
disabled: this.props.disabled,
456+
disabled: this.props.disabled || (disabledFields && disabledFields.indexOf(field.InternalName) > -1),
457457
listId: this.props.listId,
458458
columnInternalName: field.InternalName,
459459
label: field.Title,

src/controls/dynamicForm/IDynamicFormProps.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,8 @@ export interface IDynamicFormProps {
4949
* Used to execute WebSearch. If not provided SearchTab will not be available.
5050
*/
5151
//bingAPIKey?: string;
52+
/**
53+
* InternalName of fields that should be disabled
54+
*/
55+
disabledFields?: string[];
5256
}

0 commit comments

Comments
 (0)