extended-dynamic-forms 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +398 -1075
- package/dist/WizardForm.d.ts +4 -1
- package/dist/events/FormEventContext.d.ts +3 -0
- package/dist/events/FormEventHub.d.ts +19 -2
- package/dist/index.es.js +21051 -12923
- package/dist/index.umd.js +63 -36
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +6 -1
- package/dist/utils/fieldChangeDetector.d.ts +22 -0
- package/dist/widgets/base/index.d.ts +2 -0
- package/dist/widgets/base/types.d.ts +135 -0
- package/dist/widgets/base/utils.d.ts +63 -0
- package/dist/widgets/choice/ChoiceWidget.d.ts +30 -0
- package/dist/widgets/choice/ChoiceWidget.types.d.ts +496 -0
- package/dist/widgets/choice/examples/ChoiceWidget.example.d.ts +7 -0
- package/dist/widgets/choice/hooks/__tests__/useChoiceWidget.test.d.ts +1 -0
- package/dist/widgets/choice/hooks/__tests__/useDataSource.test.d.ts +1 -0
- package/dist/widgets/choice/hooks/examples/useChoiceWidget.example.d.ts +18 -0
- package/dist/widgets/choice/hooks/examples/useDataSourceExample.d.ts +22 -0
- package/dist/widgets/choice/hooks/index.d.ts +6 -0
- package/dist/widgets/choice/hooks/useChoiceWidget.d.ts +65 -0
- package/dist/widgets/choice/hooks/useDataSource.d.ts +69 -0
- package/dist/widgets/choice/index.d.ts +59 -0
- package/dist/widgets/choice/presenters/CheckboxPresenter.d.ts +70 -0
- package/dist/widgets/choice/presenters/DropdownPresenter.d.ts +37 -0
- package/dist/widgets/choice/presenters/PresenterStrategy.d.ts +230 -0
- package/dist/widgets/choice/presenters/RadioPresenter.d.ts +39 -0
- package/dist/widgets/choice/presenters/examples/RadioPresenterExample.d.ts +7 -0
- package/dist/widgets/choice/presenters/index.d.ts +20 -0
- package/dist/widgets/choice/providers/ApiDataSource.d.ts +241 -0
- package/dist/widgets/choice/providers/DataSourceProvider.d.ts +260 -0
- package/dist/widgets/choice/providers/StaticDataSource.d.ts +258 -0
- package/dist/widgets/choice/providers/WebSocketDataSource.d.ts +310 -0
- package/dist/widgets/choice/providers/index.d.ts +12 -0
- package/dist/widgets/choice/utils/index.d.ts +1 -0
- package/dist/widgets/choice/utils/responseMappers.d.ts +342 -0
- package/dist/widgets/date/DateTimeWidget.d.ts +26 -0
- package/dist/widgets/date/EnhancedDateWidget.d.ts +26 -0
- package/dist/widgets/date/index.d.ts +13 -0
- package/dist/widgets/file/FileUploadWidget.d.ts +40 -0
- package/dist/widgets/file/index.d.ts +2 -0
- package/dist/widgets/index.d.ts +33 -17
- package/dist/widgets/input/EmailWidget.d.ts +34 -0
- package/dist/widgets/input/NumberWidget.d.ts +39 -0
- package/dist/widgets/input/TelephoneWidget.d.ts +34 -0
- package/dist/widgets/input/URLWidget.d.ts +34 -0
- package/dist/widgets/input/index.d.ts +7 -0
- package/dist/widgets/text/PasswordWidget.d.ts +45 -0
- package/dist/widgets/text/TextWidget.d.ts +40 -0
- package/dist/widgets/text/TextareaWidget.d.ts +38 -0
- package/dist/widgets/text/index.d.ts +20 -0
- package/package.json +8 -8
- package/dist/vanilla-entry.d.ts +0 -204
- package/dist/widgets/enhanced/EnhancedWidgets.d.ts +0 -37
- package/examples/conditional-v2-example.tsx +0 -64
- package/examples/dynamic-array-items-example.tsx +0 -211
- package/examples/form-devtools-example.tsx +0 -384
- package/examples/global-ui-rules-example.tsx +0 -371
- package/examples/vanilla-js/README.md +0 -212
- package/examples/vanilla-js/basic-form.html +0 -142
- package/examples/vanilla-js/conditional-form.html +0 -159
- package/examples/vanilla-js/wizard-form.html +0 -185
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { ChoiceOption, ResponseMapper, ResponseMapperConfig } from '../ChoiceWidget.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error thrown when response mapping fails
|
|
5
|
+
*/
|
|
6
|
+
export declare class ResponseMappingError extends Error {
|
|
7
|
+
readonly path?: string | undefined;
|
|
8
|
+
readonly index?: number | undefined;
|
|
9
|
+
readonly originalError?: Error | undefined;
|
|
10
|
+
constructor(message: string, path?: string | undefined, index?: number | undefined, originalError?: Error | undefined);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validate a single choice option
|
|
14
|
+
*
|
|
15
|
+
* @param option - The option to validate
|
|
16
|
+
* @param index - The index in the array for error reporting
|
|
17
|
+
* @returns Validated ChoiceOption
|
|
18
|
+
* @throws ResponseMappingError if validation fails
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateChoiceOption(option: unknown, index: number): ChoiceOption;
|
|
21
|
+
/**
|
|
22
|
+
* Validate an array of choice options
|
|
23
|
+
*
|
|
24
|
+
* @param options - Array to validate
|
|
25
|
+
* @returns Validated ChoiceOption array
|
|
26
|
+
* @throws ResponseMappingError if validation fails
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateChoiceOptions(options: unknown): ChoiceOption[];
|
|
29
|
+
/**
|
|
30
|
+
* Get a nested value from an object using dot notation
|
|
31
|
+
*
|
|
32
|
+
* @param obj - Object to extract value from
|
|
33
|
+
* @param path - Dot notation path (e.g., 'data.items')
|
|
34
|
+
* @returns The value at the path or undefined
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const obj = { data: { items: [1, 2, 3] } };
|
|
39
|
+
* getNestedValue(obj, 'data.items'); // [1, 2, 3]
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function getNestedValue(obj: unknown, path: string): unknown;
|
|
43
|
+
/**
|
|
44
|
+
* Set a nested value in an object using dot notation
|
|
45
|
+
*
|
|
46
|
+
* @param obj - Object to set value in
|
|
47
|
+
* @param path - Dot notation path
|
|
48
|
+
* @param value - Value to set
|
|
49
|
+
* @returns New object with value set (immutable)
|
|
50
|
+
*/
|
|
51
|
+
export declare function setNestedValue(obj: Record<string, unknown>, path: string, value: unknown): Record<string, unknown>;
|
|
52
|
+
/**
|
|
53
|
+
* Extract array from response data using a path
|
|
54
|
+
*
|
|
55
|
+
* @param data - Response data
|
|
56
|
+
* @param arrayPath - Path to array (optional)
|
|
57
|
+
* @returns Extracted array
|
|
58
|
+
* @throws ResponseMappingError if array not found
|
|
59
|
+
*/
|
|
60
|
+
export declare function extractArrayFromResponse(data: unknown, arrayPath?: string): unknown[];
|
|
61
|
+
/**
|
|
62
|
+
* Map a simple response structure to ChoiceOption array
|
|
63
|
+
*
|
|
64
|
+
* @param data - Response data
|
|
65
|
+
* @param config - Simple mapper configuration
|
|
66
|
+
* @returns Mapped ChoiceOption array
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const data = { items: [{ name: 'Option 1', id: 1 }] };
|
|
71
|
+
* const options = mapSimpleResponse(data, {
|
|
72
|
+
* arrayPath: 'items',
|
|
73
|
+
* labelField: 'name',
|
|
74
|
+
* valueField: 'id'
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function mapSimpleResponse(data: unknown, config?: NonNullable<ResponseMapperConfig['simple']>): ChoiceOption[];
|
|
79
|
+
/**
|
|
80
|
+
* Map a nested response structure to ChoiceOption array
|
|
81
|
+
*
|
|
82
|
+
* @param data - Response data
|
|
83
|
+
* @param config - Nested mapper configuration
|
|
84
|
+
* @returns Mapped ChoiceOption array
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const data = {
|
|
89
|
+
* response: {
|
|
90
|
+
* data: [
|
|
91
|
+
* {
|
|
92
|
+
* info: { displayName: 'Option 1' },
|
|
93
|
+
* meta: { identifier: 'opt1', active: false }
|
|
94
|
+
* }
|
|
95
|
+
* ]
|
|
96
|
+
* }
|
|
97
|
+
* };
|
|
98
|
+
*
|
|
99
|
+
* const options = mapNestedResponse(data, {
|
|
100
|
+
* arrayPath: 'response.data',
|
|
101
|
+
* paths: {
|
|
102
|
+
* label: 'info.displayName',
|
|
103
|
+
* value: 'meta.identifier',
|
|
104
|
+
* disabled: 'meta.active'
|
|
105
|
+
* }
|
|
106
|
+
* });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function mapNestedResponse(data: unknown, config: NonNullable<ResponseMapperConfig['nested']>): ChoiceOption[];
|
|
110
|
+
/**
|
|
111
|
+
* Create a custom response mapper with validation
|
|
112
|
+
*
|
|
113
|
+
* @param mapper - Custom mapper function
|
|
114
|
+
* @returns Wrapped mapper with validation
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const customMapper = createCustomMapper((data: any) => {
|
|
119
|
+
* return data.options.map((opt: any) => ({
|
|
120
|
+
* label: opt.text || opt.name,
|
|
121
|
+
* value: opt.key || opt.id,
|
|
122
|
+
* disabled: !opt.enabled
|
|
123
|
+
* }));
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function createCustomMapper(mapper: ResponseMapper): ResponseMapper;
|
|
128
|
+
/**
|
|
129
|
+
* Main response mapper that handles all mapper types
|
|
130
|
+
*
|
|
131
|
+
* @param data - Response data to map
|
|
132
|
+
* @param config - Response mapper configuration
|
|
133
|
+
* @returns Mapped ChoiceOption array
|
|
134
|
+
* @throws ResponseMappingError if mapping fails
|
|
135
|
+
*/
|
|
136
|
+
export declare function mapResponse(data: unknown, config: ResponseMapperConfig): ChoiceOption[];
|
|
137
|
+
/**
|
|
138
|
+
* Predefined response mappers for common API patterns
|
|
139
|
+
*/
|
|
140
|
+
export declare const COMMON_MAPPERS: {
|
|
141
|
+
/**
|
|
142
|
+
* Simple flat array: [{ label: "Option", value: "opt" }]
|
|
143
|
+
*/
|
|
144
|
+
readonly SIMPLE_ARRAY: {
|
|
145
|
+
readonly type: "simple";
|
|
146
|
+
readonly simple: {
|
|
147
|
+
readonly labelField: "label";
|
|
148
|
+
readonly valueField: "value";
|
|
149
|
+
readonly disabledField: "disabled";
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Name/ID pattern: [{ name: "Option", id: 1 }]
|
|
154
|
+
*/
|
|
155
|
+
readonly NAME_ID: {
|
|
156
|
+
readonly type: "simple";
|
|
157
|
+
readonly simple: {
|
|
158
|
+
readonly labelField: "name";
|
|
159
|
+
readonly valueField: "id";
|
|
160
|
+
readonly disabledField: "disabled";
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Title/Key pattern: [{ title: "Option", key: "opt" }]
|
|
165
|
+
*/
|
|
166
|
+
readonly TITLE_KEY: {
|
|
167
|
+
readonly type: "simple";
|
|
168
|
+
readonly simple: {
|
|
169
|
+
readonly labelField: "title";
|
|
170
|
+
readonly valueField: "key";
|
|
171
|
+
readonly disabledField: "disabled";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Text/Value pattern: [{ text: "Option", value: "opt" }]
|
|
176
|
+
*/
|
|
177
|
+
readonly TEXT_VALUE: {
|
|
178
|
+
readonly type: "simple";
|
|
179
|
+
readonly simple: {
|
|
180
|
+
readonly labelField: "text";
|
|
181
|
+
readonly valueField: "value";
|
|
182
|
+
readonly disabledField: "disabled";
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Display/Code pattern: [{ display: "Option", code: "OPT" }]
|
|
187
|
+
*/
|
|
188
|
+
readonly DISPLAY_CODE: {
|
|
189
|
+
readonly type: "simple";
|
|
190
|
+
readonly simple: {
|
|
191
|
+
readonly labelField: "display";
|
|
192
|
+
readonly valueField: "code";
|
|
193
|
+
readonly disabledField: "disabled";
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Paginated response mappers for common pagination patterns
|
|
199
|
+
*/
|
|
200
|
+
export declare const PAGINATED_MAPPERS: {
|
|
201
|
+
/**
|
|
202
|
+
* Standard paginated: { data: [...], total: 100, page: 1 }
|
|
203
|
+
*/
|
|
204
|
+
readonly DATA_ARRAY: {
|
|
205
|
+
readonly type: "simple";
|
|
206
|
+
readonly simple: {
|
|
207
|
+
readonly arrayPath: "data";
|
|
208
|
+
readonly labelField: "label";
|
|
209
|
+
readonly valueField: "value";
|
|
210
|
+
readonly disabledField: "disabled";
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Results pattern: { results: [...], count: 100 }
|
|
215
|
+
*/
|
|
216
|
+
readonly RESULTS_ARRAY: {
|
|
217
|
+
readonly type: "simple";
|
|
218
|
+
readonly simple: {
|
|
219
|
+
readonly arrayPath: "results";
|
|
220
|
+
readonly labelField: "name";
|
|
221
|
+
readonly valueField: "id";
|
|
222
|
+
readonly disabledField: "disabled";
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Items pattern: { items: [...], totalItems: 100 }
|
|
227
|
+
*/
|
|
228
|
+
readonly ITEMS_ARRAY: {
|
|
229
|
+
readonly type: "simple";
|
|
230
|
+
readonly simple: {
|
|
231
|
+
readonly arrayPath: "items";
|
|
232
|
+
readonly labelField: "label";
|
|
233
|
+
readonly valueField: "value";
|
|
234
|
+
readonly disabledField: "disabled";
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Nested data: { data: { items: [...] }, meta: {...} }
|
|
239
|
+
*/
|
|
240
|
+
readonly NESTED_DATA_ITEMS: {
|
|
241
|
+
readonly type: "simple";
|
|
242
|
+
readonly simple: {
|
|
243
|
+
readonly arrayPath: "data.items";
|
|
244
|
+
readonly labelField: "label";
|
|
245
|
+
readonly valueField: "value";
|
|
246
|
+
readonly disabledField: "disabled";
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Response wrapper: { response: { data: [...] } }
|
|
251
|
+
*/
|
|
252
|
+
readonly RESPONSE_DATA: {
|
|
253
|
+
readonly type: "simple";
|
|
254
|
+
readonly simple: {
|
|
255
|
+
readonly arrayPath: "response.data";
|
|
256
|
+
readonly labelField: "name";
|
|
257
|
+
readonly valueField: "id";
|
|
258
|
+
readonly disabledField: "disabled";
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Helper function to create a mapper for active/inactive patterns
|
|
264
|
+
*
|
|
265
|
+
* @param config - Configuration for active field mapping
|
|
266
|
+
* @returns ResponseMapperConfig
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* const mapper = createActiveMapper({
|
|
271
|
+
* arrayPath: 'users',
|
|
272
|
+
* labelField: 'fullName',
|
|
273
|
+
* valueField: 'userId',
|
|
274
|
+
* activeField: 'isActive',
|
|
275
|
+
* invertActive: false // true = active when false
|
|
276
|
+
* });
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
export declare function createActiveMapper(config: {
|
|
280
|
+
arrayPath?: string;
|
|
281
|
+
labelField: string;
|
|
282
|
+
valueField: string;
|
|
283
|
+
activeField: string;
|
|
284
|
+
invertActive?: boolean;
|
|
285
|
+
}): ResponseMapperConfig;
|
|
286
|
+
/**
|
|
287
|
+
* Create a mapper pipeline that applies multiple transformations
|
|
288
|
+
*
|
|
289
|
+
* @param mappers - Array of mapper functions to apply in sequence
|
|
290
|
+
* @returns Combined mapper function
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* const pipeline = createMapperPipeline([
|
|
295
|
+
* // First extract and map basic structure
|
|
296
|
+
* (data) => mapSimpleResponse(data, { arrayPath: 'users' }),
|
|
297
|
+
* // Then filter out inactive users
|
|
298
|
+
* (options) => options.filter(opt => !opt.disabled),
|
|
299
|
+
* // Finally sort by label
|
|
300
|
+
* (options) => options.sort((a, b) => a.label.localeCompare(b.label))
|
|
301
|
+
* ]);
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
export declare function createMapperPipeline(mappers: Array<ResponseMapper | ((options: ChoiceOption[]) => ChoiceOption[])>): ResponseMapper;
|
|
305
|
+
/**
|
|
306
|
+
* Filter helper to remove disabled options
|
|
307
|
+
*
|
|
308
|
+
* @param options - Options to filter
|
|
309
|
+
* @returns Filtered options
|
|
310
|
+
*/
|
|
311
|
+
export declare function filterEnabledOptions(options: ChoiceOption[]): ChoiceOption[];
|
|
312
|
+
/**
|
|
313
|
+
* Sort helper to sort options by label
|
|
314
|
+
*
|
|
315
|
+
* @param options - Options to sort
|
|
316
|
+
* @param locale - Locale for comparison (optional)
|
|
317
|
+
* @returns Sorted options
|
|
318
|
+
*/
|
|
319
|
+
export declare function sortByLabel(options: ChoiceOption[], locale?: string): ChoiceOption[];
|
|
320
|
+
/**
|
|
321
|
+
* Sort helper to sort options by value
|
|
322
|
+
*
|
|
323
|
+
* @param options - Options to sort
|
|
324
|
+
* @returns Sorted options
|
|
325
|
+
*/
|
|
326
|
+
export declare function sortByValue(options: ChoiceOption[]): ChoiceOption[];
|
|
327
|
+
/**
|
|
328
|
+
* Group helper to add group metadata to options
|
|
329
|
+
*
|
|
330
|
+
* @param options - Options to group
|
|
331
|
+
* @param groupBy - Function to determine group for each option
|
|
332
|
+
* @returns Options with group metadata
|
|
333
|
+
*/
|
|
334
|
+
export declare function groupOptions(options: ChoiceOption[], groupBy: (option: ChoiceOption) => string): ChoiceOption[];
|
|
335
|
+
/**
|
|
336
|
+
* Transform helper to add additional metadata
|
|
337
|
+
*
|
|
338
|
+
* @param options - Options to transform
|
|
339
|
+
* @param transform - Transform function
|
|
340
|
+
* @returns Transformed options
|
|
341
|
+
*/
|
|
342
|
+
export declare function transformOptions(options: ChoiceOption[], transform: (option: ChoiceOption, index: number) => ChoiceOption): ChoiceOption[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WidgetProps } from '@rjsf/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DateTime Widget for date and time selection
|
|
6
|
+
*
|
|
7
|
+
* Can be configured to use either:
|
|
8
|
+
* 1. Ant Design DatePicker with showTime option (default)
|
|
9
|
+
* 2. Native HTML datetime-local input (when useNativeInput is true)
|
|
10
|
+
*
|
|
11
|
+
* Supports Ant Design DatePicker API properties through uiSchema options:
|
|
12
|
+
* - useNativeInput: Use HTML datetime-local input instead of DatePicker
|
|
13
|
+
* - format: DateTime format (default: 'YYYY-MM-DD HH:mm:ss')
|
|
14
|
+
* - showTime: Time picker options (true or object with time picker config)
|
|
15
|
+
* - placeholder: Input placeholder text
|
|
16
|
+
* - placement: Dropdown placement
|
|
17
|
+
* - size: Component size ('small', 'middle', 'large')
|
|
18
|
+
* - bordered: Show border
|
|
19
|
+
* - status: Validation status ('error', 'warning')
|
|
20
|
+
* - style: Custom CSS styles
|
|
21
|
+
* - className: Custom CSS class
|
|
22
|
+
* - And all other Ant Design DatePicker props
|
|
23
|
+
*/
|
|
24
|
+
declare const DateTimeWidget: FC<WidgetProps>;
|
|
25
|
+
export default DateTimeWidget;
|
|
26
|
+
export { DateTimeWidget };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WidgetProps } from '@rjsf/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enhanced Date Widget using Ant Design DatePicker
|
|
6
|
+
*
|
|
7
|
+
* Supports Ant Design DatePicker API properties through uiSchema options:
|
|
8
|
+
* - format: Date format (default: 'YYYY-MM-DD')
|
|
9
|
+
* - picker: Date picker type ('date', 'week', 'month', 'quarter', 'year')
|
|
10
|
+
* - placeholder: Input placeholder text
|
|
11
|
+
* - showTime: Show time picker
|
|
12
|
+
* - showNow: Show 'Now' button
|
|
13
|
+
* - showToday: Show 'Today' button
|
|
14
|
+
* - placement: Dropdown placement
|
|
15
|
+
* - size: Component size ('small', 'middle', 'large')
|
|
16
|
+
* - bordered: Show border
|
|
17
|
+
* - status: Validation status ('error', 'warning')
|
|
18
|
+
* - style: Custom CSS styles
|
|
19
|
+
* - className: Custom CSS class
|
|
20
|
+
* - And all other Ant Design DatePicker props
|
|
21
|
+
*
|
|
22
|
+
* Falls back to native HTML date input when readonly is true
|
|
23
|
+
*/
|
|
24
|
+
declare const EnhancedDateWidget: FC<WidgetProps>;
|
|
25
|
+
export default EnhancedDateWidget;
|
|
26
|
+
export { EnhancedDateWidget };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date and Time Widget Exports
|
|
3
|
+
*
|
|
4
|
+
* This module provides various date and time input widgets:
|
|
5
|
+
*
|
|
6
|
+
* - DateWidget: Basic HTML date input widget
|
|
7
|
+
* - EnhancedDateWidget: Ant Design DatePicker with full API support
|
|
8
|
+
* - DateTimeWidget: DateTime picker with both DatePicker and native options
|
|
9
|
+
*/
|
|
10
|
+
export { DateWidget } from './DateWidget';
|
|
11
|
+
export { EnhancedDateWidget } from './EnhancedDateWidget';
|
|
12
|
+
export { DateTimeWidget } from './DateTimeWidget';
|
|
13
|
+
export { DateWidget as default } from './DateWidget';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WidgetProps } from '@rjsf/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* File Upload Widget with support for both native input and Ant Design Upload
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* This widget provides two modes for file upload:
|
|
9
|
+
* 1. Native HTML input[type="file"] (default)
|
|
10
|
+
* 2. Ant Design Upload component (when ui:options.useAntUpload is true)
|
|
11
|
+
*
|
|
12
|
+
* Both modes convert files to base64 data URLs for storage in form data.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // In uiSchema for native input
|
|
16
|
+
* {
|
|
17
|
+
* myFileField: {
|
|
18
|
+
* 'ui:widget': 'fileUpload',
|
|
19
|
+
* 'ui:options': {
|
|
20
|
+
* accept: 'image/*'
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // In uiSchema for Ant Design Upload
|
|
27
|
+
* {
|
|
28
|
+
* myFileField: {
|
|
29
|
+
* 'ui:widget': 'fileUpload',
|
|
30
|
+
* 'ui:options': {
|
|
31
|
+
* useAntUpload: true,
|
|
32
|
+
* accept: '.pdf,.doc,.docx',
|
|
33
|
+
* maxSize: 5 // in MB
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
*/
|
|
38
|
+
declare const FileUploadWidget: FC<WidgetProps>;
|
|
39
|
+
export default FileUploadWidget;
|
|
40
|
+
export { FileUploadWidget };
|
package/dist/widgets/index.d.ts
CHANGED
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
import { ColorWidget } from './input/ColorWidget';
|
|
2
|
-
import { DateWidget } from './date/DateWidget';
|
|
3
|
-
import { FileWidget } from './file/FileWidget';
|
|
4
2
|
import { RangeWidget } from './input/RangeWidget';
|
|
5
3
|
import { RatingWidget } from './input/RatingWidget';
|
|
6
|
-
import {
|
|
4
|
+
import { NumberWidget } from './input/NumberWidget';
|
|
5
|
+
import { TelephoneWidget } from './input/TelephoneWidget';
|
|
6
|
+
import { EmailWidget } from './input/EmailWidget';
|
|
7
|
+
import { URLWidget } from './input/URLWidget';
|
|
8
|
+
import { TextWidget } from './text/TextWidget';
|
|
9
|
+
import { TextareaWidget } from './text/TextareaWidget';
|
|
10
|
+
import { PasswordWidget } from './text/PasswordWidget';
|
|
11
|
+
import { DateWidget, EnhancedDateWidget, DateTimeWidget } from './date';
|
|
12
|
+
import { FileWidget } from './file/FileWidget';
|
|
13
|
+
import { FileUploadWidget } from './file/FileUploadWidget';
|
|
14
|
+
import { ChoiceWidget } from './choice';
|
|
7
15
|
|
|
16
|
+
export * from './choice';
|
|
17
|
+
export * from './text';
|
|
8
18
|
export declare const customWidgets: {
|
|
19
|
+
choice: import('react').FC<import('./choice').ChoiceWidgetProps>;
|
|
20
|
+
color: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
21
|
+
range: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
22
|
+
slider: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
23
|
+
rating: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
24
|
+
text: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
9
25
|
TextWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
26
|
+
textarea: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
10
27
|
TextareaWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
RadioWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
28
|
+
password: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
29
|
+
PasswordWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
14
30
|
UpDownWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
15
|
-
|
|
31
|
+
number: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
32
|
+
NumberWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
16
33
|
tel: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
17
|
-
email: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
18
|
-
url: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
19
|
-
password: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
20
|
-
date: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
21
|
-
'datetime-local': import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
22
34
|
TelWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
35
|
+
TelephoneWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
36
|
+
email: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
23
37
|
EmailWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
38
|
+
url: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
24
39
|
URLWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
25
|
-
|
|
40
|
+
date: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
26
41
|
DateWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
42
|
+
'datetime-local': import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
27
43
|
DateTimeWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
28
|
-
color: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
29
44
|
file: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
FileWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
46
|
+
fileUpload: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
47
|
+
FileUploadWidget: import('react').FC<import('@rjsf/utils').WidgetProps<any, import('@rjsf/utils').RJSFSchema, any>>;
|
|
32
48
|
};
|
|
33
|
-
export {
|
|
49
|
+
export { ChoiceWidget, ColorWidget, RangeWidget, RatingWidget, TextWidget, TextareaWidget, PasswordWidget, NumberWidget, TelephoneWidget, EmailWidget, URLWidget, DateWidget, EnhancedDateWidget, DateTimeWidget, FileWidget, FileUploadWidget, };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WidgetProps } from '@rjsf/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Email input widget using Ant Design Input component
|
|
6
|
+
*
|
|
7
|
+
* This widget provides an email input field with support for:
|
|
8
|
+
* - Native email input type for validation and mobile keyboard optimization
|
|
9
|
+
* - Built-in browser email validation
|
|
10
|
+
* - All Ant Design Input API properties through uiSchema options
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // In schema
|
|
14
|
+
* {
|
|
15
|
+
* type: "string",
|
|
16
|
+
* format: "email",
|
|
17
|
+
* pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$" // Optional custom pattern
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* // In uiSchema
|
|
21
|
+
* {
|
|
22
|
+
* "ui:widget": "email",
|
|
23
|
+
* "ui:options": {
|
|
24
|
+
* placeholder: "user@example.com",
|
|
25
|
+
* prefix: <MailOutlined />,
|
|
26
|
+
* allowClear: true,
|
|
27
|
+
* size: "large",
|
|
28
|
+
* suffix: ".com"
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*/
|
|
32
|
+
declare const EmailWidget: FC<WidgetProps>;
|
|
33
|
+
export default EmailWidget;
|
|
34
|
+
export { EmailWidget };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WidgetProps } from '@rjsf/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Number input widget using Ant Design InputNumber component
|
|
6
|
+
*
|
|
7
|
+
* This widget provides a numeric input field with support for:
|
|
8
|
+
* - Min/max constraints from JSON Schema
|
|
9
|
+
* - Step/multipleOf validation
|
|
10
|
+
* - Precision control
|
|
11
|
+
* - Custom formatting and parsing
|
|
12
|
+
* - Keyboard controls
|
|
13
|
+
* - All Ant Design InputNumber API properties through uiSchema options
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // In schema
|
|
17
|
+
* {
|
|
18
|
+
* type: "number",
|
|
19
|
+
* minimum: 0,
|
|
20
|
+
* maximum: 100,
|
|
21
|
+
* multipleOf: 0.01
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* // In uiSchema
|
|
25
|
+
* {
|
|
26
|
+
* "ui:widget": "number",
|
|
27
|
+
* "ui:options": {
|
|
28
|
+
* placeholder: "Enter amount",
|
|
29
|
+
* precision: 2,
|
|
30
|
+
* formatter: value => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ','),
|
|
31
|
+
* parser: value => value.replace(/\$\s?|(,*)/g, ''),
|
|
32
|
+
* controls: true,
|
|
33
|
+
* size: "large"
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
*/
|
|
37
|
+
declare const NumberWidget: FC<WidgetProps>;
|
|
38
|
+
export default NumberWidget;
|
|
39
|
+
export { NumberWidget };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WidgetProps } from '@rjsf/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Telephone input widget using Ant Design Input component
|
|
6
|
+
*
|
|
7
|
+
* This widget provides a telephone/phone number input field with support for:
|
|
8
|
+
* - Native tel input type for mobile keyboard optimization
|
|
9
|
+
* - Pattern validation support
|
|
10
|
+
* - All Ant Design Input API properties through uiSchema options
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // In schema
|
|
14
|
+
* {
|
|
15
|
+
* type: "string",
|
|
16
|
+
* format: "tel",
|
|
17
|
+
* pattern: "^\\+?[1-9]\\d{1,14}$" // E.164 format
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* // In uiSchema
|
|
21
|
+
* {
|
|
22
|
+
* "ui:widget": "tel",
|
|
23
|
+
* "ui:options": {
|
|
24
|
+
* placeholder: "+1 (555) 000-0000",
|
|
25
|
+
* prefix: <PhoneOutlined />,
|
|
26
|
+
* allowClear: true,
|
|
27
|
+
* size: "large",
|
|
28
|
+
* maxLength: 20
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*/
|
|
32
|
+
declare const TelephoneWidget: FC<WidgetProps>;
|
|
33
|
+
export default TelephoneWidget;
|
|
34
|
+
export { TelephoneWidget };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { WidgetProps } from '@rjsf/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* URL input widget using Ant Design Input component
|
|
6
|
+
*
|
|
7
|
+
* This widget provides a URL input field with support for:
|
|
8
|
+
* - Native url input type for validation
|
|
9
|
+
* - Built-in browser URL validation
|
|
10
|
+
* - All Ant Design Input API properties through uiSchema options
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // In schema
|
|
14
|
+
* {
|
|
15
|
+
* type: "string",
|
|
16
|
+
* format: "uri",
|
|
17
|
+
* pattern: "^https?://.*" // Optional: enforce http/https only
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* // In uiSchema
|
|
21
|
+
* {
|
|
22
|
+
* "ui:widget": "url",
|
|
23
|
+
* "ui:options": {
|
|
24
|
+
* placeholder: "https://example.com",
|
|
25
|
+
* prefix: <LinkOutlined />,
|
|
26
|
+
* allowClear: true,
|
|
27
|
+
* size: "large",
|
|
28
|
+
* addonBefore: "https://"
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*/
|
|
32
|
+
declare const URLWidget: FC<WidgetProps>;
|
|
33
|
+
export default URLWidget;
|
|
34
|
+
export { URLWidget };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ColorWidget } from './ColorWidget';
|
|
2
|
+
export { RangeWidget } from './RangeWidget';
|
|
3
|
+
export { RatingWidget } from './RatingWidget';
|
|
4
|
+
export { NumberWidget } from './NumberWidget';
|
|
5
|
+
export { TelephoneWidget } from './TelephoneWidget';
|
|
6
|
+
export { EmailWidget } from './EmailWidget';
|
|
7
|
+
export { URLWidget } from './URLWidget';
|