@rjsf/antd 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +183 -183
- package/dist/antd.cjs.development.js +456 -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 +453 -380
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +457 -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 +18 -14
|
@@ -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');
|
|
@@ -18,12 +18,14 @@ var Space = require('antd/lib/space');
|
|
|
18
18
|
var ExclamationCircleOutlined = require('@ant-design/icons/ExclamationCircleOutlined');
|
|
19
19
|
var ArrowDownOutlined = require('@ant-design/icons/ArrowDownOutlined');
|
|
20
20
|
var ArrowUpOutlined = require('@ant-design/icons/ArrowUpOutlined');
|
|
21
|
+
var CopyOutlined = require('@ant-design/icons/CopyOutlined');
|
|
21
22
|
var DeleteOutlined = require('@ant-design/icons/DeleteOutlined');
|
|
22
23
|
var PlusCircleOutlined = require('@ant-design/icons/PlusCircleOutlined');
|
|
23
24
|
var Form$1 = require('antd/lib/form');
|
|
24
25
|
var isObject = require('lodash/isObject');
|
|
25
26
|
var isNumber = require('lodash/isNumber');
|
|
26
27
|
var isString = require('lodash/isString');
|
|
28
|
+
var react = require('react');
|
|
27
29
|
var Checkbox = require('antd/lib/checkbox');
|
|
28
30
|
var dayjs = require('dayjs');
|
|
29
31
|
var dayjsGenerateConfig = require('rc-picker/lib/generate/dayjs');
|
|
@@ -34,7 +36,6 @@ var Select = require('antd/lib/select');
|
|
|
34
36
|
|
|
35
37
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
36
38
|
|
|
37
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
38
39
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
39
40
|
var Col__default = /*#__PURE__*/_interopDefaultLegacy(Col);
|
|
40
41
|
var Row__default = /*#__PURE__*/_interopDefaultLegacy(Row);
|
|
@@ -47,6 +48,7 @@ var Space__default = /*#__PURE__*/_interopDefaultLegacy(Space);
|
|
|
47
48
|
var ExclamationCircleOutlined__default = /*#__PURE__*/_interopDefaultLegacy(ExclamationCircleOutlined);
|
|
48
49
|
var ArrowDownOutlined__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDownOutlined);
|
|
49
50
|
var ArrowUpOutlined__default = /*#__PURE__*/_interopDefaultLegacy(ArrowUpOutlined);
|
|
51
|
+
var CopyOutlined__default = /*#__PURE__*/_interopDefaultLegacy(CopyOutlined);
|
|
50
52
|
var DeleteOutlined__default = /*#__PURE__*/_interopDefaultLegacy(DeleteOutlined);
|
|
51
53
|
var PlusCircleOutlined__default = /*#__PURE__*/_interopDefaultLegacy(PlusCircleOutlined);
|
|
52
54
|
var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form$1);
|
|
@@ -62,10 +64,10 @@ var Slider__default = /*#__PURE__*/_interopDefaultLegacy(Slider);
|
|
|
62
64
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
63
65
|
|
|
64
66
|
var BTN_GRP_STYLE = {
|
|
65
|
-
width:
|
|
67
|
+
width: '100%'
|
|
66
68
|
};
|
|
67
69
|
var BTN_STYLE = {
|
|
68
|
-
width:
|
|
70
|
+
width: 'calc(100% / 4)'
|
|
69
71
|
};
|
|
70
72
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
71
73
|
*
|
|
@@ -74,17 +76,20 @@ var BTN_STYLE = {
|
|
|
74
76
|
function ArrayFieldItemTemplate(props) {
|
|
75
77
|
var children = props.children,
|
|
76
78
|
disabled = props.disabled,
|
|
79
|
+
hasCopy = props.hasCopy,
|
|
77
80
|
hasMoveDown = props.hasMoveDown,
|
|
78
81
|
hasMoveUp = props.hasMoveUp,
|
|
79
82
|
hasRemove = props.hasRemove,
|
|
80
83
|
hasToolbar = props.hasToolbar,
|
|
81
84
|
index = props.index,
|
|
85
|
+
onCopyIndexClick = props.onCopyIndexClick,
|
|
82
86
|
onDropIndexClick = props.onDropIndexClick,
|
|
83
87
|
onReorderClick = props.onReorderClick,
|
|
84
88
|
readonly = props.readonly,
|
|
85
89
|
registry = props.registry,
|
|
86
90
|
uiSchema = props.uiSchema;
|
|
87
91
|
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
92
|
+
CopyButton = _registry$templates$B.CopyButton,
|
|
88
93
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
89
94
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
90
95
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
@@ -92,36 +97,45 @@ function ArrayFieldItemTemplate(props) {
|
|
|
92
97
|
_registry$formContext2 = _registry$formContext.rowGutter,
|
|
93
98
|
rowGutter = _registry$formContext2 === void 0 ? 24 : _registry$formContext2,
|
|
94
99
|
_registry$formContext3 = _registry$formContext.toolbarAlign,
|
|
95
|
-
toolbarAlign = _registry$formContext3 === void 0 ?
|
|
96
|
-
return
|
|
100
|
+
toolbarAlign = _registry$formContext3 === void 0 ? 'top' : _registry$formContext3;
|
|
101
|
+
return jsxRuntime.jsxs(Row__default["default"], {
|
|
97
102
|
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
|
-
|
|
103
|
+
gutter: rowGutter,
|
|
104
|
+
children: [jsxRuntime.jsx(Col__default["default"], {
|
|
105
|
+
flex: '1',
|
|
106
|
+
children: children
|
|
107
|
+
}), hasToolbar && jsxRuntime.jsx(Col__default["default"], {
|
|
108
|
+
flex: '192px',
|
|
109
|
+
children: jsxRuntime.jsxs(Button__default["default"].Group, {
|
|
110
|
+
style: BTN_GRP_STYLE,
|
|
111
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
112
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
113
|
+
onClick: onReorderClick(index, index - 1),
|
|
114
|
+
style: BTN_STYLE,
|
|
115
|
+
uiSchema: uiSchema,
|
|
116
|
+
registry: registry
|
|
117
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
118
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
119
|
+
onClick: onReorderClick(index, index + 1),
|
|
120
|
+
style: BTN_STYLE,
|
|
121
|
+
uiSchema: uiSchema,
|
|
122
|
+
registry: registry
|
|
123
|
+
}), hasCopy && jsxRuntime.jsx(CopyButton, {
|
|
124
|
+
disabled: disabled || readonly,
|
|
125
|
+
onClick: onCopyIndexClick(index),
|
|
126
|
+
style: BTN_STYLE,
|
|
127
|
+
uiSchema: uiSchema,
|
|
128
|
+
registry: registry
|
|
129
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
130
|
+
disabled: disabled || readonly,
|
|
131
|
+
onClick: onDropIndexClick(index),
|
|
132
|
+
style: BTN_STYLE,
|
|
133
|
+
uiSchema: uiSchema,
|
|
134
|
+
registry: registry
|
|
135
|
+
})]
|
|
136
|
+
})
|
|
137
|
+
})]
|
|
138
|
+
}, "array-item-" + index);
|
|
125
139
|
}
|
|
126
140
|
|
|
127
141
|
function _extends() {
|
|
@@ -153,7 +167,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
153
167
|
|
|
154
168
|
var _excluded$1 = ["key"];
|
|
155
169
|
var DESCRIPTION_COL_STYLE$1 = {
|
|
156
|
-
paddingBottom:
|
|
170
|
+
paddingBottom: '8px'
|
|
157
171
|
};
|
|
158
172
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
159
173
|
*
|
|
@@ -174,75 +188,83 @@ function ArrayFieldTemplate(props) {
|
|
|
174
188
|
title = props.title,
|
|
175
189
|
uiSchema = props.uiSchema;
|
|
176
190
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
177
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
178
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
179
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
191
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
192
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
193
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
180
194
|
// Button templates are not overridden in the uiSchema
|
|
181
195
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
182
196
|
var _formContext$labelAli = formContext.labelAlign,
|
|
183
|
-
labelAlign = _formContext$labelAli === void 0 ?
|
|
197
|
+
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
184
198
|
_formContext$rowGutte = formContext.rowGutter,
|
|
185
199
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
186
|
-
return
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
200
|
+
return jsxRuntime.jsx(context.ConfigConsumer, {
|
|
201
|
+
children: function children(configProps) {
|
|
202
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
203
|
+
var prefixCls = getPrefixCls('form');
|
|
204
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
205
|
+
var labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left"
|
|
206
|
+
// labelCol.className,
|
|
207
|
+
);
|
|
193
208
|
|
|
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
|
-
|
|
209
|
+
return jsxRuntime.jsx("fieldset", {
|
|
210
|
+
className: className,
|
|
211
|
+
id: idSchema.$id,
|
|
212
|
+
children: jsxRuntime.jsxs(Row__default["default"], {
|
|
213
|
+
gutter: rowGutter,
|
|
214
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(Col__default["default"], {
|
|
215
|
+
className: labelColClassName,
|
|
216
|
+
span: 24,
|
|
217
|
+
children: jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
218
|
+
idSchema: idSchema,
|
|
219
|
+
required: required,
|
|
220
|
+
title: uiOptions.title || title,
|
|
221
|
+
schema: schema,
|
|
222
|
+
uiSchema: uiSchema,
|
|
223
|
+
registry: registry
|
|
224
|
+
})
|
|
225
|
+
}), (uiOptions.description || schema.description) && jsxRuntime.jsx(Col__default["default"], {
|
|
226
|
+
span: 24,
|
|
227
|
+
style: DESCRIPTION_COL_STYLE$1,
|
|
228
|
+
children: jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
229
|
+
description: uiOptions.description || schema.description || '',
|
|
230
|
+
idSchema: idSchema,
|
|
231
|
+
schema: schema,
|
|
232
|
+
uiSchema: uiSchema,
|
|
233
|
+
registry: registry
|
|
234
|
+
})
|
|
235
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
236
|
+
className: 'row array-item-list',
|
|
237
|
+
span: 24,
|
|
238
|
+
children: items && items.map(function (_ref) {
|
|
239
|
+
var key = _ref.key,
|
|
240
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
241
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
242
|
+
})
|
|
243
|
+
}), canAdd && jsxRuntime.jsx(Col__default["default"], {
|
|
244
|
+
span: 24,
|
|
245
|
+
children: jsxRuntime.jsx(Row__default["default"], {
|
|
246
|
+
gutter: rowGutter,
|
|
247
|
+
justify: 'end',
|
|
248
|
+
children: jsxRuntime.jsx(Col__default["default"], {
|
|
249
|
+
flex: '192px',
|
|
250
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
251
|
+
className: 'array-item-add',
|
|
252
|
+
disabled: disabled || readonly,
|
|
253
|
+
onClick: onAddClick,
|
|
254
|
+
uiSchema: uiSchema,
|
|
255
|
+
registry: registry
|
|
256
|
+
})
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
})]
|
|
260
|
+
})
|
|
261
|
+
});
|
|
262
|
+
}
|
|
241
263
|
});
|
|
242
264
|
}
|
|
243
265
|
|
|
244
266
|
var INPUT_STYLE$2 = {
|
|
245
|
-
width:
|
|
267
|
+
width: '100%'
|
|
246
268
|
};
|
|
247
269
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
248
270
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
@@ -256,6 +278,7 @@ function BaseInputTemplate(props) {
|
|
|
256
278
|
id = props.id,
|
|
257
279
|
onBlur = props.onBlur,
|
|
258
280
|
onChange = props.onChange,
|
|
281
|
+
onChangeOverride = props.onChangeOverride,
|
|
259
282
|
onFocus = props.onFocus,
|
|
260
283
|
options = props.options,
|
|
261
284
|
placeholder = props.placeholder,
|
|
@@ -269,9 +292,9 @@ function BaseInputTemplate(props) {
|
|
|
269
292
|
var handleNumberChange = function handleNumberChange(nextValue) {
|
|
270
293
|
return onChange(nextValue);
|
|
271
294
|
};
|
|
272
|
-
var handleTextChange = function
|
|
295
|
+
var handleTextChange = onChangeOverride ? onChangeOverride : function (_ref) {
|
|
273
296
|
var target = _ref.target;
|
|
274
|
-
return onChange(target.value ===
|
|
297
|
+
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
275
298
|
};
|
|
276
299
|
var handleBlur = function handleBlur(_ref2) {
|
|
277
300
|
var target = _ref2.target;
|
|
@@ -281,7 +304,7 @@ function BaseInputTemplate(props) {
|
|
|
281
304
|
var target = _ref3.target;
|
|
282
305
|
return onFocus(id, target.value);
|
|
283
306
|
};
|
|
284
|
-
var input = inputProps.type ===
|
|
307
|
+
var input = inputProps.type === 'number' || inputProps.type === 'integer' ? jsxRuntime.jsx(InputNumber__default["default"], _extends({
|
|
285
308
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
286
309
|
id: id,
|
|
287
310
|
name: id,
|
|
@@ -294,7 +317,7 @@ function BaseInputTemplate(props) {
|
|
|
294
317
|
}, inputProps, {
|
|
295
318
|
value: value,
|
|
296
319
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
297
|
-
})) :
|
|
320
|
+
})) : jsxRuntime.jsx(Input__default["default"], _extends({
|
|
298
321
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
299
322
|
id: id,
|
|
300
323
|
name: id,
|
|
@@ -308,14 +331,16 @@ function BaseInputTemplate(props) {
|
|
|
308
331
|
value: value,
|
|
309
332
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
310
333
|
}));
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
334
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
335
|
+
children: [input, Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
336
|
+
id: utils.examplesId(id),
|
|
337
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
338
|
+
return jsxRuntime.jsx("option", {
|
|
339
|
+
value: example
|
|
340
|
+
}, example);
|
|
341
|
+
})
|
|
342
|
+
})]
|
|
343
|
+
});
|
|
319
344
|
}
|
|
320
345
|
|
|
321
346
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -328,9 +353,10 @@ function DescriptionField(props) {
|
|
|
328
353
|
if (!description) {
|
|
329
354
|
return null;
|
|
330
355
|
}
|
|
331
|
-
return
|
|
332
|
-
id: id
|
|
333
|
-
|
|
356
|
+
return jsxRuntime.jsx("span", {
|
|
357
|
+
id: id,
|
|
358
|
+
children: description
|
|
359
|
+
});
|
|
334
360
|
}
|
|
335
361
|
|
|
336
362
|
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
@@ -342,71 +368,82 @@ function ErrorList(_ref) {
|
|
|
342
368
|
registry = _ref.registry;
|
|
343
369
|
var translateString = registry.translateString;
|
|
344
370
|
var renderErrors = function renderErrors() {
|
|
345
|
-
return
|
|
346
|
-
className:
|
|
347
|
-
size:
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
371
|
+
return jsxRuntime.jsx(List__default["default"], {
|
|
372
|
+
className: 'list-group',
|
|
373
|
+
size: 'small',
|
|
374
|
+
children: errors.map(function (error, index) {
|
|
375
|
+
return jsxRuntime.jsx(List__default["default"].Item, {
|
|
376
|
+
children: jsxRuntime.jsxs(Space__default["default"], {
|
|
377
|
+
children: [jsxRuntime.jsx(ExclamationCircleOutlined__default["default"], {}), error.stack]
|
|
378
|
+
})
|
|
379
|
+
}, index);
|
|
380
|
+
})
|
|
381
|
+
});
|
|
353
382
|
};
|
|
354
|
-
return
|
|
355
|
-
className:
|
|
383
|
+
return jsxRuntime.jsx(Alert__default["default"], {
|
|
384
|
+
className: 'panel panel-danger errors',
|
|
356
385
|
description: renderErrors(),
|
|
357
386
|
message: translateString(utils.TranslatableString.ErrorsLabel),
|
|
358
|
-
type:
|
|
387
|
+
type: 'error'
|
|
359
388
|
});
|
|
360
389
|
}
|
|
361
390
|
|
|
362
391
|
var _excluded = ["iconType", "icon", "uiSchema", "registry"];
|
|
363
392
|
function IconButton(props) {
|
|
364
393
|
var _props$iconType = props.iconType,
|
|
365
|
-
iconType = _props$iconType === void 0 ?
|
|
394
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
366
395
|
icon = props.icon,
|
|
367
396
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
368
|
-
return
|
|
397
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
369
398
|
type: iconType,
|
|
370
399
|
icon: icon
|
|
371
400
|
}, otherProps));
|
|
372
401
|
}
|
|
373
402
|
function AddButton(props) {
|
|
374
403
|
var translateString = props.registry.translateString;
|
|
375
|
-
return
|
|
404
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
376
405
|
title: translateString(utils.TranslatableString.AddItemButton)
|
|
377
406
|
}, props, {
|
|
378
407
|
block: true,
|
|
379
|
-
iconType:
|
|
380
|
-
icon:
|
|
408
|
+
iconType: 'primary',
|
|
409
|
+
icon: jsxRuntime.jsx(PlusCircleOutlined__default["default"], {})
|
|
410
|
+
}));
|
|
411
|
+
}
|
|
412
|
+
function CopyButton(props) {
|
|
413
|
+
var translateString = props.registry.translateString;
|
|
414
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
415
|
+
title: translateString(utils.TranslatableString.CopyButton)
|
|
416
|
+
}, props, {
|
|
417
|
+
icon: jsxRuntime.jsx(CopyOutlined__default["default"], {})
|
|
381
418
|
}));
|
|
382
419
|
}
|
|
383
420
|
function MoveDownButton(props) {
|
|
384
421
|
var translateString = props.registry.translateString;
|
|
385
|
-
return
|
|
422
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
386
423
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
387
424
|
}, props, {
|
|
388
|
-
icon:
|
|
425
|
+
icon: jsxRuntime.jsx(ArrowDownOutlined__default["default"], {})
|
|
389
426
|
}));
|
|
390
427
|
}
|
|
391
428
|
function MoveUpButton(props) {
|
|
392
429
|
var translateString = props.registry.translateString;
|
|
393
|
-
return
|
|
430
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
394
431
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
395
432
|
}, props, {
|
|
396
|
-
icon:
|
|
433
|
+
icon: jsxRuntime.jsx(ArrowUpOutlined__default["default"], {})
|
|
397
434
|
}));
|
|
398
435
|
}
|
|
399
436
|
function RemoveButton(props) {
|
|
400
437
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
|
|
401
438
|
var options = utils.getUiOptions(props.uiSchema);
|
|
402
439
|
var translateString = props.registry.translateString;
|
|
403
|
-
return
|
|
440
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
404
441
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
405
442
|
}, props, {
|
|
406
443
|
danger: true,
|
|
407
444
|
block: !!options.block,
|
|
408
|
-
iconType:
|
|
409
|
-
icon:
|
|
445
|
+
iconType: 'primary',
|
|
446
|
+
icon: jsxRuntime.jsx(DeleteOutlined__default["default"], {})
|
|
410
447
|
}));
|
|
411
448
|
}
|
|
412
449
|
|
|
@@ -422,13 +459,14 @@ function FieldErrorTemplate(props) {
|
|
|
422
459
|
return null;
|
|
423
460
|
}
|
|
424
461
|
var id = utils.errorId(idSchema);
|
|
425
|
-
return
|
|
426
|
-
id: id
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
462
|
+
return jsxRuntime.jsx("div", {
|
|
463
|
+
id: id,
|
|
464
|
+
children: errors.map(function (error) {
|
|
465
|
+
return jsxRuntime.jsx("div", {
|
|
466
|
+
children: error
|
|
467
|
+
}, "field-" + id + "-error-" + error);
|
|
468
|
+
})
|
|
469
|
+
});
|
|
432
470
|
}
|
|
433
471
|
|
|
434
472
|
var VERTICAL_LABEL_COL$1 = {
|
|
@@ -472,13 +510,14 @@ function FieldTemplate(props) {
|
|
|
472
510
|
wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
|
|
473
511
|
wrapperStyle = formContext.wrapperStyle;
|
|
474
512
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
475
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
513
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
476
514
|
if (hidden) {
|
|
477
|
-
return
|
|
478
|
-
className:
|
|
479
|
-
|
|
515
|
+
return jsxRuntime.jsx("div", {
|
|
516
|
+
className: 'field-hidden',
|
|
517
|
+
children: children
|
|
518
|
+
});
|
|
480
519
|
}
|
|
481
|
-
return
|
|
520
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
482
521
|
classNames: classNames,
|
|
483
522
|
style: style,
|
|
484
523
|
disabled: disabled,
|
|
@@ -490,24 +529,26 @@ function FieldTemplate(props) {
|
|
|
490
529
|
required: required,
|
|
491
530
|
schema: schema,
|
|
492
531
|
uiSchema: uiSchema,
|
|
493
|
-
registry: registry
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
532
|
+
registry: registry,
|
|
533
|
+
children: id === 'root' ? children : jsxRuntime.jsx(Form__default["default"].Item, {
|
|
534
|
+
colon: colon,
|
|
535
|
+
extra: rawDescription && description,
|
|
536
|
+
hasFeedback: schema.type !== 'array' && schema.type !== 'object',
|
|
537
|
+
help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
|
|
538
|
+
htmlFor: id,
|
|
539
|
+
label: displayLabel && label,
|
|
540
|
+
labelCol: labelCol,
|
|
541
|
+
required: required,
|
|
542
|
+
style: wrapperStyle,
|
|
543
|
+
validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? 'error' : undefined,
|
|
544
|
+
wrapperCol: wrapperCol,
|
|
545
|
+
children: children
|
|
546
|
+
})
|
|
547
|
+
});
|
|
507
548
|
}
|
|
508
549
|
|
|
509
550
|
var DESCRIPTION_COL_STYLE = {
|
|
510
|
-
paddingBottom:
|
|
551
|
+
paddingBottom: '8px'
|
|
511
552
|
};
|
|
512
553
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
513
554
|
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
@@ -530,14 +571,14 @@ function ObjectFieldTemplate(props) {
|
|
|
530
571
|
title = props.title,
|
|
531
572
|
uiSchema = props.uiSchema;
|
|
532
573
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
533
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
534
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
574
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
575
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
535
576
|
// Button templates are not overridden in the uiSchema
|
|
536
577
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
537
578
|
var _formContext$colSpan = formContext.colSpan,
|
|
538
579
|
colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
|
|
539
580
|
_formContext$labelAli = formContext.labelAlign,
|
|
540
|
-
labelAlign = _formContext$labelAli === void 0 ?
|
|
581
|
+
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
541
582
|
_formContext$rowGutte = formContext.rowGutter,
|
|
542
583
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
543
584
|
var findSchema = function findSchema(element) {
|
|
@@ -561,7 +602,7 @@ function ObjectFieldTemplate(props) {
|
|
|
561
602
|
var widget = findUiSchemaWidget(element);
|
|
562
603
|
var defaultColSpan = properties.length < 2 ||
|
|
563
604
|
// Single or no field in object.
|
|
564
|
-
type ===
|
|
605
|
+
type === 'object' || type === 'array' || widget === 'textarea' ? 24 : 12;
|
|
565
606
|
if (isObject__default["default"](colSpan)) {
|
|
566
607
|
var colSpanObj = colSpan;
|
|
567
608
|
if (isString__default["default"](widget)) {
|
|
@@ -579,58 +620,67 @@ function ObjectFieldTemplate(props) {
|
|
|
579
620
|
}
|
|
580
621
|
return defaultColSpan;
|
|
581
622
|
};
|
|
582
|
-
return
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
623
|
+
return jsxRuntime.jsx(context.ConfigConsumer, {
|
|
624
|
+
children: function children(configProps) {
|
|
625
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
626
|
+
var prefixCls = getPrefixCls('form');
|
|
627
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
628
|
+
var labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left"
|
|
629
|
+
// labelCol.className,
|
|
630
|
+
);
|
|
589
631
|
|
|
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
|
-
|
|
632
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
633
|
+
id: idSchema.$id,
|
|
634
|
+
children: [jsxRuntime.jsxs(Row__default["default"], {
|
|
635
|
+
gutter: rowGutter,
|
|
636
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(Col__default["default"], {
|
|
637
|
+
className: labelColClassName,
|
|
638
|
+
span: 24,
|
|
639
|
+
children: jsxRuntime.jsx(TitleFieldTemplate, {
|
|
640
|
+
id: utils.titleId(idSchema),
|
|
641
|
+
title: uiOptions.title || title,
|
|
642
|
+
required: required,
|
|
643
|
+
schema: schema,
|
|
644
|
+
uiSchema: uiSchema,
|
|
645
|
+
registry: registry
|
|
646
|
+
})
|
|
647
|
+
}), (uiOptions.description || description) && jsxRuntime.jsx(Col__default["default"], {
|
|
648
|
+
span: 24,
|
|
649
|
+
style: DESCRIPTION_COL_STYLE,
|
|
650
|
+
children: jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
651
|
+
id: utils.descriptionId(idSchema),
|
|
652
|
+
description: uiOptions.description || description,
|
|
653
|
+
schema: schema,
|
|
654
|
+
uiSchema: uiSchema,
|
|
655
|
+
registry: registry
|
|
656
|
+
})
|
|
657
|
+
}), properties.filter(function (e) {
|
|
658
|
+
return !e.hidden;
|
|
659
|
+
}).map(function (element) {
|
|
660
|
+
return jsxRuntime.jsx(Col__default["default"], {
|
|
661
|
+
span: calculateColSpan(element),
|
|
662
|
+
children: element.content
|
|
663
|
+
}, element.name);
|
|
664
|
+
})]
|
|
665
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(Col__default["default"], {
|
|
666
|
+
span: 24,
|
|
667
|
+
children: jsxRuntime.jsx(Row__default["default"], {
|
|
668
|
+
gutter: rowGutter,
|
|
669
|
+
justify: 'end',
|
|
670
|
+
children: jsxRuntime.jsx(Col__default["default"], {
|
|
671
|
+
flex: '192px',
|
|
672
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
673
|
+
className: 'object-property-expand',
|
|
674
|
+
disabled: disabled || readonly,
|
|
675
|
+
onClick: onAddClick(schema),
|
|
676
|
+
uiSchema: uiSchema,
|
|
677
|
+
registry: registry
|
|
678
|
+
})
|
|
679
|
+
})
|
|
680
|
+
})
|
|
681
|
+
})]
|
|
682
|
+
});
|
|
683
|
+
}
|
|
634
684
|
});
|
|
635
685
|
}
|
|
636
686
|
|
|
@@ -645,11 +695,12 @@ function SubmitButton(_ref) {
|
|
|
645
695
|
if (norender) {
|
|
646
696
|
return null;
|
|
647
697
|
}
|
|
648
|
-
return
|
|
649
|
-
type:
|
|
698
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
699
|
+
type: 'submit'
|
|
650
700
|
}, submitButtonProps, {
|
|
651
|
-
htmlType:
|
|
652
|
-
|
|
701
|
+
htmlType: 'submit',
|
|
702
|
+
children: submitText
|
|
703
|
+
}));
|
|
653
704
|
}
|
|
654
705
|
|
|
655
706
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -665,8 +716,8 @@ function TitleField(_ref) {
|
|
|
665
716
|
var _formContext$colon = formContext.colon,
|
|
666
717
|
colon = _formContext$colon === void 0 ? true : _formContext$colon;
|
|
667
718
|
var labelChildren = title;
|
|
668
|
-
if (colon && typeof title ===
|
|
669
|
-
labelChildren = title.replace(/[::]\s*$/,
|
|
719
|
+
if (colon && typeof title === 'string' && title.trim() !== '') {
|
|
720
|
+
labelChildren = title.replace(/[::]\s*$/, '');
|
|
670
721
|
}
|
|
671
722
|
var handleLabelClick = function handleLabelClick() {
|
|
672
723
|
if (!id) {
|
|
@@ -677,17 +728,20 @@ function TitleField(_ref) {
|
|
|
677
728
|
control.focus();
|
|
678
729
|
}
|
|
679
730
|
};
|
|
680
|
-
return title ?
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
731
|
+
return title ? jsxRuntime.jsx(context.ConfigConsumer, {
|
|
732
|
+
children: function children(configProps) {
|
|
733
|
+
var _classNames;
|
|
734
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
735
|
+
var prefixCls = getPrefixCls('form');
|
|
736
|
+
var labelClassName = classNames__default["default"]((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
|
|
737
|
+
return jsxRuntime.jsx("label", {
|
|
738
|
+
className: labelClassName,
|
|
739
|
+
htmlFor: id,
|
|
740
|
+
onClick: handleLabelClick,
|
|
741
|
+
title: typeof title === 'string' ? title : '',
|
|
742
|
+
children: labelChildren
|
|
743
|
+
});
|
|
744
|
+
}
|
|
691
745
|
}) : null;
|
|
692
746
|
}
|
|
693
747
|
|
|
@@ -698,7 +752,7 @@ var VERTICAL_WRAPPER_COL = {
|
|
|
698
752
|
span: 24
|
|
699
753
|
};
|
|
700
754
|
var INPUT_STYLE$1 = {
|
|
701
|
-
width:
|
|
755
|
+
width: '100%'
|
|
702
756
|
};
|
|
703
757
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
704
758
|
* part of an `additionalProperties` part of a schema.
|
|
@@ -729,7 +783,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
729
783
|
_registry$formContext4 = _registry$formContext.rowGutter,
|
|
730
784
|
rowGutter = _registry$formContext4 === void 0 ? 24 : _registry$formContext4,
|
|
731
785
|
_registry$formContext5 = _registry$formContext.toolbarAlign,
|
|
732
|
-
toolbarAlign = _registry$formContext5 === void 0 ?
|
|
786
|
+
toolbarAlign = _registry$formContext5 === void 0 ? 'top' : _registry$formContext5,
|
|
733
787
|
_registry$formContext6 = _registry$formContext.wrapperCol,
|
|
734
788
|
wrapperCol = _registry$formContext6 === void 0 ? VERTICAL_WRAPPER_COL : _registry$formContext6,
|
|
735
789
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
@@ -740,10 +794,11 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
740
794
|
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
741
795
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
742
796
|
if (!additional) {
|
|
743
|
-
return
|
|
797
|
+
return jsxRuntime.jsx("div", {
|
|
744
798
|
className: classNames,
|
|
745
|
-
style: style
|
|
746
|
-
|
|
799
|
+
style: style,
|
|
800
|
+
children: children
|
|
801
|
+
});
|
|
747
802
|
}
|
|
748
803
|
var handleBlur = function handleBlur(_ref) {
|
|
749
804
|
var target = _ref.target;
|
|
@@ -754,48 +809,55 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
754
809
|
var buttonUiOptions = _extends({}, uiSchema, (_extends2 = {}, _extends2[utils.UI_OPTIONS_KEY] = _extends({}, uiOptions, {
|
|
755
810
|
block: true
|
|
756
811
|
}), _extends2));
|
|
757
|
-
return
|
|
812
|
+
return jsxRuntime.jsx("div", {
|
|
758
813
|
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
|
-
|
|
814
|
+
style: style,
|
|
815
|
+
children: jsxRuntime.jsxs(Row__default["default"], {
|
|
816
|
+
align: toolbarAlign,
|
|
817
|
+
gutter: rowGutter,
|
|
818
|
+
children: [jsxRuntime.jsx(Col__default["default"], {
|
|
819
|
+
className: 'form-additional',
|
|
820
|
+
flex: '1',
|
|
821
|
+
children: jsxRuntime.jsx("div", {
|
|
822
|
+
className: 'form-group',
|
|
823
|
+
children: jsxRuntime.jsx(Form__default["default"].Item, {
|
|
824
|
+
colon: colon,
|
|
825
|
+
className: 'form-group',
|
|
826
|
+
hasFeedback: true,
|
|
827
|
+
htmlFor: id + "-key",
|
|
828
|
+
label: keyLabel,
|
|
829
|
+
labelCol: labelCol,
|
|
830
|
+
required: required,
|
|
831
|
+
style: wrapperStyle,
|
|
832
|
+
wrapperCol: wrapperCol,
|
|
833
|
+
children: jsxRuntime.jsx(Input__default["default"], {
|
|
834
|
+
className: 'form-control',
|
|
835
|
+
defaultValue: label,
|
|
836
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
837
|
+
id: id + "-key",
|
|
838
|
+
name: id + "-key",
|
|
839
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
840
|
+
style: INPUT_STYLE$1,
|
|
841
|
+
type: 'text'
|
|
842
|
+
})
|
|
843
|
+
})
|
|
844
|
+
})
|
|
845
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
846
|
+
className: 'form-additional',
|
|
847
|
+
flex: '1',
|
|
848
|
+
children: children
|
|
849
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
850
|
+
flex: '192px',
|
|
851
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
852
|
+
className: 'array-item-remove',
|
|
853
|
+
disabled: disabled || readonly,
|
|
854
|
+
onClick: onDropPropertyClick(label),
|
|
855
|
+
uiSchema: buttonUiOptions,
|
|
856
|
+
registry: registry
|
|
857
|
+
})
|
|
858
|
+
})]
|
|
859
|
+
})
|
|
860
|
+
});
|
|
799
861
|
}
|
|
800
862
|
|
|
801
863
|
function generateTemplates() {
|
|
@@ -805,6 +867,7 @@ function generateTemplates() {
|
|
|
805
867
|
BaseInputTemplate: BaseInputTemplate,
|
|
806
868
|
ButtonTemplates: {
|
|
807
869
|
AddButton: AddButton,
|
|
870
|
+
CopyButton: CopyButton,
|
|
808
871
|
MoveDownButton: MoveDownButton,
|
|
809
872
|
MoveUpButton: MoveUpButton,
|
|
810
873
|
RemoveButton: RemoveButton,
|
|
@@ -847,29 +910,29 @@ function dateElementProps(state, time, yearsRange) {
|
|
|
847
910
|
minute = state.minute,
|
|
848
911
|
second = state.second;
|
|
849
912
|
var data = [{
|
|
850
|
-
type:
|
|
913
|
+
type: 'year',
|
|
851
914
|
range: yearsRange,
|
|
852
915
|
value: year
|
|
853
916
|
}, {
|
|
854
|
-
type:
|
|
917
|
+
type: 'month',
|
|
855
918
|
range: [1, 12],
|
|
856
919
|
value: month
|
|
857
920
|
}, {
|
|
858
|
-
type:
|
|
921
|
+
type: 'day',
|
|
859
922
|
range: [1, 31],
|
|
860
923
|
value: day
|
|
861
924
|
}];
|
|
862
925
|
if (time) {
|
|
863
926
|
data.push({
|
|
864
|
-
type:
|
|
927
|
+
type: 'hour',
|
|
865
928
|
range: [0, 23],
|
|
866
929
|
value: hour || -1
|
|
867
930
|
}, {
|
|
868
|
-
type:
|
|
931
|
+
type: 'minute',
|
|
869
932
|
range: [0, 59],
|
|
870
933
|
value: minute || -1
|
|
871
934
|
}, {
|
|
872
|
-
type:
|
|
935
|
+
type: 'second',
|
|
873
936
|
range: [0, 59],
|
|
874
937
|
value: second || -1
|
|
875
938
|
});
|
|
@@ -894,15 +957,15 @@ function AltDateWidget(props) {
|
|
|
894
957
|
var SelectWidget = widgets.SelectWidget;
|
|
895
958
|
var _formContext$rowGutte = formContext.rowGutter,
|
|
896
959
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
897
|
-
var _useState =
|
|
960
|
+
var _useState = react.useState(utils.parseDateString(value, showTime)),
|
|
898
961
|
state = _useState[0],
|
|
899
962
|
setState = _useState[1];
|
|
900
|
-
|
|
963
|
+
react.useEffect(function () {
|
|
901
964
|
setState(utils.parseDateString(value, showTime));
|
|
902
965
|
}, [showTime, value]);
|
|
903
966
|
var handleChange = function handleChange(property, nextValue) {
|
|
904
967
|
var _extends2;
|
|
905
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
968
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
906
969
|
if (readyForChange(nextState)) {
|
|
907
970
|
onChange(utils.toDateString(nextState, showTime));
|
|
908
971
|
} else {
|
|
@@ -925,9 +988,9 @@ function AltDateWidget(props) {
|
|
|
925
988
|
onChange(undefined);
|
|
926
989
|
};
|
|
927
990
|
var renderDateElement = function renderDateElement(elemProps) {
|
|
928
|
-
return
|
|
991
|
+
return jsxRuntime.jsx(SelectWidget, {
|
|
929
992
|
autofocus: elemProps.autofocus,
|
|
930
|
-
className:
|
|
993
|
+
className: 'form-control',
|
|
931
994
|
disabled: elemProps.disabled,
|
|
932
995
|
id: elemProps.id,
|
|
933
996
|
name: elemProps.name,
|
|
@@ -942,51 +1005,56 @@ function AltDateWidget(props) {
|
|
|
942
1005
|
placeholder: elemProps.type,
|
|
943
1006
|
readonly: elemProps.readonly,
|
|
944
1007
|
schema: {
|
|
945
|
-
type:
|
|
1008
|
+
type: 'integer'
|
|
946
1009
|
},
|
|
947
1010
|
value: elemProps.value,
|
|
948
1011
|
registry: registry,
|
|
949
|
-
label:
|
|
1012
|
+
label: '',
|
|
950
1013
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
951
1014
|
});
|
|
952
1015
|
};
|
|
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
|
-
|
|
1016
|
+
return jsxRuntime.jsxs(Row__default["default"], {
|
|
1017
|
+
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)],
|
|
1018
|
+
children: [dateElementProps(state, showTime, options.yearsRange).map(function (elemProps, i) {
|
|
1019
|
+
var elemId = id + '_' + elemProps.type;
|
|
1020
|
+
return jsxRuntime.jsx(Col__default["default"], {
|
|
1021
|
+
flex: '88px',
|
|
1022
|
+
children: renderDateElement(_extends({}, elemProps, {
|
|
1023
|
+
autofocus: autofocus && i === 0,
|
|
1024
|
+
disabled: disabled,
|
|
1025
|
+
id: elemId,
|
|
1026
|
+
name: id,
|
|
1027
|
+
onBlur: onBlur,
|
|
1028
|
+
onFocus: onFocus,
|
|
1029
|
+
readonly: readonly,
|
|
1030
|
+
registry: registry,
|
|
1031
|
+
select: handleChange,
|
|
1032
|
+
// NOTE: antd components accept -1 rather than issue a warning
|
|
1033
|
+
// like material-ui, so we need to convert -1 to undefined here.
|
|
1034
|
+
value: elemProps.value < 0 ? undefined : elemProps.value
|
|
1035
|
+
}))
|
|
1036
|
+
}, elemId);
|
|
1037
|
+
}), !options.hideNowButton && jsxRuntime.jsx(Col__default["default"], {
|
|
1038
|
+
flex: '88px',
|
|
1039
|
+
children: jsxRuntime.jsx(Button__default["default"], {
|
|
1040
|
+
block: true,
|
|
1041
|
+
className: 'btn-now',
|
|
1042
|
+
onClick: handleNow,
|
|
1043
|
+
type: 'primary',
|
|
1044
|
+
children: translateString(utils.TranslatableString.NowLabel)
|
|
1045
|
+
})
|
|
1046
|
+
}), !options.hideClearButton && jsxRuntime.jsx(Col__default["default"], {
|
|
1047
|
+
flex: '88px',
|
|
1048
|
+
children: jsxRuntime.jsx(Button__default["default"], {
|
|
1049
|
+
block: true,
|
|
1050
|
+
className: 'btn-clear',
|
|
1051
|
+
danger: true,
|
|
1052
|
+
onClick: handleClear,
|
|
1053
|
+
type: 'primary',
|
|
1054
|
+
children: translateString(utils.TranslatableString.ClearLabel)
|
|
1055
|
+
})
|
|
1056
|
+
})]
|
|
1057
|
+
});
|
|
990
1058
|
}
|
|
991
1059
|
AltDateWidget.defaultProps = {
|
|
992
1060
|
autofocus: false,
|
|
@@ -1000,7 +1068,7 @@ AltDateWidget.defaultProps = {
|
|
|
1000
1068
|
|
|
1001
1069
|
function AltDateTimeWidget(props) {
|
|
1002
1070
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
1003
|
-
return
|
|
1071
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({
|
|
1004
1072
|
showTime: true
|
|
1005
1073
|
}, props));
|
|
1006
1074
|
}
|
|
@@ -1049,23 +1117,25 @@ function CheckboxesWidget(_ref) {
|
|
|
1049
1117
|
onFocus: !readonly ? handleFocus : undefined
|
|
1050
1118
|
};
|
|
1051
1119
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
1052
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ?
|
|
1120
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? jsxRuntime.jsx(Checkbox__default["default"].Group, _extends({
|
|
1053
1121
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1054
1122
|
name: id,
|
|
1055
1123
|
onChange: !readonly ? handleChange : undefined,
|
|
1056
1124
|
value: selectedIndexes
|
|
1057
1125
|
}, extraProps, {
|
|
1058
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1126
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1127
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
1128
|
+
return jsxRuntime.jsxs("span", {
|
|
1129
|
+
children: [jsxRuntime.jsx(Checkbox__default["default"], {
|
|
1130
|
+
id: utils.optionId(id, i),
|
|
1131
|
+
name: id,
|
|
1132
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1133
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1134
|
+
value: String(i),
|
|
1135
|
+
children: option.label
|
|
1136
|
+
}), !inline && jsxRuntime.jsx("br", {})]
|
|
1137
|
+
}, i);
|
|
1138
|
+
})
|
|
1069
1139
|
})) : null;
|
|
1070
1140
|
}
|
|
1071
1141
|
|
|
@@ -1105,22 +1175,23 @@ function CheckboxWidget(props) {
|
|
|
1105
1175
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1106
1176
|
onFocus: !readonly ? handleFocus : undefined
|
|
1107
1177
|
};
|
|
1108
|
-
return
|
|
1178
|
+
return jsxRuntime.jsx(Checkbox__default["default"], _extends({
|
|
1109
1179
|
autoFocus: autofocus,
|
|
1110
|
-
checked: typeof value ===
|
|
1180
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
1111
1181
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1112
1182
|
id: id,
|
|
1113
1183
|
name: id,
|
|
1114
1184
|
onChange: !readonly ? handleChange : undefined
|
|
1115
1185
|
}, extraProps, {
|
|
1116
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1117
|
-
|
|
1186
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1187
|
+
children: label
|
|
1188
|
+
}));
|
|
1118
1189
|
}
|
|
1119
1190
|
|
|
1120
1191
|
var DatePicker = /*#__PURE__*/generatePicker__default["default"](dayjsGenerateConfig__default["default"]);
|
|
1121
1192
|
|
|
1122
1193
|
var DATE_PICKER_STYLE$1 = {
|
|
1123
|
-
width:
|
|
1194
|
+
width: '100%'
|
|
1124
1195
|
};
|
|
1125
1196
|
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
1126
1197
|
* the value to/from utc using the appropriate utility functions.
|
|
@@ -1151,7 +1222,7 @@ function DateTimeWidget(props) {
|
|
|
1151
1222
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1152
1223
|
return node.parentNode;
|
|
1153
1224
|
};
|
|
1154
|
-
return
|
|
1225
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1155
1226
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1156
1227
|
getPopupContainer: getPopupContainer,
|
|
1157
1228
|
id: id,
|
|
@@ -1168,7 +1239,7 @@ function DateTimeWidget(props) {
|
|
|
1168
1239
|
}
|
|
1169
1240
|
|
|
1170
1241
|
var DATE_PICKER_STYLE = {
|
|
1171
|
-
width:
|
|
1242
|
+
width: '100%'
|
|
1172
1243
|
};
|
|
1173
1244
|
/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms
|
|
1174
1245
|
* the value to undefined when it is falsy during the `onChange` handling.
|
|
@@ -1188,7 +1259,7 @@ function DateWidget(props) {
|
|
|
1188
1259
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1189
1260
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1190
1261
|
var handleChange = function handleChange(nextValue) {
|
|
1191
|
-
return onChange(nextValue && nextValue.format(
|
|
1262
|
+
return onChange(nextValue && nextValue.format('YYYY-MM-DD'));
|
|
1192
1263
|
};
|
|
1193
1264
|
var handleBlur = function handleBlur() {
|
|
1194
1265
|
return onBlur(id, value);
|
|
@@ -1199,7 +1270,7 @@ function DateWidget(props) {
|
|
|
1199
1270
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1200
1271
|
return node.parentNode;
|
|
1201
1272
|
};
|
|
1202
|
-
return
|
|
1273
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1203
1274
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1204
1275
|
getPopupContainer: getPopupContainer,
|
|
1205
1276
|
id: id,
|
|
@@ -1232,10 +1303,10 @@ function PasswordWidget(props) {
|
|
|
1232
1303
|
value = props.value;
|
|
1233
1304
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1234
1305
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1235
|
-
var emptyValue = options.emptyValue ||
|
|
1306
|
+
var emptyValue = options.emptyValue || '';
|
|
1236
1307
|
var handleChange = function handleChange(_ref) {
|
|
1237
1308
|
var target = _ref.target;
|
|
1238
|
-
return onChange(target.value ===
|
|
1309
|
+
return onChange(target.value === '' ? emptyValue : target.value);
|
|
1239
1310
|
};
|
|
1240
1311
|
var handleBlur = function handleBlur(_ref2) {
|
|
1241
1312
|
var target = _ref2.target;
|
|
@@ -1245,7 +1316,7 @@ function PasswordWidget(props) {
|
|
|
1245
1316
|
var target = _ref3.target;
|
|
1246
1317
|
return onFocus(id, target.value);
|
|
1247
1318
|
};
|
|
1248
|
-
return
|
|
1319
|
+
return jsxRuntime.jsx(Input__default["default"].Password, {
|
|
1249
1320
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1250
1321
|
id: id,
|
|
1251
1322
|
name: id,
|
|
@@ -1253,7 +1324,7 @@ function PasswordWidget(props) {
|
|
|
1253
1324
|
onChange: !readonly ? handleChange : undefined,
|
|
1254
1325
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1255
1326
|
placeholder: placeholder,
|
|
1256
|
-
value: value ||
|
|
1327
|
+
value: value || '',
|
|
1257
1328
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1258
1329
|
});
|
|
1259
1330
|
}
|
|
@@ -1292,7 +1363,7 @@ function RadioWidget(_ref) {
|
|
|
1292
1363
|
return onFocus(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1293
1364
|
};
|
|
1294
1365
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
1295
|
-
return
|
|
1366
|
+
return jsxRuntime.jsx(Radio__default["default"].Group, {
|
|
1296
1367
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1297
1368
|
id: id,
|
|
1298
1369
|
name: id,
|
|
@@ -1300,17 +1371,18 @@ function RadioWidget(_ref) {
|
|
|
1300
1371
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1301
1372
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1302
1373
|
value: selectedIndexes,
|
|
1303
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1374
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1375
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
1376
|
+
return jsxRuntime.jsx(Radio__default["default"], {
|
|
1377
|
+
id: utils.optionId(id, i),
|
|
1378
|
+
name: id,
|
|
1379
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1380
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1381
|
+
value: String(i),
|
|
1382
|
+
children: option.label
|
|
1383
|
+
}, i);
|
|
1384
|
+
})
|
|
1385
|
+
});
|
|
1314
1386
|
}
|
|
1315
1387
|
|
|
1316
1388
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -1337,9 +1409,9 @@ function RangeWidget(props) {
|
|
|
1337
1409
|
min = _rangeSpec.min,
|
|
1338
1410
|
max = _rangeSpec.max,
|
|
1339
1411
|
step = _rangeSpec.step;
|
|
1340
|
-
var emptyValue = options.emptyValue ||
|
|
1412
|
+
var emptyValue = options.emptyValue || '';
|
|
1341
1413
|
var handleChange = function handleChange(nextValue) {
|
|
1342
|
-
return onChange(nextValue ===
|
|
1414
|
+
return onChange(nextValue === '' ? emptyValue : nextValue);
|
|
1343
1415
|
};
|
|
1344
1416
|
var handleBlur = function handleBlur() {
|
|
1345
1417
|
return onBlur(id, value);
|
|
@@ -1354,7 +1426,7 @@ function RangeWidget(props) {
|
|
|
1354
1426
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1355
1427
|
onFocus: !readonly ? handleFocus : undefined
|
|
1356
1428
|
};
|
|
1357
|
-
return
|
|
1429
|
+
return jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
1358
1430
|
autoFocus: autofocus,
|
|
1359
1431
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1360
1432
|
id: id,
|
|
@@ -1370,7 +1442,7 @@ function RangeWidget(props) {
|
|
|
1370
1442
|
}
|
|
1371
1443
|
|
|
1372
1444
|
var SELECT_STYLE = {
|
|
1373
|
-
width:
|
|
1445
|
+
width: '100%'
|
|
1374
1446
|
};
|
|
1375
1447
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
1376
1448
|
* It is typically used with string properties constrained with enum options.
|
|
@@ -1421,12 +1493,12 @@ function SelectWidget(_ref) {
|
|
|
1421
1493
|
var extraProps = {
|
|
1422
1494
|
name: id
|
|
1423
1495
|
};
|
|
1424
|
-
return
|
|
1496
|
+
return jsxRuntime.jsx(Select__default["default"], _extends({
|
|
1425
1497
|
autoFocus: autofocus,
|
|
1426
1498
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1427
1499
|
getPopupContainer: getPopupContainer,
|
|
1428
1500
|
id: id,
|
|
1429
|
-
mode: typeof multiple !==
|
|
1501
|
+
mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
|
|
1430
1502
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1431
1503
|
onChange: !readonly ? handleChange : undefined,
|
|
1432
1504
|
onFocus: !readonly ? handleFocus : undefined,
|
|
@@ -1435,20 +1507,21 @@ function SelectWidget(_ref) {
|
|
|
1435
1507
|
value: selectedIndexes
|
|
1436
1508
|
}, extraProps, {
|
|
1437
1509
|
filterOption: filterOption,
|
|
1438
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1510
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1511
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (_ref2, index) {
|
|
1512
|
+
var optionValue = _ref2.value,
|
|
1513
|
+
optionLabel = _ref2.label;
|
|
1514
|
+
return jsxRuntime.jsx(Select__default["default"].Option, {
|
|
1515
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
1516
|
+
value: String(index),
|
|
1517
|
+
children: optionLabel
|
|
1518
|
+
}, String(index));
|
|
1519
|
+
})
|
|
1447
1520
|
}));
|
|
1448
1521
|
}
|
|
1449
1522
|
|
|
1450
1523
|
var INPUT_STYLE = {
|
|
1451
|
-
width:
|
|
1524
|
+
width: '100%'
|
|
1452
1525
|
};
|
|
1453
1526
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
1454
1527
|
*
|
|
@@ -1469,7 +1542,7 @@ function TextareaWidget(_ref) {
|
|
|
1469
1542
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1470
1543
|
var handleChange = function handleChange(_ref2) {
|
|
1471
1544
|
var target = _ref2.target;
|
|
1472
|
-
return onChange(target.value ===
|
|
1545
|
+
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
1473
1546
|
};
|
|
1474
1547
|
var handleBlur = function handleBlur(_ref3) {
|
|
1475
1548
|
var target = _ref3.target;
|
|
@@ -1482,9 +1555,9 @@ function TextareaWidget(_ref) {
|
|
|
1482
1555
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1483
1556
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1484
1557
|
var extraProps = {
|
|
1485
|
-
type:
|
|
1558
|
+
type: 'textarea'
|
|
1486
1559
|
};
|
|
1487
|
-
return
|
|
1560
|
+
return jsxRuntime.jsx(Input__default["default"].TextArea, _extends({
|
|
1488
1561
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1489
1562
|
id: id,
|
|
1490
1563
|
name: id,
|