-
Notifications
You must be signed in to change notification settings - Fork 399
/
Copy pathIDynamicFieldProps.ts
127 lines (98 loc) · 4.14 KB
/
IDynamicFieldProps.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
126
127
import { BaseComponentContext } from '@microsoft/sp-component-base';
import { IDropdownOption } from "@fluentui/react/lib/Dropdown";
import { IStyle, IStyleFunctionOrObject, Theme } from '@fluentui/react';
import { IFilePickerResult } from '../../filePicker';
import { ChoiceFieldFormatType } from '@pnp/sp/fields';
export type DateFormat = 'DateTime' | 'DateOnly';
export type FieldChangeAdditionalData = IFilePickerResult;
export interface IDynamicFieldProps {
context: BaseComponentContext;
/** Internal column name */
columnInternalName: string;
cultureName?: string;
/** SharePoint Field Type */
fieldType: string;
/** Text label for field */
label?: string;
/** Placeholder text for field */
placeholder?: string;
/** Specifies if a field should be filled in order to pass validation */
required: boolean;
/** Specifies if a field should be disabled */
disabled?: boolean;
/** List Item Id, passed to various utility/helper functions to determine things like selected User UPN, Lookup text, Term labels etc. */
listItemId?: number;
/** The default value of the field. */
defaultValue: any; // eslint-disable-line @typescript-eslint/no-explicit-any
/** Holds a field value. Set on all fields in the form. */
value?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
/** Fired by DynamicField when a field value is changed */
onChanged?: (
columnInternalName: string,
newValue: any, // eslint-disable-line @typescript-eslint/no-explicit-any
validate: boolean,
additionalData?: FieldChangeAdditionalData
) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
/** Represents the value of the field as updated by the user. Only updated by fields when changed. */
newValue?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
/** Represents a stringified value of the field. Used in custom formatting and validation. */
stringValue: any; // eslint-disable-line @typescript-eslint/no-explicit-any
/** Holds additional properties that can be queried in validation. For example a Person column may be reference by both [$Person] and [$Person.email] */
subPropertyValues?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
/** If validation raises an error message, it can be stored against the field here for display by DynamicField */
validationErrorMessage?: string;
/** Field Term Set ID, used in Taxonomy / Metadata fields */
fieldTermSetId?: string;
/** Field Anchor ID, used in Taxonomy / Metadata fields */
fieldAnchorId?: string;
/** Lookup List ID, used in Lookup and User fields */
lookupListID?: string;
/** Lookup Field. Represents the field used for Lookup values. */
lookupField?: string;
// changedValue: any; // eslint-disable-line @typescript-eslint/no-explicit-any
/** Equivalent to HiddenListInternalName, used for Taxonomy Metadata fields */
hiddenFieldName?: string;
/** Order of the field in the form */
Order: number;
/** Used for files / image uploads */
additionalData?: FieldChangeAdditionalData;
/** Used to Render TaxonomyPicker or ModernTaxonomyPicker */
useModernTaxonomyPickerControl?: boolean;
// Related to various field types
options?: IDropdownOption[];
isRichText?: boolean;
dateFormat?: DateFormat;
firstDayOfWeek: number;
principalType?: string;
description?: string;
maximumValue?: number;
minimumValue?: number;
showAsPercentage?: boolean;
itemsQueryCountLimit?: number;
customIcon?: string;
orderBy?: string;
choiceType?: ChoiceFieldFormatType;
/** Used for customize component styling */
styles?:IStyleFunctionOrObject<IDynamicFieldStyleProps, IDynamicFieldStyles>;
}
export interface IDynamicFieldStyleProps {
theme: Theme;
required?: boolean;
}
export interface IDynamicFieldStyles {
titleContainer: IStyle;
fieldIcon:IStyle;
fieldDisplay:IStyle;
fieldDisplayNoPadding:IStyle;
fieldContainer:IStyle;
fieldDescription:IStyle,
fieldLabel:IStyle;
labelContainer:IStyle;
pickersContainer:IStyle;
fieldEditor:IStyle;
errormessage:IStyle;
richText:IStyle;
thumbnailFieldButtons:IStyle;
selectedFileContainer:IStyle;
fieldRequired:IStyle;
}