@rjsf/antd 5.2.0 → 5.2.1
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/LICENSE.md +183 -183
- package/dist/antd.cjs.development.js +436 -383
- 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 +434 -380
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +438 -386
- 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 +5 -5
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@rjsf/core');
|
|
6
|
-
var
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var Button = require('antd/lib/button');
|
|
8
8
|
var Col = require('antd/lib/col');
|
|
9
9
|
var Row = require('antd/lib/row');
|
|
@@ -24,6 +24,7 @@ var Form$1 = require('antd/lib/form');
|
|
|
24
24
|
var isObject = require('lodash/isObject');
|
|
25
25
|
var isNumber = require('lodash/isNumber');
|
|
26
26
|
var isString = require('lodash/isString');
|
|
27
|
+
var react = require('react');
|
|
27
28
|
var Checkbox = require('antd/lib/checkbox');
|
|
28
29
|
var dayjs = require('dayjs');
|
|
29
30
|
var dayjsGenerateConfig = require('rc-picker/lib/generate/dayjs');
|
|
@@ -34,7 +35,6 @@ var Select = require('antd/lib/select');
|
|
|
34
35
|
|
|
35
36
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
36
37
|
|
|
37
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
38
38
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
39
39
|
var Col__default = /*#__PURE__*/_interopDefaultLegacy(Col);
|
|
40
40
|
var Row__default = /*#__PURE__*/_interopDefaultLegacy(Row);
|
|
@@ -62,10 +62,10 @@ var Slider__default = /*#__PURE__*/_interopDefaultLegacy(Slider);
|
|
|
62
62
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
63
63
|
|
|
64
64
|
var BTN_GRP_STYLE = {
|
|
65
|
-
width:
|
|
65
|
+
width: '100%'
|
|
66
66
|
};
|
|
67
67
|
var BTN_STYLE = {
|
|
68
|
-
width:
|
|
68
|
+
width: 'calc(100% / 3)'
|
|
69
69
|
};
|
|
70
70
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
71
71
|
*
|
|
@@ -92,36 +92,39 @@ function ArrayFieldItemTemplate(props) {
|
|
|
92
92
|
_registry$formContext2 = _registry$formContext.rowGutter,
|
|
93
93
|
rowGutter = _registry$formContext2 === void 0 ? 24 : _registry$formContext2,
|
|
94
94
|
_registry$formContext3 = _registry$formContext.toolbarAlign,
|
|
95
|
-
toolbarAlign = _registry$formContext3 === void 0 ?
|
|
96
|
-
return
|
|
95
|
+
toolbarAlign = _registry$formContext3 === void 0 ? 'top' : _registry$formContext3;
|
|
96
|
+
return jsxRuntime.jsxs(Row__default["default"], {
|
|
97
97
|
align: toolbarAlign,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
98
|
+
gutter: rowGutter,
|
|
99
|
+
children: [jsxRuntime.jsx(Col__default["default"], {
|
|
100
|
+
flex: '1',
|
|
101
|
+
children: children
|
|
102
|
+
}), hasToolbar && jsxRuntime.jsx(Col__default["default"], {
|
|
103
|
+
flex: '192px',
|
|
104
|
+
children: jsxRuntime.jsxs(Button__default["default"].Group, {
|
|
105
|
+
style: BTN_GRP_STYLE,
|
|
106
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
107
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
108
|
+
onClick: onReorderClick(index, index - 1),
|
|
109
|
+
style: BTN_STYLE,
|
|
110
|
+
uiSchema: uiSchema,
|
|
111
|
+
registry: registry
|
|
112
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
113
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
114
|
+
onClick: onReorderClick(index, index + 1),
|
|
115
|
+
style: BTN_STYLE,
|
|
116
|
+
uiSchema: uiSchema,
|
|
117
|
+
registry: registry
|
|
118
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
119
|
+
disabled: disabled || readonly,
|
|
120
|
+
onClick: onDropIndexClick(index),
|
|
121
|
+
style: BTN_STYLE,
|
|
122
|
+
uiSchema: uiSchema,
|
|
123
|
+
registry: registry
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
})]
|
|
127
|
+
}, "array-item-" + index);
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
function _extends() {
|
|
@@ -153,7 +156,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
153
156
|
|
|
154
157
|
var _excluded$1 = ["key"];
|
|
155
158
|
var DESCRIPTION_COL_STYLE$1 = {
|
|
156
|
-
paddingBottom:
|
|
159
|
+
paddingBottom: '8px'
|
|
157
160
|
};
|
|
158
161
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
159
162
|
*
|
|
@@ -174,75 +177,83 @@ function ArrayFieldTemplate(props) {
|
|
|
174
177
|
title = props.title,
|
|
175
178
|
uiSchema = props.uiSchema;
|
|
176
179
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
177
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
178
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
179
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
180
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
181
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
182
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
180
183
|
// Button templates are not overridden in the uiSchema
|
|
181
184
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
182
185
|
var _formContext$labelAli = formContext.labelAlign,
|
|
183
|
-
labelAlign = _formContext$labelAli === void 0 ?
|
|
186
|
+
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
184
187
|
_formContext$rowGutte = formContext.rowGutter,
|
|
185
188
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
186
|
-
return
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
return jsxRuntime.jsx(context.ConfigConsumer, {
|
|
190
|
+
children: function children(configProps) {
|
|
191
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
192
|
+
var prefixCls = getPrefixCls('form');
|
|
193
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
194
|
+
var labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left"
|
|
195
|
+
// labelCol.className,
|
|
196
|
+
);
|
|
193
197
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
198
|
+
return jsxRuntime.jsx("fieldset", {
|
|
199
|
+
className: className,
|
|
200
|
+
id: idSchema.$id,
|
|
201
|
+
children: jsxRuntime.jsxs(Row__default["default"], {
|
|
202
|
+
gutter: rowGutter,
|
|
203
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(Col__default["default"], {
|
|
204
|
+
className: labelColClassName,
|
|
205
|
+
span: 24,
|
|
206
|
+
children: jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
207
|
+
idSchema: idSchema,
|
|
208
|
+
required: required,
|
|
209
|
+
title: uiOptions.title || title,
|
|
210
|
+
schema: schema,
|
|
211
|
+
uiSchema: uiSchema,
|
|
212
|
+
registry: registry
|
|
213
|
+
})
|
|
214
|
+
}), (uiOptions.description || schema.description) && jsxRuntime.jsx(Col__default["default"], {
|
|
215
|
+
span: 24,
|
|
216
|
+
style: DESCRIPTION_COL_STYLE$1,
|
|
217
|
+
children: jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
218
|
+
description: uiOptions.description || schema.description || '',
|
|
219
|
+
idSchema: idSchema,
|
|
220
|
+
schema: schema,
|
|
221
|
+
uiSchema: uiSchema,
|
|
222
|
+
registry: registry
|
|
223
|
+
})
|
|
224
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
225
|
+
className: 'row array-item-list',
|
|
226
|
+
span: 24,
|
|
227
|
+
children: items && items.map(function (_ref) {
|
|
228
|
+
var key = _ref.key,
|
|
229
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
230
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
231
|
+
})
|
|
232
|
+
}), canAdd && jsxRuntime.jsx(Col__default["default"], {
|
|
233
|
+
span: 24,
|
|
234
|
+
children: jsxRuntime.jsx(Row__default["default"], {
|
|
235
|
+
gutter: rowGutter,
|
|
236
|
+
justify: 'end',
|
|
237
|
+
children: jsxRuntime.jsx(Col__default["default"], {
|
|
238
|
+
flex: '192px',
|
|
239
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
240
|
+
className: 'array-item-add',
|
|
241
|
+
disabled: disabled || readonly,
|
|
242
|
+
onClick: onAddClick,
|
|
243
|
+
uiSchema: uiSchema,
|
|
244
|
+
registry: registry
|
|
245
|
+
})
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
})]
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
}
|
|
241
252
|
});
|
|
242
253
|
}
|
|
243
254
|
|
|
244
255
|
var INPUT_STYLE$2 = {
|
|
245
|
-
width:
|
|
256
|
+
width: '100%'
|
|
246
257
|
};
|
|
247
258
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
248
259
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
@@ -256,6 +267,7 @@ function BaseInputTemplate(props) {
|
|
|
256
267
|
id = props.id,
|
|
257
268
|
onBlur = props.onBlur,
|
|
258
269
|
onChange = props.onChange,
|
|
270
|
+
onChangeOverride = props.onChangeOverride,
|
|
259
271
|
onFocus = props.onFocus,
|
|
260
272
|
options = props.options,
|
|
261
273
|
placeholder = props.placeholder,
|
|
@@ -269,9 +281,9 @@ function BaseInputTemplate(props) {
|
|
|
269
281
|
var handleNumberChange = function handleNumberChange(nextValue) {
|
|
270
282
|
return onChange(nextValue);
|
|
271
283
|
};
|
|
272
|
-
var handleTextChange = function
|
|
284
|
+
var handleTextChange = onChangeOverride ? onChangeOverride : function (_ref) {
|
|
273
285
|
var target = _ref.target;
|
|
274
|
-
return onChange(target.value ===
|
|
286
|
+
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
275
287
|
};
|
|
276
288
|
var handleBlur = function handleBlur(_ref2) {
|
|
277
289
|
var target = _ref2.target;
|
|
@@ -281,7 +293,7 @@ function BaseInputTemplate(props) {
|
|
|
281
293
|
var target = _ref3.target;
|
|
282
294
|
return onFocus(id, target.value);
|
|
283
295
|
};
|
|
284
|
-
var input = inputProps.type ===
|
|
296
|
+
var input = inputProps.type === 'number' || inputProps.type === 'integer' ? jsxRuntime.jsx(InputNumber__default["default"], _extends({
|
|
285
297
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
286
298
|
id: id,
|
|
287
299
|
name: id,
|
|
@@ -294,7 +306,7 @@ function BaseInputTemplate(props) {
|
|
|
294
306
|
}, inputProps, {
|
|
295
307
|
value: value,
|
|
296
308
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
297
|
-
})) :
|
|
309
|
+
})) : jsxRuntime.jsx(Input__default["default"], _extends({
|
|
298
310
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
299
311
|
id: id,
|
|
300
312
|
name: id,
|
|
@@ -308,14 +320,16 @@ function BaseInputTemplate(props) {
|
|
|
308
320
|
value: value,
|
|
309
321
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
310
322
|
}));
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
323
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
324
|
+
children: [input, Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
325
|
+
id: utils.examplesId(id),
|
|
326
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
327
|
+
return jsxRuntime.jsx("option", {
|
|
328
|
+
value: example
|
|
329
|
+
}, example);
|
|
330
|
+
})
|
|
331
|
+
})]
|
|
332
|
+
});
|
|
319
333
|
}
|
|
320
334
|
|
|
321
335
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -328,9 +342,10 @@ function DescriptionField(props) {
|
|
|
328
342
|
if (!description) {
|
|
329
343
|
return null;
|
|
330
344
|
}
|
|
331
|
-
return
|
|
332
|
-
id: id
|
|
333
|
-
|
|
345
|
+
return jsxRuntime.jsx("span", {
|
|
346
|
+
id: id,
|
|
347
|
+
children: description
|
|
348
|
+
});
|
|
334
349
|
}
|
|
335
350
|
|
|
336
351
|
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
@@ -342,71 +357,74 @@ function ErrorList(_ref) {
|
|
|
342
357
|
registry = _ref.registry;
|
|
343
358
|
var translateString = registry.translateString;
|
|
344
359
|
var renderErrors = function renderErrors() {
|
|
345
|
-
return
|
|
346
|
-
className:
|
|
347
|
-
size:
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
360
|
+
return jsxRuntime.jsx(List__default["default"], {
|
|
361
|
+
className: 'list-group',
|
|
362
|
+
size: 'small',
|
|
363
|
+
children: errors.map(function (error, index) {
|
|
364
|
+
return jsxRuntime.jsx(List__default["default"].Item, {
|
|
365
|
+
children: jsxRuntime.jsxs(Space__default["default"], {
|
|
366
|
+
children: [jsxRuntime.jsx(ExclamationCircleOutlined__default["default"], {}), error.stack]
|
|
367
|
+
})
|
|
368
|
+
}, index);
|
|
369
|
+
})
|
|
370
|
+
});
|
|
353
371
|
};
|
|
354
|
-
return
|
|
355
|
-
className:
|
|
372
|
+
return jsxRuntime.jsx(Alert__default["default"], {
|
|
373
|
+
className: 'panel panel-danger errors',
|
|
356
374
|
description: renderErrors(),
|
|
357
375
|
message: translateString(utils.TranslatableString.ErrorsLabel),
|
|
358
|
-
type:
|
|
376
|
+
type: 'error'
|
|
359
377
|
});
|
|
360
378
|
}
|
|
361
379
|
|
|
362
380
|
var _excluded = ["iconType", "icon", "uiSchema", "registry"];
|
|
363
381
|
function IconButton(props) {
|
|
364
382
|
var _props$iconType = props.iconType,
|
|
365
|
-
iconType = _props$iconType === void 0 ?
|
|
383
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
366
384
|
icon = props.icon,
|
|
367
385
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
368
|
-
return
|
|
386
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
369
387
|
type: iconType,
|
|
370
388
|
icon: icon
|
|
371
389
|
}, otherProps));
|
|
372
390
|
}
|
|
373
391
|
function AddButton(props) {
|
|
374
392
|
var translateString = props.registry.translateString;
|
|
375
|
-
return
|
|
393
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
376
394
|
title: translateString(utils.TranslatableString.AddItemButton)
|
|
377
395
|
}, props, {
|
|
378
396
|
block: true,
|
|
379
|
-
iconType:
|
|
380
|
-
icon:
|
|
397
|
+
iconType: 'primary',
|
|
398
|
+
icon: jsxRuntime.jsx(PlusCircleOutlined__default["default"], {})
|
|
381
399
|
}));
|
|
382
400
|
}
|
|
383
401
|
function MoveDownButton(props) {
|
|
384
402
|
var translateString = props.registry.translateString;
|
|
385
|
-
return
|
|
403
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
386
404
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
387
405
|
}, props, {
|
|
388
|
-
icon:
|
|
406
|
+
icon: jsxRuntime.jsx(ArrowDownOutlined__default["default"], {})
|
|
389
407
|
}));
|
|
390
408
|
}
|
|
391
409
|
function MoveUpButton(props) {
|
|
392
410
|
var translateString = props.registry.translateString;
|
|
393
|
-
return
|
|
411
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
394
412
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
395
413
|
}, props, {
|
|
396
|
-
icon:
|
|
414
|
+
icon: jsxRuntime.jsx(ArrowUpOutlined__default["default"], {})
|
|
397
415
|
}));
|
|
398
416
|
}
|
|
399
417
|
function RemoveButton(props) {
|
|
400
418
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
|
|
401
419
|
var options = utils.getUiOptions(props.uiSchema);
|
|
402
420
|
var translateString = props.registry.translateString;
|
|
403
|
-
return
|
|
421
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
404
422
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
405
423
|
}, props, {
|
|
406
424
|
danger: true,
|
|
407
425
|
block: !!options.block,
|
|
408
|
-
iconType:
|
|
409
|
-
icon:
|
|
426
|
+
iconType: 'primary',
|
|
427
|
+
icon: jsxRuntime.jsx(DeleteOutlined__default["default"], {})
|
|
410
428
|
}));
|
|
411
429
|
}
|
|
412
430
|
|
|
@@ -422,13 +440,14 @@ function FieldErrorTemplate(props) {
|
|
|
422
440
|
return null;
|
|
423
441
|
}
|
|
424
442
|
var id = utils.errorId(idSchema);
|
|
425
|
-
return
|
|
426
|
-
id: id
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
443
|
+
return jsxRuntime.jsx("div", {
|
|
444
|
+
id: id,
|
|
445
|
+
children: errors.map(function (error) {
|
|
446
|
+
return jsxRuntime.jsx("div", {
|
|
447
|
+
children: error
|
|
448
|
+
}, "field-" + id + "-error-" + error);
|
|
449
|
+
})
|
|
450
|
+
});
|
|
432
451
|
}
|
|
433
452
|
|
|
434
453
|
var VERTICAL_LABEL_COL$1 = {
|
|
@@ -472,13 +491,14 @@ function FieldTemplate(props) {
|
|
|
472
491
|
wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
|
|
473
492
|
wrapperStyle = formContext.wrapperStyle;
|
|
474
493
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
475
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
494
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
476
495
|
if (hidden) {
|
|
477
|
-
return
|
|
478
|
-
className:
|
|
479
|
-
|
|
496
|
+
return jsxRuntime.jsx("div", {
|
|
497
|
+
className: 'field-hidden',
|
|
498
|
+
children: children
|
|
499
|
+
});
|
|
480
500
|
}
|
|
481
|
-
return
|
|
501
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
482
502
|
classNames: classNames,
|
|
483
503
|
style: style,
|
|
484
504
|
disabled: disabled,
|
|
@@ -490,24 +510,26 @@ function FieldTemplate(props) {
|
|
|
490
510
|
required: required,
|
|
491
511
|
schema: schema,
|
|
492
512
|
uiSchema: uiSchema,
|
|
493
|
-
registry: registry
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
513
|
+
registry: registry,
|
|
514
|
+
children: id === 'root' ? children : jsxRuntime.jsx(Form__default["default"].Item, {
|
|
515
|
+
colon: colon,
|
|
516
|
+
extra: rawDescription && description,
|
|
517
|
+
hasFeedback: schema.type !== 'array' && schema.type !== 'object',
|
|
518
|
+
help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
|
|
519
|
+
htmlFor: id,
|
|
520
|
+
label: displayLabel && label,
|
|
521
|
+
labelCol: labelCol,
|
|
522
|
+
required: required,
|
|
523
|
+
style: wrapperStyle,
|
|
524
|
+
validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? 'error' : undefined,
|
|
525
|
+
wrapperCol: wrapperCol,
|
|
526
|
+
children: children
|
|
527
|
+
})
|
|
528
|
+
});
|
|
507
529
|
}
|
|
508
530
|
|
|
509
531
|
var DESCRIPTION_COL_STYLE = {
|
|
510
|
-
paddingBottom:
|
|
532
|
+
paddingBottom: '8px'
|
|
511
533
|
};
|
|
512
534
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
513
535
|
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
@@ -530,14 +552,14 @@ function ObjectFieldTemplate(props) {
|
|
|
530
552
|
title = props.title,
|
|
531
553
|
uiSchema = props.uiSchema;
|
|
532
554
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
533
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
534
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
555
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
556
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
535
557
|
// Button templates are not overridden in the uiSchema
|
|
536
558
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
537
559
|
var _formContext$colSpan = formContext.colSpan,
|
|
538
560
|
colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
|
|
539
561
|
_formContext$labelAli = formContext.labelAlign,
|
|
540
|
-
labelAlign = _formContext$labelAli === void 0 ?
|
|
562
|
+
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
541
563
|
_formContext$rowGutte = formContext.rowGutter,
|
|
542
564
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
543
565
|
var findSchema = function findSchema(element) {
|
|
@@ -561,7 +583,7 @@ function ObjectFieldTemplate(props) {
|
|
|
561
583
|
var widget = findUiSchemaWidget(element);
|
|
562
584
|
var defaultColSpan = properties.length < 2 ||
|
|
563
585
|
// Single or no field in object.
|
|
564
|
-
type ===
|
|
586
|
+
type === 'object' || type === 'array' || widget === 'textarea' ? 24 : 12;
|
|
565
587
|
if (isObject__default["default"](colSpan)) {
|
|
566
588
|
var colSpanObj = colSpan;
|
|
567
589
|
if (isString__default["default"](widget)) {
|
|
@@ -579,58 +601,67 @@ function ObjectFieldTemplate(props) {
|
|
|
579
601
|
}
|
|
580
602
|
return defaultColSpan;
|
|
581
603
|
};
|
|
582
|
-
return
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
604
|
+
return jsxRuntime.jsx(context.ConfigConsumer, {
|
|
605
|
+
children: function children(configProps) {
|
|
606
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
607
|
+
var prefixCls = getPrefixCls('form');
|
|
608
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
609
|
+
var labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left"
|
|
610
|
+
// labelCol.className,
|
|
611
|
+
);
|
|
589
612
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
613
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
614
|
+
id: idSchema.$id,
|
|
615
|
+
children: [jsxRuntime.jsxs(Row__default["default"], {
|
|
616
|
+
gutter: rowGutter,
|
|
617
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(Col__default["default"], {
|
|
618
|
+
className: labelColClassName,
|
|
619
|
+
span: 24,
|
|
620
|
+
children: jsxRuntime.jsx(TitleFieldTemplate, {
|
|
621
|
+
id: utils.titleId(idSchema),
|
|
622
|
+
title: uiOptions.title || title,
|
|
623
|
+
required: required,
|
|
624
|
+
schema: schema,
|
|
625
|
+
uiSchema: uiSchema,
|
|
626
|
+
registry: registry
|
|
627
|
+
})
|
|
628
|
+
}), (uiOptions.description || description) && jsxRuntime.jsx(Col__default["default"], {
|
|
629
|
+
span: 24,
|
|
630
|
+
style: DESCRIPTION_COL_STYLE,
|
|
631
|
+
children: jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
632
|
+
id: utils.descriptionId(idSchema),
|
|
633
|
+
description: uiOptions.description || description,
|
|
634
|
+
schema: schema,
|
|
635
|
+
uiSchema: uiSchema,
|
|
636
|
+
registry: registry
|
|
637
|
+
})
|
|
638
|
+
}), properties.filter(function (e) {
|
|
639
|
+
return !e.hidden;
|
|
640
|
+
}).map(function (element) {
|
|
641
|
+
return jsxRuntime.jsx(Col__default["default"], {
|
|
642
|
+
span: calculateColSpan(element),
|
|
643
|
+
children: element.content
|
|
644
|
+
}, element.name);
|
|
645
|
+
})]
|
|
646
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(Col__default["default"], {
|
|
647
|
+
span: 24,
|
|
648
|
+
children: jsxRuntime.jsx(Row__default["default"], {
|
|
649
|
+
gutter: rowGutter,
|
|
650
|
+
justify: 'end',
|
|
651
|
+
children: jsxRuntime.jsx(Col__default["default"], {
|
|
652
|
+
flex: '192px',
|
|
653
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
654
|
+
className: 'object-property-expand',
|
|
655
|
+
disabled: disabled || readonly,
|
|
656
|
+
onClick: onAddClick(schema),
|
|
657
|
+
uiSchema: uiSchema,
|
|
658
|
+
registry: registry
|
|
659
|
+
})
|
|
660
|
+
})
|
|
661
|
+
})
|
|
662
|
+
})]
|
|
663
|
+
});
|
|
664
|
+
}
|
|
634
665
|
});
|
|
635
666
|
}
|
|
636
667
|
|
|
@@ -645,11 +676,12 @@ function SubmitButton(_ref) {
|
|
|
645
676
|
if (norender) {
|
|
646
677
|
return null;
|
|
647
678
|
}
|
|
648
|
-
return
|
|
649
|
-
type:
|
|
679
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
680
|
+
type: 'submit'
|
|
650
681
|
}, submitButtonProps, {
|
|
651
|
-
htmlType:
|
|
652
|
-
|
|
682
|
+
htmlType: 'submit',
|
|
683
|
+
children: submitText
|
|
684
|
+
}));
|
|
653
685
|
}
|
|
654
686
|
|
|
655
687
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -665,8 +697,8 @@ function TitleField(_ref) {
|
|
|
665
697
|
var _formContext$colon = formContext.colon,
|
|
666
698
|
colon = _formContext$colon === void 0 ? true : _formContext$colon;
|
|
667
699
|
var labelChildren = title;
|
|
668
|
-
if (colon && typeof title ===
|
|
669
|
-
labelChildren = title.replace(/[::]\s*$/,
|
|
700
|
+
if (colon && typeof title === 'string' && title.trim() !== '') {
|
|
701
|
+
labelChildren = title.replace(/[::]\s*$/, '');
|
|
670
702
|
}
|
|
671
703
|
var handleLabelClick = function handleLabelClick() {
|
|
672
704
|
if (!id) {
|
|
@@ -677,17 +709,20 @@ function TitleField(_ref) {
|
|
|
677
709
|
control.focus();
|
|
678
710
|
}
|
|
679
711
|
};
|
|
680
|
-
return title ?
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
712
|
+
return title ? jsxRuntime.jsx(context.ConfigConsumer, {
|
|
713
|
+
children: function children(configProps) {
|
|
714
|
+
var _classNames;
|
|
715
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
716
|
+
var prefixCls = getPrefixCls('form');
|
|
717
|
+
var labelClassName = classNames__default["default"]((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
|
|
718
|
+
return jsxRuntime.jsx("label", {
|
|
719
|
+
className: labelClassName,
|
|
720
|
+
htmlFor: id,
|
|
721
|
+
onClick: handleLabelClick,
|
|
722
|
+
title: typeof title === 'string' ? title : '',
|
|
723
|
+
children: labelChildren
|
|
724
|
+
});
|
|
725
|
+
}
|
|
691
726
|
}) : null;
|
|
692
727
|
}
|
|
693
728
|
|
|
@@ -698,7 +733,7 @@ var VERTICAL_WRAPPER_COL = {
|
|
|
698
733
|
span: 24
|
|
699
734
|
};
|
|
700
735
|
var INPUT_STYLE$1 = {
|
|
701
|
-
width:
|
|
736
|
+
width: '100%'
|
|
702
737
|
};
|
|
703
738
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
704
739
|
* part of an `additionalProperties` part of a schema.
|
|
@@ -729,7 +764,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
729
764
|
_registry$formContext4 = _registry$formContext.rowGutter,
|
|
730
765
|
rowGutter = _registry$formContext4 === void 0 ? 24 : _registry$formContext4,
|
|
731
766
|
_registry$formContext5 = _registry$formContext.toolbarAlign,
|
|
732
|
-
toolbarAlign = _registry$formContext5 === void 0 ?
|
|
767
|
+
toolbarAlign = _registry$formContext5 === void 0 ? 'top' : _registry$formContext5,
|
|
733
768
|
_registry$formContext6 = _registry$formContext.wrapperCol,
|
|
734
769
|
wrapperCol = _registry$formContext6 === void 0 ? VERTICAL_WRAPPER_COL : _registry$formContext6,
|
|
735
770
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
@@ -740,10 +775,11 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
740
775
|
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
741
776
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
742
777
|
if (!additional) {
|
|
743
|
-
return
|
|
778
|
+
return jsxRuntime.jsx("div", {
|
|
744
779
|
className: classNames,
|
|
745
|
-
style: style
|
|
746
|
-
|
|
780
|
+
style: style,
|
|
781
|
+
children: children
|
|
782
|
+
});
|
|
747
783
|
}
|
|
748
784
|
var handleBlur = function handleBlur(_ref) {
|
|
749
785
|
var target = _ref.target;
|
|
@@ -754,48 +790,55 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
754
790
|
var buttonUiOptions = _extends({}, uiSchema, (_extends2 = {}, _extends2[utils.UI_OPTIONS_KEY] = _extends({}, uiOptions, {
|
|
755
791
|
block: true
|
|
756
792
|
}), _extends2));
|
|
757
|
-
return
|
|
793
|
+
return jsxRuntime.jsx("div", {
|
|
758
794
|
className: classNames,
|
|
759
|
-
style: style
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
795
|
+
style: style,
|
|
796
|
+
children: jsxRuntime.jsxs(Row__default["default"], {
|
|
797
|
+
align: toolbarAlign,
|
|
798
|
+
gutter: rowGutter,
|
|
799
|
+
children: [jsxRuntime.jsx(Col__default["default"], {
|
|
800
|
+
className: 'form-additional',
|
|
801
|
+
flex: '1',
|
|
802
|
+
children: jsxRuntime.jsx("div", {
|
|
803
|
+
className: 'form-group',
|
|
804
|
+
children: jsxRuntime.jsx(Form__default["default"].Item, {
|
|
805
|
+
colon: colon,
|
|
806
|
+
className: 'form-group',
|
|
807
|
+
hasFeedback: true,
|
|
808
|
+
htmlFor: id + "-key",
|
|
809
|
+
label: keyLabel,
|
|
810
|
+
labelCol: labelCol,
|
|
811
|
+
required: required,
|
|
812
|
+
style: wrapperStyle,
|
|
813
|
+
wrapperCol: wrapperCol,
|
|
814
|
+
children: jsxRuntime.jsx(Input__default["default"], {
|
|
815
|
+
className: 'form-control',
|
|
816
|
+
defaultValue: label,
|
|
817
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
818
|
+
id: id + "-key",
|
|
819
|
+
name: id + "-key",
|
|
820
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
821
|
+
style: INPUT_STYLE$1,
|
|
822
|
+
type: 'text'
|
|
823
|
+
})
|
|
824
|
+
})
|
|
825
|
+
})
|
|
826
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
827
|
+
className: 'form-additional',
|
|
828
|
+
flex: '1',
|
|
829
|
+
children: children
|
|
830
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
831
|
+
flex: '192px',
|
|
832
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
833
|
+
className: 'array-item-remove',
|
|
834
|
+
disabled: disabled || readonly,
|
|
835
|
+
onClick: onDropPropertyClick(label),
|
|
836
|
+
uiSchema: buttonUiOptions,
|
|
837
|
+
registry: registry
|
|
838
|
+
})
|
|
839
|
+
})]
|
|
840
|
+
})
|
|
841
|
+
});
|
|
799
842
|
}
|
|
800
843
|
|
|
801
844
|
function generateTemplates() {
|
|
@@ -847,29 +890,29 @@ function dateElementProps(state, time, yearsRange) {
|
|
|
847
890
|
minute = state.minute,
|
|
848
891
|
second = state.second;
|
|
849
892
|
var data = [{
|
|
850
|
-
type:
|
|
893
|
+
type: 'year',
|
|
851
894
|
range: yearsRange,
|
|
852
895
|
value: year
|
|
853
896
|
}, {
|
|
854
|
-
type:
|
|
897
|
+
type: 'month',
|
|
855
898
|
range: [1, 12],
|
|
856
899
|
value: month
|
|
857
900
|
}, {
|
|
858
|
-
type:
|
|
901
|
+
type: 'day',
|
|
859
902
|
range: [1, 31],
|
|
860
903
|
value: day
|
|
861
904
|
}];
|
|
862
905
|
if (time) {
|
|
863
906
|
data.push({
|
|
864
|
-
type:
|
|
907
|
+
type: 'hour',
|
|
865
908
|
range: [0, 23],
|
|
866
909
|
value: hour || -1
|
|
867
910
|
}, {
|
|
868
|
-
type:
|
|
911
|
+
type: 'minute',
|
|
869
912
|
range: [0, 59],
|
|
870
913
|
value: minute || -1
|
|
871
914
|
}, {
|
|
872
|
-
type:
|
|
915
|
+
type: 'second',
|
|
873
916
|
range: [0, 59],
|
|
874
917
|
value: second || -1
|
|
875
918
|
});
|
|
@@ -894,15 +937,15 @@ function AltDateWidget(props) {
|
|
|
894
937
|
var SelectWidget = widgets.SelectWidget;
|
|
895
938
|
var _formContext$rowGutte = formContext.rowGutter,
|
|
896
939
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
897
|
-
var _useState =
|
|
940
|
+
var _useState = react.useState(utils.parseDateString(value, showTime)),
|
|
898
941
|
state = _useState[0],
|
|
899
942
|
setState = _useState[1];
|
|
900
|
-
|
|
943
|
+
react.useEffect(function () {
|
|
901
944
|
setState(utils.parseDateString(value, showTime));
|
|
902
945
|
}, [showTime, value]);
|
|
903
946
|
var handleChange = function handleChange(property, nextValue) {
|
|
904
947
|
var _extends2;
|
|
905
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
948
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
906
949
|
if (readyForChange(nextState)) {
|
|
907
950
|
onChange(utils.toDateString(nextState, showTime));
|
|
908
951
|
} else {
|
|
@@ -925,9 +968,9 @@ function AltDateWidget(props) {
|
|
|
925
968
|
onChange(undefined);
|
|
926
969
|
};
|
|
927
970
|
var renderDateElement = function renderDateElement(elemProps) {
|
|
928
|
-
return
|
|
971
|
+
return jsxRuntime.jsx(SelectWidget, {
|
|
929
972
|
autofocus: elemProps.autofocus,
|
|
930
|
-
className:
|
|
973
|
+
className: 'form-control',
|
|
931
974
|
disabled: elemProps.disabled,
|
|
932
975
|
id: elemProps.id,
|
|
933
976
|
name: elemProps.name,
|
|
@@ -942,51 +985,56 @@ function AltDateWidget(props) {
|
|
|
942
985
|
placeholder: elemProps.type,
|
|
943
986
|
readonly: elemProps.readonly,
|
|
944
987
|
schema: {
|
|
945
|
-
type:
|
|
988
|
+
type: 'integer'
|
|
946
989
|
},
|
|
947
990
|
value: elemProps.value,
|
|
948
991
|
registry: registry,
|
|
949
|
-
label:
|
|
992
|
+
label: '',
|
|
950
993
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
951
994
|
});
|
|
952
995
|
};
|
|
953
|
-
return
|
|
954
|
-
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
996
|
+
return jsxRuntime.jsxs(Row__default["default"], {
|
|
997
|
+
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)],
|
|
998
|
+
children: [dateElementProps(state, showTime, options.yearsRange).map(function (elemProps, i) {
|
|
999
|
+
var elemId = id + '_' + elemProps.type;
|
|
1000
|
+
return jsxRuntime.jsx(Col__default["default"], {
|
|
1001
|
+
flex: '88px',
|
|
1002
|
+
children: renderDateElement(_extends({}, elemProps, {
|
|
1003
|
+
autofocus: autofocus && i === 0,
|
|
1004
|
+
disabled: disabled,
|
|
1005
|
+
id: elemId,
|
|
1006
|
+
name: id,
|
|
1007
|
+
onBlur: onBlur,
|
|
1008
|
+
onFocus: onFocus,
|
|
1009
|
+
readonly: readonly,
|
|
1010
|
+
registry: registry,
|
|
1011
|
+
select: handleChange,
|
|
1012
|
+
// NOTE: antd components accept -1 rather than issue a warning
|
|
1013
|
+
// like material-ui, so we need to convert -1 to undefined here.
|
|
1014
|
+
value: elemProps.value < 0 ? undefined : elemProps.value
|
|
1015
|
+
}))
|
|
1016
|
+
}, elemId);
|
|
1017
|
+
}), !options.hideNowButton && jsxRuntime.jsx(Col__default["default"], {
|
|
1018
|
+
flex: '88px',
|
|
1019
|
+
children: jsxRuntime.jsx(Button__default["default"], {
|
|
1020
|
+
block: true,
|
|
1021
|
+
className: 'btn-now',
|
|
1022
|
+
onClick: handleNow,
|
|
1023
|
+
type: 'primary',
|
|
1024
|
+
children: translateString(utils.TranslatableString.NowLabel)
|
|
1025
|
+
})
|
|
1026
|
+
}), !options.hideClearButton && jsxRuntime.jsx(Col__default["default"], {
|
|
1027
|
+
flex: '88px',
|
|
1028
|
+
children: jsxRuntime.jsx(Button__default["default"], {
|
|
1029
|
+
block: true,
|
|
1030
|
+
className: 'btn-clear',
|
|
1031
|
+
danger: true,
|
|
1032
|
+
onClick: handleClear,
|
|
1033
|
+
type: 'primary',
|
|
1034
|
+
children: translateString(utils.TranslatableString.ClearLabel)
|
|
1035
|
+
})
|
|
1036
|
+
})]
|
|
1037
|
+
});
|
|
990
1038
|
}
|
|
991
1039
|
AltDateWidget.defaultProps = {
|
|
992
1040
|
autofocus: false,
|
|
@@ -1000,7 +1048,7 @@ AltDateWidget.defaultProps = {
|
|
|
1000
1048
|
|
|
1001
1049
|
function AltDateTimeWidget(props) {
|
|
1002
1050
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
1003
|
-
return
|
|
1051
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({
|
|
1004
1052
|
showTime: true
|
|
1005
1053
|
}, props));
|
|
1006
1054
|
}
|
|
@@ -1049,23 +1097,25 @@ function CheckboxesWidget(_ref) {
|
|
|
1049
1097
|
onFocus: !readonly ? handleFocus : undefined
|
|
1050
1098
|
};
|
|
1051
1099
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
1052
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ?
|
|
1100
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? jsxRuntime.jsx(Checkbox__default["default"].Group, _extends({
|
|
1053
1101
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1054
1102
|
name: id,
|
|
1055
1103
|
onChange: !readonly ? handleChange : undefined,
|
|
1056
1104
|
value: selectedIndexes
|
|
1057
1105
|
}, extraProps, {
|
|
1058
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1106
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1107
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
1108
|
+
return jsxRuntime.jsxs("span", {
|
|
1109
|
+
children: [jsxRuntime.jsx(Checkbox__default["default"], {
|
|
1110
|
+
id: utils.optionId(id, i),
|
|
1111
|
+
name: id,
|
|
1112
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1113
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1114
|
+
value: String(i),
|
|
1115
|
+
children: option.label
|
|
1116
|
+
}), !inline && jsxRuntime.jsx("br", {})]
|
|
1117
|
+
}, i);
|
|
1118
|
+
})
|
|
1069
1119
|
})) : null;
|
|
1070
1120
|
}
|
|
1071
1121
|
|
|
@@ -1105,22 +1155,23 @@ function CheckboxWidget(props) {
|
|
|
1105
1155
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1106
1156
|
onFocus: !readonly ? handleFocus : undefined
|
|
1107
1157
|
};
|
|
1108
|
-
return
|
|
1158
|
+
return jsxRuntime.jsx(Checkbox__default["default"], _extends({
|
|
1109
1159
|
autoFocus: autofocus,
|
|
1110
|
-
checked: typeof value ===
|
|
1160
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
1111
1161
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1112
1162
|
id: id,
|
|
1113
1163
|
name: id,
|
|
1114
1164
|
onChange: !readonly ? handleChange : undefined
|
|
1115
1165
|
}, extraProps, {
|
|
1116
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1117
|
-
|
|
1166
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1167
|
+
children: label
|
|
1168
|
+
}));
|
|
1118
1169
|
}
|
|
1119
1170
|
|
|
1120
1171
|
var DatePicker = /*#__PURE__*/generatePicker__default["default"](dayjsGenerateConfig__default["default"]);
|
|
1121
1172
|
|
|
1122
1173
|
var DATE_PICKER_STYLE$1 = {
|
|
1123
|
-
width:
|
|
1174
|
+
width: '100%'
|
|
1124
1175
|
};
|
|
1125
1176
|
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
1126
1177
|
* the value to/from utc using the appropriate utility functions.
|
|
@@ -1151,7 +1202,7 @@ function DateTimeWidget(props) {
|
|
|
1151
1202
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1152
1203
|
return node.parentNode;
|
|
1153
1204
|
};
|
|
1154
|
-
return
|
|
1205
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1155
1206
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1156
1207
|
getPopupContainer: getPopupContainer,
|
|
1157
1208
|
id: id,
|
|
@@ -1168,7 +1219,7 @@ function DateTimeWidget(props) {
|
|
|
1168
1219
|
}
|
|
1169
1220
|
|
|
1170
1221
|
var DATE_PICKER_STYLE = {
|
|
1171
|
-
width:
|
|
1222
|
+
width: '100%'
|
|
1172
1223
|
};
|
|
1173
1224
|
/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms
|
|
1174
1225
|
* the value to undefined when it is falsy during the `onChange` handling.
|
|
@@ -1188,7 +1239,7 @@ function DateWidget(props) {
|
|
|
1188
1239
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1189
1240
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1190
1241
|
var handleChange = function handleChange(nextValue) {
|
|
1191
|
-
return onChange(nextValue && nextValue.format(
|
|
1242
|
+
return onChange(nextValue && nextValue.format('YYYY-MM-DD'));
|
|
1192
1243
|
};
|
|
1193
1244
|
var handleBlur = function handleBlur() {
|
|
1194
1245
|
return onBlur(id, value);
|
|
@@ -1199,7 +1250,7 @@ function DateWidget(props) {
|
|
|
1199
1250
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1200
1251
|
return node.parentNode;
|
|
1201
1252
|
};
|
|
1202
|
-
return
|
|
1253
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1203
1254
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1204
1255
|
getPopupContainer: getPopupContainer,
|
|
1205
1256
|
id: id,
|
|
@@ -1232,10 +1283,10 @@ function PasswordWidget(props) {
|
|
|
1232
1283
|
value = props.value;
|
|
1233
1284
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1234
1285
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1235
|
-
var emptyValue = options.emptyValue ||
|
|
1286
|
+
var emptyValue = options.emptyValue || '';
|
|
1236
1287
|
var handleChange = function handleChange(_ref) {
|
|
1237
1288
|
var target = _ref.target;
|
|
1238
|
-
return onChange(target.value ===
|
|
1289
|
+
return onChange(target.value === '' ? emptyValue : target.value);
|
|
1239
1290
|
};
|
|
1240
1291
|
var handleBlur = function handleBlur(_ref2) {
|
|
1241
1292
|
var target = _ref2.target;
|
|
@@ -1245,7 +1296,7 @@ function PasswordWidget(props) {
|
|
|
1245
1296
|
var target = _ref3.target;
|
|
1246
1297
|
return onFocus(id, target.value);
|
|
1247
1298
|
};
|
|
1248
|
-
return
|
|
1299
|
+
return jsxRuntime.jsx(Input__default["default"].Password, {
|
|
1249
1300
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1250
1301
|
id: id,
|
|
1251
1302
|
name: id,
|
|
@@ -1253,7 +1304,7 @@ function PasswordWidget(props) {
|
|
|
1253
1304
|
onChange: !readonly ? handleChange : undefined,
|
|
1254
1305
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1255
1306
|
placeholder: placeholder,
|
|
1256
|
-
value: value ||
|
|
1307
|
+
value: value || '',
|
|
1257
1308
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1258
1309
|
});
|
|
1259
1310
|
}
|
|
@@ -1292,7 +1343,7 @@ function RadioWidget(_ref) {
|
|
|
1292
1343
|
return onFocus(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1293
1344
|
};
|
|
1294
1345
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
1295
|
-
return
|
|
1346
|
+
return jsxRuntime.jsx(Radio__default["default"].Group, {
|
|
1296
1347
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1297
1348
|
id: id,
|
|
1298
1349
|
name: id,
|
|
@@ -1300,17 +1351,18 @@ function RadioWidget(_ref) {
|
|
|
1300
1351
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1301
1352
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1302
1353
|
value: selectedIndexes,
|
|
1303
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1354
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1355
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
1356
|
+
return jsxRuntime.jsx(Radio__default["default"], {
|
|
1357
|
+
id: utils.optionId(id, i),
|
|
1358
|
+
name: id,
|
|
1359
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1360
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1361
|
+
value: String(i),
|
|
1362
|
+
children: option.label
|
|
1363
|
+
}, i);
|
|
1364
|
+
})
|
|
1365
|
+
});
|
|
1314
1366
|
}
|
|
1315
1367
|
|
|
1316
1368
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -1337,9 +1389,9 @@ function RangeWidget(props) {
|
|
|
1337
1389
|
min = _rangeSpec.min,
|
|
1338
1390
|
max = _rangeSpec.max,
|
|
1339
1391
|
step = _rangeSpec.step;
|
|
1340
|
-
var emptyValue = options.emptyValue ||
|
|
1392
|
+
var emptyValue = options.emptyValue || '';
|
|
1341
1393
|
var handleChange = function handleChange(nextValue) {
|
|
1342
|
-
return onChange(nextValue ===
|
|
1394
|
+
return onChange(nextValue === '' ? emptyValue : nextValue);
|
|
1343
1395
|
};
|
|
1344
1396
|
var handleBlur = function handleBlur() {
|
|
1345
1397
|
return onBlur(id, value);
|
|
@@ -1354,7 +1406,7 @@ function RangeWidget(props) {
|
|
|
1354
1406
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1355
1407
|
onFocus: !readonly ? handleFocus : undefined
|
|
1356
1408
|
};
|
|
1357
|
-
return
|
|
1409
|
+
return jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
1358
1410
|
autoFocus: autofocus,
|
|
1359
1411
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1360
1412
|
id: id,
|
|
@@ -1370,7 +1422,7 @@ function RangeWidget(props) {
|
|
|
1370
1422
|
}
|
|
1371
1423
|
|
|
1372
1424
|
var SELECT_STYLE = {
|
|
1373
|
-
width:
|
|
1425
|
+
width: '100%'
|
|
1374
1426
|
};
|
|
1375
1427
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
1376
1428
|
* It is typically used with string properties constrained with enum options.
|
|
@@ -1421,12 +1473,12 @@ function SelectWidget(_ref) {
|
|
|
1421
1473
|
var extraProps = {
|
|
1422
1474
|
name: id
|
|
1423
1475
|
};
|
|
1424
|
-
return
|
|
1476
|
+
return jsxRuntime.jsx(Select__default["default"], _extends({
|
|
1425
1477
|
autoFocus: autofocus,
|
|
1426
1478
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1427
1479
|
getPopupContainer: getPopupContainer,
|
|
1428
1480
|
id: id,
|
|
1429
|
-
mode: typeof multiple !==
|
|
1481
|
+
mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
|
|
1430
1482
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1431
1483
|
onChange: !readonly ? handleChange : undefined,
|
|
1432
1484
|
onFocus: !readonly ? handleFocus : undefined,
|
|
@@ -1435,20 +1487,21 @@ function SelectWidget(_ref) {
|
|
|
1435
1487
|
value: selectedIndexes
|
|
1436
1488
|
}, extraProps, {
|
|
1437
1489
|
filterOption: filterOption,
|
|
1438
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1490
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1491
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (_ref2, index) {
|
|
1492
|
+
var optionValue = _ref2.value,
|
|
1493
|
+
optionLabel = _ref2.label;
|
|
1494
|
+
return jsxRuntime.jsx(Select__default["default"].Option, {
|
|
1495
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
1496
|
+
value: String(index),
|
|
1497
|
+
children: optionLabel
|
|
1498
|
+
}, String(index));
|
|
1499
|
+
})
|
|
1447
1500
|
}));
|
|
1448
1501
|
}
|
|
1449
1502
|
|
|
1450
1503
|
var INPUT_STYLE = {
|
|
1451
|
-
width:
|
|
1504
|
+
width: '100%'
|
|
1452
1505
|
};
|
|
1453
1506
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
1454
1507
|
*
|
|
@@ -1469,7 +1522,7 @@ function TextareaWidget(_ref) {
|
|
|
1469
1522
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1470
1523
|
var handleChange = function handleChange(_ref2) {
|
|
1471
1524
|
var target = _ref2.target;
|
|
1472
|
-
return onChange(target.value ===
|
|
1525
|
+
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
1473
1526
|
};
|
|
1474
1527
|
var handleBlur = function handleBlur(_ref3) {
|
|
1475
1528
|
var target = _ref3.target;
|
|
@@ -1482,9 +1535,9 @@ function TextareaWidget(_ref) {
|
|
|
1482
1535
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1483
1536
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1484
1537
|
var extraProps = {
|
|
1485
|
-
type:
|
|
1538
|
+
type: 'textarea'
|
|
1486
1539
|
};
|
|
1487
|
-
return
|
|
1540
|
+
return jsxRuntime.jsx(Input__default["default"].TextArea, _extends({
|
|
1488
1541
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1489
1542
|
id: id,
|
|
1490
1543
|
name: id,
|