@rjsf/antd 5.10.0 → 5.11.2
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/dist/antd.cjs.development.js +777 -780
- package/dist/antd.cjs.development.js.map +1 -1
- package/dist/antd.cjs.production.min.js +1 -1
- package/dist/antd.cjs.production.min.js.map +1 -1
- package/dist/antd.esm.js +778 -781
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +777 -780
- package/dist/antd.umd.development.js.map +1 -1
- package/dist/antd.umd.production.min.js +1 -1
- package/dist/antd.umd.production.min.js.map +1 -1
- package/package.json +11 -10
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
var Slider__default = /*#__PURE__*/_interopDefaultLegacy(Slider);
|
|
34
34
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
const BTN_GRP_STYLE = {
|
|
37
37
|
width: '100%'
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
const BTN_STYLE = {
|
|
40
40
|
width: 'calc(100% / 4)'
|
|
41
41
|
};
|
|
42
42
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -44,30 +44,32 @@
|
|
|
44
44
|
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
45
45
|
*/
|
|
46
46
|
function ArrayFieldItemTemplate(props) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
47
|
+
const {
|
|
48
|
+
children,
|
|
49
|
+
disabled,
|
|
50
|
+
hasCopy,
|
|
51
|
+
hasMoveDown,
|
|
52
|
+
hasMoveUp,
|
|
53
|
+
hasRemove,
|
|
54
|
+
hasToolbar,
|
|
55
|
+
index,
|
|
56
|
+
onCopyIndexClick,
|
|
57
|
+
onDropIndexClick,
|
|
58
|
+
onReorderClick,
|
|
59
|
+
readonly,
|
|
60
|
+
registry,
|
|
61
|
+
uiSchema
|
|
62
|
+
} = props;
|
|
63
|
+
const {
|
|
64
|
+
CopyButton,
|
|
65
|
+
MoveDownButton,
|
|
66
|
+
MoveUpButton,
|
|
67
|
+
RemoveButton
|
|
68
|
+
} = registry.templates.ButtonTemplates;
|
|
69
|
+
const {
|
|
70
|
+
rowGutter = 24,
|
|
71
|
+
toolbarAlign = 'top'
|
|
72
|
+
} = registry.formContext;
|
|
71
73
|
return jsxRuntime.jsxs(Row__default["default"], {
|
|
72
74
|
align: toolbarAlign,
|
|
73
75
|
gutter: rowGutter,
|
|
@@ -105,38 +107,10 @@
|
|
|
105
107
|
})]
|
|
106
108
|
})
|
|
107
109
|
})]
|
|
108
|
-
},
|
|
110
|
+
}, `array-item-${index}`);
|
|
109
111
|
}
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
113
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
114
|
-
var source = arguments[i];
|
|
115
|
-
for (var key in source) {
|
|
116
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
117
|
-
target[key] = source[key];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return target;
|
|
122
|
-
};
|
|
123
|
-
return _extends.apply(this, arguments);
|
|
124
|
-
}
|
|
125
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
126
|
-
if (source == null) return {};
|
|
127
|
-
var target = {};
|
|
128
|
-
var sourceKeys = Object.keys(source);
|
|
129
|
-
var key, i;
|
|
130
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
131
|
-
key = sourceKeys[i];
|
|
132
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
133
|
-
target[key] = source[key];
|
|
134
|
-
}
|
|
135
|
-
return target;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
var _excluded$1 = ["key"];
|
|
139
|
-
var DESCRIPTION_COL_STYLE$1 = {
|
|
113
|
+
const DESCRIPTION_COL_STYLE$1 = {
|
|
140
114
|
paddingBottom: '8px'
|
|
141
115
|
};
|
|
142
116
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
@@ -144,35 +118,43 @@
|
|
|
144
118
|
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
145
119
|
*/
|
|
146
120
|
function ArrayFieldTemplate(props) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
121
|
+
const {
|
|
122
|
+
canAdd,
|
|
123
|
+
className,
|
|
124
|
+
disabled,
|
|
125
|
+
formContext,
|
|
126
|
+
idSchema,
|
|
127
|
+
items,
|
|
128
|
+
onAddClick,
|
|
129
|
+
readonly,
|
|
130
|
+
registry,
|
|
131
|
+
required,
|
|
132
|
+
schema,
|
|
133
|
+
title,
|
|
134
|
+
uiSchema
|
|
135
|
+
} = props;
|
|
136
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
137
|
+
const ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
138
|
+
const ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
139
|
+
const ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
164
140
|
// Button templates are not overridden in the uiSchema
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
141
|
+
const {
|
|
142
|
+
ButtonTemplates: {
|
|
143
|
+
AddButton
|
|
144
|
+
}
|
|
145
|
+
} = registry.templates;
|
|
146
|
+
const {
|
|
147
|
+
labelAlign = 'right',
|
|
148
|
+
rowGutter = 24
|
|
149
|
+
} = formContext;
|
|
170
150
|
return jsxRuntime.jsx(context.ConfigConsumer, {
|
|
171
|
-
children:
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
151
|
+
children: configProps => {
|
|
152
|
+
const {
|
|
153
|
+
getPrefixCls
|
|
154
|
+
} = configProps;
|
|
155
|
+
const prefixCls = getPrefixCls('form');
|
|
156
|
+
const labelClsBasic = `${prefixCls}-item-label`;
|
|
157
|
+
const labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === 'left' && `${labelClsBasic}-left`
|
|
176
158
|
// labelCol.className,
|
|
177
159
|
);
|
|
178
160
|
|
|
@@ -205,11 +187,12 @@
|
|
|
205
187
|
}), jsxRuntime.jsx(Col__default["default"], {
|
|
206
188
|
className: 'row array-item-list',
|
|
207
189
|
span: 24,
|
|
208
|
-
children: items && items.map(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
190
|
+
children: items && items.map(({
|
|
191
|
+
key,
|
|
192
|
+
...itemProps
|
|
193
|
+
}) => jsxRuntime.jsx(ArrayFieldItemTemplate, {
|
|
194
|
+
...itemProps
|
|
195
|
+
}, key))
|
|
213
196
|
}), canAdd && jsxRuntime.jsx(Col__default["default"], {
|
|
214
197
|
span: 24,
|
|
215
198
|
children: jsxRuntime.jsx(Row__default["default"], {
|
|
@@ -233,7 +216,7 @@
|
|
|
233
216
|
});
|
|
234
217
|
}
|
|
235
218
|
|
|
236
|
-
|
|
219
|
+
const INPUT_STYLE$2 = {
|
|
237
220
|
width: '100%'
|
|
238
221
|
};
|
|
239
222
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -243,38 +226,36 @@
|
|
|
243
226
|
* @param props - The `WidgetProps` for this template
|
|
244
227
|
*/
|
|
245
228
|
function BaseInputTemplate(props) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
};
|
|
277
|
-
var input = inputProps.type === 'number' || inputProps.type === 'integer' ? jsxRuntime.jsx(InputNumber__default["default"], _extends({
|
|
229
|
+
const {
|
|
230
|
+
disabled,
|
|
231
|
+
formContext,
|
|
232
|
+
id,
|
|
233
|
+
onBlur,
|
|
234
|
+
onChange,
|
|
235
|
+
onChangeOverride,
|
|
236
|
+
onFocus,
|
|
237
|
+
options,
|
|
238
|
+
placeholder,
|
|
239
|
+
readonly,
|
|
240
|
+
schema,
|
|
241
|
+
value,
|
|
242
|
+
type
|
|
243
|
+
} = props;
|
|
244
|
+
const inputProps = utils.getInputProps(schema, type, options, false);
|
|
245
|
+
const {
|
|
246
|
+
readonlyAsDisabled = true
|
|
247
|
+
} = formContext;
|
|
248
|
+
const handleNumberChange = nextValue => onChange(nextValue);
|
|
249
|
+
const handleTextChange = onChangeOverride ? onChangeOverride : ({
|
|
250
|
+
target
|
|
251
|
+
}) => onChange(target.value === '' ? options.emptyValue : target.value);
|
|
252
|
+
const handleBlur = ({
|
|
253
|
+
target
|
|
254
|
+
}) => onBlur(id, target.value);
|
|
255
|
+
const handleFocus = ({
|
|
256
|
+
target
|
|
257
|
+
}) => onFocus(id, target.value);
|
|
258
|
+
const input = inputProps.type === 'number' || inputProps.type === 'integer' ? jsxRuntime.jsx(InputNumber__default["default"], {
|
|
278
259
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
279
260
|
id: id,
|
|
280
261
|
name: id,
|
|
@@ -283,11 +264,11 @@
|
|
|
283
264
|
onFocus: !readonly ? handleFocus : undefined,
|
|
284
265
|
placeholder: placeholder,
|
|
285
266
|
style: INPUT_STYLE$2,
|
|
286
|
-
list: schema.examples ? utils.examplesId(id) : undefined
|
|
287
|
-
|
|
267
|
+
list: schema.examples ? utils.examplesId(id) : undefined,
|
|
268
|
+
...inputProps,
|
|
288
269
|
value: value,
|
|
289
270
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
290
|
-
})
|
|
271
|
+
}) : jsxRuntime.jsx(Input__default["default"], {
|
|
291
272
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
292
273
|
id: id,
|
|
293
274
|
name: id,
|
|
@@ -296,15 +277,15 @@
|
|
|
296
277
|
onFocus: !readonly ? handleFocus : undefined,
|
|
297
278
|
placeholder: placeholder,
|
|
298
279
|
style: INPUT_STYLE$2,
|
|
299
|
-
list: schema.examples ? utils.examplesId(id) : undefined
|
|
300
|
-
|
|
280
|
+
list: schema.examples ? utils.examplesId(id) : undefined,
|
|
281
|
+
...inputProps,
|
|
301
282
|
value: value,
|
|
302
283
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
303
|
-
})
|
|
284
|
+
});
|
|
304
285
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
305
286
|
children: [input, Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
306
287
|
id: utils.examplesId(id),
|
|
307
|
-
children: schema.examples.concat(schema
|
|
288
|
+
children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map(example => {
|
|
308
289
|
return jsxRuntime.jsx("option", {
|
|
309
290
|
value: example
|
|
310
291
|
}, example);
|
|
@@ -318,8 +299,10 @@
|
|
|
318
299
|
* @param props - The `DescriptionFieldProps` for this component
|
|
319
300
|
*/
|
|
320
301
|
function DescriptionField(props) {
|
|
321
|
-
|
|
322
|
-
|
|
302
|
+
const {
|
|
303
|
+
id,
|
|
304
|
+
description
|
|
305
|
+
} = props;
|
|
323
306
|
if (!description) {
|
|
324
307
|
return null;
|
|
325
308
|
}
|
|
@@ -333,23 +316,22 @@
|
|
|
333
316
|
*
|
|
334
317
|
* @param props - The `ErrorListProps` for this component
|
|
335
318
|
*/
|
|
336
|
-
function ErrorList(
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}, index);
|
|
319
|
+
function ErrorList({
|
|
320
|
+
errors,
|
|
321
|
+
registry
|
|
322
|
+
}) {
|
|
323
|
+
const {
|
|
324
|
+
translateString
|
|
325
|
+
} = registry;
|
|
326
|
+
const renderErrors = () => jsxRuntime.jsx(List__default["default"], {
|
|
327
|
+
className: 'list-group',
|
|
328
|
+
size: 'small',
|
|
329
|
+
children: errors.map((error, index) => jsxRuntime.jsx(List__default["default"].Item, {
|
|
330
|
+
children: jsxRuntime.jsxs(Space__default["default"], {
|
|
331
|
+
children: [jsxRuntime.jsx(ExclamationCircleOutlined__default["default"], {}), error.stack]
|
|
350
332
|
})
|
|
351
|
-
})
|
|
352
|
-
};
|
|
333
|
+
}, index))
|
|
334
|
+
});
|
|
353
335
|
return jsxRuntime.jsx(Alert__default["default"], {
|
|
354
336
|
className: 'panel panel-danger errors',
|
|
355
337
|
description: renderErrors(),
|
|
@@ -358,63 +340,86 @@
|
|
|
358
340
|
});
|
|
359
341
|
}
|
|
360
342
|
|
|
361
|
-
var _excluded = ["iconType", "icon", "uiSchema", "registry"];
|
|
362
343
|
function IconButton(props) {
|
|
363
|
-
|
|
364
|
-
iconType =
|
|
365
|
-
icon
|
|
366
|
-
|
|
367
|
-
|
|
344
|
+
const {
|
|
345
|
+
iconType = 'default',
|
|
346
|
+
icon,
|
|
347
|
+
uiSchema,
|
|
348
|
+
registry,
|
|
349
|
+
...otherProps
|
|
350
|
+
} = props;
|
|
351
|
+
return jsxRuntime.jsx(Button__default["default"], {
|
|
368
352
|
type: iconType,
|
|
369
|
-
icon: icon
|
|
370
|
-
|
|
353
|
+
icon: icon,
|
|
354
|
+
...otherProps
|
|
355
|
+
});
|
|
371
356
|
}
|
|
372
357
|
function AddButton(props) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
358
|
+
const {
|
|
359
|
+
registry: {
|
|
360
|
+
translateString
|
|
361
|
+
}
|
|
362
|
+
} = props;
|
|
363
|
+
return jsxRuntime.jsx(IconButton, {
|
|
364
|
+
title: translateString(utils.TranslatableString.AddItemButton),
|
|
365
|
+
...props,
|
|
377
366
|
block: true,
|
|
378
367
|
iconType: 'primary',
|
|
379
368
|
icon: jsxRuntime.jsx(PlusCircleOutlined__default["default"], {})
|
|
380
|
-
})
|
|
369
|
+
});
|
|
381
370
|
}
|
|
382
371
|
function CopyButton(props) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
372
|
+
const {
|
|
373
|
+
registry: {
|
|
374
|
+
translateString
|
|
375
|
+
}
|
|
376
|
+
} = props;
|
|
377
|
+
return jsxRuntime.jsx(IconButton, {
|
|
378
|
+
title: translateString(utils.TranslatableString.CopyButton),
|
|
379
|
+
...props,
|
|
387
380
|
icon: jsxRuntime.jsx(CopyOutlined__default["default"], {})
|
|
388
|
-
})
|
|
381
|
+
});
|
|
389
382
|
}
|
|
390
383
|
function MoveDownButton(props) {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
384
|
+
const {
|
|
385
|
+
registry: {
|
|
386
|
+
translateString
|
|
387
|
+
}
|
|
388
|
+
} = props;
|
|
389
|
+
return jsxRuntime.jsx(IconButton, {
|
|
390
|
+
title: translateString(utils.TranslatableString.MoveDownButton),
|
|
391
|
+
...props,
|
|
395
392
|
icon: jsxRuntime.jsx(ArrowDownOutlined__default["default"], {})
|
|
396
|
-
})
|
|
393
|
+
});
|
|
397
394
|
}
|
|
398
395
|
function MoveUpButton(props) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
396
|
+
const {
|
|
397
|
+
registry: {
|
|
398
|
+
translateString
|
|
399
|
+
}
|
|
400
|
+
} = props;
|
|
401
|
+
return jsxRuntime.jsx(IconButton, {
|
|
402
|
+
title: translateString(utils.TranslatableString.MoveUpButton),
|
|
403
|
+
...props,
|
|
403
404
|
icon: jsxRuntime.jsx(ArrowUpOutlined__default["default"], {})
|
|
404
|
-
})
|
|
405
|
+
});
|
|
405
406
|
}
|
|
406
407
|
function RemoveButton(props) {
|
|
407
408
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
const options = utils.getUiOptions(props.uiSchema);
|
|
410
|
+
const {
|
|
411
|
+
registry: {
|
|
412
|
+
translateString
|
|
413
|
+
}
|
|
414
|
+
} = props;
|
|
415
|
+
return jsxRuntime.jsx(IconButton, {
|
|
416
|
+
title: translateString(utils.TranslatableString.RemoveButton),
|
|
417
|
+
...props,
|
|
413
418
|
danger: true,
|
|
414
419
|
block: !!options.block,
|
|
415
420
|
iconType: 'primary',
|
|
416
421
|
icon: jsxRuntime.jsx(DeleteOutlined__default["default"], {})
|
|
417
|
-
})
|
|
422
|
+
});
|
|
418
423
|
}
|
|
419
424
|
|
|
420
425
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -422,27 +427,26 @@
|
|
|
422
427
|
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
423
428
|
*/
|
|
424
429
|
function FieldErrorTemplate(props) {
|
|
425
|
-
|
|
426
|
-
errors =
|
|
427
|
-
idSchema
|
|
430
|
+
const {
|
|
431
|
+
errors = [],
|
|
432
|
+
idSchema
|
|
433
|
+
} = props;
|
|
428
434
|
if (errors.length === 0) {
|
|
429
435
|
return null;
|
|
430
436
|
}
|
|
431
|
-
|
|
437
|
+
const id = utils.errorId(idSchema);
|
|
432
438
|
return jsxRuntime.jsx("div", {
|
|
433
439
|
id: id,
|
|
434
|
-
children: errors.map(
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}, "field-" + id + "-error-" + error);
|
|
438
|
-
})
|
|
440
|
+
children: errors.map(error => jsxRuntime.jsx("div", {
|
|
441
|
+
children: error
|
|
442
|
+
}, `field-${id}-error-${error}`))
|
|
439
443
|
});
|
|
440
444
|
}
|
|
441
445
|
|
|
442
|
-
|
|
446
|
+
const VERTICAL_LABEL_COL$1 = {
|
|
443
447
|
span: 24
|
|
444
448
|
};
|
|
445
|
-
|
|
449
|
+
const VERTICAL_WRAPPER_COL$1 = {
|
|
446
450
|
span: 24
|
|
447
451
|
};
|
|
448
452
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -451,38 +455,39 @@
|
|
|
451
455
|
* @param props - The `FieldTemplateProps` for this component
|
|
452
456
|
*/
|
|
453
457
|
function FieldTemplate(props) {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
descriptionLocation =
|
|
484
|
-
|
|
485
|
-
|
|
458
|
+
const {
|
|
459
|
+
children,
|
|
460
|
+
classNames,
|
|
461
|
+
style,
|
|
462
|
+
description,
|
|
463
|
+
disabled,
|
|
464
|
+
displayLabel,
|
|
465
|
+
errors,
|
|
466
|
+
formContext,
|
|
467
|
+
help,
|
|
468
|
+
hidden,
|
|
469
|
+
id,
|
|
470
|
+
label,
|
|
471
|
+
onDropPropertyClick,
|
|
472
|
+
onKeyChange,
|
|
473
|
+
rawErrors,
|
|
474
|
+
rawDescription,
|
|
475
|
+
rawHelp,
|
|
476
|
+
readonly,
|
|
477
|
+
registry,
|
|
478
|
+
required,
|
|
479
|
+
schema,
|
|
480
|
+
uiSchema
|
|
481
|
+
} = props;
|
|
482
|
+
const {
|
|
483
|
+
colon,
|
|
484
|
+
labelCol = VERTICAL_LABEL_COL$1,
|
|
485
|
+
wrapperCol = VERTICAL_WRAPPER_COL$1,
|
|
486
|
+
wrapperStyle,
|
|
487
|
+
descriptionLocation = 'below'
|
|
488
|
+
} = formContext;
|
|
489
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
490
|
+
const WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
486
491
|
if (hidden) {
|
|
487
492
|
return jsxRuntime.jsx("div", {
|
|
488
493
|
className: 'field-hidden',
|
|
@@ -491,8 +496,8 @@
|
|
|
491
496
|
}
|
|
492
497
|
// check to see if there is rawDescription(string) before using description(ReactNode)
|
|
493
498
|
// to prevent showing a blank description area
|
|
494
|
-
|
|
495
|
-
|
|
499
|
+
const descriptionNode = rawDescription ? description : undefined;
|
|
500
|
+
const descriptionProps = {};
|
|
496
501
|
switch (descriptionLocation) {
|
|
497
502
|
case 'tooltip':
|
|
498
503
|
descriptionProps.tooltip = descriptionNode;
|
|
@@ -515,7 +520,7 @@
|
|
|
515
520
|
schema: schema,
|
|
516
521
|
uiSchema: uiSchema,
|
|
517
522
|
registry: registry,
|
|
518
|
-
children: jsxRuntime.jsx(Form__default["default"].Item,
|
|
523
|
+
children: jsxRuntime.jsx(Form__default["default"].Item, {
|
|
519
524
|
colon: colon,
|
|
520
525
|
hasFeedback: schema.type !== 'array' && schema.type !== 'object',
|
|
521
526
|
help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
|
|
@@ -525,14 +530,14 @@
|
|
|
525
530
|
required: required,
|
|
526
531
|
style: wrapperStyle,
|
|
527
532
|
validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? 'error' : undefined,
|
|
528
|
-
wrapperCol: wrapperCol
|
|
529
|
-
|
|
533
|
+
wrapperCol: wrapperCol,
|
|
534
|
+
...descriptionProps,
|
|
530
535
|
children: children
|
|
531
|
-
})
|
|
536
|
+
})
|
|
532
537
|
});
|
|
533
538
|
}
|
|
534
539
|
|
|
535
|
-
|
|
540
|
+
const DESCRIPTION_COL_STYLE = {
|
|
536
541
|
paddingBottom: '8px'
|
|
537
542
|
};
|
|
538
543
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -542,54 +547,49 @@
|
|
|
542
547
|
* @param props - The `ObjectFieldTemplateProps` for this component
|
|
543
548
|
*/
|
|
544
549
|
function ObjectFieldTemplate(props) {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
550
|
+
const {
|
|
551
|
+
description,
|
|
552
|
+
disabled,
|
|
553
|
+
formContext,
|
|
554
|
+
formData,
|
|
555
|
+
idSchema,
|
|
556
|
+
onAddClick,
|
|
557
|
+
properties,
|
|
558
|
+
readonly,
|
|
559
|
+
required,
|
|
560
|
+
registry,
|
|
561
|
+
schema,
|
|
562
|
+
title,
|
|
563
|
+
uiSchema
|
|
564
|
+
} = props;
|
|
565
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
566
|
+
const TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
567
|
+
const DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
561
568
|
// Button templates are not overridden in the uiSchema
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
return utils.getUiOptions(findUiSchema(element)).widget;
|
|
583
|
-
};
|
|
584
|
-
var calculateColSpan = function calculateColSpan(element) {
|
|
585
|
-
var type = findSchemaType(element);
|
|
586
|
-
var field = findUiSchemaField(element);
|
|
587
|
-
var widget = findUiSchemaWidget(element);
|
|
588
|
-
var defaultColSpan = properties.length < 2 ||
|
|
569
|
+
const {
|
|
570
|
+
ButtonTemplates: {
|
|
571
|
+
AddButton
|
|
572
|
+
}
|
|
573
|
+
} = registry.templates;
|
|
574
|
+
const {
|
|
575
|
+
colSpan = 24,
|
|
576
|
+
labelAlign = 'right',
|
|
577
|
+
rowGutter = 24
|
|
578
|
+
} = formContext;
|
|
579
|
+
const findSchema = element => element.content.props.schema;
|
|
580
|
+
const findSchemaType = element => findSchema(element).type;
|
|
581
|
+
const findUiSchema = element => element.content.props.uiSchema;
|
|
582
|
+
const findUiSchemaField = element => utils.getUiOptions(findUiSchema(element)).field;
|
|
583
|
+
const findUiSchemaWidget = element => utils.getUiOptions(findUiSchema(element)).widget;
|
|
584
|
+
const calculateColSpan = element => {
|
|
585
|
+
const type = findSchemaType(element);
|
|
586
|
+
const field = findUiSchemaField(element);
|
|
587
|
+
const widget = findUiSchemaWidget(element);
|
|
588
|
+
const defaultColSpan = properties.length < 2 ||
|
|
589
589
|
// Single or no field in object.
|
|
590
590
|
type === 'object' || type === 'array' || widget === 'textarea' ? 24 : 12;
|
|
591
591
|
if (isObject__default["default"](colSpan)) {
|
|
592
|
-
|
|
592
|
+
const colSpanObj = colSpan;
|
|
593
593
|
if (isString__default["default"](widget)) {
|
|
594
594
|
return colSpanObj[widget];
|
|
595
595
|
}
|
|
@@ -606,11 +606,13 @@
|
|
|
606
606
|
return defaultColSpan;
|
|
607
607
|
};
|
|
608
608
|
return jsxRuntime.jsx(context.ConfigConsumer, {
|
|
609
|
-
children:
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
609
|
+
children: configProps => {
|
|
610
|
+
const {
|
|
611
|
+
getPrefixCls
|
|
612
|
+
} = configProps;
|
|
613
|
+
const prefixCls = getPrefixCls('form');
|
|
614
|
+
const labelClsBasic = `${prefixCls}-item-label`;
|
|
615
|
+
const labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === 'left' && `${labelClsBasic}-left`
|
|
614
616
|
// labelCol.className,
|
|
615
617
|
);
|
|
616
618
|
|
|
@@ -639,14 +641,10 @@
|
|
|
639
641
|
uiSchema: uiSchema,
|
|
640
642
|
registry: registry
|
|
641
643
|
})
|
|
642
|
-
}), properties.filter(
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
span: calculateColSpan(element),
|
|
647
|
-
children: element.content
|
|
648
|
-
}, element.name);
|
|
649
|
-
})]
|
|
644
|
+
}), properties.filter(e => !e.hidden).map(element => jsxRuntime.jsx(Col__default["default"], {
|
|
645
|
+
span: calculateColSpan(element),
|
|
646
|
+
children: element.content
|
|
647
|
+
}, element.name))]
|
|
650
648
|
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(Col__default["default"], {
|
|
651
649
|
span: 24,
|
|
652
650
|
children: jsxRuntime.jsx(Row__default["default"], {
|
|
@@ -671,54 +669,64 @@
|
|
|
671
669
|
|
|
672
670
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
673
671
|
*/
|
|
674
|
-
function SubmitButton(
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
672
|
+
function SubmitButton({
|
|
673
|
+
uiSchema
|
|
674
|
+
}) {
|
|
675
|
+
const {
|
|
676
|
+
submitText,
|
|
677
|
+
norender,
|
|
678
|
+
props: submitButtonProps
|
|
679
|
+
} = utils.getSubmitButtonOptions(uiSchema);
|
|
680
680
|
if (norender) {
|
|
681
681
|
return null;
|
|
682
682
|
}
|
|
683
|
-
return jsxRuntime.jsx(Button__default["default"],
|
|
684
|
-
type: 'submit'
|
|
685
|
-
|
|
683
|
+
return jsxRuntime.jsx(Button__default["default"], {
|
|
684
|
+
type: 'submit',
|
|
685
|
+
...submitButtonProps,
|
|
686
686
|
htmlType: 'submit',
|
|
687
687
|
children: submitText
|
|
688
|
-
})
|
|
688
|
+
});
|
|
689
689
|
}
|
|
690
690
|
|
|
691
691
|
/** The `TitleField` is the template to use to render the title of a field
|
|
692
692
|
*
|
|
693
693
|
* @param props - The `TitleFieldProps` for this component
|
|
694
694
|
*/
|
|
695
|
-
function TitleField(
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
695
|
+
function TitleField({
|
|
696
|
+
id,
|
|
697
|
+
required,
|
|
698
|
+
registry,
|
|
699
|
+
title
|
|
700
|
+
}) {
|
|
701
|
+
const {
|
|
702
|
+
formContext
|
|
703
|
+
} = registry;
|
|
704
|
+
const {
|
|
705
|
+
colon = true
|
|
706
|
+
} = formContext;
|
|
707
|
+
let labelChildren = title;
|
|
704
708
|
if (colon && typeof title === 'string' && title.trim() !== '') {
|
|
705
709
|
labelChildren = title.replace(/[::]\s*$/, '');
|
|
706
710
|
}
|
|
707
|
-
|
|
711
|
+
const handleLabelClick = () => {
|
|
708
712
|
if (!id) {
|
|
709
713
|
return;
|
|
710
714
|
}
|
|
711
|
-
|
|
715
|
+
const control = document.querySelector(`[id="${id}"]`);
|
|
712
716
|
if (control && control.focus) {
|
|
713
717
|
control.focus();
|
|
714
718
|
}
|
|
715
719
|
};
|
|
716
720
|
return title ? jsxRuntime.jsx(context.ConfigConsumer, {
|
|
717
|
-
children:
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
721
|
+
children: configProps => {
|
|
722
|
+
const {
|
|
723
|
+
getPrefixCls
|
|
724
|
+
} = configProps;
|
|
725
|
+
const prefixCls = getPrefixCls('form');
|
|
726
|
+
const labelClassName = classNames__default["default"]({
|
|
727
|
+
[`${prefixCls}-item-required`]: required,
|
|
728
|
+
[`${prefixCls}-item-no-colon`]: !colon
|
|
729
|
+
});
|
|
722
730
|
return jsxRuntime.jsx("label", {
|
|
723
731
|
className: labelClassName,
|
|
724
732
|
htmlFor: id,
|
|
@@ -730,13 +738,13 @@
|
|
|
730
738
|
}) : null;
|
|
731
739
|
}
|
|
732
740
|
|
|
733
|
-
|
|
741
|
+
const VERTICAL_LABEL_COL = {
|
|
734
742
|
span: 24
|
|
735
743
|
};
|
|
736
|
-
|
|
744
|
+
const VERTICAL_WRAPPER_COL = {
|
|
737
745
|
span: 24
|
|
738
746
|
};
|
|
739
|
-
|
|
747
|
+
const INPUT_STYLE$1 = {
|
|
740
748
|
width: '100%'
|
|
741
749
|
};
|
|
742
750
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -745,39 +753,40 @@
|
|
|
745
753
|
* @param props - The `WrapIfAdditionalProps` for this component
|
|
746
754
|
*/
|
|
747
755
|
function WrapIfAdditionalTemplate(props) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
classNames
|
|
751
|
-
style
|
|
752
|
-
disabled
|
|
753
|
-
id
|
|
754
|
-
label
|
|
755
|
-
onDropPropertyClick
|
|
756
|
-
onKeyChange
|
|
757
|
-
readonly
|
|
758
|
-
required
|
|
759
|
-
registry
|
|
760
|
-
schema
|
|
761
|
-
uiSchema
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
labelCol =
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
translateString = registry.translateString;
|
|
756
|
+
const {
|
|
757
|
+
children,
|
|
758
|
+
classNames,
|
|
759
|
+
style,
|
|
760
|
+
disabled,
|
|
761
|
+
id,
|
|
762
|
+
label,
|
|
763
|
+
onDropPropertyClick,
|
|
764
|
+
onKeyChange,
|
|
765
|
+
readonly,
|
|
766
|
+
required,
|
|
767
|
+
registry,
|
|
768
|
+
schema,
|
|
769
|
+
uiSchema
|
|
770
|
+
} = props;
|
|
771
|
+
const {
|
|
772
|
+
colon,
|
|
773
|
+
labelCol = VERTICAL_LABEL_COL,
|
|
774
|
+
readonlyAsDisabled = true,
|
|
775
|
+
rowGutter = 24,
|
|
776
|
+
toolbarAlign = 'top',
|
|
777
|
+
wrapperCol = VERTICAL_WRAPPER_COL,
|
|
778
|
+
wrapperStyle
|
|
779
|
+
} = registry.formContext;
|
|
780
|
+
const {
|
|
781
|
+
templates,
|
|
782
|
+
translateString
|
|
783
|
+
} = registry;
|
|
777
784
|
// Button templates are not overridden in the uiSchema
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
785
|
+
const {
|
|
786
|
+
RemoveButton
|
|
787
|
+
} = templates.ButtonTemplates;
|
|
788
|
+
const keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
789
|
+
const additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
781
790
|
if (!additional) {
|
|
782
791
|
return jsxRuntime.jsx("div", {
|
|
783
792
|
className: classNames,
|
|
@@ -785,15 +794,18 @@
|
|
|
785
794
|
children: children
|
|
786
795
|
});
|
|
787
796
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
};
|
|
797
|
+
const handleBlur = ({
|
|
798
|
+
target
|
|
799
|
+
}) => onKeyChange(target.value);
|
|
792
800
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so put it into the uiSchema instead
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
801
|
+
const uiOptions = uiSchema ? uiSchema[utils.UI_OPTIONS_KEY] : {};
|
|
802
|
+
const buttonUiOptions = {
|
|
803
|
+
...uiSchema,
|
|
804
|
+
[utils.UI_OPTIONS_KEY]: {
|
|
805
|
+
...uiOptions,
|
|
806
|
+
block: true
|
|
807
|
+
}
|
|
808
|
+
};
|
|
797
809
|
return jsxRuntime.jsx("div", {
|
|
798
810
|
className: classNames,
|
|
799
811
|
style: style,
|
|
@@ -809,7 +821,7 @@
|
|
|
809
821
|
colon: colon,
|
|
810
822
|
className: 'form-group',
|
|
811
823
|
hasFeedback: true,
|
|
812
|
-
htmlFor: id
|
|
824
|
+
htmlFor: `${id}-key`,
|
|
813
825
|
label: keyLabel,
|
|
814
826
|
labelCol: labelCol,
|
|
815
827
|
required: required,
|
|
@@ -819,8 +831,8 @@
|
|
|
819
831
|
className: 'form-control',
|
|
820
832
|
defaultValue: label,
|
|
821
833
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
822
|
-
id: id
|
|
823
|
-
name: id
|
|
834
|
+
id: `${id}-key`,
|
|
835
|
+
name: `${id}-key`,
|
|
824
836
|
onBlur: !readonly ? handleBlur : undefined,
|
|
825
837
|
style: INPUT_STYLE$1,
|
|
826
838
|
type: 'text'
|
|
@@ -847,31 +859,31 @@
|
|
|
847
859
|
|
|
848
860
|
function generateTemplates() {
|
|
849
861
|
return {
|
|
850
|
-
ArrayFieldItemTemplate
|
|
851
|
-
ArrayFieldTemplate
|
|
852
|
-
BaseInputTemplate
|
|
862
|
+
ArrayFieldItemTemplate,
|
|
863
|
+
ArrayFieldTemplate,
|
|
864
|
+
BaseInputTemplate,
|
|
853
865
|
ButtonTemplates: {
|
|
854
|
-
AddButton
|
|
855
|
-
CopyButton
|
|
856
|
-
MoveDownButton
|
|
857
|
-
MoveUpButton
|
|
858
|
-
RemoveButton
|
|
859
|
-
SubmitButton
|
|
866
|
+
AddButton,
|
|
867
|
+
CopyButton,
|
|
868
|
+
MoveDownButton,
|
|
869
|
+
MoveUpButton,
|
|
870
|
+
RemoveButton,
|
|
871
|
+
SubmitButton
|
|
860
872
|
},
|
|
861
873
|
DescriptionFieldTemplate: DescriptionField,
|
|
862
874
|
ErrorListTemplate: ErrorList,
|
|
863
|
-
FieldErrorTemplate
|
|
864
|
-
FieldTemplate
|
|
865
|
-
ObjectFieldTemplate
|
|
875
|
+
FieldErrorTemplate,
|
|
876
|
+
FieldTemplate,
|
|
877
|
+
ObjectFieldTemplate,
|
|
866
878
|
TitleFieldTemplate: TitleField,
|
|
867
|
-
WrapIfAdditionalTemplate
|
|
879
|
+
WrapIfAdditionalTemplate
|
|
868
880
|
};
|
|
869
881
|
}
|
|
870
882
|
var index$1 = /*#__PURE__*/generateTemplates();
|
|
871
883
|
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
for (
|
|
884
|
+
const rangeOptions = (start, stop) => {
|
|
885
|
+
const options = [];
|
|
886
|
+
for (let i = start; i <= stop; i++) {
|
|
875
887
|
options.push({
|
|
876
888
|
value: i,
|
|
877
889
|
label: utils.pad(i, 2)
|
|
@@ -879,22 +891,19 @@
|
|
|
879
891
|
}
|
|
880
892
|
return options;
|
|
881
893
|
};
|
|
882
|
-
|
|
883
|
-
return Object.values(state).every(
|
|
884
|
-
return value !== -1;
|
|
885
|
-
});
|
|
894
|
+
const readyForChange = state => {
|
|
895
|
+
return Object.values(state).every(value => value !== -1);
|
|
886
896
|
};
|
|
887
|
-
function dateElementProps(state, time, yearsRange) {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
var data = [{
|
|
897
|
+
function dateElementProps(state, time, yearsRange = [1900, new Date().getFullYear() + 2]) {
|
|
898
|
+
const {
|
|
899
|
+
year,
|
|
900
|
+
month,
|
|
901
|
+
day,
|
|
902
|
+
hour,
|
|
903
|
+
minute,
|
|
904
|
+
second
|
|
905
|
+
} = state;
|
|
906
|
+
const data = [{
|
|
898
907
|
type: 'year',
|
|
899
908
|
range: yearsRange,
|
|
900
909
|
value: year
|
|
@@ -925,99 +934,103 @@
|
|
|
925
934
|
return data;
|
|
926
935
|
}
|
|
927
936
|
function AltDateWidget(props) {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
937
|
+
const {
|
|
938
|
+
autofocus,
|
|
939
|
+
disabled,
|
|
940
|
+
formContext,
|
|
941
|
+
id,
|
|
942
|
+
onBlur,
|
|
943
|
+
onChange,
|
|
944
|
+
onFocus,
|
|
945
|
+
options,
|
|
946
|
+
readonly,
|
|
947
|
+
registry,
|
|
948
|
+
showTime,
|
|
949
|
+
value
|
|
950
|
+
} = props;
|
|
951
|
+
const {
|
|
952
|
+
translateString,
|
|
953
|
+
widgets
|
|
954
|
+
} = registry;
|
|
955
|
+
const {
|
|
956
|
+
SelectWidget
|
|
957
|
+
} = widgets;
|
|
958
|
+
const {
|
|
959
|
+
rowGutter = 24
|
|
960
|
+
} = formContext;
|
|
961
|
+
const [state, setState] = react.useState(utils.parseDateString(value, showTime));
|
|
962
|
+
react.useEffect(() => {
|
|
949
963
|
setState(utils.parseDateString(value, showTime));
|
|
950
964
|
}, [showTime, value]);
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
965
|
+
const handleChange = (property, nextValue) => {
|
|
966
|
+
const nextState = {
|
|
967
|
+
...state,
|
|
968
|
+
[property]: typeof nextValue === 'undefined' ? -1 : nextValue
|
|
969
|
+
};
|
|
954
970
|
if (readyForChange(nextState)) {
|
|
955
971
|
onChange(utils.toDateString(nextState, showTime));
|
|
956
972
|
} else {
|
|
957
973
|
setState(nextState);
|
|
958
974
|
}
|
|
959
975
|
};
|
|
960
|
-
|
|
976
|
+
const handleNow = event => {
|
|
961
977
|
event.preventDefault();
|
|
962
978
|
if (disabled || readonly) {
|
|
963
979
|
return;
|
|
964
980
|
}
|
|
965
|
-
|
|
981
|
+
const nextState = utils.parseDateString(new Date().toJSON(), showTime);
|
|
966
982
|
onChange(utils.toDateString(nextState, showTime));
|
|
967
983
|
};
|
|
968
|
-
|
|
984
|
+
const handleClear = event => {
|
|
969
985
|
event.preventDefault();
|
|
970
986
|
if (disabled || readonly) {
|
|
971
987
|
return;
|
|
972
988
|
}
|
|
973
989
|
onChange(undefined);
|
|
974
990
|
};
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
label: '',
|
|
998
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
999
|
-
});
|
|
1000
|
-
};
|
|
991
|
+
const renderDateElement = elemProps => jsxRuntime.jsx(SelectWidget, {
|
|
992
|
+
autofocus: elemProps.autofocus,
|
|
993
|
+
className: 'form-control',
|
|
994
|
+
disabled: elemProps.disabled,
|
|
995
|
+
id: elemProps.id,
|
|
996
|
+
name: elemProps.name,
|
|
997
|
+
onBlur: elemProps.onBlur,
|
|
998
|
+
onChange: elemValue => elemProps.select(elemProps.type, elemValue),
|
|
999
|
+
onFocus: elemProps.onFocus,
|
|
1000
|
+
options: {
|
|
1001
|
+
enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
|
|
1002
|
+
},
|
|
1003
|
+
placeholder: elemProps.type,
|
|
1004
|
+
readonly: elemProps.readonly,
|
|
1005
|
+
schema: {
|
|
1006
|
+
type: 'integer'
|
|
1007
|
+
},
|
|
1008
|
+
value: elemProps.value,
|
|
1009
|
+
registry: registry,
|
|
1010
|
+
label: '',
|
|
1011
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1012
|
+
});
|
|
1001
1013
|
return jsxRuntime.jsxs(Row__default["default"], {
|
|
1002
1014
|
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)],
|
|
1003
|
-
children: [dateElementProps(state, showTime, options.yearsRange).map(
|
|
1004
|
-
|
|
1015
|
+
children: [dateElementProps(state, showTime, options.yearsRange).map((elemProps, i) => {
|
|
1016
|
+
const elemId = id + '_' + elemProps.type;
|
|
1005
1017
|
return jsxRuntime.jsx(Col__default["default"], {
|
|
1006
1018
|
flex: '88px',
|
|
1007
|
-
children: renderDateElement(
|
|
1019
|
+
children: renderDateElement({
|
|
1020
|
+
...elemProps,
|
|
1008
1021
|
autofocus: autofocus && i === 0,
|
|
1009
|
-
disabled
|
|
1022
|
+
disabled,
|
|
1010
1023
|
id: elemId,
|
|
1011
1024
|
name: id,
|
|
1012
|
-
onBlur
|
|
1013
|
-
onFocus
|
|
1014
|
-
readonly
|
|
1015
|
-
registry
|
|
1025
|
+
onBlur,
|
|
1026
|
+
onFocus,
|
|
1027
|
+
readonly,
|
|
1028
|
+
registry,
|
|
1016
1029
|
select: handleChange,
|
|
1017
1030
|
// NOTE: antd components accept -1 rather than issue a warning
|
|
1018
1031
|
// like material-ui, so we need to convert -1 to undefined here.
|
|
1019
1032
|
value: elemProps.value < 0 ? undefined : elemProps.value
|
|
1020
|
-
})
|
|
1033
|
+
})
|
|
1021
1034
|
}, elemId);
|
|
1022
1035
|
}), !options.hideNowButton && jsxRuntime.jsx(Col__default["default"], {
|
|
1023
1036
|
flex: '88px',
|
|
@@ -1052,62 +1065,66 @@
|
|
|
1052
1065
|
};
|
|
1053
1066
|
|
|
1054
1067
|
function AltDateTimeWidget(props) {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1068
|
+
const {
|
|
1069
|
+
AltDateWidget
|
|
1070
|
+
} = props.registry.widgets;
|
|
1071
|
+
return jsxRuntime.jsx(AltDateWidget, {
|
|
1072
|
+
showTime: true,
|
|
1073
|
+
...props
|
|
1074
|
+
});
|
|
1059
1075
|
}
|
|
1060
|
-
AltDateTimeWidget.defaultProps =
|
|
1076
|
+
AltDateTimeWidget.defaultProps = {
|
|
1077
|
+
...AltDateWidget.defaultProps,
|
|
1061
1078
|
showTime: true
|
|
1062
|
-
}
|
|
1079
|
+
};
|
|
1063
1080
|
|
|
1064
1081
|
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
1065
1082
|
* It is typically used to represent an array of enums.
|
|
1066
1083
|
*
|
|
1067
1084
|
* @param props - The `WidgetProps` for this component
|
|
1068
1085
|
*/
|
|
1069
|
-
function CheckboxesWidget(
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
};
|
|
1086
|
+
function CheckboxesWidget({
|
|
1087
|
+
autofocus,
|
|
1088
|
+
disabled,
|
|
1089
|
+
formContext,
|
|
1090
|
+
id,
|
|
1091
|
+
label,
|
|
1092
|
+
hideLabel,
|
|
1093
|
+
onBlur,
|
|
1094
|
+
onChange,
|
|
1095
|
+
onFocus,
|
|
1096
|
+
options,
|
|
1097
|
+
readonly,
|
|
1098
|
+
registry,
|
|
1099
|
+
schema,
|
|
1100
|
+
uiSchema,
|
|
1101
|
+
value
|
|
1102
|
+
}) {
|
|
1103
|
+
const {
|
|
1104
|
+
readonlyAsDisabled = true
|
|
1105
|
+
} = formContext;
|
|
1106
|
+
const TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
1107
|
+
const {
|
|
1108
|
+
enumOptions,
|
|
1109
|
+
enumDisabled,
|
|
1110
|
+
inline,
|
|
1111
|
+
emptyValue
|
|
1112
|
+
} = options;
|
|
1113
|
+
const handleChange = nextValue => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
1114
|
+
const handleBlur = ({
|
|
1115
|
+
target
|
|
1116
|
+
}) => onBlur(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1117
|
+
const handleFocus = ({
|
|
1118
|
+
target
|
|
1119
|
+
}) => onFocus(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1103
1120
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1104
1121
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1105
|
-
|
|
1106
|
-
id
|
|
1122
|
+
const extraProps = {
|
|
1123
|
+
id,
|
|
1107
1124
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1108
1125
|
onFocus: !readonly ? handleFocus : undefined
|
|
1109
1126
|
};
|
|
1110
|
-
|
|
1127
|
+
const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
1111
1128
|
return Array.isArray(enumOptions) && enumOptions.length > 0 ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1112
1129
|
children: [!hideLabel && !!label && jsxRuntime.jsx("div", {
|
|
1113
1130
|
children: jsxRuntime.jsx(TitleFieldTemplate, {
|
|
@@ -1117,26 +1134,24 @@
|
|
|
1117
1134
|
uiSchema: uiSchema,
|
|
1118
1135
|
registry: registry
|
|
1119
1136
|
})
|
|
1120
|
-
}), jsxRuntime.jsx(Checkbox__default["default"].Group,
|
|
1137
|
+
}), jsxRuntime.jsx(Checkbox__default["default"].Group, {
|
|
1121
1138
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1122
1139
|
name: id,
|
|
1123
1140
|
onChange: !readonly ? handleChange : undefined,
|
|
1124
|
-
value: selectedIndexes
|
|
1125
|
-
|
|
1141
|
+
value: selectedIndexes,
|
|
1142
|
+
...extraProps,
|
|
1126
1143
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1127
|
-
children: Array.isArray(enumOptions) && enumOptions.map(
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
})
|
|
1139
|
-
}))]
|
|
1144
|
+
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => jsxRuntime.jsxs("span", {
|
|
1145
|
+
children: [jsxRuntime.jsx(Checkbox__default["default"], {
|
|
1146
|
+
id: utils.optionId(id, i),
|
|
1147
|
+
name: id,
|
|
1148
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1149
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1150
|
+
value: String(i),
|
|
1151
|
+
children: option.label
|
|
1152
|
+
}), !inline && jsxRuntime.jsx("br", {})]
|
|
1153
|
+
}, i))
|
|
1154
|
+
})]
|
|
1140
1155
|
}) : null;
|
|
1141
1156
|
}
|
|
1142
1157
|
|
|
@@ -1146,53 +1161,53 @@
|
|
|
1146
1161
|
* @param props - The `WidgetProps` for this component
|
|
1147
1162
|
*/
|
|
1148
1163
|
function CheckboxWidget(props) {
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
};
|
|
1164
|
+
const {
|
|
1165
|
+
autofocus,
|
|
1166
|
+
disabled,
|
|
1167
|
+
formContext,
|
|
1168
|
+
id,
|
|
1169
|
+
label,
|
|
1170
|
+
hideLabel,
|
|
1171
|
+
onBlur,
|
|
1172
|
+
onChange,
|
|
1173
|
+
onFocus,
|
|
1174
|
+
readonly,
|
|
1175
|
+
value
|
|
1176
|
+
} = props;
|
|
1177
|
+
const {
|
|
1178
|
+
readonlyAsDisabled = true
|
|
1179
|
+
} = formContext;
|
|
1180
|
+
const handleChange = ({
|
|
1181
|
+
target
|
|
1182
|
+
}) => onChange(target.checked);
|
|
1183
|
+
const handleBlur = ({
|
|
1184
|
+
target
|
|
1185
|
+
}) => onBlur(id, target.checked);
|
|
1186
|
+
const handleFocus = ({
|
|
1187
|
+
target
|
|
1188
|
+
}) => onFocus(id, target.checked);
|
|
1174
1189
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1175
1190
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1176
|
-
|
|
1191
|
+
const extraProps = {
|
|
1177
1192
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1178
1193
|
onFocus: !readonly ? handleFocus : undefined
|
|
1179
1194
|
};
|
|
1180
|
-
return jsxRuntime.jsx(Checkbox__default["default"],
|
|
1195
|
+
return jsxRuntime.jsx(Checkbox__default["default"], {
|
|
1181
1196
|
autoFocus: autofocus,
|
|
1182
1197
|
checked: typeof value === 'undefined' ? false : value,
|
|
1183
1198
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1184
1199
|
id: id,
|
|
1185
1200
|
name: id,
|
|
1186
|
-
onChange: !readonly ? handleChange : undefined
|
|
1187
|
-
|
|
1201
|
+
onChange: !readonly ? handleChange : undefined,
|
|
1202
|
+
...extraProps,
|
|
1188
1203
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1189
1204
|
children: utils.labelValue(label, hideLabel, '')
|
|
1190
|
-
})
|
|
1205
|
+
});
|
|
1191
1206
|
}
|
|
1192
1207
|
|
|
1193
|
-
|
|
1208
|
+
const DatePicker = /*#__PURE__*/generatePicker__default["default"](dayjsGenerateConfig__default["default"]);
|
|
1194
1209
|
|
|
1195
|
-
|
|
1210
|
+
const DATE_PICKER_STYLE$1 = {
|
|
1196
1211
|
width: '100%'
|
|
1197
1212
|
};
|
|
1198
1213
|
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
@@ -1201,29 +1216,24 @@
|
|
|
1201
1216
|
* @param props - The `WidgetProps` for this component
|
|
1202
1217
|
*/
|
|
1203
1218
|
function DateTimeWidget(props) {
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
};
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
return onFocus(id, value);
|
|
1223
|
-
};
|
|
1224
|
-
var getPopupContainer = function getPopupContainer(node) {
|
|
1225
|
-
return node.parentNode;
|
|
1226
|
-
};
|
|
1219
|
+
const {
|
|
1220
|
+
disabled,
|
|
1221
|
+
formContext,
|
|
1222
|
+
id,
|
|
1223
|
+
onBlur,
|
|
1224
|
+
onChange,
|
|
1225
|
+
onFocus,
|
|
1226
|
+
placeholder,
|
|
1227
|
+
readonly,
|
|
1228
|
+
value
|
|
1229
|
+
} = props;
|
|
1230
|
+
const {
|
|
1231
|
+
readonlyAsDisabled = true
|
|
1232
|
+
} = formContext;
|
|
1233
|
+
const handleChange = nextValue => onChange(nextValue && nextValue.toISOString());
|
|
1234
|
+
const handleBlur = () => onBlur(id, value);
|
|
1235
|
+
const handleFocus = () => onFocus(id, value);
|
|
1236
|
+
const getPopupContainer = node => node.parentNode;
|
|
1227
1237
|
return jsxRuntime.jsx(DatePicker, {
|
|
1228
1238
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1229
1239
|
getPopupContainer: getPopupContainer,
|
|
@@ -1240,7 +1250,7 @@
|
|
|
1240
1250
|
});
|
|
1241
1251
|
}
|
|
1242
1252
|
|
|
1243
|
-
|
|
1253
|
+
const DATE_PICKER_STYLE = {
|
|
1244
1254
|
width: '100%'
|
|
1245
1255
|
};
|
|
1246
1256
|
/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms
|
|
@@ -1249,29 +1259,24 @@
|
|
|
1249
1259
|
* @param props - The `WidgetProps` for this component
|
|
1250
1260
|
*/
|
|
1251
1261
|
function DateWidget(props) {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
};
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
return onFocus(id, value);
|
|
1271
|
-
};
|
|
1272
|
-
var getPopupContainer = function getPopupContainer(node) {
|
|
1273
|
-
return node.parentNode;
|
|
1274
|
-
};
|
|
1262
|
+
const {
|
|
1263
|
+
disabled,
|
|
1264
|
+
formContext,
|
|
1265
|
+
id,
|
|
1266
|
+
onBlur,
|
|
1267
|
+
onChange,
|
|
1268
|
+
onFocus,
|
|
1269
|
+
placeholder,
|
|
1270
|
+
readonly,
|
|
1271
|
+
value
|
|
1272
|
+
} = props;
|
|
1273
|
+
const {
|
|
1274
|
+
readonlyAsDisabled = true
|
|
1275
|
+
} = formContext;
|
|
1276
|
+
const handleChange = nextValue => onChange(nextValue && nextValue.format('YYYY-MM-DD'));
|
|
1277
|
+
const handleBlur = () => onBlur(id, value);
|
|
1278
|
+
const handleFocus = () => onFocus(id, value);
|
|
1279
|
+
const getPopupContainer = node => node.parentNode;
|
|
1275
1280
|
return jsxRuntime.jsx(DatePicker, {
|
|
1276
1281
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1277
1282
|
getPopupContainer: getPopupContainer,
|
|
@@ -1293,31 +1298,31 @@
|
|
|
1293
1298
|
* @param props - The `WidgetProps` for this component
|
|
1294
1299
|
*/
|
|
1295
1300
|
function PasswordWidget(props) {
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
};
|
|
1301
|
+
const {
|
|
1302
|
+
disabled,
|
|
1303
|
+
formContext,
|
|
1304
|
+
id,
|
|
1305
|
+
onBlur,
|
|
1306
|
+
onChange,
|
|
1307
|
+
onFocus,
|
|
1308
|
+
options,
|
|
1309
|
+
placeholder,
|
|
1310
|
+
readonly,
|
|
1311
|
+
value
|
|
1312
|
+
} = props;
|
|
1313
|
+
const {
|
|
1314
|
+
readonlyAsDisabled = true
|
|
1315
|
+
} = formContext;
|
|
1316
|
+
const emptyValue = options.emptyValue || '';
|
|
1317
|
+
const handleChange = ({
|
|
1318
|
+
target
|
|
1319
|
+
}) => onChange(target.value === '' ? emptyValue : target.value);
|
|
1320
|
+
const handleBlur = ({
|
|
1321
|
+
target
|
|
1322
|
+
}) => onBlur(id, target.value);
|
|
1323
|
+
const handleFocus = ({
|
|
1324
|
+
target
|
|
1325
|
+
}) => onFocus(id, target.value);
|
|
1321
1326
|
return jsxRuntime.jsx(Input__default["default"].Password, {
|
|
1322
1327
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1323
1328
|
id: id,
|
|
@@ -1336,35 +1341,38 @@
|
|
|
1336
1341
|
*
|
|
1337
1342
|
* @param props - The `WidgetProps` for this component
|
|
1338
1343
|
*/
|
|
1339
|
-
function RadioWidget(
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
};
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
};
|
|
1367
|
-
|
|
1344
|
+
function RadioWidget({
|
|
1345
|
+
autofocus,
|
|
1346
|
+
disabled,
|
|
1347
|
+
formContext,
|
|
1348
|
+
id,
|
|
1349
|
+
onBlur,
|
|
1350
|
+
onChange,
|
|
1351
|
+
onFocus,
|
|
1352
|
+
options,
|
|
1353
|
+
readonly,
|
|
1354
|
+
value
|
|
1355
|
+
}) {
|
|
1356
|
+
const {
|
|
1357
|
+
readonlyAsDisabled = true
|
|
1358
|
+
} = formContext;
|
|
1359
|
+
const {
|
|
1360
|
+
enumOptions,
|
|
1361
|
+
enumDisabled,
|
|
1362
|
+
emptyValue
|
|
1363
|
+
} = options;
|
|
1364
|
+
const handleChange = ({
|
|
1365
|
+
target: {
|
|
1366
|
+
value: nextValue
|
|
1367
|
+
}
|
|
1368
|
+
}) => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
1369
|
+
const handleBlur = ({
|
|
1370
|
+
target
|
|
1371
|
+
}) => onBlur(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1372
|
+
const handleFocus = ({
|
|
1373
|
+
target
|
|
1374
|
+
}) => onFocus(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1375
|
+
const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
1368
1376
|
return jsxRuntime.jsx(Radio__default["default"].Group, {
|
|
1369
1377
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1370
1378
|
id: id,
|
|
@@ -1374,16 +1382,14 @@
|
|
|
1374
1382
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1375
1383
|
value: selectedIndexes,
|
|
1376
1384
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1377
|
-
children: Array.isArray(enumOptions) && enumOptions.map(
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
}, i);
|
|
1386
|
-
})
|
|
1385
|
+
children: Array.isArray(enumOptions) && enumOptions.map((option, i) => jsxRuntime.jsx(Radio__default["default"], {
|
|
1386
|
+
id: utils.optionId(id, i),
|
|
1387
|
+
name: id,
|
|
1388
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1389
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1390
|
+
value: String(i),
|
|
1391
|
+
children: option.label
|
|
1392
|
+
}, i))
|
|
1387
1393
|
});
|
|
1388
1394
|
}
|
|
1389
1395
|
|
|
@@ -1393,42 +1399,40 @@
|
|
|
1393
1399
|
* @param props - The `WidgetProps` for this component
|
|
1394
1400
|
*/
|
|
1395
1401
|
function RangeWidget(props) {
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
};
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
return onFocus(id, value);
|
|
1423
|
-
};
|
|
1402
|
+
const {
|
|
1403
|
+
autofocus,
|
|
1404
|
+
disabled,
|
|
1405
|
+
formContext,
|
|
1406
|
+
id,
|
|
1407
|
+
onBlur,
|
|
1408
|
+
onChange,
|
|
1409
|
+
onFocus,
|
|
1410
|
+
options,
|
|
1411
|
+
placeholder,
|
|
1412
|
+
readonly,
|
|
1413
|
+
schema,
|
|
1414
|
+
value
|
|
1415
|
+
} = props;
|
|
1416
|
+
const {
|
|
1417
|
+
readonlyAsDisabled = true
|
|
1418
|
+
} = formContext;
|
|
1419
|
+
const {
|
|
1420
|
+
min,
|
|
1421
|
+
max,
|
|
1422
|
+
step
|
|
1423
|
+
} = utils.rangeSpec(schema);
|
|
1424
|
+
const emptyValue = options.emptyValue || '';
|
|
1425
|
+
const handleChange = nextValue => onChange(nextValue === '' ? emptyValue : nextValue);
|
|
1426
|
+
const handleBlur = () => onBlur(id, value);
|
|
1427
|
+
const handleFocus = () => onFocus(id, value);
|
|
1424
1428
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1425
1429
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1426
|
-
|
|
1427
|
-
placeholder
|
|
1430
|
+
const extraProps = {
|
|
1431
|
+
placeholder,
|
|
1428
1432
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1429
1433
|
onFocus: !readonly ? handleFocus : undefined
|
|
1430
1434
|
};
|
|
1431
|
-
return jsxRuntime.jsx(Slider__default["default"],
|
|
1435
|
+
return jsxRuntime.jsx(Slider__default["default"], {
|
|
1432
1436
|
autoFocus: autofocus,
|
|
1433
1437
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1434
1438
|
id: id,
|
|
@@ -1437,13 +1441,13 @@
|
|
|
1437
1441
|
onChange: !readonly ? handleChange : undefined,
|
|
1438
1442
|
range: false,
|
|
1439
1443
|
step: step,
|
|
1440
|
-
value: value
|
|
1441
|
-
|
|
1444
|
+
value: value,
|
|
1445
|
+
...extraProps,
|
|
1442
1446
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1443
|
-
})
|
|
1447
|
+
});
|
|
1444
1448
|
}
|
|
1445
1449
|
|
|
1446
|
-
|
|
1450
|
+
const SELECT_STYLE = {
|
|
1447
1451
|
width: '100%'
|
|
1448
1452
|
};
|
|
1449
1453
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
@@ -1451,51 +1455,46 @@
|
|
|
1451
1455
|
*
|
|
1452
1456
|
* @param props - The `WidgetProps` for this component
|
|
1453
1457
|
*/
|
|
1454
|
-
function SelectWidget(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
readonlyAsDisabled =
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
};
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1481
|
-
};
|
|
1482
|
-
var filterOption = function filterOption(input, option) {
|
|
1458
|
+
function SelectWidget({
|
|
1459
|
+
autofocus,
|
|
1460
|
+
disabled,
|
|
1461
|
+
formContext = {},
|
|
1462
|
+
id,
|
|
1463
|
+
multiple,
|
|
1464
|
+
onBlur,
|
|
1465
|
+
onChange,
|
|
1466
|
+
onFocus,
|
|
1467
|
+
options,
|
|
1468
|
+
placeholder,
|
|
1469
|
+
readonly,
|
|
1470
|
+
value
|
|
1471
|
+
}) {
|
|
1472
|
+
const {
|
|
1473
|
+
readonlyAsDisabled = true
|
|
1474
|
+
} = formContext;
|
|
1475
|
+
const {
|
|
1476
|
+
enumOptions,
|
|
1477
|
+
enumDisabled,
|
|
1478
|
+
emptyValue
|
|
1479
|
+
} = options;
|
|
1480
|
+
const handleChange = nextValue => onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
1481
|
+
const handleBlur = () => onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1482
|
+
const handleFocus = () => onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1483
|
+
const filterOption = (input, option) => {
|
|
1483
1484
|
if (option && isString__default["default"](option.label)) {
|
|
1484
1485
|
// labels are strings in this context
|
|
1485
1486
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
1486
1487
|
}
|
|
1487
1488
|
return false;
|
|
1488
1489
|
};
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
};
|
|
1492
|
-
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1490
|
+
const getPopupContainer = node => node.parentNode;
|
|
1491
|
+
const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1493
1492
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1494
1493
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1495
|
-
|
|
1494
|
+
const extraProps = {
|
|
1496
1495
|
name: id
|
|
1497
1496
|
};
|
|
1498
|
-
return jsxRuntime.jsx(Select__default["default"],
|
|
1497
|
+
return jsxRuntime.jsx(Select__default["default"], {
|
|
1499
1498
|
autoFocus: autofocus,
|
|
1500
1499
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1501
1500
|
getPopupContainer: getPopupContainer,
|
|
@@ -1506,60 +1505,58 @@
|
|
|
1506
1505
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1507
1506
|
placeholder: placeholder,
|
|
1508
1507
|
style: SELECT_STYLE,
|
|
1509
|
-
value: selectedIndexes
|
|
1510
|
-
|
|
1508
|
+
value: selectedIndexes,
|
|
1509
|
+
...extraProps,
|
|
1511
1510
|
filterOption: filterOption,
|
|
1512
1511
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1513
|
-
children: Array.isArray(enumOptions) && enumOptions.map(
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
}));
|
|
1512
|
+
children: Array.isArray(enumOptions) && enumOptions.map(({
|
|
1513
|
+
value: optionValue,
|
|
1514
|
+
label: optionLabel
|
|
1515
|
+
}, index) => jsxRuntime.jsx(Select__default["default"].Option, {
|
|
1516
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
1517
|
+
value: String(index),
|
|
1518
|
+
children: optionLabel
|
|
1519
|
+
}, String(index)))
|
|
1520
|
+
});
|
|
1523
1521
|
}
|
|
1524
1522
|
|
|
1525
|
-
|
|
1523
|
+
const INPUT_STYLE = {
|
|
1526
1524
|
width: '100%'
|
|
1527
1525
|
};
|
|
1528
1526
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
1529
1527
|
*
|
|
1530
1528
|
* @param props - The `WidgetProps` for this component
|
|
1531
1529
|
*/
|
|
1532
|
-
function TextareaWidget(
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
};
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
};
|
|
1530
|
+
function TextareaWidget({
|
|
1531
|
+
disabled,
|
|
1532
|
+
formContext,
|
|
1533
|
+
id,
|
|
1534
|
+
onBlur,
|
|
1535
|
+
onChange,
|
|
1536
|
+
onFocus,
|
|
1537
|
+
options,
|
|
1538
|
+
placeholder,
|
|
1539
|
+
readonly,
|
|
1540
|
+
value
|
|
1541
|
+
}) {
|
|
1542
|
+
const {
|
|
1543
|
+
readonlyAsDisabled = true
|
|
1544
|
+
} = formContext;
|
|
1545
|
+
const handleChange = ({
|
|
1546
|
+
target
|
|
1547
|
+
}) => onChange(target.value === '' ? options.emptyValue : target.value);
|
|
1548
|
+
const handleBlur = ({
|
|
1549
|
+
target
|
|
1550
|
+
}) => onBlur(id, target.value);
|
|
1551
|
+
const handleFocus = ({
|
|
1552
|
+
target
|
|
1553
|
+
}) => onFocus(id, target.value);
|
|
1557
1554
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1558
1555
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1559
|
-
|
|
1556
|
+
const extraProps = {
|
|
1560
1557
|
type: 'textarea'
|
|
1561
1558
|
};
|
|
1562
|
-
return jsxRuntime.jsx(Input__default["default"].TextArea,
|
|
1559
|
+
return jsxRuntime.jsx(Input__default["default"].TextArea, {
|
|
1563
1560
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1564
1561
|
id: id,
|
|
1565
1562
|
name: id,
|
|
@@ -1569,25 +1566,25 @@
|
|
|
1569
1566
|
placeholder: placeholder,
|
|
1570
1567
|
rows: options.rows || 4,
|
|
1571
1568
|
style: INPUT_STYLE,
|
|
1572
|
-
value: value
|
|
1573
|
-
|
|
1569
|
+
value: value,
|
|
1570
|
+
...extraProps,
|
|
1574
1571
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1575
|
-
})
|
|
1572
|
+
});
|
|
1576
1573
|
}
|
|
1577
1574
|
|
|
1578
1575
|
function generateWidgets() {
|
|
1579
1576
|
return {
|
|
1580
|
-
AltDateTimeWidget
|
|
1581
|
-
AltDateWidget
|
|
1582
|
-
CheckboxesWidget
|
|
1583
|
-
CheckboxWidget
|
|
1584
|
-
DateTimeWidget
|
|
1585
|
-
DateWidget
|
|
1586
|
-
PasswordWidget
|
|
1587
|
-
RadioWidget
|
|
1588
|
-
RangeWidget
|
|
1589
|
-
SelectWidget
|
|
1590
|
-
TextareaWidget
|
|
1577
|
+
AltDateTimeWidget,
|
|
1578
|
+
AltDateWidget,
|
|
1579
|
+
CheckboxesWidget,
|
|
1580
|
+
CheckboxWidget,
|
|
1581
|
+
DateTimeWidget,
|
|
1582
|
+
DateWidget,
|
|
1583
|
+
PasswordWidget,
|
|
1584
|
+
RadioWidget,
|
|
1585
|
+
RangeWidget,
|
|
1586
|
+
SelectWidget,
|
|
1587
|
+
TextareaWidget
|
|
1591
1588
|
};
|
|
1592
1589
|
}
|
|
1593
1590
|
var index = /*#__PURE__*/generateWidgets();
|
|
@@ -1598,11 +1595,11 @@
|
|
|
1598
1595
|
widgets: generateWidgets()
|
|
1599
1596
|
};
|
|
1600
1597
|
}
|
|
1601
|
-
|
|
1598
|
+
const Theme = /*#__PURE__*/generateTheme();
|
|
1602
1599
|
function generateForm() {
|
|
1603
1600
|
return core.withTheme(generateTheme());
|
|
1604
1601
|
}
|
|
1605
|
-
|
|
1602
|
+
const Form = /*#__PURE__*/generateForm();
|
|
1606
1603
|
|
|
1607
1604
|
exports.Form = Form;
|
|
1608
1605
|
exports.Templates = index$1;
|