@rjsf/antd 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +183 -183
- package/dist/antd.cjs.development.js +436 -383
- package/dist/antd.cjs.development.js.map +1 -1
- package/dist/antd.cjs.production.min.js +1 -1
- package/dist/antd.cjs.production.min.js.map +1 -1
- package/dist/antd.esm.js +434 -380
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +438 -386
- package/dist/antd.umd.development.js.map +1 -1
- package/dist/antd.umd.production.min.js +1 -1
- package/dist/antd.umd.production.min.js.map +1 -1
- package/package.json +5 -5
|
@@ -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`
|
|
@@ -314,71 +328,74 @@
|
|
|
314
328
|
registry = _ref.registry;
|
|
315
329
|
var translateString = registry.translateString;
|
|
316
330
|
var renderErrors = function renderErrors() {
|
|
317
|
-
return
|
|
318
|
-
className:
|
|
319
|
-
size:
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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
|
+
});
|
|
325
342
|
};
|
|
326
|
-
return
|
|
327
|
-
className:
|
|
343
|
+
return jsxRuntime.jsx(Alert__default["default"], {
|
|
344
|
+
className: 'panel panel-danger errors',
|
|
328
345
|
description: renderErrors(),
|
|
329
346
|
message: translateString(utils.TranslatableString.ErrorsLabel),
|
|
330
|
-
type:
|
|
347
|
+
type: 'error'
|
|
331
348
|
});
|
|
332
349
|
}
|
|
333
350
|
|
|
334
351
|
var _excluded = ["iconType", "icon", "uiSchema", "registry"];
|
|
335
352
|
function IconButton(props) {
|
|
336
353
|
var _props$iconType = props.iconType,
|
|
337
|
-
iconType = _props$iconType === void 0 ?
|
|
354
|
+
iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
|
|
338
355
|
icon = props.icon,
|
|
339
356
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
340
|
-
return
|
|
357
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
341
358
|
type: iconType,
|
|
342
359
|
icon: icon
|
|
343
360
|
}, otherProps));
|
|
344
361
|
}
|
|
345
362
|
function AddButton(props) {
|
|
346
363
|
var translateString = props.registry.translateString;
|
|
347
|
-
return
|
|
364
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
348
365
|
title: translateString(utils.TranslatableString.AddItemButton)
|
|
349
366
|
}, props, {
|
|
350
367
|
block: true,
|
|
351
|
-
iconType:
|
|
352
|
-
icon:
|
|
368
|
+
iconType: 'primary',
|
|
369
|
+
icon: jsxRuntime.jsx(PlusCircleOutlined__default["default"], {})
|
|
353
370
|
}));
|
|
354
371
|
}
|
|
355
372
|
function MoveDownButton(props) {
|
|
356
373
|
var translateString = props.registry.translateString;
|
|
357
|
-
return
|
|
374
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
358
375
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
359
376
|
}, props, {
|
|
360
|
-
icon:
|
|
377
|
+
icon: jsxRuntime.jsx(ArrowDownOutlined__default["default"], {})
|
|
361
378
|
}));
|
|
362
379
|
}
|
|
363
380
|
function MoveUpButton(props) {
|
|
364
381
|
var translateString = props.registry.translateString;
|
|
365
|
-
return
|
|
382
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
366
383
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
367
384
|
}, props, {
|
|
368
|
-
icon:
|
|
385
|
+
icon: jsxRuntime.jsx(ArrowUpOutlined__default["default"], {})
|
|
369
386
|
}));
|
|
370
387
|
}
|
|
371
388
|
function RemoveButton(props) {
|
|
372
389
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
|
|
373
390
|
var options = utils.getUiOptions(props.uiSchema);
|
|
374
391
|
var translateString = props.registry.translateString;
|
|
375
|
-
return
|
|
392
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
376
393
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
377
394
|
}, props, {
|
|
378
395
|
danger: true,
|
|
379
396
|
block: !!options.block,
|
|
380
|
-
iconType:
|
|
381
|
-
icon:
|
|
397
|
+
iconType: 'primary',
|
|
398
|
+
icon: jsxRuntime.jsx(DeleteOutlined__default["default"], {})
|
|
382
399
|
}));
|
|
383
400
|
}
|
|
384
401
|
|
|
@@ -394,13 +411,14 @@
|
|
|
394
411
|
return null;
|
|
395
412
|
}
|
|
396
413
|
var id = utils.errorId(idSchema);
|
|
397
|
-
return
|
|
398
|
-
id: id
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
+
});
|
|
404
422
|
}
|
|
405
423
|
|
|
406
424
|
var VERTICAL_LABEL_COL$1 = {
|
|
@@ -444,13 +462,14 @@
|
|
|
444
462
|
wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
|
|
445
463
|
wrapperStyle = formContext.wrapperStyle;
|
|
446
464
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
447
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
465
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
448
466
|
if (hidden) {
|
|
449
|
-
return
|
|
450
|
-
className:
|
|
451
|
-
|
|
467
|
+
return jsxRuntime.jsx("div", {
|
|
468
|
+
className: 'field-hidden',
|
|
469
|
+
children: children
|
|
470
|
+
});
|
|
452
471
|
}
|
|
453
|
-
return
|
|
472
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
454
473
|
classNames: classNames,
|
|
455
474
|
style: style,
|
|
456
475
|
disabled: disabled,
|
|
@@ -462,24 +481,26 @@
|
|
|
462
481
|
required: required,
|
|
463
482
|
schema: schema,
|
|
464
483
|
uiSchema: uiSchema,
|
|
465
|
-
registry: registry
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
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
|
+
});
|
|
479
500
|
}
|
|
480
501
|
|
|
481
502
|
var DESCRIPTION_COL_STYLE = {
|
|
482
|
-
paddingBottom:
|
|
503
|
+
paddingBottom: '8px'
|
|
483
504
|
};
|
|
484
505
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
485
506
|
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
@@ -502,14 +523,14 @@
|
|
|
502
523
|
title = props.title,
|
|
503
524
|
uiSchema = props.uiSchema;
|
|
504
525
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
505
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
506
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
526
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
527
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
507
528
|
// Button templates are not overridden in the uiSchema
|
|
508
529
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
509
530
|
var _formContext$colSpan = formContext.colSpan,
|
|
510
531
|
colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
|
|
511
532
|
_formContext$labelAli = formContext.labelAlign,
|
|
512
|
-
labelAlign = _formContext$labelAli === void 0 ?
|
|
533
|
+
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
513
534
|
_formContext$rowGutte = formContext.rowGutter,
|
|
514
535
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
515
536
|
var findSchema = function findSchema(element) {
|
|
@@ -533,7 +554,7 @@
|
|
|
533
554
|
var widget = findUiSchemaWidget(element);
|
|
534
555
|
var defaultColSpan = properties.length < 2 ||
|
|
535
556
|
// Single or no field in object.
|
|
536
|
-
type ===
|
|
557
|
+
type === 'object' || type === 'array' || widget === 'textarea' ? 24 : 12;
|
|
537
558
|
if (isObject__default["default"](colSpan)) {
|
|
538
559
|
var colSpanObj = colSpan;
|
|
539
560
|
if (isString__default["default"](widget)) {
|
|
@@ -551,58 +572,67 @@
|
|
|
551
572
|
}
|
|
552
573
|
return defaultColSpan;
|
|
553
574
|
};
|
|
554
|
-
return
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
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
|
+
);
|
|
561
583
|
|
|
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
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
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
|
+
}
|
|
606
636
|
});
|
|
607
637
|
}
|
|
608
638
|
|
|
@@ -617,11 +647,12 @@
|
|
|
617
647
|
if (norender) {
|
|
618
648
|
return null;
|
|
619
649
|
}
|
|
620
|
-
return
|
|
621
|
-
type:
|
|
650
|
+
return jsxRuntime.jsx(Button__default["default"], _extends({
|
|
651
|
+
type: 'submit'
|
|
622
652
|
}, submitButtonProps, {
|
|
623
|
-
htmlType:
|
|
624
|
-
|
|
653
|
+
htmlType: 'submit',
|
|
654
|
+
children: submitText
|
|
655
|
+
}));
|
|
625
656
|
}
|
|
626
657
|
|
|
627
658
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -637,8 +668,8 @@
|
|
|
637
668
|
var _formContext$colon = formContext.colon,
|
|
638
669
|
colon = _formContext$colon === void 0 ? true : _formContext$colon;
|
|
639
670
|
var labelChildren = title;
|
|
640
|
-
if (colon && typeof title ===
|
|
641
|
-
labelChildren = title.replace(/[::]\s*$/,
|
|
671
|
+
if (colon && typeof title === 'string' && title.trim() !== '') {
|
|
672
|
+
labelChildren = title.replace(/[::]\s*$/, '');
|
|
642
673
|
}
|
|
643
674
|
var handleLabelClick = function handleLabelClick() {
|
|
644
675
|
if (!id) {
|
|
@@ -649,17 +680,20 @@
|
|
|
649
680
|
control.focus();
|
|
650
681
|
}
|
|
651
682
|
};
|
|
652
|
-
return title ?
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
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
|
+
}
|
|
663
697
|
}) : null;
|
|
664
698
|
}
|
|
665
699
|
|
|
@@ -670,7 +704,7 @@
|
|
|
670
704
|
span: 24
|
|
671
705
|
};
|
|
672
706
|
var INPUT_STYLE$1 = {
|
|
673
|
-
width:
|
|
707
|
+
width: '100%'
|
|
674
708
|
};
|
|
675
709
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
676
710
|
* part of an `additionalProperties` part of a schema.
|
|
@@ -701,7 +735,7 @@
|
|
|
701
735
|
_registry$formContext4 = _registry$formContext.rowGutter,
|
|
702
736
|
rowGutter = _registry$formContext4 === void 0 ? 24 : _registry$formContext4,
|
|
703
737
|
_registry$formContext5 = _registry$formContext.toolbarAlign,
|
|
704
|
-
toolbarAlign = _registry$formContext5 === void 0 ?
|
|
738
|
+
toolbarAlign = _registry$formContext5 === void 0 ? 'top' : _registry$formContext5,
|
|
705
739
|
_registry$formContext6 = _registry$formContext.wrapperCol,
|
|
706
740
|
wrapperCol = _registry$formContext6 === void 0 ? VERTICAL_WRAPPER_COL : _registry$formContext6,
|
|
707
741
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
@@ -712,10 +746,11 @@
|
|
|
712
746
|
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
713
747
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
714
748
|
if (!additional) {
|
|
715
|
-
return
|
|
749
|
+
return jsxRuntime.jsx("div", {
|
|
716
750
|
className: classNames,
|
|
717
|
-
style: style
|
|
718
|
-
|
|
751
|
+
style: style,
|
|
752
|
+
children: children
|
|
753
|
+
});
|
|
719
754
|
}
|
|
720
755
|
var handleBlur = function handleBlur(_ref) {
|
|
721
756
|
var target = _ref.target;
|
|
@@ -726,48 +761,55 @@
|
|
|
726
761
|
var buttonUiOptions = _extends({}, uiSchema, (_extends2 = {}, _extends2[utils.UI_OPTIONS_KEY] = _extends({}, uiOptions, {
|
|
727
762
|
block: true
|
|
728
763
|
}), _extends2));
|
|
729
|
-
return
|
|
764
|
+
return jsxRuntime.jsx("div", {
|
|
730
765
|
className: classNames,
|
|
731
|
-
style: style
|
|
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
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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
|
+
});
|
|
771
813
|
}
|
|
772
814
|
|
|
773
815
|
function generateTemplates() {
|
|
@@ -819,29 +861,29 @@
|
|
|
819
861
|
minute = state.minute,
|
|
820
862
|
second = state.second;
|
|
821
863
|
var data = [{
|
|
822
|
-
type:
|
|
864
|
+
type: 'year',
|
|
823
865
|
range: yearsRange,
|
|
824
866
|
value: year
|
|
825
867
|
}, {
|
|
826
|
-
type:
|
|
868
|
+
type: 'month',
|
|
827
869
|
range: [1, 12],
|
|
828
870
|
value: month
|
|
829
871
|
}, {
|
|
830
|
-
type:
|
|
872
|
+
type: 'day',
|
|
831
873
|
range: [1, 31],
|
|
832
874
|
value: day
|
|
833
875
|
}];
|
|
834
876
|
if (time) {
|
|
835
877
|
data.push({
|
|
836
|
-
type:
|
|
878
|
+
type: 'hour',
|
|
837
879
|
range: [0, 23],
|
|
838
880
|
value: hour || -1
|
|
839
881
|
}, {
|
|
840
|
-
type:
|
|
882
|
+
type: 'minute',
|
|
841
883
|
range: [0, 59],
|
|
842
884
|
value: minute || -1
|
|
843
885
|
}, {
|
|
844
|
-
type:
|
|
886
|
+
type: 'second',
|
|
845
887
|
range: [0, 59],
|
|
846
888
|
value: second || -1
|
|
847
889
|
});
|
|
@@ -866,15 +908,15 @@
|
|
|
866
908
|
var SelectWidget = widgets.SelectWidget;
|
|
867
909
|
var _formContext$rowGutte = formContext.rowGutter,
|
|
868
910
|
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
869
|
-
var _useState =
|
|
911
|
+
var _useState = react.useState(utils.parseDateString(value, showTime)),
|
|
870
912
|
state = _useState[0],
|
|
871
913
|
setState = _useState[1];
|
|
872
|
-
|
|
914
|
+
react.useEffect(function () {
|
|
873
915
|
setState(utils.parseDateString(value, showTime));
|
|
874
916
|
}, [showTime, value]);
|
|
875
917
|
var handleChange = function handleChange(property, nextValue) {
|
|
876
918
|
var _extends2;
|
|
877
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
919
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
878
920
|
if (readyForChange(nextState)) {
|
|
879
921
|
onChange(utils.toDateString(nextState, showTime));
|
|
880
922
|
} else {
|
|
@@ -897,9 +939,9 @@
|
|
|
897
939
|
onChange(undefined);
|
|
898
940
|
};
|
|
899
941
|
var renderDateElement = function renderDateElement(elemProps) {
|
|
900
|
-
return
|
|
942
|
+
return jsxRuntime.jsx(SelectWidget, {
|
|
901
943
|
autofocus: elemProps.autofocus,
|
|
902
|
-
className:
|
|
944
|
+
className: 'form-control',
|
|
903
945
|
disabled: elemProps.disabled,
|
|
904
946
|
id: elemProps.id,
|
|
905
947
|
name: elemProps.name,
|
|
@@ -914,51 +956,56 @@
|
|
|
914
956
|
placeholder: elemProps.type,
|
|
915
957
|
readonly: elemProps.readonly,
|
|
916
958
|
schema: {
|
|
917
|
-
type:
|
|
959
|
+
type: 'integer'
|
|
918
960
|
},
|
|
919
961
|
value: elemProps.value,
|
|
920
962
|
registry: registry,
|
|
921
|
-
label:
|
|
963
|
+
label: '',
|
|
922
964
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
923
965
|
});
|
|
924
966
|
};
|
|
925
|
-
return
|
|
926
|
-
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
|
|
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
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
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
|
+
});
|
|
962
1009
|
}
|
|
963
1010
|
AltDateWidget.defaultProps = {
|
|
964
1011
|
autofocus: false,
|
|
@@ -972,7 +1019,7 @@
|
|
|
972
1019
|
|
|
973
1020
|
function AltDateTimeWidget(props) {
|
|
974
1021
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
975
|
-
return
|
|
1022
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({
|
|
976
1023
|
showTime: true
|
|
977
1024
|
}, props));
|
|
978
1025
|
}
|
|
@@ -1021,23 +1068,25 @@
|
|
|
1021
1068
|
onFocus: !readonly ? handleFocus : undefined
|
|
1022
1069
|
};
|
|
1023
1070
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
1024
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ?
|
|
1071
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? jsxRuntime.jsx(Checkbox__default["default"].Group, _extends({
|
|
1025
1072
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1026
1073
|
name: id,
|
|
1027
1074
|
onChange: !readonly ? handleChange : undefined,
|
|
1028
1075
|
value: selectedIndexes
|
|
1029
1076
|
}, extraProps, {
|
|
1030
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
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
|
+
})
|
|
1041
1090
|
})) : null;
|
|
1042
1091
|
}
|
|
1043
1092
|
|
|
@@ -1077,22 +1126,23 @@
|
|
|
1077
1126
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1078
1127
|
onFocus: !readonly ? handleFocus : undefined
|
|
1079
1128
|
};
|
|
1080
|
-
return
|
|
1129
|
+
return jsxRuntime.jsx(Checkbox__default["default"], _extends({
|
|
1081
1130
|
autoFocus: autofocus,
|
|
1082
|
-
checked: typeof value ===
|
|
1131
|
+
checked: typeof value === 'undefined' ? false : value,
|
|
1083
1132
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1084
1133
|
id: id,
|
|
1085
1134
|
name: id,
|
|
1086
1135
|
onChange: !readonly ? handleChange : undefined
|
|
1087
1136
|
}, extraProps, {
|
|
1088
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1089
|
-
|
|
1137
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1138
|
+
children: label
|
|
1139
|
+
}));
|
|
1090
1140
|
}
|
|
1091
1141
|
|
|
1092
1142
|
var DatePicker = /*#__PURE__*/generatePicker__default["default"](dayjsGenerateConfig__default["default"]);
|
|
1093
1143
|
|
|
1094
1144
|
var DATE_PICKER_STYLE$1 = {
|
|
1095
|
-
width:
|
|
1145
|
+
width: '100%'
|
|
1096
1146
|
};
|
|
1097
1147
|
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
1098
1148
|
* the value to/from utc using the appropriate utility functions.
|
|
@@ -1123,7 +1173,7 @@
|
|
|
1123
1173
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1124
1174
|
return node.parentNode;
|
|
1125
1175
|
};
|
|
1126
|
-
return
|
|
1176
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1127
1177
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1128
1178
|
getPopupContainer: getPopupContainer,
|
|
1129
1179
|
id: id,
|
|
@@ -1140,7 +1190,7 @@
|
|
|
1140
1190
|
}
|
|
1141
1191
|
|
|
1142
1192
|
var DATE_PICKER_STYLE = {
|
|
1143
|
-
width:
|
|
1193
|
+
width: '100%'
|
|
1144
1194
|
};
|
|
1145
1195
|
/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms
|
|
1146
1196
|
* the value to undefined when it is falsy during the `onChange` handling.
|
|
@@ -1160,7 +1210,7 @@
|
|
|
1160
1210
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1161
1211
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1162
1212
|
var handleChange = function handleChange(nextValue) {
|
|
1163
|
-
return onChange(nextValue && nextValue.format(
|
|
1213
|
+
return onChange(nextValue && nextValue.format('YYYY-MM-DD'));
|
|
1164
1214
|
};
|
|
1165
1215
|
var handleBlur = function handleBlur() {
|
|
1166
1216
|
return onBlur(id, value);
|
|
@@ -1171,7 +1221,7 @@
|
|
|
1171
1221
|
var getPopupContainer = function getPopupContainer(node) {
|
|
1172
1222
|
return node.parentNode;
|
|
1173
1223
|
};
|
|
1174
|
-
return
|
|
1224
|
+
return jsxRuntime.jsx(DatePicker, {
|
|
1175
1225
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1176
1226
|
getPopupContainer: getPopupContainer,
|
|
1177
1227
|
id: id,
|
|
@@ -1204,10 +1254,10 @@
|
|
|
1204
1254
|
value = props.value;
|
|
1205
1255
|
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1206
1256
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1207
|
-
var emptyValue = options.emptyValue ||
|
|
1257
|
+
var emptyValue = options.emptyValue || '';
|
|
1208
1258
|
var handleChange = function handleChange(_ref) {
|
|
1209
1259
|
var target = _ref.target;
|
|
1210
|
-
return onChange(target.value ===
|
|
1260
|
+
return onChange(target.value === '' ? emptyValue : target.value);
|
|
1211
1261
|
};
|
|
1212
1262
|
var handleBlur = function handleBlur(_ref2) {
|
|
1213
1263
|
var target = _ref2.target;
|
|
@@ -1217,7 +1267,7 @@
|
|
|
1217
1267
|
var target = _ref3.target;
|
|
1218
1268
|
return onFocus(id, target.value);
|
|
1219
1269
|
};
|
|
1220
|
-
return
|
|
1270
|
+
return jsxRuntime.jsx(Input__default["default"].Password, {
|
|
1221
1271
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1222
1272
|
id: id,
|
|
1223
1273
|
name: id,
|
|
@@ -1225,7 +1275,7 @@
|
|
|
1225
1275
|
onChange: !readonly ? handleChange : undefined,
|
|
1226
1276
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1227
1277
|
placeholder: placeholder,
|
|
1228
|
-
value: value ||
|
|
1278
|
+
value: value || '',
|
|
1229
1279
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1230
1280
|
});
|
|
1231
1281
|
}
|
|
@@ -1264,7 +1314,7 @@
|
|
|
1264
1314
|
return onFocus(id, utils.enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1265
1315
|
};
|
|
1266
1316
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
1267
|
-
return
|
|
1317
|
+
return jsxRuntime.jsx(Radio__default["default"].Group, {
|
|
1268
1318
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1269
1319
|
id: id,
|
|
1270
1320
|
name: id,
|
|
@@ -1272,17 +1322,18 @@
|
|
|
1272
1322
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1273
1323
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1274
1324
|
value: selectedIndexes,
|
|
1275
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
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
|
+
});
|
|
1286
1337
|
}
|
|
1287
1338
|
|
|
1288
1339
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -1309,9 +1360,9 @@
|
|
|
1309
1360
|
min = _rangeSpec.min,
|
|
1310
1361
|
max = _rangeSpec.max,
|
|
1311
1362
|
step = _rangeSpec.step;
|
|
1312
|
-
var emptyValue = options.emptyValue ||
|
|
1363
|
+
var emptyValue = options.emptyValue || '';
|
|
1313
1364
|
var handleChange = function handleChange(nextValue) {
|
|
1314
|
-
return onChange(nextValue ===
|
|
1365
|
+
return onChange(nextValue === '' ? emptyValue : nextValue);
|
|
1315
1366
|
};
|
|
1316
1367
|
var handleBlur = function handleBlur() {
|
|
1317
1368
|
return onBlur(id, value);
|
|
@@ -1326,7 +1377,7 @@
|
|
|
1326
1377
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1327
1378
|
onFocus: !readonly ? handleFocus : undefined
|
|
1328
1379
|
};
|
|
1329
|
-
return
|
|
1380
|
+
return jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
1330
1381
|
autoFocus: autofocus,
|
|
1331
1382
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1332
1383
|
id: id,
|
|
@@ -1342,7 +1393,7 @@
|
|
|
1342
1393
|
}
|
|
1343
1394
|
|
|
1344
1395
|
var SELECT_STYLE = {
|
|
1345
|
-
width:
|
|
1396
|
+
width: '100%'
|
|
1346
1397
|
};
|
|
1347
1398
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
1348
1399
|
* It is typically used with string properties constrained with enum options.
|
|
@@ -1393,12 +1444,12 @@
|
|
|
1393
1444
|
var extraProps = {
|
|
1394
1445
|
name: id
|
|
1395
1446
|
};
|
|
1396
|
-
return
|
|
1447
|
+
return jsxRuntime.jsx(Select__default["default"], _extends({
|
|
1397
1448
|
autoFocus: autofocus,
|
|
1398
1449
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1399
1450
|
getPopupContainer: getPopupContainer,
|
|
1400
1451
|
id: id,
|
|
1401
|
-
mode: typeof multiple !==
|
|
1452
|
+
mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
|
|
1402
1453
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1403
1454
|
onChange: !readonly ? handleChange : undefined,
|
|
1404
1455
|
onFocus: !readonly ? handleFocus : undefined,
|
|
@@ -1407,20 +1458,21 @@
|
|
|
1407
1458
|
value: selectedIndexes
|
|
1408
1459
|
}, extraProps, {
|
|
1409
1460
|
filterOption: filterOption,
|
|
1410
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
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
|
+
})
|
|
1419
1471
|
}));
|
|
1420
1472
|
}
|
|
1421
1473
|
|
|
1422
1474
|
var INPUT_STYLE = {
|
|
1423
|
-
width:
|
|
1475
|
+
width: '100%'
|
|
1424
1476
|
};
|
|
1425
1477
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
1426
1478
|
*
|
|
@@ -1441,7 +1493,7 @@
|
|
|
1441
1493
|
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1442
1494
|
var handleChange = function handleChange(_ref2) {
|
|
1443
1495
|
var target = _ref2.target;
|
|
1444
|
-
return onChange(target.value ===
|
|
1496
|
+
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
1445
1497
|
};
|
|
1446
1498
|
var handleBlur = function handleBlur(_ref3) {
|
|
1447
1499
|
var target = _ref3.target;
|
|
@@ -1454,9 +1506,9 @@
|
|
|
1454
1506
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1455
1507
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1456
1508
|
var extraProps = {
|
|
1457
|
-
type:
|
|
1509
|
+
type: 'textarea'
|
|
1458
1510
|
};
|
|
1459
|
-
return
|
|
1511
|
+
return jsxRuntime.jsx(Input__default["default"].TextArea, _extends({
|
|
1460
1512
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1461
1513
|
id: id,
|
|
1462
1514
|
name: id,
|