@rjsf/antd 5.1.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 +455 -392
- 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 +454 -390
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +457 -395
- 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`
|
|
@@ -338,69 +353,78 @@ function DescriptionField(props) {
|
|
|
338
353
|
* @param props - The `ErrorListProps` for this component
|
|
339
354
|
*/
|
|
340
355
|
function ErrorList(_ref) {
|
|
341
|
-
var errors = _ref.errors
|
|
356
|
+
var errors = _ref.errors,
|
|
357
|
+
registry = _ref.registry;
|
|
358
|
+
var translateString = registry.translateString;
|
|
342
359
|
var renderErrors = function renderErrors() {
|
|
343
|
-
return
|
|
344
|
-
className:
|
|
345
|
-
size:
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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
|
+
});
|
|
351
371
|
};
|
|
352
|
-
return
|
|
353
|
-
className:
|
|
372
|
+
return jsxRuntime.jsx(Alert__default["default"], {
|
|
373
|
+
className: 'panel panel-danger errors',
|
|
354
374
|
description: renderErrors(),
|
|
355
|
-
message:
|
|
356
|
-
type:
|
|
375
|
+
message: translateString(utils.TranslatableString.ErrorsLabel),
|
|
376
|
+
type: 'error'
|
|
357
377
|
});
|
|
358
378
|
}
|
|
359
379
|
|
|
360
380
|
var _excluded = ["iconType", "icon", "uiSchema", "registry"];
|
|
361
381
|
function IconButton(props) {
|
|
362
382
|
var _props$iconType = props.iconType,
|
|
363
|
-
iconType = _props$iconType === void 0 ?
|
|
383
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
364
384
|
icon = props.icon,
|
|
365
385
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
366
|
-
return
|
|
386
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
367
387
|
type: iconType,
|
|
368
388
|
icon: icon
|
|
369
389
|
}, otherProps));
|
|
370
390
|
}
|
|
371
391
|
function AddButton(props) {
|
|
372
|
-
|
|
373
|
-
|
|
392
|
+
var translateString = props.registry.translateString;
|
|
393
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
394
|
+
title: translateString(utils.TranslatableString.AddItemButton)
|
|
374
395
|
}, props, {
|
|
375
396
|
block: true,
|
|
376
|
-
iconType:
|
|
377
|
-
icon:
|
|
397
|
+
iconType: 'primary',
|
|
398
|
+
icon: jsxRuntime.jsx(PlusCircleOutlined__default["default"], {})
|
|
378
399
|
}));
|
|
379
400
|
}
|
|
380
401
|
function MoveDownButton(props) {
|
|
381
|
-
|
|
382
|
-
|
|
402
|
+
var translateString = props.registry.translateString;
|
|
403
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
404
|
+
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
383
405
|
}, props, {
|
|
384
|
-
icon:
|
|
406
|
+
icon: jsxRuntime.jsx(ArrowDownOutlined__default["default"], {})
|
|
385
407
|
}));
|
|
386
408
|
}
|
|
387
409
|
function MoveUpButton(props) {
|
|
388
|
-
|
|
389
|
-
|
|
410
|
+
var translateString = props.registry.translateString;
|
|
411
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
412
|
+
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
390
413
|
}, props, {
|
|
391
|
-
icon:
|
|
414
|
+
icon: jsxRuntime.jsx(ArrowUpOutlined__default["default"], {})
|
|
392
415
|
}));
|
|
393
416
|
}
|
|
394
417
|
function RemoveButton(props) {
|
|
395
418
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
|
|
396
419
|
var options = utils.getUiOptions(props.uiSchema);
|
|
397
|
-
|
|
398
|
-
|
|
420
|
+
var translateString = props.registry.translateString;
|
|
421
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
422
|
+
title: translateString(utils.TranslatableString.RemoveButton)
|
|
399
423
|
}, props, {
|
|
400
424
|
danger: true,
|
|
401
425
|
block: !!options.block,
|
|
402
|
-
iconType:
|
|
403
|
-
icon:
|
|
426
|
+
iconType: 'primary',
|
|
427
|
+
icon: jsxRuntime.jsx(DeleteOutlined__default["default"], {})
|
|
404
428
|
}));
|
|
405
429
|
}
|
|
406
430
|
|
|
@@ -416,13 +440,14 @@ function FieldErrorTemplate(props) {
|
|
|
416
440
|
return null;
|
|
417
441
|
}
|
|
418
442
|
var id = utils.errorId(idSchema);
|
|
419
|
-
return
|
|
420
|
-
id: id
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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
|
+
});
|
|
426
451
|
}
|
|
427
452
|
|
|
428
453
|
var VERTICAL_LABEL_COL$1 = {
|
|
@@ -466,13 +491,14 @@ function FieldTemplate(props) {
|
|
|
466
491
|
wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
|
|
467
492
|
wrapperStyle = formContext.wrapperStyle;
|
|
468
493
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
469
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
494
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
470
495
|
if (hidden) {
|
|
471
|
-
return
|
|
472
|
-
className:
|
|
473
|
-
|
|
496
|
+
return jsxRuntime.jsx("div", {
|
|
497
|
+
className: 'field-hidden',
|
|
498
|
+
children: children
|
|
499
|
+
});
|
|
474
500
|
}
|
|
475
|
-
return
|
|
501
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
476
502
|
classNames: classNames,
|
|
477
503
|
style: style,
|
|
478
504
|
disabled: disabled,
|
|
@@ -484,24 +510,26 @@ function FieldTemplate(props) {
|
|
|
484
510
|
required: required,
|
|
485
511
|
schema: schema,
|
|
486
512
|
uiSchema: uiSchema,
|
|
487
|
-
registry: registry
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
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
|
+
});
|
|
501
529
|
}
|
|
502
530
|
|
|
503
531
|
var DESCRIPTION_COL_STYLE = {
|
|
504
|
-
paddingBottom:
|
|
532
|
+
paddingBottom: '8px'
|
|
505
533
|
};
|
|
506
534
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
507
535
|
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
@@ -524,14 +552,14 @@ function ObjectFieldTemplate(props) {
|
|
|
524
552
|
title = props.title,
|
|
525
553
|
uiSchema = props.uiSchema;
|
|
526
554
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
527
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
528
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
555
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
556
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
529
557
|
// Button templates are not overridden in the uiSchema
|
|
530
558
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
531
559
|
var _formContext$colSpan = formContext.colSpan,
|
|
532
560
|
colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
|
|
533
561
|
_formContext$labelAli = formContext.labelAlign,
|
|
534
|
-
labelAlign = _formContext$labelAli === void 0 ?
|
|
562
|
+
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
535
563
|
_formContext$rowGutte = formContext.rowGutter,
|
|
536
564
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
537
565
|
var findSchema = function findSchema(element) {
|
|
@@ -555,7 +583,7 @@ function ObjectFieldTemplate(props) {
|
|
|
555
583
|
var widget = findUiSchemaWidget(element);
|
|
556
584
|
var defaultColSpan = properties.length < 2 ||
|
|
557
585
|
// Single or no field in object.
|
|
558
|
-
type ===
|
|
586
|
+
type === 'object' || type === 'array' || widget === 'textarea' ? 24 : 12;
|
|
559
587
|
if (isObject__default["default"](colSpan)) {
|
|
560
588
|
var colSpanObj = colSpan;
|
|
561
589
|
if (isString__default["default"](widget)) {
|
|
@@ -573,58 +601,67 @@ function ObjectFieldTemplate(props) {
|
|
|
573
601
|
}
|
|
574
602
|
return defaultColSpan;
|
|
575
603
|
};
|
|
576
|
-
return
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
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
|
+
);
|
|
583
612
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
628
665
|
});
|
|
629
666
|
}
|
|
630
667
|
|
|
@@ -639,11 +676,12 @@ function SubmitButton(_ref) {
|
|
|
639
676
|
if (norender) {
|
|
640
677
|
return null;
|
|
641
678
|
}
|
|
642
|
-
return
|
|
643
|
-
type:
|
|
679
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
680
|
+
type: 'submit'
|
|
644
681
|
}, submitButtonProps, {
|
|
645
|
-
htmlType:
|
|
646
|
-
|
|
682
|
+
htmlType: 'submit',
|
|
683
|
+
children: submitText
|
|
684
|
+
}));
|
|
647
685
|
}
|
|
648
686
|
|
|
649
687
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -659,8 +697,8 @@ function TitleField(_ref) {
|
|
|
659
697
|
var _formContext$colon = formContext.colon,
|
|
660
698
|
colon = _formContext$colon === void 0 ? true : _formContext$colon;
|
|
661
699
|
var labelChildren = title;
|
|
662
|
-
if (colon && typeof title ===
|
|
663
|
-
labelChildren = title.replace(/[::]\s*$/,
|
|
700
|
+
if (colon && typeof title === 'string' && title.trim() !== '') {
|
|
701
|
+
labelChildren = title.replace(/[::]\s*$/, '');
|
|
664
702
|
}
|
|
665
703
|
var handleLabelClick = function handleLabelClick() {
|
|
666
704
|
if (!id) {
|
|
@@ -671,17 +709,20 @@ function TitleField(_ref) {
|
|
|
671
709
|
control.focus();
|
|
672
710
|
}
|
|
673
711
|
};
|
|
674
|
-
return title ?
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
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
|
+
}
|
|
685
726
|
}) : null;
|
|
686
727
|
}
|
|
687
728
|
|
|
@@ -692,7 +733,7 @@ var VERTICAL_WRAPPER_COL = {
|
|
|
692
733
|
span: 24
|
|
693
734
|
};
|
|
694
735
|
var INPUT_STYLE$1 = {
|
|
695
|
-
width:
|
|
736
|
+
width: '100%'
|
|
696
737
|
};
|
|
697
738
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
698
739
|
* part of an `additionalProperties` part of a schema.
|
|
@@ -723,19 +764,22 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
723
764
|
_registry$formContext4 = _registry$formContext.rowGutter,
|
|
724
765
|
rowGutter = _registry$formContext4 === void 0 ? 24 : _registry$formContext4,
|
|
725
766
|
_registry$formContext5 = _registry$formContext.toolbarAlign,
|
|
726
|
-
toolbarAlign = _registry$formContext5 === void 0 ?
|
|
767
|
+
toolbarAlign = _registry$formContext5 === void 0 ? 'top' : _registry$formContext5,
|
|
727
768
|
_registry$formContext6 = _registry$formContext.wrapperCol,
|
|
728
769
|
wrapperCol = _registry$formContext6 === void 0 ? VERTICAL_WRAPPER_COL : _registry$formContext6,
|
|
729
770
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
771
|
+
var templates = registry.templates,
|
|
772
|
+
translateString = registry.translateString;
|
|
730
773
|
// Button templates are not overridden in the uiSchema
|
|
731
|
-
var RemoveButton =
|
|
732
|
-
var keyLabel = label
|
|
774
|
+
var RemoveButton = templates.ButtonTemplates.RemoveButton;
|
|
775
|
+
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
733
776
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
734
777
|
if (!additional) {
|
|
735
|
-
return
|
|
778
|
+
return jsxRuntime.jsx("div", {
|
|
736
779
|
className: classNames,
|
|
737
|
-
style: style
|
|
738
|
-
|
|
780
|
+
style: style,
|
|
781
|
+
children: children
|
|
782
|
+
});
|
|
739
783
|
}
|
|
740
784
|
var handleBlur = function handleBlur(_ref) {
|
|
741
785
|
var target = _ref.target;
|
|
@@ -746,48 +790,55 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
746
790
|
var buttonUiOptions = _extends({}, uiSchema, (_extends2 = {}, _extends2[utils.UI_OPTIONS_KEY] = _extends({}, uiOptions, {
|
|
747
791
|
block: true
|
|
748
792
|
}), _extends2));
|
|
749
|
-
return
|
|
793
|
+
return jsxRuntime.jsx("div", {
|
|
750
794
|
className: classNames,
|
|
751
|
-
style: style
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
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
|
-
|
|
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
|
+
});
|
|
791
842
|
}
|
|
792
843
|
|
|
793
844
|
function generateTemplates() {
|
|
@@ -839,29 +890,29 @@ function dateElementProps(state, time, yearsRange) {
|
|
|
839
890
|
minute = state.minute,
|
|
840
891
|
second = state.second;
|
|
841
892
|
var data = [{
|
|
842
|
-
type:
|
|
893
|
+
type: 'year',
|
|
843
894
|
range: yearsRange,
|
|
844
895
|
value: year
|
|
845
896
|
}, {
|
|
846
|
-
type:
|
|
897
|
+
type: 'month',
|
|
847
898
|
range: [1, 12],
|
|
848
899
|
value: month
|
|
849
900
|
}, {
|
|
850
|
-
type:
|
|
901
|
+
type: 'day',
|
|
851
902
|
range: [1, 31],
|
|
852
903
|
value: day
|
|
853
904
|
}];
|
|
854
905
|
if (time) {
|
|
855
906
|
data.push({
|
|
856
|
-
type:
|
|
907
|
+
type: 'hour',
|
|
857
908
|
range: [0, 23],
|
|
858
909
|
value: hour || -1
|
|
859
910
|
}, {
|
|
860
|
-
type:
|
|
911
|
+
type: 'minute',
|
|
861
912
|
range: [0, 59],
|
|
862
913
|
value: minute || -1
|
|
863
914
|
}, {
|
|
864
|
-
type:
|
|
915
|
+
type: 'second',
|
|
865
916
|
range: [0, 59],
|
|
866
917
|
value: second || -1
|
|
867
918
|
});
|
|
@@ -881,18 +932,20 @@ function AltDateWidget(props) {
|
|
|
881
932
|
registry = props.registry,
|
|
882
933
|
showTime = props.showTime,
|
|
883
934
|
value = props.value;
|
|
884
|
-
var
|
|
935
|
+
var translateString = registry.translateString,
|
|
936
|
+
widgets = registry.widgets;
|
|
937
|
+
var SelectWidget = widgets.SelectWidget;
|
|
885
938
|
var _formContext$rowGutte = formContext.rowGutter,
|
|
886
939
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
887
|
-
var _useState =
|
|
940
|
+
var _useState = react.useState(utils.parseDateString(value, showTime)),
|
|
888
941
|
state = _useState[0],
|
|
889
942
|
setState = _useState[1];
|
|
890
|
-
|
|
943
|
+
react.useEffect(function () {
|
|
891
944
|
setState(utils.parseDateString(value, showTime));
|
|
892
945
|
}, [showTime, value]);
|
|
893
946
|
var handleChange = function handleChange(property, nextValue) {
|
|
894
947
|
var _extends2;
|
|
895
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
948
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
896
949
|
if (readyForChange(nextState)) {
|
|
897
950
|
onChange(utils.toDateString(nextState, showTime));
|
|
898
951
|
} else {
|
|
@@ -915,9 +968,9 @@ function AltDateWidget(props) {
|
|
|
915
968
|
onChange(undefined);
|
|
916
969
|
};
|
|
917
970
|
var renderDateElement = function renderDateElement(elemProps) {
|
|
918
|
-
return
|
|
971
|
+
return jsxRuntime.jsx(SelectWidget, {
|
|
919
972
|
autofocus: elemProps.autofocus,
|
|
920
|
-
className:
|
|
973
|
+
className: 'form-control',
|
|
921
974
|
disabled: elemProps.disabled,
|
|
922
975
|
id: elemProps.id,
|
|
923
976
|
name: elemProps.name,
|
|
@@ -932,51 +985,56 @@ function AltDateWidget(props) {
|
|
|
932
985
|
placeholder: elemProps.type,
|
|
933
986
|
readonly: elemProps.readonly,
|
|
934
987
|
schema: {
|
|
935
|
-
type:
|
|
988
|
+
type: 'integer'
|
|
936
989
|
},
|
|
937
990
|
value: elemProps.value,
|
|
938
991
|
registry: registry,
|
|
939
|
-
label:
|
|
992
|
+
label: '',
|
|
940
993
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
941
994
|
});
|
|
942
995
|
};
|
|
943
|
-
return
|
|
944
|
-
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
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
|
-
|
|
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
|
+
});
|
|
980
1038
|
}
|
|
981
1039
|
AltDateWidget.defaultProps = {
|
|
982
1040
|
autofocus: false,
|
|
@@ -990,7 +1048,7 @@ AltDateWidget.defaultProps = {
|
|
|
990
1048
|
|
|
991
1049
|
function AltDateTimeWidget(props) {
|
|
992
1050
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
993
|
-
return
|
|
1051
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({
|
|
994
1052
|
showTime: true
|
|
995
1053
|
}, props));
|
|
996
1054
|
}
|
|
@@ -1039,23 +1097,25 @@ function CheckboxesWidget(_ref) {
|
|
|
1039
1097
|
onFocus: !readonly ? handleFocus : undefined
|
|
1040
1098
|
};
|
|
1041
1099
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
1042
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ?
|
|
1100
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? jsxRuntime.jsx(Checkbox__default["default"].Group, _extends({
|
|
1043
1101
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1044
1102
|
name: id,
|
|
1045
1103
|
onChange: !readonly ? handleChange : undefined,
|
|
1046
1104
|
value: selectedIndexes
|
|
1047
1105
|
}, extraProps, {
|
|
1048
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
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
|
+
})
|
|
1059
1119
|
})) : null;
|
|
1060
1120
|
}
|
|
1061
1121
|
|
|
@@ -1095,22 +1155,23 @@ function CheckboxWidget(props) {
|
|
|
1095
1155
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1096
1156
|
onFocus: !readonly ? handleFocus : undefined
|
|
1097
1157
|
};
|
|
1098
|
-
return
|
|
1158
|
+
return jsxRuntime.jsx(Checkbox__default["default"], _extends({
|
|
1099
1159
|
autoFocus: autofocus,
|
|
1100
|
-
checked: typeof value ===
|
|
1160
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
1101
1161
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1102
1162
|
id: id,
|
|
1103
1163
|
name: id,
|
|
1104
1164
|
onChange: !readonly ? handleChange : undefined
|
|
1105
1165
|
}, extraProps, {
|
|
1106
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1107
|
-
|
|
1166
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1167
|
+
children: label
|
|
1168
|
+
}));
|
|
1108
1169
|
}
|
|
1109
1170
|
|
|
1110
1171
|
var DatePicker = /*#__PURE__*/generatePicker__default["default"](dayjsGenerateConfig__default["default"]);
|
|
1111
1172
|
|
|
1112
1173
|
var DATE_PICKER_STYLE$1 = {
|
|
1113
|
-
width:
|
|
1174
|
+
width: '100%'
|
|
1114
1175
|
};
|
|
1115
1176
|
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
1116
1177
|
* the value to/from utc using the appropriate utility functions.
|
|
@@ -1141,7 +1202,7 @@ function DateTimeWidget(props) {
|
|
|
1141
1202
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1142
1203
|
return node.parentNode;
|
|
1143
1204
|
};
|
|
1144
|
-
return
|
|
1205
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1145
1206
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1146
1207
|
getPopupContainer: getPopupContainer,
|
|
1147
1208
|
id: id,
|
|
@@ -1158,7 +1219,7 @@ function DateTimeWidget(props) {
|
|
|
1158
1219
|
}
|
|
1159
1220
|
|
|
1160
1221
|
var DATE_PICKER_STYLE = {
|
|
1161
|
-
width:
|
|
1222
|
+
width: '100%'
|
|
1162
1223
|
};
|
|
1163
1224
|
/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms
|
|
1164
1225
|
* the value to undefined when it is falsy during the `onChange` handling.
|
|
@@ -1178,7 +1239,7 @@ function DateWidget(props) {
|
|
|
1178
1239
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1179
1240
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1180
1241
|
var handleChange = function handleChange(nextValue) {
|
|
1181
|
-
return onChange(nextValue && nextValue.format(
|
|
1242
|
+
return onChange(nextValue && nextValue.format('YYYY-MM-DD'));
|
|
1182
1243
|
};
|
|
1183
1244
|
var handleBlur = function handleBlur() {
|
|
1184
1245
|
return onBlur(id, value);
|
|
@@ -1189,7 +1250,7 @@ function DateWidget(props) {
|
|
|
1189
1250
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1190
1251
|
return node.parentNode;
|
|
1191
1252
|
};
|
|
1192
|
-
return
|
|
1253
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1193
1254
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1194
1255
|
getPopupContainer: getPopupContainer,
|
|
1195
1256
|
id: id,
|
|
@@ -1222,10 +1283,10 @@ function PasswordWidget(props) {
|
|
|
1222
1283
|
value = props.value;
|
|
1223
1284
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1224
1285
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1225
|
-
var emptyValue = options.emptyValue ||
|
|
1286
|
+
var emptyValue = options.emptyValue || '';
|
|
1226
1287
|
var handleChange = function handleChange(_ref) {
|
|
1227
1288
|
var target = _ref.target;
|
|
1228
|
-
return onChange(target.value ===
|
|
1289
|
+
return onChange(target.value === '' ? emptyValue : target.value);
|
|
1229
1290
|
};
|
|
1230
1291
|
var handleBlur = function handleBlur(_ref2) {
|
|
1231
1292
|
var target = _ref2.target;
|
|
@@ -1235,7 +1296,7 @@ function PasswordWidget(props) {
|
|
|
1235
1296
|
var target = _ref3.target;
|
|
1236
1297
|
return onFocus(id, target.value);
|
|
1237
1298
|
};
|
|
1238
|
-
return
|
|
1299
|
+
return jsxRuntime.jsx(Input__default["default"].Password, {
|
|
1239
1300
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1240
1301
|
id: id,
|
|
1241
1302
|
name: id,
|
|
@@ -1243,7 +1304,7 @@ function PasswordWidget(props) {
|
|
|
1243
1304
|
onChange: !readonly ? handleChange : undefined,
|
|
1244
1305
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1245
1306
|
placeholder: placeholder,
|
|
1246
|
-
value: value ||
|
|
1307
|
+
value: value || '',
|
|
1247
1308
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1248
1309
|
});
|
|
1249
1310
|
}
|
|
@@ -1282,7 +1343,7 @@ function RadioWidget(_ref) {
|
|
|
1282
1343
|
return onFocus(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1283
1344
|
};
|
|
1284
1345
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
1285
|
-
return
|
|
1346
|
+
return jsxRuntime.jsx(Radio__default["default"].Group, {
|
|
1286
1347
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1287
1348
|
id: id,
|
|
1288
1349
|
name: id,
|
|
@@ -1290,17 +1351,18 @@ function RadioWidget(_ref) {
|
|
|
1290
1351
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1291
1352
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1292
1353
|
value: selectedIndexes,
|
|
1293
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
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
|
+
});
|
|
1304
1366
|
}
|
|
1305
1367
|
|
|
1306
1368
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -1327,9 +1389,9 @@ function RangeWidget(props) {
|
|
|
1327
1389
|
min = _rangeSpec.min,
|
|
1328
1390
|
max = _rangeSpec.max,
|
|
1329
1391
|
step = _rangeSpec.step;
|
|
1330
|
-
var emptyValue = options.emptyValue ||
|
|
1392
|
+
var emptyValue = options.emptyValue || '';
|
|
1331
1393
|
var handleChange = function handleChange(nextValue) {
|
|
1332
|
-
return onChange(nextValue ===
|
|
1394
|
+
return onChange(nextValue === '' ? emptyValue : nextValue);
|
|
1333
1395
|
};
|
|
1334
1396
|
var handleBlur = function handleBlur() {
|
|
1335
1397
|
return onBlur(id, value);
|
|
@@ -1344,7 +1406,7 @@ function RangeWidget(props) {
|
|
|
1344
1406
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1345
1407
|
onFocus: !readonly ? handleFocus : undefined
|
|
1346
1408
|
};
|
|
1347
|
-
return
|
|
1409
|
+
return jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
1348
1410
|
autoFocus: autofocus,
|
|
1349
1411
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1350
1412
|
id: id,
|
|
@@ -1360,7 +1422,7 @@ function RangeWidget(props) {
|
|
|
1360
1422
|
}
|
|
1361
1423
|
|
|
1362
1424
|
var SELECT_STYLE = {
|
|
1363
|
-
width:
|
|
1425
|
+
width: '100%'
|
|
1364
1426
|
};
|
|
1365
1427
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
1366
1428
|
* It is typically used with string properties constrained with enum options.
|
|
@@ -1411,12 +1473,12 @@ function SelectWidget(_ref) {
|
|
|
1411
1473
|
var extraProps = {
|
|
1412
1474
|
name: id
|
|
1413
1475
|
};
|
|
1414
|
-
return
|
|
1476
|
+
return jsxRuntime.jsx(Select__default["default"], _extends({
|
|
1415
1477
|
autoFocus: autofocus,
|
|
1416
1478
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1417
1479
|
getPopupContainer: getPopupContainer,
|
|
1418
1480
|
id: id,
|
|
1419
|
-
mode: typeof multiple !==
|
|
1481
|
+
mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
|
|
1420
1482
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1421
1483
|
onChange: !readonly ? handleChange : undefined,
|
|
1422
1484
|
onFocus: !readonly ? handleFocus : undefined,
|
|
@@ -1425,20 +1487,21 @@ function SelectWidget(_ref) {
|
|
|
1425
1487
|
value: selectedIndexes
|
|
1426
1488
|
}, extraProps, {
|
|
1427
1489
|
filterOption: filterOption,
|
|
1428
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
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
|
+
})
|
|
1437
1500
|
}));
|
|
1438
1501
|
}
|
|
1439
1502
|
|
|
1440
1503
|
var INPUT_STYLE = {
|
|
1441
|
-
width:
|
|
1504
|
+
width: '100%'
|
|
1442
1505
|
};
|
|
1443
1506
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
1444
1507
|
*
|
|
@@ -1459,7 +1522,7 @@ function TextareaWidget(_ref) {
|
|
|
1459
1522
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1460
1523
|
var handleChange = function handleChange(_ref2) {
|
|
1461
1524
|
var target = _ref2.target;
|
|
1462
|
-
return onChange(target.value ===
|
|
1525
|
+
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
1463
1526
|
};
|
|
1464
1527
|
var handleBlur = function handleBlur(_ref3) {
|
|
1465
1528
|
var target = _ref3.target;
|
|
@@ -1472,9 +1535,9 @@ function TextareaWidget(_ref) {
|
|
|
1472
1535
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1473
1536
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1474
1537
|
var extraProps = {
|
|
1475
|
-
type:
|
|
1538
|
+
type: 'textarea'
|
|
1476
1539
|
};
|
|
1477
|
-
return
|
|
1540
|
+
return jsxRuntime.jsx(Input__default["default"].TextArea, _extends({
|
|
1478
1541
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1479
1542
|
id: id,
|
|
1480
1543
|
name: id,
|