-
Notifications
You must be signed in to change notification settings - Fork 379
/
IDynamicFormProps.ts
125 lines (111 loc) · 3.65 KB
/
IDynamicFormProps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import { BaseComponentContext } from '@microsoft/sp-component-base';
import { IItem } from '@pnp/sp/items';
import React from 'react';
import { IDynamicFieldProps } from './dynamicField';
import { IValidationErrorDialogProps } from './IValidationErrorDialogProps';
export interface IDynamicFormProps {
/**
* Current context
*/
context: BaseComponentContext;
/**
* Specifies if the form is disabled
*/
disabled?: boolean;
/**
* List id
*/
listId: string;
/**
* List item loaded handler.
* Allows to access list item information after it's loaded.
*/
onListItemLoaded?: (listItemData: any) => Promise<void>; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Before submit handler.
* Allows to modify the object to be submitted or cancel the submission.
*/
onBeforeSubmit?: (listItemData: any) => Promise<boolean>; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Handler for form submitted event
*/
onSubmitted?: (listItemData: any, listItem?: IItem) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Handler of submission error
*/
onSubmitError?: (listItemData: any, error: Error) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Handler for form cancelled event
*/
onCancelled?: () => void;
/**
* ID of the list item to display on the form
*/
listItemId?: number;
/**
* Content type id of the item
*/
contentTypeId?: string;
/**
* Key value pair for fields you want to override. Key is the internal field name, value is the function to be called for the custom element to render
*/
fieldOverrides?: {
[columnInternalName: string]: {
(
fieldProperties: IDynamicFieldProps
): React.ReactElement<IDynamicFieldProps>;
};
};
/**
* Specifies if onSubmitted event should pass PnPJS list item (IItem) as a second parameter. Default - true
*/
returnListItemInstanceOnSubmit?: boolean;
/**
* InternalName of fields that should be disabled
*/
disabledFields?: string[];
/**
* InternalName of fields that should be hidden
*/
hiddenFields?: string[];
/**
* Absolute Web Url of target site (user requires permissions)
*/
webAbsoluteUrl?: string;
/**
* Specifies if ETag should be respected when updating the item. Default - true
*/
respectETag?: boolean;
/**
* Specifies whether custom formatting (set when customizing the out of the box form) should be used. Default - true
*/
useCustomFormatting?: boolean;
/**
* Specifies whether client side validation should be used. Default - true
*/
useClientSideValidation?: boolean;
/**
* Specifies whether field validation (set in column settings) should be used. Default - true
*/
useFieldValidation?: boolean;
/**
* Specify validation error dialog properties
*/
validationErrorDialogProps?: IValidationErrorDialogProps;
/**
* Specify if the form should support the creation of a new list item in a document library attaching a file to it.
* This option is only available for document libraries and works only when the contentTypeId is specified and has a base type of type Document.
* Default - false
*/
enableFileSelection?: boolean;
/**
* Specify the supported file extensions for the file picker. Default - "docx", "doc", "pptx", "ppt", "xlsx", "xls", "pdf"
* Only used when enableFileSelection is true
*/
supportedFileExtensions?: string[];
/**
* Specify a set of custom icons to be used.
* The key is the field internal name and the value is the Fluent UI icon name.
*/
customIcons?: { [columnInternalName: string]: string };
}