@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
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('react'), require('antd/lib/button'), require('antd/lib/col'), require('antd/lib/row'), require('@rjsf/utils'), require('classnames'), require('antd/lib/config-provider/context'), require('antd/lib/input'), require('antd/lib/input-number'), require('antd/lib/alert'), require('antd/lib/list'), require('antd/lib/space'), require('@ant-design/icons/ExclamationCircleOutlined'), require('@ant-design/icons/ArrowDownOutlined'), require('@ant-design/icons/ArrowUpOutlined'), require('@ant-design/icons/DeleteOutlined'), require('@ant-design/icons/PlusCircleOutlined'), require('antd/lib/form'), require('lodash-es/isObject'), require('lodash-es/isNumber'), require('lodash-es/isString'), require('antd/lib/checkbox'), require('dayjs'), require('rc-picker/lib/generate/dayjs'), require('antd/lib/date-picker/generatePicker'), require('antd/lib/radio'), require('antd/lib/slider'), require('antd/lib/select')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'react', 'antd/lib/button', 'antd/lib/col', 'antd/lib/row', '@rjsf/utils', 'classnames', 'antd/lib/config-provider/context', 'antd/lib/input', 'antd/lib/input-number', 'antd/lib/alert', 'antd/lib/list', 'antd/lib/space', '@ant-design/icons/ExclamationCircleOutlined', '@ant-design/icons/ArrowDownOutlined', '@ant-design/icons/ArrowUpOutlined', '@ant-design/icons/DeleteOutlined', '@ant-design/icons/PlusCircleOutlined', 'antd/lib/form', 'lodash-es/isObject', 'lodash-es/isNumber', 'lodash-es/isString', 'antd/lib/checkbox', 'dayjs', 'rc-picker/lib/generate/dayjs', 'antd/lib/date-picker/generatePicker', 'antd/lib/radio', 'antd/lib/slider', 'antd/lib/select'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/antd"] = {}, global.core, global.
|
|
5
|
-
})(this, (function (exports, core,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('react/jsx-runtime'), require('antd/lib/button'), require('antd/lib/col'), require('antd/lib/row'), require('@rjsf/utils'), require('classnames'), require('antd/lib/config-provider/context'), require('antd/lib/input'), require('antd/lib/input-number'), require('antd/lib/alert'), require('antd/lib/list'), require('antd/lib/space'), require('@ant-design/icons/ExclamationCircleOutlined'), require('@ant-design/icons/ArrowDownOutlined'), require('@ant-design/icons/ArrowUpOutlined'), require('@ant-design/icons/DeleteOutlined'), require('@ant-design/icons/PlusCircleOutlined'), require('antd/lib/form'), require('lodash-es/isObject'), require('lodash-es/isNumber'), require('lodash-es/isString'), require('react'), require('antd/lib/checkbox'), require('dayjs'), require('rc-picker/lib/generate/dayjs'), require('antd/lib/date-picker/generatePicker'), require('antd/lib/radio'), require('antd/lib/slider'), require('antd/lib/select')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'react/jsx-runtime', 'antd/lib/button', 'antd/lib/col', 'antd/lib/row', '@rjsf/utils', 'classnames', 'antd/lib/config-provider/context', 'antd/lib/input', 'antd/lib/input-number', 'antd/lib/alert', 'antd/lib/list', 'antd/lib/space', '@ant-design/icons/ExclamationCircleOutlined', '@ant-design/icons/ArrowDownOutlined', '@ant-design/icons/ArrowUpOutlined', '@ant-design/icons/DeleteOutlined', '@ant-design/icons/PlusCircleOutlined', 'antd/lib/form', 'lodash-es/isObject', 'lodash-es/isNumber', 'lodash-es/isString', 'react', 'antd/lib/checkbox', 'dayjs', 'rc-picker/lib/generate/dayjs', 'antd/lib/date-picker/generatePicker', 'antd/lib/radio', 'antd/lib/slider', 'antd/lib/select'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/antd"] = {}, global.core, global.jsxRuntime, global.Button, global.Col, global.Row, global.utils, global.classNames, global.context, global.Input, global.InputNumber, global.Alert, global.List, global.Space, global.ExclamationCircleOutlined, global.ArrowDownOutlined, global.ArrowUpOutlined, global.DeleteOutlined, global.PlusCircleOutlined, global.Form$1, global.isObject, global.isNumber, global.isString, global.React, global.Checkbox, global.dayjs, global.dayjsGenerateConfig, global.generatePicker, global.Radio, global.Slider, global.Select));
|
|
5
|
+
})(this, (function (exports, core, jsxRuntime, Button, Col, Row, utils, classNames, context, Input, InputNumber, Alert, List, Space, ExclamationCircleOutlined, ArrowDownOutlined, ArrowUpOutlined, DeleteOutlined, PlusCircleOutlined, Form$1, isObject, isNumber, isString, react, Checkbox, dayjs, dayjsGenerateConfig, generatePicker, Radio, Slider, Select) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
9
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
11
10
|
var Col__default = /*#__PURE__*/_interopDefaultLegacy(Col);
|
|
12
11
|
var Row__default = /*#__PURE__*/_interopDefaultLegacy(Row);
|
|
@@ -34,10 +33,10 @@
|
|
|
34
33
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
35
34
|
|
|
36
35
|
var BTN_GRP_STYLE = {
|
|
37
|
-
width:
|
|
36
|
+
width: '100%'
|
|
38
37
|
};
|
|
39
38
|
var BTN_STYLE = {
|
|
40
|
-
width:
|
|
39
|
+
width: 'calc(100% / 3)'
|
|
41
40
|
};
|
|
42
41
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
43
42
|
*
|
|
@@ -64,36 +63,39 @@
|
|
|
64
63
|
_registry$formContext2 = _registry$formContext.rowGutter,
|
|
65
64
|
rowGutter = _registry$formContext2 === void 0 ? 24 : _registry$formContext2,
|
|
66
65
|
_registry$formContext3 = _registry$formContext.toolbarAlign,
|
|
67
|
-
toolbarAlign = _registry$formContext3 === void 0 ?
|
|
68
|
-
return
|
|
66
|
+
toolbarAlign = _registry$formContext3 === void 0 ? 'top' : _registry$formContext3;
|
|
67
|
+
return jsxRuntime.jsxs(Row__default["default"], {
|
|
69
68
|
align: toolbarAlign,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
gutter: rowGutter,
|
|
70
|
+
children: [jsxRuntime.jsx(Col__default["default"], {
|
|
71
|
+
flex: '1',
|
|
72
|
+
children: children
|
|
73
|
+
}), hasToolbar && jsxRuntime.jsx(Col__default["default"], {
|
|
74
|
+
flex: '192px',
|
|
75
|
+
children: jsxRuntime.jsxs(Button__default["default"].Group, {
|
|
76
|
+
style: BTN_GRP_STYLE,
|
|
77
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
78
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
79
|
+
onClick: onReorderClick(index, index - 1),
|
|
80
|
+
style: BTN_STYLE,
|
|
81
|
+
uiSchema: uiSchema,
|
|
82
|
+
registry: registry
|
|
83
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
84
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
85
|
+
onClick: onReorderClick(index, index + 1),
|
|
86
|
+
style: BTN_STYLE,
|
|
87
|
+
uiSchema: uiSchema,
|
|
88
|
+
registry: registry
|
|
89
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
90
|
+
disabled: disabled || readonly,
|
|
91
|
+
onClick: onDropIndexClick(index),
|
|
92
|
+
style: BTN_STYLE,
|
|
93
|
+
uiSchema: uiSchema,
|
|
94
|
+
registry: registry
|
|
95
|
+
})]
|
|
96
|
+
})
|
|
97
|
+
})]
|
|
98
|
+
}, "array-item-" + index);
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
function _extends() {
|
|
@@ -125,7 +127,7 @@
|
|
|
125
127
|
|
|
126
128
|
var _excluded$1 = ["key"];
|
|
127
129
|
var DESCRIPTION_COL_STYLE$1 = {
|
|
128
|
-
paddingBottom:
|
|
130
|
+
paddingBottom: '8px'
|
|
129
131
|
};
|
|
130
132
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
131
133
|
*
|
|
@@ -146,75 +148,83 @@
|
|
|
146
148
|
title = props.title,
|
|
147
149
|
uiSchema = props.uiSchema;
|
|
148
150
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
149
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
150
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
151
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
151
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
152
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
153
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
152
154
|
// Button templates are not overridden in the uiSchema
|
|
153
155
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
154
156
|
var _formContext$labelAli = formContext.labelAlign,
|
|
155
|
-
labelAlign = _formContext$labelAli === void 0 ?
|
|
157
|
+
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
156
158
|
_formContext$rowGutte = formContext.rowGutter,
|
|
157
159
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
158
|
-
return
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
return jsxRuntime.jsx(context.ConfigConsumer, {
|
|
161
|
+
children: function children(configProps) {
|
|
162
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
163
|
+
var prefixCls = getPrefixCls('form');
|
|
164
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
165
|
+
var labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left"
|
|
166
|
+
// labelCol.className,
|
|
167
|
+
);
|
|
165
168
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
169
|
+
return jsxRuntime.jsx("fieldset", {
|
|
170
|
+
className: className,
|
|
171
|
+
id: idSchema.$id,
|
|
172
|
+
children: jsxRuntime.jsxs(Row__default["default"], {
|
|
173
|
+
gutter: rowGutter,
|
|
174
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(Col__default["default"], {
|
|
175
|
+
className: labelColClassName,
|
|
176
|
+
span: 24,
|
|
177
|
+
children: jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
178
|
+
idSchema: idSchema,
|
|
179
|
+
required: required,
|
|
180
|
+
title: uiOptions.title || title,
|
|
181
|
+
schema: schema,
|
|
182
|
+
uiSchema: uiSchema,
|
|
183
|
+
registry: registry
|
|
184
|
+
})
|
|
185
|
+
}), (uiOptions.description || schema.description) && jsxRuntime.jsx(Col__default["default"], {
|
|
186
|
+
span: 24,
|
|
187
|
+
style: DESCRIPTION_COL_STYLE$1,
|
|
188
|
+
children: jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
189
|
+
description: uiOptions.description || schema.description || '',
|
|
190
|
+
idSchema: idSchema,
|
|
191
|
+
schema: schema,
|
|
192
|
+
uiSchema: uiSchema,
|
|
193
|
+
registry: registry
|
|
194
|
+
})
|
|
195
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
196
|
+
className: 'row array-item-list',
|
|
197
|
+
span: 24,
|
|
198
|
+
children: items && items.map(function (_ref) {
|
|
199
|
+
var key = _ref.key,
|
|
200
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
201
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
202
|
+
})
|
|
203
|
+
}), canAdd && jsxRuntime.jsx(Col__default["default"], {
|
|
204
|
+
span: 24,
|
|
205
|
+
children: jsxRuntime.jsx(Row__default["default"], {
|
|
206
|
+
gutter: rowGutter,
|
|
207
|
+
justify: 'end',
|
|
208
|
+
children: jsxRuntime.jsx(Col__default["default"], {
|
|
209
|
+
flex: '192px',
|
|
210
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
211
|
+
className: 'array-item-add',
|
|
212
|
+
disabled: disabled || readonly,
|
|
213
|
+
onClick: onAddClick,
|
|
214
|
+
uiSchema: uiSchema,
|
|
215
|
+
registry: registry
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
})]
|
|
220
|
+
})
|
|
221
|
+
});
|
|
222
|
+
}
|
|
213
223
|
});
|
|
214
224
|
}
|
|
215
225
|
|
|
216
226
|
var INPUT_STYLE$2 = {
|
|
217
|
-
width:
|
|
227
|
+
width: '100%'
|
|
218
228
|
};
|
|
219
229
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
220
230
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
@@ -228,6 +238,7 @@
|
|
|
228
238
|
id = props.id,
|
|
229
239
|
onBlur = props.onBlur,
|
|
230
240
|
onChange = props.onChange,
|
|
241
|
+
onChangeOverride = props.onChangeOverride,
|
|
231
242
|
onFocus = props.onFocus,
|
|
232
243
|
options = props.options,
|
|
233
244
|
placeholder = props.placeholder,
|
|
@@ -241,9 +252,9 @@
|
|
|
241
252
|
var handleNumberChange = function handleNumberChange(nextValue) {
|
|
242
253
|
return onChange(nextValue);
|
|
243
254
|
};
|
|
244
|
-
var handleTextChange = function
|
|
255
|
+
var handleTextChange = onChangeOverride ? onChangeOverride : function (_ref) {
|
|
245
256
|
var target = _ref.target;
|
|
246
|
-
return onChange(target.value ===
|
|
257
|
+
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
247
258
|
};
|
|
248
259
|
var handleBlur = function handleBlur(_ref2) {
|
|
249
260
|
var target = _ref2.target;
|
|
@@ -253,7 +264,7 @@
|
|
|
253
264
|
var target = _ref3.target;
|
|
254
265
|
return onFocus(id, target.value);
|
|
255
266
|
};
|
|
256
|
-
var input = inputProps.type ===
|
|
267
|
+
var input = inputProps.type === 'number' || inputProps.type === 'integer' ? jsxRuntime.jsx(InputNumber__default["default"], _extends({
|
|
257
268
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
258
269
|
id: id,
|
|
259
270
|
name: id,
|
|
@@ -266,7 +277,7 @@
|
|
|
266
277
|
}, inputProps, {
|
|
267
278
|
value: value,
|
|
268
279
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
269
|
-
})) :
|
|
280
|
+
})) : jsxRuntime.jsx(Input__default["default"], _extends({
|
|
270
281
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
271
282
|
id: id,
|
|
272
283
|
name: id,
|
|
@@ -280,14 +291,16 @@
|
|
|
280
291
|
value: value,
|
|
281
292
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
282
293
|
}));
|
|
283
|
-
return
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
294
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
295
|
+
children: [input, Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
296
|
+
id: utils.examplesId(id),
|
|
297
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
298
|
+
return jsxRuntime.jsx("option", {
|
|
299
|
+
value: example
|
|
300
|
+
}, example);
|
|
301
|
+
})
|
|
302
|
+
})]
|
|
303
|
+
});
|
|
291
304
|
}
|
|
292
305
|
|
|
293
306
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -300,9 +313,10 @@
|
|
|
300
313
|
if (!description) {
|
|
301
314
|
return null;
|
|
302
315
|
}
|
|
303
|
-
return
|
|
304
|
-
id: id
|
|
305
|
-
|
|
316
|
+
return jsxRuntime.jsx("span", {
|
|
317
|
+
id: id,
|
|
318
|
+
children: description
|
|
319
|
+
});
|
|
306
320
|
}
|
|
307
321
|
|
|
308
322
|
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
@@ -310,69 +324,78 @@
|
|
|
310
324
|
* @param props - The `ErrorListProps` for this component
|
|
311
325
|
*/
|
|
312
326
|
function ErrorList(_ref) {
|
|
313
|
-
var errors = _ref.errors
|
|
327
|
+
var errors = _ref.errors,
|
|
328
|
+
registry = _ref.registry;
|
|
329
|
+
var translateString = registry.translateString;
|
|
314
330
|
var renderErrors = function renderErrors() {
|
|
315
|
-
return
|
|
316
|
-
className:
|
|
317
|
-
size:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
331
|
+
return jsxRuntime.jsx(List__default["default"], {
|
|
332
|
+
className: 'list-group',
|
|
333
|
+
size: 'small',
|
|
334
|
+
children: errors.map(function (error, index) {
|
|
335
|
+
return jsxRuntime.jsx(List__default["default"].Item, {
|
|
336
|
+
children: jsxRuntime.jsxs(Space__default["default"], {
|
|
337
|
+
children: [jsxRuntime.jsx(ExclamationCircleOutlined__default["default"], {}), error.stack]
|
|
338
|
+
})
|
|
339
|
+
}, index);
|
|
340
|
+
})
|
|
341
|
+
});
|
|
323
342
|
};
|
|
324
|
-
return
|
|
325
|
-
className:
|
|
343
|
+
return jsxRuntime.jsx(Alert__default["default"], {
|
|
344
|
+
className: 'panel panel-danger errors',
|
|
326
345
|
description: renderErrors(),
|
|
327
|
-
message:
|
|
328
|
-
type:
|
|
346
|
+
message: translateString(utils.TranslatableString.ErrorsLabel),
|
|
347
|
+
type: 'error'
|
|
329
348
|
});
|
|
330
349
|
}
|
|
331
350
|
|
|
332
351
|
var _excluded = ["iconType", "icon", "uiSchema", "registry"];
|
|
333
352
|
function IconButton(props) {
|
|
334
353
|
var _props$iconType = props.iconType,
|
|
335
|
-
iconType = _props$iconType === void 0 ?
|
|
354
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
336
355
|
icon = props.icon,
|
|
337
356
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
338
|
-
return
|
|
357
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
339
358
|
type: iconType,
|
|
340
359
|
icon: icon
|
|
341
360
|
}, otherProps));
|
|
342
361
|
}
|
|
343
362
|
function AddButton(props) {
|
|
344
|
-
|
|
345
|
-
|
|
363
|
+
var translateString = props.registry.translateString;
|
|
364
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
365
|
+
title: translateString(utils.TranslatableString.AddItemButton)
|
|
346
366
|
}, props, {
|
|
347
367
|
block: true,
|
|
348
|
-
iconType:
|
|
349
|
-
icon:
|
|
368
|
+
iconType: 'primary',
|
|
369
|
+
icon: jsxRuntime.jsx(PlusCircleOutlined__default["default"], {})
|
|
350
370
|
}));
|
|
351
371
|
}
|
|
352
372
|
function MoveDownButton(props) {
|
|
353
|
-
|
|
354
|
-
|
|
373
|
+
var translateString = props.registry.translateString;
|
|
374
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
375
|
+
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
355
376
|
}, props, {
|
|
356
|
-
icon:
|
|
377
|
+
icon: jsxRuntime.jsx(ArrowDownOutlined__default["default"], {})
|
|
357
378
|
}));
|
|
358
379
|
}
|
|
359
380
|
function MoveUpButton(props) {
|
|
360
|
-
|
|
361
|
-
|
|
381
|
+
var translateString = props.registry.translateString;
|
|
382
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
383
|
+
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
362
384
|
}, props, {
|
|
363
|
-
icon:
|
|
385
|
+
icon: jsxRuntime.jsx(ArrowUpOutlined__default["default"], {})
|
|
364
386
|
}));
|
|
365
387
|
}
|
|
366
388
|
function RemoveButton(props) {
|
|
367
389
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
|
|
368
390
|
var options = utils.getUiOptions(props.uiSchema);
|
|
369
|
-
|
|
370
|
-
|
|
391
|
+
var translateString = props.registry.translateString;
|
|
392
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
393
|
+
title: translateString(utils.TranslatableString.RemoveButton)
|
|
371
394
|
}, props, {
|
|
372
395
|
danger: true,
|
|
373
396
|
block: !!options.block,
|
|
374
|
-
iconType:
|
|
375
|
-
icon:
|
|
397
|
+
iconType: 'primary',
|
|
398
|
+
icon: jsxRuntime.jsx(DeleteOutlined__default["default"], {})
|
|
376
399
|
}));
|
|
377
400
|
}
|
|
378
401
|
|
|
@@ -388,13 +411,14 @@
|
|
|
388
411
|
return null;
|
|
389
412
|
}
|
|
390
413
|
var id = utils.errorId(idSchema);
|
|
391
|
-
return
|
|
392
|
-
id: id
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
414
|
+
return jsxRuntime.jsx("div", {
|
|
415
|
+
id: id,
|
|
416
|
+
children: errors.map(function (error) {
|
|
417
|
+
return jsxRuntime.jsx("div", {
|
|
418
|
+
children: error
|
|
419
|
+
}, "field-" + id + "-error-" + error);
|
|
420
|
+
})
|
|
421
|
+
});
|
|
398
422
|
}
|
|
399
423
|
|
|
400
424
|
var VERTICAL_LABEL_COL$1 = {
|
|
@@ -438,13 +462,14 @@
|
|
|
438
462
|
wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
|
|
439
463
|
wrapperStyle = formContext.wrapperStyle;
|
|
440
464
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
441
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
465
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
442
466
|
if (hidden) {
|
|
443
|
-
return
|
|
444
|
-
className:
|
|
445
|
-
|
|
467
|
+
return jsxRuntime.jsx("div", {
|
|
468
|
+
className: 'field-hidden',
|
|
469
|
+
children: children
|
|
470
|
+
});
|
|
446
471
|
}
|
|
447
|
-
return
|
|
472
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
448
473
|
classNames: classNames,
|
|
449
474
|
style: style,
|
|
450
475
|
disabled: disabled,
|
|
@@ -456,24 +481,26 @@
|
|
|
456
481
|
required: required,
|
|
457
482
|
schema: schema,
|
|
458
483
|
uiSchema: uiSchema,
|
|
459
|
-
registry: registry
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
484
|
+
registry: registry,
|
|
485
|
+
children: id === 'root' ? children : jsxRuntime.jsx(Form__default["default"].Item, {
|
|
486
|
+
colon: colon,
|
|
487
|
+
extra: rawDescription && description,
|
|
488
|
+
hasFeedback: schema.type !== 'array' && schema.type !== 'object',
|
|
489
|
+
help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
|
|
490
|
+
htmlFor: id,
|
|
491
|
+
label: displayLabel && label,
|
|
492
|
+
labelCol: labelCol,
|
|
493
|
+
required: required,
|
|
494
|
+
style: wrapperStyle,
|
|
495
|
+
validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? 'error' : undefined,
|
|
496
|
+
wrapperCol: wrapperCol,
|
|
497
|
+
children: children
|
|
498
|
+
})
|
|
499
|
+
});
|
|
473
500
|
}
|
|
474
501
|
|
|
475
502
|
var DESCRIPTION_COL_STYLE = {
|
|
476
|
-
paddingBottom:
|
|
503
|
+
paddingBottom: '8px'
|
|
477
504
|
};
|
|
478
505
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
479
506
|
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
@@ -496,14 +523,14 @@
|
|
|
496
523
|
title = props.title,
|
|
497
524
|
uiSchema = props.uiSchema;
|
|
498
525
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
499
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
500
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
526
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
527
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
501
528
|
// Button templates are not overridden in the uiSchema
|
|
502
529
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
503
530
|
var _formContext$colSpan = formContext.colSpan,
|
|
504
531
|
colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
|
|
505
532
|
_formContext$labelAli = formContext.labelAlign,
|
|
506
|
-
labelAlign = _formContext$labelAli === void 0 ?
|
|
533
|
+
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
507
534
|
_formContext$rowGutte = formContext.rowGutter,
|
|
508
535
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
509
536
|
var findSchema = function findSchema(element) {
|
|
@@ -527,7 +554,7 @@
|
|
|
527
554
|
var widget = findUiSchemaWidget(element);
|
|
528
555
|
var defaultColSpan = properties.length < 2 ||
|
|
529
556
|
// Single or no field in object.
|
|
530
|
-
type ===
|
|
557
|
+
type === 'object' || type === 'array' || widget === 'textarea' ? 24 : 12;
|
|
531
558
|
if (isObject__default["default"](colSpan)) {
|
|
532
559
|
var colSpanObj = colSpan;
|
|
533
560
|
if (isString__default["default"](widget)) {
|
|
@@ -545,58 +572,67 @@
|
|
|
545
572
|
}
|
|
546
573
|
return defaultColSpan;
|
|
547
574
|
};
|
|
548
|
-
return
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
575
|
+
return jsxRuntime.jsx(context.ConfigConsumer, {
|
|
576
|
+
children: function children(configProps) {
|
|
577
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
578
|
+
var prefixCls = getPrefixCls('form');
|
|
579
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
580
|
+
var labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left"
|
|
581
|
+
// labelCol.className,
|
|
582
|
+
);
|
|
555
583
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
584
|
+
return jsxRuntime.jsxs("fieldset", {
|
|
585
|
+
id: idSchema.$id,
|
|
586
|
+
children: [jsxRuntime.jsxs(Row__default["default"], {
|
|
587
|
+
gutter: rowGutter,
|
|
588
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(Col__default["default"], {
|
|
589
|
+
className: labelColClassName,
|
|
590
|
+
span: 24,
|
|
591
|
+
children: jsxRuntime.jsx(TitleFieldTemplate, {
|
|
592
|
+
id: utils.titleId(idSchema),
|
|
593
|
+
title: uiOptions.title || title,
|
|
594
|
+
required: required,
|
|
595
|
+
schema: schema,
|
|
596
|
+
uiSchema: uiSchema,
|
|
597
|
+
registry: registry
|
|
598
|
+
})
|
|
599
|
+
}), (uiOptions.description || description) && jsxRuntime.jsx(Col__default["default"], {
|
|
600
|
+
span: 24,
|
|
601
|
+
style: DESCRIPTION_COL_STYLE,
|
|
602
|
+
children: jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
603
|
+
id: utils.descriptionId(idSchema),
|
|
604
|
+
description: uiOptions.description || description,
|
|
605
|
+
schema: schema,
|
|
606
|
+
uiSchema: uiSchema,
|
|
607
|
+
registry: registry
|
|
608
|
+
})
|
|
609
|
+
}), properties.filter(function (e) {
|
|
610
|
+
return !e.hidden;
|
|
611
|
+
}).map(function (element) {
|
|
612
|
+
return jsxRuntime.jsx(Col__default["default"], {
|
|
613
|
+
span: calculateColSpan(element),
|
|
614
|
+
children: element.content
|
|
615
|
+
}, element.name);
|
|
616
|
+
})]
|
|
617
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(Col__default["default"], {
|
|
618
|
+
span: 24,
|
|
619
|
+
children: jsxRuntime.jsx(Row__default["default"], {
|
|
620
|
+
gutter: rowGutter,
|
|
621
|
+
justify: 'end',
|
|
622
|
+
children: jsxRuntime.jsx(Col__default["default"], {
|
|
623
|
+
flex: '192px',
|
|
624
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
625
|
+
className: 'object-property-expand',
|
|
626
|
+
disabled: disabled || readonly,
|
|
627
|
+
onClick: onAddClick(schema),
|
|
628
|
+
uiSchema: uiSchema,
|
|
629
|
+
registry: registry
|
|
630
|
+
})
|
|
631
|
+
})
|
|
632
|
+
})
|
|
633
|
+
})]
|
|
634
|
+
});
|
|
635
|
+
}
|
|
600
636
|
});
|
|
601
637
|
}
|
|
602
638
|
|
|
@@ -611,11 +647,12 @@
|
|
|
611
647
|
if (norender) {
|
|
612
648
|
return null;
|
|
613
649
|
}
|
|
614
|
-
return
|
|
615
|
-
type:
|
|
650
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
651
|
+
type: 'submit'
|
|
616
652
|
}, submitButtonProps, {
|
|
617
|
-
htmlType:
|
|
618
|
-
|
|
653
|
+
htmlType: 'submit',
|
|
654
|
+
children: submitText
|
|
655
|
+
}));
|
|
619
656
|
}
|
|
620
657
|
|
|
621
658
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -631,8 +668,8 @@
|
|
|
631
668
|
var _formContext$colon = formContext.colon,
|
|
632
669
|
colon = _formContext$colon === void 0 ? true : _formContext$colon;
|
|
633
670
|
var labelChildren = title;
|
|
634
|
-
if (colon && typeof title ===
|
|
635
|
-
labelChildren = title.replace(/[::]\s*$/,
|
|
671
|
+
if (colon && typeof title === 'string' && title.trim() !== '') {
|
|
672
|
+
labelChildren = title.replace(/[::]\s*$/, '');
|
|
636
673
|
}
|
|
637
674
|
var handleLabelClick = function handleLabelClick() {
|
|
638
675
|
if (!id) {
|
|
@@ -643,17 +680,20 @@
|
|
|
643
680
|
control.focus();
|
|
644
681
|
}
|
|
645
682
|
};
|
|
646
|
-
return title ?
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
683
|
+
return title ? jsxRuntime.jsx(context.ConfigConsumer, {
|
|
684
|
+
children: function children(configProps) {
|
|
685
|
+
var _classNames;
|
|
686
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
687
|
+
var prefixCls = getPrefixCls('form');
|
|
688
|
+
var labelClassName = classNames__default["default"]((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
|
|
689
|
+
return jsxRuntime.jsx("label", {
|
|
690
|
+
className: labelClassName,
|
|
691
|
+
htmlFor: id,
|
|
692
|
+
onClick: handleLabelClick,
|
|
693
|
+
title: typeof title === 'string' ? title : '',
|
|
694
|
+
children: labelChildren
|
|
695
|
+
});
|
|
696
|
+
}
|
|
657
697
|
}) : null;
|
|
658
698
|
}
|
|
659
699
|
|
|
@@ -664,7 +704,7 @@
|
|
|
664
704
|
span: 24
|
|
665
705
|
};
|
|
666
706
|
var INPUT_STYLE$1 = {
|
|
667
|
-
width:
|
|
707
|
+
width: '100%'
|
|
668
708
|
};
|
|
669
709
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
670
710
|
* part of an `additionalProperties` part of a schema.
|
|
@@ -695,19 +735,22 @@
|
|
|
695
735
|
_registry$formContext4 = _registry$formContext.rowGutter,
|
|
696
736
|
rowGutter = _registry$formContext4 === void 0 ? 24 : _registry$formContext4,
|
|
697
737
|
_registry$formContext5 = _registry$formContext.toolbarAlign,
|
|
698
|
-
toolbarAlign = _registry$formContext5 === void 0 ?
|
|
738
|
+
toolbarAlign = _registry$formContext5 === void 0 ? 'top' : _registry$formContext5,
|
|
699
739
|
_registry$formContext6 = _registry$formContext.wrapperCol,
|
|
700
740
|
wrapperCol = _registry$formContext6 === void 0 ? VERTICAL_WRAPPER_COL : _registry$formContext6,
|
|
701
741
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
742
|
+
var templates = registry.templates,
|
|
743
|
+
translateString = registry.translateString;
|
|
702
744
|
// Button templates are not overridden in the uiSchema
|
|
703
|
-
var RemoveButton =
|
|
704
|
-
var keyLabel = label
|
|
745
|
+
var RemoveButton = templates.ButtonTemplates.RemoveButton;
|
|
746
|
+
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
705
747
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
706
748
|
if (!additional) {
|
|
707
|
-
return
|
|
749
|
+
return jsxRuntime.jsx("div", {
|
|
708
750
|
className: classNames,
|
|
709
|
-
style: style
|
|
710
|
-
|
|
751
|
+
style: style,
|
|
752
|
+
children: children
|
|
753
|
+
});
|
|
711
754
|
}
|
|
712
755
|
var handleBlur = function handleBlur(_ref) {
|
|
713
756
|
var target = _ref.target;
|
|
@@ -718,48 +761,55 @@
|
|
|
718
761
|
var buttonUiOptions = _extends({}, uiSchema, (_extends2 = {}, _extends2[utils.UI_OPTIONS_KEY] = _extends({}, uiOptions, {
|
|
719
762
|
block: true
|
|
720
763
|
}), _extends2));
|
|
721
|
-
return
|
|
764
|
+
return jsxRuntime.jsx("div", {
|
|
722
765
|
className: classNames,
|
|
723
|
-
style: style
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
766
|
+
style: style,
|
|
767
|
+
children: jsxRuntime.jsxs(Row__default["default"], {
|
|
768
|
+
align: toolbarAlign,
|
|
769
|
+
gutter: rowGutter,
|
|
770
|
+
children: [jsxRuntime.jsx(Col__default["default"], {
|
|
771
|
+
className: 'form-additional',
|
|
772
|
+
flex: '1',
|
|
773
|
+
children: jsxRuntime.jsx("div", {
|
|
774
|
+
className: 'form-group',
|
|
775
|
+
children: jsxRuntime.jsx(Form__default["default"].Item, {
|
|
776
|
+
colon: colon,
|
|
777
|
+
className: 'form-group',
|
|
778
|
+
hasFeedback: true,
|
|
779
|
+
htmlFor: id + "-key",
|
|
780
|
+
label: keyLabel,
|
|
781
|
+
labelCol: labelCol,
|
|
782
|
+
required: required,
|
|
783
|
+
style: wrapperStyle,
|
|
784
|
+
wrapperCol: wrapperCol,
|
|
785
|
+
children: jsxRuntime.jsx(Input__default["default"], {
|
|
786
|
+
className: 'form-control',
|
|
787
|
+
defaultValue: label,
|
|
788
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
789
|
+
id: id + "-key",
|
|
790
|
+
name: id + "-key",
|
|
791
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
792
|
+
style: INPUT_STYLE$1,
|
|
793
|
+
type: 'text'
|
|
794
|
+
})
|
|
795
|
+
})
|
|
796
|
+
})
|
|
797
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
798
|
+
className: 'form-additional',
|
|
799
|
+
flex: '1',
|
|
800
|
+
children: children
|
|
801
|
+
}), jsxRuntime.jsx(Col__default["default"], {
|
|
802
|
+
flex: '192px',
|
|
803
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
804
|
+
className: 'array-item-remove',
|
|
805
|
+
disabled: disabled || readonly,
|
|
806
|
+
onClick: onDropPropertyClick(label),
|
|
807
|
+
uiSchema: buttonUiOptions,
|
|
808
|
+
registry: registry
|
|
809
|
+
})
|
|
810
|
+
})]
|
|
811
|
+
})
|
|
812
|
+
});
|
|
763
813
|
}
|
|
764
814
|
|
|
765
815
|
function generateTemplates() {
|
|
@@ -811,29 +861,29 @@
|
|
|
811
861
|
minute = state.minute,
|
|
812
862
|
second = state.second;
|
|
813
863
|
var data = [{
|
|
814
|
-
type:
|
|
864
|
+
type: 'year',
|
|
815
865
|
range: yearsRange,
|
|
816
866
|
value: year
|
|
817
867
|
}, {
|
|
818
|
-
type:
|
|
868
|
+
type: 'month',
|
|
819
869
|
range: [1, 12],
|
|
820
870
|
value: month
|
|
821
871
|
}, {
|
|
822
|
-
type:
|
|
872
|
+
type: 'day',
|
|
823
873
|
range: [1, 31],
|
|
824
874
|
value: day
|
|
825
875
|
}];
|
|
826
876
|
if (time) {
|
|
827
877
|
data.push({
|
|
828
|
-
type:
|
|
878
|
+
type: 'hour',
|
|
829
879
|
range: [0, 23],
|
|
830
880
|
value: hour || -1
|
|
831
881
|
}, {
|
|
832
|
-
type:
|
|
882
|
+
type: 'minute',
|
|
833
883
|
range: [0, 59],
|
|
834
884
|
value: minute || -1
|
|
835
885
|
}, {
|
|
836
|
-
type:
|
|
886
|
+
type: 'second',
|
|
837
887
|
range: [0, 59],
|
|
838
888
|
value: second || -1
|
|
839
889
|
});
|
|
@@ -853,18 +903,20 @@
|
|
|
853
903
|
registry = props.registry,
|
|
854
904
|
showTime = props.showTime,
|
|
855
905
|
value = props.value;
|
|
856
|
-
var
|
|
906
|
+
var translateString = registry.translateString,
|
|
907
|
+
widgets = registry.widgets;
|
|
908
|
+
var SelectWidget = widgets.SelectWidget;
|
|
857
909
|
var _formContext$rowGutte = formContext.rowGutter,
|
|
858
910
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
859
|
-
var _useState =
|
|
911
|
+
var _useState = react.useState(utils.parseDateString(value, showTime)),
|
|
860
912
|
state = _useState[0],
|
|
861
913
|
setState = _useState[1];
|
|
862
|
-
|
|
914
|
+
react.useEffect(function () {
|
|
863
915
|
setState(utils.parseDateString(value, showTime));
|
|
864
916
|
}, [showTime, value]);
|
|
865
917
|
var handleChange = function handleChange(property, nextValue) {
|
|
866
918
|
var _extends2;
|
|
867
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
919
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
868
920
|
if (readyForChange(nextState)) {
|
|
869
921
|
onChange(utils.toDateString(nextState, showTime));
|
|
870
922
|
} else {
|
|
@@ -887,9 +939,9 @@
|
|
|
887
939
|
onChange(undefined);
|
|
888
940
|
};
|
|
889
941
|
var renderDateElement = function renderDateElement(elemProps) {
|
|
890
|
-
return
|
|
942
|
+
return jsxRuntime.jsx(SelectWidget, {
|
|
891
943
|
autofocus: elemProps.autofocus,
|
|
892
|
-
className:
|
|
944
|
+
className: 'form-control',
|
|
893
945
|
disabled: elemProps.disabled,
|
|
894
946
|
id: elemProps.id,
|
|
895
947
|
name: elemProps.name,
|
|
@@ -904,51 +956,56 @@
|
|
|
904
956
|
placeholder: elemProps.type,
|
|
905
957
|
readonly: elemProps.readonly,
|
|
906
958
|
schema: {
|
|
907
|
-
type:
|
|
959
|
+
type: 'integer'
|
|
908
960
|
},
|
|
909
961
|
value: elemProps.value,
|
|
910
962
|
registry: registry,
|
|
911
|
-
label:
|
|
963
|
+
label: '',
|
|
912
964
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
913
965
|
});
|
|
914
966
|
};
|
|
915
|
-
return
|
|
916
|
-
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
967
|
+
return jsxRuntime.jsxs(Row__default["default"], {
|
|
968
|
+
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)],
|
|
969
|
+
children: [dateElementProps(state, showTime, options.yearsRange).map(function (elemProps, i) {
|
|
970
|
+
var elemId = id + '_' + elemProps.type;
|
|
971
|
+
return jsxRuntime.jsx(Col__default["default"], {
|
|
972
|
+
flex: '88px',
|
|
973
|
+
children: renderDateElement(_extends({}, elemProps, {
|
|
974
|
+
autofocus: autofocus && i === 0,
|
|
975
|
+
disabled: disabled,
|
|
976
|
+
id: elemId,
|
|
977
|
+
name: id,
|
|
978
|
+
onBlur: onBlur,
|
|
979
|
+
onFocus: onFocus,
|
|
980
|
+
readonly: readonly,
|
|
981
|
+
registry: registry,
|
|
982
|
+
select: handleChange,
|
|
983
|
+
// NOTE: antd components accept -1 rather than issue a warning
|
|
984
|
+
// like material-ui, so we need to convert -1 to undefined here.
|
|
985
|
+
value: elemProps.value < 0 ? undefined : elemProps.value
|
|
986
|
+
}))
|
|
987
|
+
}, elemId);
|
|
988
|
+
}), !options.hideNowButton && jsxRuntime.jsx(Col__default["default"], {
|
|
989
|
+
flex: '88px',
|
|
990
|
+
children: jsxRuntime.jsx(Button__default["default"], {
|
|
991
|
+
block: true,
|
|
992
|
+
className: 'btn-now',
|
|
993
|
+
onClick: handleNow,
|
|
994
|
+
type: 'primary',
|
|
995
|
+
children: translateString(utils.TranslatableString.NowLabel)
|
|
996
|
+
})
|
|
997
|
+
}), !options.hideClearButton && jsxRuntime.jsx(Col__default["default"], {
|
|
998
|
+
flex: '88px',
|
|
999
|
+
children: jsxRuntime.jsx(Button__default["default"], {
|
|
1000
|
+
block: true,
|
|
1001
|
+
className: 'btn-clear',
|
|
1002
|
+
danger: true,
|
|
1003
|
+
onClick: handleClear,
|
|
1004
|
+
type: 'primary',
|
|
1005
|
+
children: translateString(utils.TranslatableString.ClearLabel)
|
|
1006
|
+
})
|
|
1007
|
+
})]
|
|
1008
|
+
});
|
|
952
1009
|
}
|
|
953
1010
|
AltDateWidget.defaultProps = {
|
|
954
1011
|
autofocus: false,
|
|
@@ -962,7 +1019,7 @@
|
|
|
962
1019
|
|
|
963
1020
|
function AltDateTimeWidget(props) {
|
|
964
1021
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
965
|
-
return
|
|
1022
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({
|
|
966
1023
|
showTime: true
|
|
967
1024
|
}, props));
|
|
968
1025
|
}
|
|
@@ -1011,23 +1068,25 @@
|
|
|
1011
1068
|
onFocus: !readonly ? handleFocus : undefined
|
|
1012
1069
|
};
|
|
1013
1070
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
1014
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ?
|
|
1071
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? jsxRuntime.jsx(Checkbox__default["default"].Group, _extends({
|
|
1015
1072
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1016
1073
|
name: id,
|
|
1017
1074
|
onChange: !readonly ? handleChange : undefined,
|
|
1018
1075
|
value: selectedIndexes
|
|
1019
1076
|
}, extraProps, {
|
|
1020
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1077
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1078
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
1079
|
+
return jsxRuntime.jsxs("span", {
|
|
1080
|
+
children: [jsxRuntime.jsx(Checkbox__default["default"], {
|
|
1081
|
+
id: utils.optionId(id, i),
|
|
1082
|
+
name: id,
|
|
1083
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1084
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1085
|
+
value: String(i),
|
|
1086
|
+
children: option.label
|
|
1087
|
+
}), !inline && jsxRuntime.jsx("br", {})]
|
|
1088
|
+
}, i);
|
|
1089
|
+
})
|
|
1031
1090
|
})) : null;
|
|
1032
1091
|
}
|
|
1033
1092
|
|
|
@@ -1067,22 +1126,23 @@
|
|
|
1067
1126
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1068
1127
|
onFocus: !readonly ? handleFocus : undefined
|
|
1069
1128
|
};
|
|
1070
|
-
return
|
|
1129
|
+
return jsxRuntime.jsx(Checkbox__default["default"], _extends({
|
|
1071
1130
|
autoFocus: autofocus,
|
|
1072
|
-
checked: typeof value ===
|
|
1131
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
1073
1132
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1074
1133
|
id: id,
|
|
1075
1134
|
name: id,
|
|
1076
1135
|
onChange: !readonly ? handleChange : undefined
|
|
1077
1136
|
}, extraProps, {
|
|
1078
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1079
|
-
|
|
1137
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1138
|
+
children: label
|
|
1139
|
+
}));
|
|
1080
1140
|
}
|
|
1081
1141
|
|
|
1082
1142
|
var DatePicker = /*#__PURE__*/generatePicker__default["default"](dayjsGenerateConfig__default["default"]);
|
|
1083
1143
|
|
|
1084
1144
|
var DATE_PICKER_STYLE$1 = {
|
|
1085
|
-
width:
|
|
1145
|
+
width: '100%'
|
|
1086
1146
|
};
|
|
1087
1147
|
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
1088
1148
|
* the value to/from utc using the appropriate utility functions.
|
|
@@ -1113,7 +1173,7 @@
|
|
|
1113
1173
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1114
1174
|
return node.parentNode;
|
|
1115
1175
|
};
|
|
1116
|
-
return
|
|
1176
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1117
1177
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1118
1178
|
getPopupContainer: getPopupContainer,
|
|
1119
1179
|
id: id,
|
|
@@ -1130,7 +1190,7 @@
|
|
|
1130
1190
|
}
|
|
1131
1191
|
|
|
1132
1192
|
var DATE_PICKER_STYLE = {
|
|
1133
|
-
width:
|
|
1193
|
+
width: '100%'
|
|
1134
1194
|
};
|
|
1135
1195
|
/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms
|
|
1136
1196
|
* the value to undefined when it is falsy during the `onChange` handling.
|
|
@@ -1150,7 +1210,7 @@
|
|
|
1150
1210
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1151
1211
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1152
1212
|
var handleChange = function handleChange(nextValue) {
|
|
1153
|
-
return onChange(nextValue && nextValue.format(
|
|
1213
|
+
return onChange(nextValue && nextValue.format('YYYY-MM-DD'));
|
|
1154
1214
|
};
|
|
1155
1215
|
var handleBlur = function handleBlur() {
|
|
1156
1216
|
return onBlur(id, value);
|
|
@@ -1161,7 +1221,7 @@
|
|
|
1161
1221
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1162
1222
|
return node.parentNode;
|
|
1163
1223
|
};
|
|
1164
|
-
return
|
|
1224
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1165
1225
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1166
1226
|
getPopupContainer: getPopupContainer,
|
|
1167
1227
|
id: id,
|
|
@@ -1194,10 +1254,10 @@
|
|
|
1194
1254
|
value = props.value;
|
|
1195
1255
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1196
1256
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1197
|
-
var emptyValue = options.emptyValue ||
|
|
1257
|
+
var emptyValue = options.emptyValue || '';
|
|
1198
1258
|
var handleChange = function handleChange(_ref) {
|
|
1199
1259
|
var target = _ref.target;
|
|
1200
|
-
return onChange(target.value ===
|
|
1260
|
+
return onChange(target.value === '' ? emptyValue : target.value);
|
|
1201
1261
|
};
|
|
1202
1262
|
var handleBlur = function handleBlur(_ref2) {
|
|
1203
1263
|
var target = _ref2.target;
|
|
@@ -1207,7 +1267,7 @@
|
|
|
1207
1267
|
var target = _ref3.target;
|
|
1208
1268
|
return onFocus(id, target.value);
|
|
1209
1269
|
};
|
|
1210
|
-
return
|
|
1270
|
+
return jsxRuntime.jsx(Input__default["default"].Password, {
|
|
1211
1271
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1212
1272
|
id: id,
|
|
1213
1273
|
name: id,
|
|
@@ -1215,7 +1275,7 @@
|
|
|
1215
1275
|
onChange: !readonly ? handleChange : undefined,
|
|
1216
1276
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1217
1277
|
placeholder: placeholder,
|
|
1218
|
-
value: value ||
|
|
1278
|
+
value: value || '',
|
|
1219
1279
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1220
1280
|
});
|
|
1221
1281
|
}
|
|
@@ -1254,7 +1314,7 @@
|
|
|
1254
1314
|
return onFocus(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1255
1315
|
};
|
|
1256
1316
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
1257
|
-
return
|
|
1317
|
+
return jsxRuntime.jsx(Radio__default["default"].Group, {
|
|
1258
1318
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1259
1319
|
id: id,
|
|
1260
1320
|
name: id,
|
|
@@ -1262,17 +1322,18 @@
|
|
|
1262
1322
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1263
1323
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1264
1324
|
value: selectedIndexes,
|
|
1265
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1325
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1326
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
1327
|
+
return jsxRuntime.jsx(Radio__default["default"], {
|
|
1328
|
+
id: utils.optionId(id, i),
|
|
1329
|
+
name: id,
|
|
1330
|
+
autoFocus: i === 0 ? autofocus : false,
|
|
1331
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1332
|
+
value: String(i),
|
|
1333
|
+
children: option.label
|
|
1334
|
+
}, i);
|
|
1335
|
+
})
|
|
1336
|
+
});
|
|
1276
1337
|
}
|
|
1277
1338
|
|
|
1278
1339
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -1299,9 +1360,9 @@
|
|
|
1299
1360
|
min = _rangeSpec.min,
|
|
1300
1361
|
max = _rangeSpec.max,
|
|
1301
1362
|
step = _rangeSpec.step;
|
|
1302
|
-
var emptyValue = options.emptyValue ||
|
|
1363
|
+
var emptyValue = options.emptyValue || '';
|
|
1303
1364
|
var handleChange = function handleChange(nextValue) {
|
|
1304
|
-
return onChange(nextValue ===
|
|
1365
|
+
return onChange(nextValue === '' ? emptyValue : nextValue);
|
|
1305
1366
|
};
|
|
1306
1367
|
var handleBlur = function handleBlur() {
|
|
1307
1368
|
return onBlur(id, value);
|
|
@@ -1316,7 +1377,7 @@
|
|
|
1316
1377
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1317
1378
|
onFocus: !readonly ? handleFocus : undefined
|
|
1318
1379
|
};
|
|
1319
|
-
return
|
|
1380
|
+
return jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
1320
1381
|
autoFocus: autofocus,
|
|
1321
1382
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1322
1383
|
id: id,
|
|
@@ -1332,7 +1393,7 @@
|
|
|
1332
1393
|
}
|
|
1333
1394
|
|
|
1334
1395
|
var SELECT_STYLE = {
|
|
1335
|
-
width:
|
|
1396
|
+
width: '100%'
|
|
1336
1397
|
};
|
|
1337
1398
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
1338
1399
|
* It is typically used with string properties constrained with enum options.
|
|
@@ -1383,12 +1444,12 @@
|
|
|
1383
1444
|
var extraProps = {
|
|
1384
1445
|
name: id
|
|
1385
1446
|
};
|
|
1386
|
-
return
|
|
1447
|
+
return jsxRuntime.jsx(Select__default["default"], _extends({
|
|
1387
1448
|
autoFocus: autofocus,
|
|
1388
1449
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1389
1450
|
getPopupContainer: getPopupContainer,
|
|
1390
1451
|
id: id,
|
|
1391
|
-
mode: typeof multiple !==
|
|
1452
|
+
mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
|
|
1392
1453
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1393
1454
|
onChange: !readonly ? handleChange : undefined,
|
|
1394
1455
|
onFocus: !readonly ? handleFocus : undefined,
|
|
@@ -1397,20 +1458,21 @@
|
|
|
1397
1458
|
value: selectedIndexes
|
|
1398
1459
|
}, extraProps, {
|
|
1399
1460
|
filterOption: filterOption,
|
|
1400
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1461
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1462
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (_ref2, index) {
|
|
1463
|
+
var optionValue = _ref2.value,
|
|
1464
|
+
optionLabel = _ref2.label;
|
|
1465
|
+
return jsxRuntime.jsx(Select__default["default"].Option, {
|
|
1466
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
1467
|
+
value: String(index),
|
|
1468
|
+
children: optionLabel
|
|
1469
|
+
}, String(index));
|
|
1470
|
+
})
|
|
1409
1471
|
}));
|
|
1410
1472
|
}
|
|
1411
1473
|
|
|
1412
1474
|
var INPUT_STYLE = {
|
|
1413
|
-
width:
|
|
1475
|
+
width: '100%'
|
|
1414
1476
|
};
|
|
1415
1477
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
1416
1478
|
*
|
|
@@ -1431,7 +1493,7 @@
|
|
|
1431
1493
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1432
1494
|
var handleChange = function handleChange(_ref2) {
|
|
1433
1495
|
var target = _ref2.target;
|
|
1434
|
-
return onChange(target.value ===
|
|
1496
|
+
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
1435
1497
|
};
|
|
1436
1498
|
var handleBlur = function handleBlur(_ref3) {
|
|
1437
1499
|
var target = _ref3.target;
|
|
@@ -1444,9 +1506,9 @@
|
|
|
1444
1506
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1445
1507
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1446
1508
|
var extraProps = {
|
|
1447
|
-
type:
|
|
1509
|
+
type: 'textarea'
|
|
1448
1510
|
};
|
|
1449
|
-
return
|
|
1511
|
+
return jsxRuntime.jsx(Input__default["default"].TextArea, _extends({
|
|
1450
1512
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1451
1513
|
id: id,
|
|
1452
1514
|
name: id,
|