@rjsf/antd 4.2.2 → 5.0.0-beta.2
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/README.md +2 -2
- package/dist/antd.cjs.development.js +1037 -1343
- 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 +962 -1293
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +1017 -1347
- 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/dist/components/DatePicker/index.d.ts +15 -22
- package/dist/index.d.ts +29 -27
- package/dist/templates/{ArrayFieldTemplate/ArrayFieldTemplateItem.d.ts → ArrayFieldItemTemplate/index.d.ts} +6 -5
- package/dist/templates/ArrayFieldTemplate/index.d.ts +2 -27
- package/dist/{widgets/TextWidget → templates/BaseInputTemplate}/index.d.ts +2 -1
- package/dist/{fields → templates}/DescriptionField/index.d.ts +0 -0
- package/dist/{ErrorList.d.ts → templates/ErrorList/index.d.ts} +0 -0
- package/dist/templates/FieldTemplate/WrapIfAdditional.d.ts +2 -1
- package/dist/templates/IconButton/index.d.ts +5 -0
- package/dist/templates/ObjectFieldTemplate/index.d.ts +1 -1
- package/dist/{widgets/SubmitButton/SubmitButton.d.ts → templates/SubmitButton/index.d.ts} +0 -0
- package/dist/templates/TitleField/index.d.ts +2 -0
- package/dist/widgets/AltDateTimeWidget/index.d.ts +1 -1
- package/dist/widgets/AltDateWidget/index.d.ts +9 -9
- package/dist/widgets/SelectWidget/index.d.ts +2 -2
- package/package.json +53 -45
- package/dist/fields/TitleField/index.d.ts +0 -2
- package/dist/templates/ArrayFieldTemplate/FixedArrayFieldTemplate.d.ts +0 -2
- package/dist/templates/ArrayFieldTemplate/NormalArrayFieldTemplate.d.ts +0 -2
- package/dist/widgets/ColorWidget/index.d.ts +0 -12
- package/dist/widgets/EmailWidget/index.d.ts +0 -13
- package/dist/widgets/SubmitButton/index.d.ts +0 -2
- package/dist/widgets/URLWidget/index.d.ts +0 -13
- package/dist/widgets/UpDownWidget/index.d.ts +0 -12
|
@@ -2,38 +2,125 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
5
|
var core = require('@rjsf/core');
|
|
8
6
|
var React = require('react');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
7
|
+
var Button = require('antd/lib/button');
|
|
8
|
+
var Col = require('antd/lib/col');
|
|
9
|
+
var Row = require('antd/lib/row');
|
|
10
|
+
var utils = require('@rjsf/utils');
|
|
11
|
+
var classNames = require('classnames');
|
|
11
12
|
var context = require('antd/lib/config-provider/context');
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
var Input = require('antd/lib/input');
|
|
14
|
+
var InputNumber = require('antd/lib/input-number');
|
|
15
|
+
var Alert = require('antd/lib/alert');
|
|
16
|
+
var List = require('antd/lib/list');
|
|
17
|
+
var Space = require('antd/lib/space');
|
|
18
|
+
var ExclamationCircleOutlined = require('@ant-design/icons/ExclamationCircleOutlined');
|
|
19
|
+
var ArrowDownOutlined = require('@ant-design/icons/ArrowDownOutlined');
|
|
20
|
+
var ArrowUpOutlined = require('@ant-design/icons/ArrowUpOutlined');
|
|
21
|
+
var DeleteOutlined = require('@ant-design/icons/DeleteOutlined');
|
|
22
|
+
var PlusCircleOutlined = require('@ant-design/icons/PlusCircleOutlined');
|
|
23
|
+
var Form$1 = require('antd/lib/form');
|
|
24
|
+
var isObject = require('lodash/isObject');
|
|
25
|
+
var isNumber = require('lodash/isNumber');
|
|
26
|
+
var Checkbox = require('antd/lib/checkbox');
|
|
27
|
+
var dayjs = require('dayjs');
|
|
28
|
+
var dayjsGenerateConfig = require('rc-picker/lib/generate/dayjs');
|
|
29
|
+
var generatePicker = require('antd/lib/date-picker/generatePicker');
|
|
30
|
+
var Radio = require('antd/lib/radio');
|
|
31
|
+
var Slider = require('antd/lib/slider');
|
|
32
|
+
var Select = require('antd/lib/select');
|
|
33
|
+
|
|
34
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
35
|
+
|
|
36
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
37
|
+
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
38
|
+
var Col__default = /*#__PURE__*/_interopDefaultLegacy(Col);
|
|
39
|
+
var Row__default = /*#__PURE__*/_interopDefaultLegacy(Row);
|
|
40
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
41
|
+
var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
|
|
42
|
+
var InputNumber__default = /*#__PURE__*/_interopDefaultLegacy(InputNumber);
|
|
43
|
+
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
|
44
|
+
var List__default = /*#__PURE__*/_interopDefaultLegacy(List);
|
|
45
|
+
var Space__default = /*#__PURE__*/_interopDefaultLegacy(Space);
|
|
46
|
+
var ExclamationCircleOutlined__default = /*#__PURE__*/_interopDefaultLegacy(ExclamationCircleOutlined);
|
|
47
|
+
var ArrowDownOutlined__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDownOutlined);
|
|
48
|
+
var ArrowUpOutlined__default = /*#__PURE__*/_interopDefaultLegacy(ArrowUpOutlined);
|
|
49
|
+
var DeleteOutlined__default = /*#__PURE__*/_interopDefaultLegacy(DeleteOutlined);
|
|
50
|
+
var PlusCircleOutlined__default = /*#__PURE__*/_interopDefaultLegacy(PlusCircleOutlined);
|
|
51
|
+
var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form$1);
|
|
52
|
+
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
53
|
+
var isNumber__default = /*#__PURE__*/_interopDefaultLegacy(isNumber);
|
|
54
|
+
var Checkbox__default = /*#__PURE__*/_interopDefaultLegacy(Checkbox);
|
|
55
|
+
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
56
|
+
var dayjsGenerateConfig__default = /*#__PURE__*/_interopDefaultLegacy(dayjsGenerateConfig);
|
|
57
|
+
var generatePicker__default = /*#__PURE__*/_interopDefaultLegacy(generatePicker);
|
|
58
|
+
var Radio__default = /*#__PURE__*/_interopDefaultLegacy(Radio);
|
|
59
|
+
var Slider__default = /*#__PURE__*/_interopDefaultLegacy(Slider);
|
|
60
|
+
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
61
|
+
|
|
62
|
+
const BTN_GRP_STYLE = {
|
|
63
|
+
width: "100%"
|
|
64
|
+
};
|
|
65
|
+
const BTN_STYLE = {
|
|
66
|
+
width: "calc(100% / 3)"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const ArrayFieldItemTemplate = _ref => {
|
|
70
|
+
let {
|
|
71
|
+
children,
|
|
72
|
+
disabled,
|
|
73
|
+
formContext,
|
|
74
|
+
hasMoveDown,
|
|
75
|
+
hasMoveUp,
|
|
76
|
+
hasRemove,
|
|
77
|
+
hasToolbar,
|
|
78
|
+
index,
|
|
79
|
+
onDropIndexClick,
|
|
80
|
+
onReorderClick,
|
|
81
|
+
readonly,
|
|
82
|
+
registry
|
|
83
|
+
} = _ref;
|
|
84
|
+
const {
|
|
85
|
+
MoveDownButton,
|
|
86
|
+
MoveUpButton,
|
|
87
|
+
RemoveButton
|
|
88
|
+
} = registry.templates.ButtonTemplates;
|
|
89
|
+
const {
|
|
90
|
+
rowGutter = 24,
|
|
91
|
+
toolbarAlign = "top"
|
|
92
|
+
} = formContext;
|
|
93
|
+
return /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
|
|
94
|
+
align: toolbarAlign,
|
|
95
|
+
key: "array-item-" + index,
|
|
96
|
+
gutter: rowGutter
|
|
97
|
+
}, /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
98
|
+
flex: "1"
|
|
99
|
+
}, children), hasToolbar && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
100
|
+
flex: "192px"
|
|
101
|
+
}, /*#__PURE__*/React__default["default"].createElement(Button__default["default"].Group, {
|
|
102
|
+
style: BTN_GRP_STYLE
|
|
103
|
+
}, (hasMoveUp || hasMoveDown) && /*#__PURE__*/React__default["default"].createElement(MoveUpButton, {
|
|
104
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
105
|
+
onClick: onReorderClick(index, index - 1),
|
|
106
|
+
style: BTN_STYLE
|
|
107
|
+
}), (hasMoveUp || hasMoveDown) && /*#__PURE__*/React__default["default"].createElement(MoveDownButton, {
|
|
108
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
109
|
+
onClick: onReorderClick(index, index + 1),
|
|
110
|
+
style: BTN_STYLE
|
|
111
|
+
}), hasRemove && /*#__PURE__*/React__default["default"].createElement(RemoveButton, {
|
|
112
|
+
disabled: disabled || readonly,
|
|
113
|
+
onClick: onDropIndexClick(index),
|
|
114
|
+
style: BTN_STYLE
|
|
115
|
+
}))));
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
ArrayFieldItemTemplate.defaultProps = {
|
|
119
|
+
formContext: {}
|
|
120
|
+
};
|
|
34
121
|
|
|
35
122
|
function _extends() {
|
|
36
|
-
_extends = Object.assign
|
|
123
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
37
124
|
for (var i = 1; i < arguments.length; i++) {
|
|
38
125
|
var source = arguments[i];
|
|
39
126
|
|
|
@@ -46,139 +133,312 @@ function _extends() {
|
|
|
46
133
|
|
|
47
134
|
return target;
|
|
48
135
|
};
|
|
49
|
-
|
|
50
136
|
return _extends.apply(this, arguments);
|
|
51
137
|
}
|
|
52
138
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var sourceKeys = Object.keys(source);
|
|
57
|
-
var key, i;
|
|
139
|
+
const DESCRIPTION_COL_STYLE$1 = {
|
|
140
|
+
paddingBottom: "8px"
|
|
141
|
+
};
|
|
58
142
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
143
|
+
const ArrayFieldTemplate = _ref => {
|
|
144
|
+
let {
|
|
145
|
+
canAdd,
|
|
146
|
+
className,
|
|
147
|
+
disabled,
|
|
148
|
+
formContext,
|
|
149
|
+
// formData,
|
|
150
|
+
idSchema,
|
|
151
|
+
items,
|
|
152
|
+
onAddClick,
|
|
153
|
+
prefixCls,
|
|
154
|
+
readonly,
|
|
155
|
+
registry,
|
|
156
|
+
required,
|
|
157
|
+
schema,
|
|
158
|
+
title,
|
|
159
|
+
uiSchema
|
|
160
|
+
} = _ref;
|
|
161
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
162
|
+
const ArrayFieldDescriptionTemplate = utils.getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
|
|
163
|
+
const ArrayFieldItemTemplate = utils.getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
164
|
+
const ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
|
|
165
|
+
|
|
166
|
+
const {
|
|
167
|
+
ButtonTemplates: {
|
|
168
|
+
AddButton
|
|
169
|
+
}
|
|
170
|
+
} = registry.templates;
|
|
171
|
+
const {
|
|
172
|
+
labelAlign = "right",
|
|
173
|
+
rowGutter = 24
|
|
174
|
+
} = formContext;
|
|
175
|
+
const labelClsBasic = prefixCls + "-item-label";
|
|
176
|
+
const labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === "left" && labelClsBasic + "-left" // labelCol.className,
|
|
177
|
+
);
|
|
178
|
+
return /*#__PURE__*/React__default["default"].createElement("fieldset", {
|
|
179
|
+
className: className,
|
|
180
|
+
id: idSchema.$id
|
|
181
|
+
}, /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
|
|
182
|
+
gutter: rowGutter
|
|
183
|
+
}, (uiOptions.title || title) && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
184
|
+
className: labelColClassName,
|
|
185
|
+
span: 24
|
|
186
|
+
}, /*#__PURE__*/React__default["default"].createElement(ArrayFieldTitleTemplate, {
|
|
187
|
+
idSchema: idSchema,
|
|
188
|
+
required: required,
|
|
189
|
+
title: uiOptions.title || title,
|
|
190
|
+
uiSchema: uiSchema,
|
|
191
|
+
registry: registry
|
|
192
|
+
})), (uiOptions.description || schema.description) && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
193
|
+
span: 24,
|
|
194
|
+
style: DESCRIPTION_COL_STYLE$1
|
|
195
|
+
}, /*#__PURE__*/React__default["default"].createElement(ArrayFieldDescriptionTemplate, {
|
|
196
|
+
description: uiOptions.description || schema.description,
|
|
197
|
+
idSchema: idSchema,
|
|
198
|
+
uiSchema: uiSchema,
|
|
199
|
+
registry: registry
|
|
200
|
+
})), /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
201
|
+
className: "row array-item-list",
|
|
202
|
+
span: 24
|
|
203
|
+
}, items && items.map(itemProps => /*#__PURE__*/React__default["default"].createElement(ArrayFieldItemTemplate, _extends({}, itemProps, {
|
|
204
|
+
formContext: formContext
|
|
205
|
+
})))), canAdd && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
206
|
+
span: 24
|
|
207
|
+
}, /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
|
|
208
|
+
gutter: rowGutter,
|
|
209
|
+
justify: "end"
|
|
210
|
+
}, /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
211
|
+
flex: "192px"
|
|
212
|
+
}, /*#__PURE__*/React__default["default"].createElement(AddButton, {
|
|
213
|
+
className: "array-item-add",
|
|
214
|
+
disabled: disabled || readonly,
|
|
215
|
+
onClick: onAddClick
|
|
216
|
+
}))))));
|
|
217
|
+
};
|
|
64
218
|
|
|
65
|
-
|
|
66
|
-
|
|
219
|
+
var ArrayFieldTemplate$1 = /*#__PURE__*/context.withConfigConsumer({
|
|
220
|
+
prefixCls: "form"
|
|
221
|
+
})(ArrayFieldTemplate);
|
|
67
222
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
id = _ref.id;
|
|
71
|
-
return /*#__PURE__*/React__default.createElement("span", {
|
|
72
|
-
id: id
|
|
73
|
-
}, description);
|
|
223
|
+
const INPUT_STYLE$2 = {
|
|
224
|
+
width: "100%"
|
|
74
225
|
};
|
|
75
226
|
|
|
76
|
-
|
|
77
|
-
|
|
227
|
+
const TextWidget = _ref => {
|
|
228
|
+
let {
|
|
229
|
+
// autofocus,
|
|
230
|
+
disabled,
|
|
231
|
+
formContext,
|
|
232
|
+
id,
|
|
233
|
+
// label,
|
|
234
|
+
onBlur,
|
|
235
|
+
onChange,
|
|
236
|
+
onFocus,
|
|
237
|
+
options,
|
|
238
|
+
placeholder,
|
|
239
|
+
readonly,
|
|
240
|
+
// required,
|
|
241
|
+
schema,
|
|
242
|
+
value,
|
|
243
|
+
type
|
|
244
|
+
} = _ref;
|
|
245
|
+
const inputProps = utils.getInputProps(schema, type, options, false);
|
|
246
|
+
const {
|
|
247
|
+
readonlyAsDisabled = true
|
|
248
|
+
} = formContext;
|
|
249
|
+
|
|
250
|
+
const handleNumberChange = nextValue => onChange(nextValue);
|
|
251
|
+
|
|
252
|
+
const handleTextChange = _ref2 => {
|
|
253
|
+
let {
|
|
254
|
+
target
|
|
255
|
+
} = _ref2;
|
|
256
|
+
return onChange(target.value === "" ? options.emptyValue : target.value);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const handleBlur = _ref3 => {
|
|
260
|
+
let {
|
|
261
|
+
target
|
|
262
|
+
} = _ref3;
|
|
263
|
+
return onBlur(id, target.value);
|
|
264
|
+
};
|
|
78
265
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
colon = _formContext$colon === void 0 ? true : _formContext$colon;
|
|
86
|
-
var labelChildren = title;
|
|
266
|
+
const handleFocus = _ref4 => {
|
|
267
|
+
let {
|
|
268
|
+
target
|
|
269
|
+
} = _ref4;
|
|
270
|
+
return onFocus(id, target.value);
|
|
271
|
+
};
|
|
87
272
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
273
|
+
return inputProps.type === "number" || inputProps.type === "integer" ? /*#__PURE__*/React__default["default"].createElement(InputNumber__default["default"], _extends({
|
|
274
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
275
|
+
id: id,
|
|
276
|
+
name: id,
|
|
277
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
278
|
+
onChange: !readonly ? handleNumberChange : undefined,
|
|
279
|
+
onFocus: !readonly ? handleFocus : undefined,
|
|
280
|
+
placeholder: placeholder,
|
|
281
|
+
style: INPUT_STYLE$2
|
|
282
|
+
}, inputProps, {
|
|
283
|
+
value: value
|
|
284
|
+
})) : /*#__PURE__*/React__default["default"].createElement(Input__default["default"], _extends({
|
|
285
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
286
|
+
id: id,
|
|
287
|
+
name: id,
|
|
288
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
289
|
+
onChange: !readonly ? handleTextChange : undefined,
|
|
290
|
+
onFocus: !readonly ? handleFocus : undefined,
|
|
291
|
+
placeholder: placeholder,
|
|
292
|
+
style: INPUT_STYLE$2
|
|
293
|
+
}, inputProps, {
|
|
294
|
+
value: value
|
|
295
|
+
}));
|
|
296
|
+
};
|
|
91
297
|
|
|
92
|
-
|
|
298
|
+
const DescriptionField = _ref => {
|
|
299
|
+
let {
|
|
300
|
+
description,
|
|
301
|
+
id // registry,
|
|
93
302
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
303
|
+
} = _ref;
|
|
304
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
305
|
+
id: id
|
|
306
|
+
}, description);
|
|
307
|
+
};
|
|
98
308
|
|
|
99
|
-
|
|
309
|
+
const ErrorList = _ref => {
|
|
310
|
+
let {
|
|
311
|
+
// errorSchema,
|
|
312
|
+
errors // formContext,
|
|
313
|
+
// schema,
|
|
314
|
+
// uiSchema,
|
|
100
315
|
|
|
101
|
-
|
|
102
|
-
control.focus();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
316
|
+
} = _ref;
|
|
105
317
|
|
|
106
|
-
|
|
107
|
-
className:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
};
|
|
318
|
+
const renderErrors = () => /*#__PURE__*/React__default["default"].createElement(List__default["default"], {
|
|
319
|
+
className: "list-group",
|
|
320
|
+
size: "small"
|
|
321
|
+
}, errors.map((error, index) => /*#__PURE__*/React__default["default"].createElement(List__default["default"].Item, {
|
|
322
|
+
key: index
|
|
323
|
+
}, /*#__PURE__*/React__default["default"].createElement(Space__default["default"], null, /*#__PURE__*/React__default["default"].createElement(ExclamationCircleOutlined__default["default"], null), error.stack))));
|
|
113
324
|
|
|
114
|
-
|
|
115
|
-
|
|
325
|
+
return /*#__PURE__*/React__default["default"].createElement(Alert__default["default"], {
|
|
326
|
+
className: "panel panel-danger errors",
|
|
327
|
+
description: renderErrors(),
|
|
328
|
+
message: "Errors",
|
|
329
|
+
type: "error"
|
|
330
|
+
});
|
|
116
331
|
};
|
|
117
|
-
var TitleField$1 = /*#__PURE__*/context.withConfigConsumer({
|
|
118
|
-
prefixCls: 'form'
|
|
119
|
-
})(TitleField);
|
|
120
332
|
|
|
121
|
-
|
|
122
|
-
|
|
333
|
+
function IconButton(props) {
|
|
334
|
+
const {
|
|
335
|
+
iconType = "default",
|
|
336
|
+
icon,
|
|
337
|
+
...otherProps
|
|
338
|
+
} = props;
|
|
339
|
+
return /*#__PURE__*/React__default["default"].createElement(Button__default["default"], _extends({
|
|
340
|
+
type: iconType,
|
|
341
|
+
icon: icon
|
|
342
|
+
}, otherProps));
|
|
343
|
+
}
|
|
344
|
+
function AddButton(props) {
|
|
345
|
+
return /*#__PURE__*/React__default["default"].createElement(IconButton, _extends({
|
|
346
|
+
title: "Add Item"
|
|
347
|
+
}, props, {
|
|
348
|
+
block: true,
|
|
349
|
+
iconType: "primary",
|
|
350
|
+
icon: /*#__PURE__*/React__default["default"].createElement(PlusCircleOutlined__default["default"], null)
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
function MoveDownButton(props) {
|
|
354
|
+
return /*#__PURE__*/React__default["default"].createElement(IconButton, _extends({
|
|
355
|
+
title: "Move down"
|
|
356
|
+
}, props, {
|
|
357
|
+
icon: /*#__PURE__*/React__default["default"].createElement(ArrowDownOutlined__default["default"], null)
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
function MoveUpButton(props) {
|
|
361
|
+
return /*#__PURE__*/React__default["default"].createElement(IconButton, _extends({
|
|
362
|
+
title: "Move up"
|
|
363
|
+
}, props, {
|
|
364
|
+
icon: /*#__PURE__*/React__default["default"].createElement(ArrowUpOutlined__default["default"], null)
|
|
365
|
+
}));
|
|
366
|
+
}
|
|
367
|
+
function RemoveButton(props) {
|
|
368
|
+
return /*#__PURE__*/React__default["default"].createElement(IconButton, _extends({
|
|
369
|
+
title: "Remove"
|
|
370
|
+
}, props, {
|
|
371
|
+
danger: true,
|
|
372
|
+
iconType: "primary",
|
|
373
|
+
icon: /*#__PURE__*/React__default["default"].createElement(DeleteOutlined__default["default"], null)
|
|
374
|
+
}));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const VERTICAL_LABEL_COL$1 = {
|
|
123
378
|
span: 24
|
|
124
379
|
};
|
|
125
|
-
|
|
380
|
+
const VERTICAL_WRAPPER_COL$1 = {
|
|
126
381
|
span: 24
|
|
127
382
|
};
|
|
128
|
-
|
|
129
|
-
width:
|
|
383
|
+
const INPUT_STYLE$1 = {
|
|
384
|
+
width: "100%"
|
|
130
385
|
};
|
|
131
386
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
387
|
+
const WrapIfAdditional = _ref => {
|
|
388
|
+
let {
|
|
389
|
+
children,
|
|
390
|
+
classNames,
|
|
391
|
+
disabled,
|
|
392
|
+
formContext,
|
|
393
|
+
id,
|
|
394
|
+
label,
|
|
395
|
+
onDropPropertyClick,
|
|
396
|
+
onKeyChange,
|
|
397
|
+
readonly,
|
|
398
|
+
required,
|
|
399
|
+
registry,
|
|
400
|
+
schema
|
|
401
|
+
} = _ref;
|
|
402
|
+
const {
|
|
403
|
+
colon,
|
|
404
|
+
labelCol = VERTICAL_LABEL_COL$1,
|
|
405
|
+
readonlyAsDisabled = true,
|
|
406
|
+
rowGutter = 24,
|
|
407
|
+
toolbarAlign = "top",
|
|
408
|
+
wrapperCol = VERTICAL_WRAPPER_COL$1,
|
|
409
|
+
wrapperStyle
|
|
410
|
+
} = formContext;
|
|
411
|
+
const {
|
|
412
|
+
RemoveButton
|
|
413
|
+
} = registry.templates.ButtonTemplates;
|
|
414
|
+
const keyLabel = label + " Key"; // i18n ?
|
|
415
|
+
|
|
416
|
+
const additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
159
417
|
|
|
160
418
|
if (!additional) {
|
|
161
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
419
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
162
420
|
className: classNames
|
|
163
421
|
}, children);
|
|
164
422
|
}
|
|
165
423
|
|
|
166
|
-
|
|
167
|
-
|
|
424
|
+
const handleBlur = _ref2 => {
|
|
425
|
+
let {
|
|
426
|
+
target
|
|
427
|
+
} = _ref2;
|
|
168
428
|
return onKeyChange(target.value);
|
|
169
429
|
};
|
|
170
430
|
|
|
171
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
431
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
172
432
|
className: classNames
|
|
173
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
433
|
+
}, /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
|
|
174
434
|
align: toolbarAlign,
|
|
175
435
|
gutter: rowGutter
|
|
176
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
436
|
+
}, /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
177
437
|
className: "form-additional",
|
|
178
438
|
flex: "1"
|
|
179
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
439
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
180
440
|
className: "form-group"
|
|
181
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
441
|
+
}, /*#__PURE__*/React__default["default"].createElement(Form__default["default"].Item, {
|
|
182
442
|
colon: colon,
|
|
183
443
|
className: "form-group",
|
|
184
444
|
hasFeedback: true,
|
|
@@ -188,78 +448,76 @@ var WrapIfAdditional = function WrapIfAdditional(_ref) {
|
|
|
188
448
|
required: required,
|
|
189
449
|
style: wrapperStyle,
|
|
190
450
|
wrapperCol: wrapperCol
|
|
191
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
451
|
+
}, /*#__PURE__*/React__default["default"].createElement(Input__default["default"], {
|
|
192
452
|
className: "form-control",
|
|
193
453
|
defaultValue: label,
|
|
194
454
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
195
455
|
id: id + "-key",
|
|
196
456
|
name: id + "-key",
|
|
197
457
|
onBlur: !readonly ? handleBlur : undefined,
|
|
198
|
-
style: INPUT_STYLE,
|
|
458
|
+
style: INPUT_STYLE$1,
|
|
199
459
|
type: "text"
|
|
200
|
-
})))), /*#__PURE__*/React__default.createElement(
|
|
460
|
+
})))), /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
201
461
|
className: "form-additional",
|
|
202
462
|
flex: "1"
|
|
203
|
-
}, children), /*#__PURE__*/React__default.createElement(
|
|
463
|
+
}, children), /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
204
464
|
flex: "192px"
|
|
205
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
465
|
+
}, /*#__PURE__*/React__default["default"].createElement(RemoveButton, {
|
|
206
466
|
block: true,
|
|
207
467
|
className: "array-item-remove",
|
|
208
|
-
danger: true,
|
|
209
468
|
disabled: disabled || readonly,
|
|
210
|
-
|
|
211
|
-
onClick: onDropPropertyClick(label),
|
|
212
|
-
type: "primary"
|
|
469
|
+
onClick: onDropPropertyClick(label)
|
|
213
470
|
}))));
|
|
214
471
|
};
|
|
215
472
|
|
|
216
|
-
|
|
473
|
+
const VERTICAL_LABEL_COL = {
|
|
217
474
|
span: 24
|
|
218
475
|
};
|
|
219
|
-
|
|
476
|
+
const VERTICAL_WRAPPER_COL = {
|
|
220
477
|
span: 24
|
|
221
478
|
};
|
|
222
479
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
480
|
+
const FieldTemplate = _ref => {
|
|
481
|
+
let {
|
|
482
|
+
children,
|
|
483
|
+
classNames,
|
|
484
|
+
description,
|
|
485
|
+
disabled,
|
|
486
|
+
displayLabel,
|
|
487
|
+
// errors,
|
|
488
|
+
formContext,
|
|
489
|
+
help,
|
|
490
|
+
hidden,
|
|
491
|
+
id,
|
|
492
|
+
label,
|
|
493
|
+
onDropPropertyClick,
|
|
494
|
+
onKeyChange,
|
|
495
|
+
rawErrors,
|
|
496
|
+
rawHelp,
|
|
497
|
+
readonly,
|
|
498
|
+
registry,
|
|
499
|
+
required,
|
|
500
|
+
schema // uiSchema,
|
|
501
|
+
|
|
502
|
+
} = _ref;
|
|
503
|
+
const {
|
|
504
|
+
colon,
|
|
505
|
+
labelCol = VERTICAL_LABEL_COL,
|
|
506
|
+
wrapperCol = VERTICAL_WRAPPER_COL,
|
|
507
|
+
wrapperStyle
|
|
508
|
+
} = formContext;
|
|
247
509
|
|
|
248
510
|
if (hidden) {
|
|
249
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
511
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
250
512
|
className: "field-hidden"
|
|
251
513
|
}, children);
|
|
252
514
|
}
|
|
253
515
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
key: "field-" + id + "-error-" + error
|
|
258
|
-
}, error);
|
|
259
|
-
});
|
|
260
|
-
};
|
|
516
|
+
const renderFieldErrors = () => [...new Set(rawErrors)].map(error => /*#__PURE__*/React__default["default"].createElement("div", {
|
|
517
|
+
key: "field-" + id + "-error-" + error
|
|
518
|
+
}, error));
|
|
261
519
|
|
|
262
|
-
return /*#__PURE__*/React__default.createElement(WrapIfAdditional, {
|
|
520
|
+
return /*#__PURE__*/React__default["default"].createElement(WrapIfAdditional, {
|
|
263
521
|
classNames: classNames,
|
|
264
522
|
disabled: disabled,
|
|
265
523
|
formContext: formContext,
|
|
@@ -269,569 +527,271 @@ var FieldTemplate = function FieldTemplate(_ref) {
|
|
|
269
527
|
onKeyChange: onKeyChange,
|
|
270
528
|
readonly: readonly,
|
|
271
529
|
required: required,
|
|
272
|
-
schema: schema
|
|
273
|
-
|
|
530
|
+
schema: schema,
|
|
531
|
+
registry: registry
|
|
532
|
+
}, id === "root" ? children : /*#__PURE__*/React__default["default"].createElement(Form__default["default"].Item, {
|
|
274
533
|
colon: colon,
|
|
275
534
|
extra: description,
|
|
276
|
-
hasFeedback: schema.type !==
|
|
535
|
+
hasFeedback: schema.type !== "array" && schema.type !== "object",
|
|
277
536
|
help: !!rawHelp && help || !!rawErrors && renderFieldErrors(),
|
|
278
537
|
htmlFor: id,
|
|
279
538
|
label: displayLabel && label,
|
|
280
539
|
labelCol: labelCol,
|
|
281
540
|
required: required,
|
|
282
541
|
style: wrapperStyle,
|
|
283
|
-
validateStatus: rawErrors ?
|
|
542
|
+
validateStatus: rawErrors ? "error" : undefined,
|
|
284
543
|
wrapperCol: wrapperCol
|
|
285
544
|
}, children));
|
|
286
545
|
};
|
|
287
546
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
paddingBottom: '8px'
|
|
547
|
+
const DESCRIPTION_COL_STYLE = {
|
|
548
|
+
paddingBottom: "8px"
|
|
291
549
|
};
|
|
292
550
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
551
|
+
const ObjectFieldTemplate = _ref => {
|
|
552
|
+
let {
|
|
553
|
+
description,
|
|
554
|
+
disabled,
|
|
555
|
+
formContext,
|
|
556
|
+
formData,
|
|
557
|
+
idSchema,
|
|
558
|
+
onAddClick,
|
|
559
|
+
prefixCls,
|
|
560
|
+
properties,
|
|
561
|
+
readonly,
|
|
562
|
+
required,
|
|
563
|
+
registry,
|
|
564
|
+
schema,
|
|
565
|
+
title,
|
|
566
|
+
uiSchema
|
|
567
|
+
} = _ref;
|
|
568
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
569
|
+
const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
|
|
570
|
+
const DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
|
|
571
|
+
|
|
572
|
+
const {
|
|
573
|
+
ButtonTemplates: {
|
|
574
|
+
AddButton
|
|
575
|
+
}
|
|
576
|
+
} = registry.templates;
|
|
577
|
+
const {
|
|
578
|
+
colSpan = 24,
|
|
579
|
+
labelAlign = "right",
|
|
580
|
+
rowGutter = 24
|
|
581
|
+
} = formContext;
|
|
582
|
+
const labelClsBasic = prefixCls + "-item-label";
|
|
583
|
+
const labelColClassName = classNames__default["default"](labelClsBasic, labelAlign === "left" && labelClsBasic + "-left" // labelCol.className,
|
|
317
584
|
);
|
|
318
585
|
|
|
319
|
-
|
|
320
|
-
return element.content.props.schema;
|
|
321
|
-
};
|
|
586
|
+
const findSchema = element => element.content.props.schema;
|
|
322
587
|
|
|
323
|
-
|
|
324
|
-
return findSchema(element).type;
|
|
325
|
-
};
|
|
588
|
+
const findSchemaType = element => findSchema(element).type;
|
|
326
589
|
|
|
327
|
-
|
|
328
|
-
return element.content.props.uiSchema;
|
|
329
|
-
};
|
|
590
|
+
const findUiSchema = element => element.content.props.uiSchema;
|
|
330
591
|
|
|
331
|
-
|
|
332
|
-
return findUiSchema(element)['ui:field'];
|
|
333
|
-
};
|
|
592
|
+
const findUiSchemaField = element => utils.getUiOptions(findUiSchema(element)).field;
|
|
334
593
|
|
|
335
|
-
|
|
336
|
-
return findUiSchema(element)['ui:widget'];
|
|
337
|
-
};
|
|
594
|
+
const findUiSchemaWidget = element => utils.getUiOptions(findUiSchema(element)).widget;
|
|
338
595
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
type ===
|
|
596
|
+
const calculateColSpan = element => {
|
|
597
|
+
const type = findSchemaType(element);
|
|
598
|
+
const field = findUiSchemaField(element);
|
|
599
|
+
const widget = findUiSchemaWidget(element);
|
|
600
|
+
const defaultColSpan = properties.length < 2 || // Single or no field in object.
|
|
601
|
+
type === "object" || type === "array" || widget === "textarea" ? 24 : 12;
|
|
345
602
|
|
|
346
|
-
if (
|
|
603
|
+
if (isObject__default["default"](colSpan)) {
|
|
347
604
|
return colSpan[widget] || colSpan[field] || colSpan[type] || defaultColSpan;
|
|
348
605
|
}
|
|
349
606
|
|
|
350
|
-
if (
|
|
607
|
+
if (isNumber__default["default"](colSpan)) {
|
|
351
608
|
return colSpan;
|
|
352
609
|
}
|
|
353
610
|
|
|
354
611
|
return defaultColSpan;
|
|
355
612
|
};
|
|
356
613
|
|
|
357
|
-
return /*#__PURE__*/React__default.createElement("fieldset", {
|
|
614
|
+
return /*#__PURE__*/React__default["default"].createElement("fieldset", {
|
|
358
615
|
id: idSchema.$id
|
|
359
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
616
|
+
}, /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
|
|
360
617
|
gutter: rowGutter
|
|
361
|
-
},
|
|
618
|
+
}, uiOptions.title !== false && (uiOptions.title || title) && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
362
619
|
className: labelColClassName,
|
|
363
620
|
span: 24
|
|
364
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
621
|
+
}, /*#__PURE__*/React__default["default"].createElement(TitleFieldTemplate, {
|
|
365
622
|
id: idSchema.$id + "-title",
|
|
366
623
|
required: required,
|
|
367
|
-
title:
|
|
368
|
-
|
|
624
|
+
title: uiOptions.title || title,
|
|
625
|
+
uiSchema: uiSchema,
|
|
626
|
+
registry: registry
|
|
627
|
+
})), uiOptions.description !== false && (uiOptions.description || description) && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
369
628
|
span: 24,
|
|
370
629
|
style: DESCRIPTION_COL_STYLE
|
|
371
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
372
|
-
description:
|
|
373
|
-
id: idSchema.$id + "-description"
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
span: calculateColSpan(element)
|
|
380
|
-
}, element.content);
|
|
381
|
-
})), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React__default.createElement(Col, {
|
|
630
|
+
}, /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
|
|
631
|
+
description: uiOptions.description || description,
|
|
632
|
+
id: idSchema.$id + "-description",
|
|
633
|
+
registry: registry
|
|
634
|
+
})), properties.filter(e => !e.hidden).map(element => /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
635
|
+
key: element.name,
|
|
636
|
+
span: calculateColSpan(element)
|
|
637
|
+
}, element.content))), utils.canExpand(schema, uiSchema, formData) && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
382
638
|
span: 24
|
|
383
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
639
|
+
}, /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
|
|
384
640
|
gutter: rowGutter,
|
|
385
641
|
justify: "end"
|
|
386
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
642
|
+
}, /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
387
643
|
flex: "192px"
|
|
388
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
389
|
-
block: true,
|
|
644
|
+
}, /*#__PURE__*/React__default["default"].createElement(AddButton, {
|
|
390
645
|
className: "object-property-expand",
|
|
391
646
|
disabled: disabled || readonly,
|
|
392
|
-
onClick: onAddClick(schema)
|
|
393
|
-
|
|
394
|
-
}, /*#__PURE__*/React__default.createElement(PlusCircleOutlined, null), " Add Item")))));
|
|
647
|
+
onClick: onAddClick(schema)
|
|
648
|
+
})))));
|
|
395
649
|
};
|
|
396
650
|
|
|
397
651
|
var ObjectFieldTemplate$1 = /*#__PURE__*/context.withConfigConsumer({
|
|
398
|
-
prefixCls:
|
|
652
|
+
prefixCls: "form"
|
|
399
653
|
})(ObjectFieldTemplate);
|
|
400
654
|
|
|
401
|
-
var
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
disabled = _ref.disabled,
|
|
411
|
-
formContext = _ref.formContext,
|
|
412
|
-
hasMoveDown = _ref.hasMoveDown,
|
|
413
|
-
hasMoveUp = _ref.hasMoveUp,
|
|
414
|
-
hasRemove = _ref.hasRemove,
|
|
415
|
-
hasToolbar = _ref.hasToolbar,
|
|
416
|
-
index = _ref.index,
|
|
417
|
-
onDropIndexClick = _ref.onDropIndexClick,
|
|
418
|
-
onReorderClick = _ref.onReorderClick,
|
|
419
|
-
readonly = _ref.readonly;
|
|
420
|
-
var _formContext$rowGutte = formContext.rowGutter,
|
|
421
|
-
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte,
|
|
422
|
-
_formContext$toolbarA = formContext.toolbarAlign,
|
|
423
|
-
toolbarAlign = _formContext$toolbarA === void 0 ? 'top' : _formContext$toolbarA;
|
|
424
|
-
return /*#__PURE__*/React__default.createElement(Row, {
|
|
425
|
-
align: toolbarAlign,
|
|
426
|
-
key: "array-item-" + index,
|
|
427
|
-
gutter: rowGutter
|
|
428
|
-
}, /*#__PURE__*/React__default.createElement(Col, {
|
|
429
|
-
flex: "1"
|
|
430
|
-
}, children), hasToolbar && /*#__PURE__*/React__default.createElement(Col, {
|
|
431
|
-
flex: "192px"
|
|
432
|
-
}, /*#__PURE__*/React__default.createElement(Button.Group, {
|
|
433
|
-
style: BTN_GRP_STYLE
|
|
434
|
-
}, (hasMoveUp || hasMoveDown) && /*#__PURE__*/React__default.createElement(Button, {
|
|
435
|
-
disabled: disabled || readonly || !hasMoveUp,
|
|
436
|
-
icon: /*#__PURE__*/React__default.createElement(ArrowUpOutlined, null),
|
|
437
|
-
onClick: onReorderClick(index, index - 1),
|
|
438
|
-
style: BTN_STYLE,
|
|
439
|
-
type: "default"
|
|
440
|
-
}), (hasMoveUp || hasMoveDown) && /*#__PURE__*/React__default.createElement(Button, {
|
|
441
|
-
disabled: disabled || readonly || !hasMoveDown,
|
|
442
|
-
icon: /*#__PURE__*/React__default.createElement(ArrowDownOutlined, null),
|
|
443
|
-
onClick: onReorderClick(index, index + 1),
|
|
444
|
-
style: BTN_STYLE,
|
|
445
|
-
type: "default"
|
|
446
|
-
}), hasRemove && /*#__PURE__*/React__default.createElement(Button, {
|
|
447
|
-
danger: true,
|
|
448
|
-
disabled: disabled || readonly,
|
|
449
|
-
icon: /*#__PURE__*/React__default.createElement(DeleteOutlined, null),
|
|
450
|
-
onClick: onDropIndexClick(index),
|
|
451
|
-
style: BTN_STYLE,
|
|
452
|
-
type: "primary"
|
|
453
|
-
}))));
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
ArrayFieldTemplateItem.defaultProps = {
|
|
457
|
-
formContext: {}
|
|
458
|
-
};
|
|
655
|
+
var SubmitButton = (_ref => {
|
|
656
|
+
let {
|
|
657
|
+
uiSchema
|
|
658
|
+
} = _ref;
|
|
659
|
+
const {
|
|
660
|
+
submitText,
|
|
661
|
+
norender,
|
|
662
|
+
props: submitButtonProps
|
|
663
|
+
} = utils.getSubmitButtonOptions(uiSchema);
|
|
459
664
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
665
|
+
if (norender) {
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
463
668
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
idSchema = _ref.idSchema,
|
|
471
|
-
items = _ref.items,
|
|
472
|
-
onAddClick = _ref.onAddClick,
|
|
473
|
-
prefixCls = _ref.prefixCls,
|
|
474
|
-
readonly = _ref.readonly,
|
|
475
|
-
required = _ref.required,
|
|
476
|
-
schema = _ref.schema,
|
|
477
|
-
title = _ref.title,
|
|
478
|
-
TitleField = _ref.TitleField,
|
|
479
|
-
uiSchema = _ref.uiSchema;
|
|
480
|
-
var _formContext$labelAli = formContext.labelAlign,
|
|
481
|
-
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
482
|
-
_formContext$rowGutte = formContext.rowGutter,
|
|
483
|
-
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
484
|
-
var labelClsBasic = prefixCls + "-item-label";
|
|
485
|
-
var labelColClassName = classNames(labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left" // labelCol.className,
|
|
486
|
-
);
|
|
487
|
-
return /*#__PURE__*/React__default.createElement("fieldset", {
|
|
488
|
-
className: className,
|
|
489
|
-
id: idSchema.$id
|
|
490
|
-
}, /*#__PURE__*/React__default.createElement(Row, {
|
|
491
|
-
gutter: rowGutter
|
|
492
|
-
}, title && /*#__PURE__*/React__default.createElement(Col, {
|
|
493
|
-
className: labelColClassName,
|
|
494
|
-
span: 24
|
|
495
|
-
}, /*#__PURE__*/React__default.createElement(TitleField, {
|
|
496
|
-
id: idSchema.$id + "__title",
|
|
497
|
-
key: "array-field-title-" + idSchema.$id,
|
|
498
|
-
required: required,
|
|
499
|
-
title: uiSchema['ui:title'] || title
|
|
500
|
-
})), (uiSchema['ui:description'] || schema.description) && /*#__PURE__*/React__default.createElement(Col, {
|
|
501
|
-
span: 24,
|
|
502
|
-
style: DESCRIPTION_COL_STYLE$1
|
|
503
|
-
}, /*#__PURE__*/React__default.createElement(DescriptionField, {
|
|
504
|
-
description: uiSchema['ui:description'] || schema.description,
|
|
505
|
-
id: idSchema.$id + "-description",
|
|
506
|
-
key: "array-field-description-" + idSchema.$id
|
|
507
|
-
})), /*#__PURE__*/React__default.createElement(Col, {
|
|
508
|
-
className: "row array-item-list",
|
|
509
|
-
span: 24
|
|
510
|
-
}, items && items.map(function (itemProps) {
|
|
511
|
-
return /*#__PURE__*/React__default.createElement(ArrayFieldTemplateItem, _extends({}, itemProps, {
|
|
512
|
-
formContext: formContext
|
|
513
|
-
}));
|
|
514
|
-
})), canAdd && /*#__PURE__*/React__default.createElement(Col, {
|
|
515
|
-
span: 24
|
|
516
|
-
}, /*#__PURE__*/React__default.createElement(Row, {
|
|
517
|
-
gutter: rowGutter,
|
|
518
|
-
justify: "end"
|
|
519
|
-
}, /*#__PURE__*/React__default.createElement(Col, {
|
|
520
|
-
flex: "192px"
|
|
521
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
522
|
-
block: true,
|
|
523
|
-
className: "array-item-add",
|
|
524
|
-
disabled: disabled || readonly,
|
|
525
|
-
onClick: onAddClick,
|
|
526
|
-
type: "primary"
|
|
527
|
-
}, /*#__PURE__*/React__default.createElement(PlusCircleOutlined, null), " Add Item"))))));
|
|
528
|
-
};
|
|
669
|
+
return /*#__PURE__*/React__default["default"].createElement(Button__default["default"], _extends({
|
|
670
|
+
type: "submit"
|
|
671
|
+
}, submitButtonProps, {
|
|
672
|
+
htmlType: "submit"
|
|
673
|
+
}), submitText);
|
|
674
|
+
});
|
|
529
675
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
676
|
+
const TitleField = _ref => {
|
|
677
|
+
let {
|
|
678
|
+
id,
|
|
679
|
+
prefixCls,
|
|
680
|
+
required,
|
|
681
|
+
registry,
|
|
682
|
+
title
|
|
683
|
+
} = _ref;
|
|
684
|
+
const {
|
|
685
|
+
formContext
|
|
686
|
+
} = registry;
|
|
687
|
+
const {
|
|
688
|
+
colon = true
|
|
689
|
+
} = formContext;
|
|
690
|
+
let labelChildren = title;
|
|
691
|
+
|
|
692
|
+
if (colon && typeof title === "string" && title.trim() !== "") {
|
|
693
|
+
labelChildren = title.replace(/[::]\s*$/, "");
|
|
694
|
+
}
|
|
533
695
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
696
|
+
const labelClassName = classNames__default["default"]({
|
|
697
|
+
[prefixCls + "-item-required"]: required,
|
|
698
|
+
[prefixCls + "-item-no-colon"]: !colon
|
|
699
|
+
});
|
|
537
700
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
disabled = _ref.disabled,
|
|
543
|
-
formContext = _ref.formContext,
|
|
544
|
-
idSchema = _ref.idSchema,
|
|
545
|
-
items = _ref.items,
|
|
546
|
-
onAddClick = _ref.onAddClick,
|
|
547
|
-
prefixCls = _ref.prefixCls,
|
|
548
|
-
readonly = _ref.readonly,
|
|
549
|
-
required = _ref.required,
|
|
550
|
-
schema = _ref.schema,
|
|
551
|
-
title = _ref.title,
|
|
552
|
-
TitleField = _ref.TitleField,
|
|
553
|
-
uiSchema = _ref.uiSchema;
|
|
554
|
-
var _formContext$labelAli = formContext.labelAlign,
|
|
555
|
-
labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
|
|
556
|
-
_formContext$rowGutte = formContext.rowGutter,
|
|
557
|
-
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
558
|
-
var labelClsBasic = prefixCls + "-item-label";
|
|
559
|
-
var labelColClassName = classNames(labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left" // labelCol.className,
|
|
560
|
-
);
|
|
561
|
-
return /*#__PURE__*/React__default.createElement("fieldset", {
|
|
562
|
-
className: className,
|
|
563
|
-
id: idSchema.$id
|
|
564
|
-
}, /*#__PURE__*/React__default.createElement(Row, {
|
|
565
|
-
gutter: rowGutter
|
|
566
|
-
}, title && /*#__PURE__*/React__default.createElement(Col, {
|
|
567
|
-
className: labelColClassName,
|
|
568
|
-
span: 24
|
|
569
|
-
}, /*#__PURE__*/React__default.createElement(TitleField, {
|
|
570
|
-
id: idSchema.$id + "__title",
|
|
571
|
-
key: "array-field-title-" + idSchema.$id,
|
|
572
|
-
required: required,
|
|
573
|
-
title: uiSchema['ui:title'] || title
|
|
574
|
-
})), (uiSchema['ui:description'] || schema.description) && /*#__PURE__*/React__default.createElement(Col, {
|
|
575
|
-
span: 24,
|
|
576
|
-
style: DESCRIPTION_COL_STYLE$2
|
|
577
|
-
}, /*#__PURE__*/React__default.createElement(DescriptionField, {
|
|
578
|
-
description: uiSchema['ui:description'] || schema.description,
|
|
579
|
-
id: idSchema.$id + "__description",
|
|
580
|
-
key: "array-field-description-" + idSchema.$id
|
|
581
|
-
})), /*#__PURE__*/React__default.createElement(Col, {
|
|
582
|
-
className: "row array-item-list",
|
|
583
|
-
span: 24
|
|
584
|
-
}, items && items.map(function (itemProps) {
|
|
585
|
-
return /*#__PURE__*/React__default.createElement(ArrayFieldTemplateItem, _extends({}, itemProps, {
|
|
586
|
-
formContext: formContext
|
|
587
|
-
}));
|
|
588
|
-
})), canAdd && /*#__PURE__*/React__default.createElement(Col, {
|
|
589
|
-
span: 24
|
|
590
|
-
}, /*#__PURE__*/React__default.createElement(Row, {
|
|
591
|
-
gutter: rowGutter,
|
|
592
|
-
justify: "end"
|
|
593
|
-
}, /*#__PURE__*/React__default.createElement(Col, {
|
|
594
|
-
flex: "192px"
|
|
595
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
596
|
-
block: true,
|
|
597
|
-
className: "array-item-add",
|
|
598
|
-
disabled: disabled || readonly,
|
|
599
|
-
onClick: onAddClick,
|
|
600
|
-
type: "primary"
|
|
601
|
-
}, /*#__PURE__*/React__default.createElement(PlusCircleOutlined, null), " Add Item"))))));
|
|
602
|
-
};
|
|
701
|
+
const handleLabelClick = () => {
|
|
702
|
+
if (!id) {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
603
705
|
|
|
604
|
-
|
|
605
|
-
prefixCls: 'form'
|
|
606
|
-
})(NormalArrayFieldTemplate);
|
|
607
|
-
|
|
608
|
-
var getUiOptions = core.utils.getUiOptions,
|
|
609
|
-
getWidget = core.utils.getWidget,
|
|
610
|
-
isFilesArray = core.utils.isFilesArray,
|
|
611
|
-
isFixedItems = core.utils.isFixedItems,
|
|
612
|
-
isMultiSelect = core.utils.isMultiSelect,
|
|
613
|
-
optionsList = core.utils.optionsList,
|
|
614
|
-
retrieveSchema = core.utils.retrieveSchema;
|
|
615
|
-
|
|
616
|
-
var ArrayFieldTemplate = function ArrayFieldTemplate(_ref) {
|
|
617
|
-
var DescriptionField = _ref.DescriptionField,
|
|
618
|
-
TitleField = _ref.TitleField,
|
|
619
|
-
autofocus = _ref.autofocus,
|
|
620
|
-
canAdd = _ref.canAdd,
|
|
621
|
-
className = _ref.className,
|
|
622
|
-
disabled = _ref.disabled,
|
|
623
|
-
formContext = _ref.formContext,
|
|
624
|
-
formData = _ref.formData,
|
|
625
|
-
idSchema = _ref.idSchema,
|
|
626
|
-
items = _ref.items,
|
|
627
|
-
label = _ref.label,
|
|
628
|
-
name = _ref.name,
|
|
629
|
-
onAddClick = _ref.onAddClick,
|
|
630
|
-
onBlur = _ref.onBlur,
|
|
631
|
-
onChange = _ref.onChange,
|
|
632
|
-
onFocus = _ref.onFocus,
|
|
633
|
-
placeholder = _ref.placeholder,
|
|
634
|
-
rawErrors = _ref.rawErrors,
|
|
635
|
-
readonly = _ref.readonly,
|
|
636
|
-
registry = _ref.registry,
|
|
637
|
-
required = _ref.required,
|
|
638
|
-
schema = _ref.schema,
|
|
639
|
-
title = _ref.title,
|
|
640
|
-
uiSchema = _ref.uiSchema;
|
|
641
|
-
var fields = registry.fields,
|
|
642
|
-
rootSchema = registry.rootSchema,
|
|
643
|
-
widgets = registry.widgets;
|
|
644
|
-
var UnsupportedField = fields.UnsupportedField;
|
|
645
|
-
|
|
646
|
-
var renderFiles = function renderFiles() {
|
|
647
|
-
var _getUiOptions = getUiOptions(uiSchema),
|
|
648
|
-
_getUiOptions$widget = _getUiOptions.widget,
|
|
649
|
-
widget = _getUiOptions$widget === void 0 ? 'files' : _getUiOptions$widget,
|
|
650
|
-
options = _objectWithoutPropertiesLoose(_getUiOptions, ["widget"]);
|
|
651
|
-
|
|
652
|
-
var Widget = getWidget(schema, widget, widgets);
|
|
653
|
-
return /*#__PURE__*/React__default.createElement(Widget, {
|
|
654
|
-
autofocus: autofocus,
|
|
655
|
-
disabled: disabled,
|
|
656
|
-
formContext: formContext,
|
|
657
|
-
id: idSchema && idSchema.$id,
|
|
658
|
-
multiple: true,
|
|
659
|
-
onBlur: onBlur,
|
|
660
|
-
onChange: onChange,
|
|
661
|
-
onFocus: onFocus,
|
|
662
|
-
options: options,
|
|
663
|
-
rawErrors: rawErrors,
|
|
664
|
-
readonly: readonly,
|
|
665
|
-
registry: registry,
|
|
666
|
-
schema: schema,
|
|
667
|
-
title: schema.title || name // Why not props.title?
|
|
668
|
-
,
|
|
669
|
-
value: formData
|
|
670
|
-
});
|
|
671
|
-
};
|
|
706
|
+
const control = document.querySelector("[id=\"" + id + "\"]");
|
|
672
707
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
var _getUiOptions$enumOpt = _extends({}, getUiOptions(uiSchema), {
|
|
678
|
-
enumOptions: enumOptions
|
|
679
|
-
}),
|
|
680
|
-
_getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
|
|
681
|
-
widget = _getUiOptions$enumOpt2 === void 0 ? 'select' : _getUiOptions$enumOpt2,
|
|
682
|
-
options = _objectWithoutPropertiesLoose(_getUiOptions$enumOpt, ["widget"]);
|
|
683
|
-
|
|
684
|
-
var Widget = getWidget(schema, widget, widgets);
|
|
685
|
-
return /*#__PURE__*/React__default.createElement(Widget, {
|
|
686
|
-
autofocus: autofocus,
|
|
687
|
-
disabled: disabled,
|
|
688
|
-
formContext: formContext,
|
|
689
|
-
id: idSchema && idSchema.$id,
|
|
690
|
-
label: label,
|
|
691
|
-
multiple: true,
|
|
692
|
-
onBlur: onBlur,
|
|
693
|
-
onChange: onChange,
|
|
694
|
-
onFocus: onFocus,
|
|
695
|
-
options: options,
|
|
696
|
-
placeholder: placeholder,
|
|
697
|
-
rawErrors: rawErrors,
|
|
698
|
-
readonly: readonly,
|
|
699
|
-
registry: registry,
|
|
700
|
-
required: required,
|
|
701
|
-
schema: schema,
|
|
702
|
-
value: formData
|
|
703
|
-
});
|
|
708
|
+
if (control && control.focus) {
|
|
709
|
+
control.focus();
|
|
710
|
+
}
|
|
704
711
|
};
|
|
705
712
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
if (isFixedItems(schema)) {
|
|
715
|
-
return /*#__PURE__*/React__default.createElement(FixedArrayFieldTemplate$1, {
|
|
716
|
-
canAdd: canAdd,
|
|
717
|
-
className: className,
|
|
718
|
-
DescriptionField: DescriptionField,
|
|
719
|
-
disabled: disabled,
|
|
720
|
-
formContext: formContext,
|
|
721
|
-
formData: formData,
|
|
722
|
-
idSchema: idSchema,
|
|
723
|
-
items: items,
|
|
724
|
-
onAddClick: onAddClick,
|
|
725
|
-
readonly: readonly,
|
|
726
|
-
registry: registry,
|
|
727
|
-
required: required,
|
|
728
|
-
schema: schema,
|
|
729
|
-
title: title,
|
|
730
|
-
TitleField: TitleField,
|
|
731
|
-
uiSchema: uiSchema
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
if (isFilesArray(schema, uiSchema, rootSchema)) {
|
|
736
|
-
return renderFiles();
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
if (isMultiSelect(schema, rootSchema)) {
|
|
740
|
-
return renderMultiSelect();
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
return /*#__PURE__*/React__default.createElement(NormalArrayFieldTemplate$1, {
|
|
744
|
-
canAdd: canAdd,
|
|
745
|
-
className: className,
|
|
746
|
-
DescriptionField: DescriptionField,
|
|
747
|
-
disabled: disabled,
|
|
748
|
-
formContext: formContext,
|
|
749
|
-
formData: formData,
|
|
750
|
-
idSchema: idSchema,
|
|
751
|
-
items: items,
|
|
752
|
-
onAddClick: onAddClick,
|
|
753
|
-
readonly: readonly,
|
|
754
|
-
registry: registry,
|
|
755
|
-
required: required,
|
|
756
|
-
schema: schema,
|
|
757
|
-
title: title,
|
|
758
|
-
TitleField: TitleField,
|
|
759
|
-
uiSchema: uiSchema
|
|
760
|
-
});
|
|
713
|
+
return title ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
714
|
+
className: labelClassName,
|
|
715
|
+
htmlFor: id,
|
|
716
|
+
onClick: handleLabelClick,
|
|
717
|
+
title: typeof title === "string" ? title : ""
|
|
718
|
+
}, labelChildren) : null;
|
|
761
719
|
};
|
|
762
720
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
721
|
+
TitleField.defaultProps = {
|
|
722
|
+
formContext: {}
|
|
723
|
+
};
|
|
724
|
+
var TitleField$1 = /*#__PURE__*/context.withConfigConsumer({
|
|
725
|
+
prefixCls: "form"
|
|
726
|
+
})(TitleField);
|
|
766
727
|
|
|
767
|
-
|
|
768
|
-
|
|
728
|
+
const rangeOptions = (start, stop) => {
|
|
729
|
+
let options = [];
|
|
769
730
|
|
|
770
|
-
for (
|
|
731
|
+
for (let i = start; i <= stop; i++) {
|
|
771
732
|
options.push({
|
|
772
733
|
value: i,
|
|
773
|
-
label: pad(i, 2)
|
|
734
|
+
label: utils.pad(i, 2)
|
|
774
735
|
});
|
|
775
736
|
}
|
|
776
737
|
|
|
777
738
|
return options;
|
|
778
739
|
};
|
|
779
740
|
|
|
780
|
-
|
|
781
|
-
return Object.keys(state).every(
|
|
782
|
-
return typeof state[key] !== "undefined" && state[key] !== -1;
|
|
783
|
-
});
|
|
741
|
+
const readyForChange = state => {
|
|
742
|
+
return Object.keys(state).every(key => typeof state[key] !== "undefined" && state[key] !== -1);
|
|
784
743
|
};
|
|
785
744
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
React.
|
|
808
|
-
|
|
745
|
+
const AltDateWidget = _ref => {
|
|
746
|
+
let {
|
|
747
|
+
autofocus,
|
|
748
|
+
disabled,
|
|
749
|
+
formContext,
|
|
750
|
+
id,
|
|
751
|
+
onBlur,
|
|
752
|
+
onChange,
|
|
753
|
+
onFocus,
|
|
754
|
+
options,
|
|
755
|
+
readonly,
|
|
756
|
+
registry,
|
|
757
|
+
showTime,
|
|
758
|
+
value
|
|
759
|
+
} = _ref;
|
|
760
|
+
const {
|
|
761
|
+
SelectWidget
|
|
762
|
+
} = registry.widgets;
|
|
763
|
+
const {
|
|
764
|
+
rowGutter = 24
|
|
765
|
+
} = formContext;
|
|
766
|
+
const [state, setState] = React.useState(utils.parseDateString(value, showTime));
|
|
767
|
+
React.useEffect(() => {
|
|
768
|
+
setState(utils.parseDateString(value, showTime));
|
|
809
769
|
}, [showTime, value]);
|
|
810
770
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
771
|
+
const handleChange = (property, nextValue) => {
|
|
772
|
+
const nextState = { ...state,
|
|
773
|
+
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
774
|
+
};
|
|
815
775
|
|
|
816
776
|
if (readyForChange(nextState)) {
|
|
817
|
-
onChange(toDateString(nextState, showTime));
|
|
777
|
+
onChange(utils.toDateString(nextState, showTime));
|
|
818
778
|
} else {
|
|
819
779
|
setState(nextState);
|
|
820
780
|
}
|
|
821
781
|
};
|
|
822
782
|
|
|
823
|
-
|
|
783
|
+
const handleNow = event => {
|
|
824
784
|
event.preventDefault();
|
|
825
785
|
|
|
826
786
|
if (disabled || readonly) {
|
|
827
787
|
return;
|
|
828
788
|
}
|
|
829
789
|
|
|
830
|
-
|
|
831
|
-
onChange(toDateString(nextState, showTime));
|
|
790
|
+
const nextState = utils.parseDateString(new Date().toJSON(), showTime);
|
|
791
|
+
onChange(utils.toDateString(nextState, showTime));
|
|
832
792
|
};
|
|
833
793
|
|
|
834
|
-
|
|
794
|
+
const handleClear = event => {
|
|
835
795
|
event.preventDefault();
|
|
836
796
|
|
|
837
797
|
if (disabled || readonly) {
|
|
@@ -841,14 +801,16 @@ var AltDateWidget = function AltDateWidget(_ref) {
|
|
|
841
801
|
onChange(undefined);
|
|
842
802
|
};
|
|
843
803
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
804
|
+
const dateElementProps = () => {
|
|
805
|
+
const {
|
|
806
|
+
year,
|
|
807
|
+
month,
|
|
808
|
+
day,
|
|
809
|
+
hour,
|
|
810
|
+
minute,
|
|
811
|
+
second
|
|
812
|
+
} = state;
|
|
813
|
+
const data = [{
|
|
852
814
|
type: "year",
|
|
853
815
|
range: options.yearsRange,
|
|
854
816
|
value: year
|
|
@@ -881,59 +843,55 @@ var AltDateWidget = function AltDateWidget(_ref) {
|
|
|
881
843
|
return data;
|
|
882
844
|
};
|
|
883
845
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
},
|
|
903
|
-
value: elemProps.value
|
|
904
|
-
});
|
|
905
|
-
};
|
|
846
|
+
const renderDateElement = elemProps => /*#__PURE__*/React__default["default"].createElement(SelectWidget, {
|
|
847
|
+
autofocus: elemProps.autofocus,
|
|
848
|
+
className: "form-control",
|
|
849
|
+
disabled: elemProps.disabled,
|
|
850
|
+
id: elemProps.id,
|
|
851
|
+
onBlur: elemProps.onBlur,
|
|
852
|
+
onChange: elemValue => elemProps.select(elemProps.type, elemValue),
|
|
853
|
+
onFocus: elemProps.onFocus,
|
|
854
|
+
options: {
|
|
855
|
+
enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
|
|
856
|
+
},
|
|
857
|
+
placeholder: elemProps.type,
|
|
858
|
+
readonly: elemProps.readonly,
|
|
859
|
+
schema: {
|
|
860
|
+
type: "integer"
|
|
861
|
+
},
|
|
862
|
+
value: elemProps.value
|
|
863
|
+
});
|
|
906
864
|
|
|
907
|
-
return /*#__PURE__*/React__default.createElement(
|
|
865
|
+
return /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
|
|
908
866
|
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
|
|
909
|
-
}, dateElementProps().map(
|
|
910
|
-
|
|
911
|
-
return /*#__PURE__*/React__default.createElement(
|
|
867
|
+
}, dateElementProps().map((elemProps, i) => {
|
|
868
|
+
const elemId = id + "_" + elemProps.type;
|
|
869
|
+
return /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
912
870
|
flex: "88px",
|
|
913
871
|
key: elemId
|
|
914
|
-
}, renderDateElement(
|
|
872
|
+
}, renderDateElement({ ...elemProps,
|
|
915
873
|
autofocus: autofocus && i === 0,
|
|
916
|
-
disabled
|
|
874
|
+
disabled,
|
|
917
875
|
id: elemId,
|
|
918
|
-
onBlur
|
|
919
|
-
onFocus
|
|
920
|
-
readonly
|
|
921
|
-
registry
|
|
876
|
+
onBlur,
|
|
877
|
+
onFocus,
|
|
878
|
+
readonly,
|
|
879
|
+
registry,
|
|
922
880
|
select: handleChange,
|
|
923
881
|
// NOTE: antd components accept -1 rather than issue a warning
|
|
924
882
|
// like material-ui, so we need to convert -1 to undefined here.
|
|
925
883
|
value: elemProps.value < 0 ? undefined : elemProps.value
|
|
926
|
-
}))
|
|
927
|
-
}), !options.hideNowButton && /*#__PURE__*/React__default.createElement(
|
|
884
|
+
}));
|
|
885
|
+
}), !options.hideNowButton && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
928
886
|
flex: "88px"
|
|
929
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
887
|
+
}, /*#__PURE__*/React__default["default"].createElement(Button__default["default"], {
|
|
930
888
|
block: true,
|
|
931
889
|
className: "btn-now",
|
|
932
890
|
onClick: handleNow,
|
|
933
891
|
type: "primary"
|
|
934
|
-
}, "Now")), !options.hideClearButton && /*#__PURE__*/React__default.createElement(
|
|
892
|
+
}, "Now")), !options.hideClearButton && /*#__PURE__*/React__default["default"].createElement(Col__default["default"], {
|
|
935
893
|
flex: "88px"
|
|
936
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
894
|
+
}, /*#__PURE__*/React__default["default"].createElement(Button__default["default"], {
|
|
937
895
|
block: true,
|
|
938
896
|
className: "btn-clear",
|
|
939
897
|
danger: true,
|
|
@@ -952,49 +910,62 @@ AltDateWidget.defaultProps = {
|
|
|
952
910
|
showTime: false
|
|
953
911
|
};
|
|
954
912
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
913
|
+
const AltDateTimeWidget = props => {
|
|
914
|
+
const {
|
|
915
|
+
AltDateWidget
|
|
916
|
+
} = props.registry.widgets;
|
|
917
|
+
return /*#__PURE__*/React__default["default"].createElement(AltDateWidget, _extends({
|
|
958
918
|
showTime: true
|
|
959
919
|
}, props));
|
|
960
920
|
};
|
|
961
921
|
|
|
962
|
-
AltDateTimeWidget.defaultProps =
|
|
922
|
+
AltDateTimeWidget.defaultProps = { ...AltDateWidget.defaultProps,
|
|
963
923
|
showTime: true
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
var CheckboxesWidget = function CheckboxesWidget(_ref) {
|
|
967
|
-
var autofocus = _ref.autofocus,
|
|
968
|
-
disabled = _ref.disabled,
|
|
969
|
-
formContext = _ref.formContext,
|
|
970
|
-
id = _ref.id,
|
|
971
|
-
onBlur = _ref.onBlur,
|
|
972
|
-
onChange = _ref.onChange,
|
|
973
|
-
onFocus = _ref.onFocus,
|
|
974
|
-
options = _ref.options,
|
|
975
|
-
readonly = _ref.readonly,
|
|
976
|
-
value = _ref.value;
|
|
977
|
-
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
978
|
-
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
979
|
-
var enumOptions = options.enumOptions,
|
|
980
|
-
enumDisabled = options.enumDisabled,
|
|
981
|
-
inline = options.inline;
|
|
982
|
-
|
|
983
|
-
var handleChange = function handleChange(nextValue) {
|
|
984
|
-
return onChange(nextValue);
|
|
985
|
-
};
|
|
924
|
+
};
|
|
986
925
|
|
|
987
|
-
|
|
988
|
-
|
|
926
|
+
const CheckboxesWidget = _ref => {
|
|
927
|
+
let {
|
|
928
|
+
autofocus,
|
|
929
|
+
disabled,
|
|
930
|
+
formContext,
|
|
931
|
+
id,
|
|
932
|
+
// label,
|
|
933
|
+
onBlur,
|
|
934
|
+
onChange,
|
|
935
|
+
onFocus,
|
|
936
|
+
options,
|
|
937
|
+
// placeholder,
|
|
938
|
+
readonly,
|
|
939
|
+
// required,
|
|
940
|
+
// schema,
|
|
941
|
+
value
|
|
942
|
+
} = _ref;
|
|
943
|
+
const {
|
|
944
|
+
readonlyAsDisabled = true
|
|
945
|
+
} = formContext;
|
|
946
|
+
const {
|
|
947
|
+
enumOptions,
|
|
948
|
+
enumDisabled,
|
|
949
|
+
inline
|
|
950
|
+
} = options;
|
|
951
|
+
|
|
952
|
+
const handleChange = nextValue => onChange(nextValue);
|
|
953
|
+
|
|
954
|
+
const handleBlur = _ref2 => {
|
|
955
|
+
let {
|
|
956
|
+
target
|
|
957
|
+
} = _ref2;
|
|
989
958
|
return onBlur(id, target.value);
|
|
990
959
|
};
|
|
991
960
|
|
|
992
|
-
|
|
993
|
-
|
|
961
|
+
const handleFocus = _ref3 => {
|
|
962
|
+
let {
|
|
963
|
+
target
|
|
964
|
+
} = _ref3;
|
|
994
965
|
return onFocus(id, target.value);
|
|
995
966
|
};
|
|
996
967
|
|
|
997
|
-
return
|
|
968
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Checkbox__default["default"].Group, {
|
|
998
969
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
999
970
|
id: id,
|
|
1000
971
|
name: id,
|
|
@@ -1002,51 +973,66 @@ var CheckboxesWidget = function CheckboxesWidget(_ref) {
|
|
|
1002
973
|
onChange: !readonly ? handleChange : undefined,
|
|
1003
974
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1004
975
|
value: value
|
|
1005
|
-
}, enumOptions.map(
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
976
|
+
}, enumOptions.map((_ref4, i) => {
|
|
977
|
+
let {
|
|
978
|
+
value: optionValue,
|
|
979
|
+
label: optionLabel
|
|
980
|
+
} = _ref4;
|
|
981
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1009
982
|
key: optionValue
|
|
1010
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
983
|
+
}, /*#__PURE__*/React__default["default"].createElement(Checkbox__default["default"], {
|
|
1011
984
|
autoFocus: i === 0 ? autofocus : false,
|
|
1012
985
|
disabled: enumDisabled && enumDisabled.indexOf(value) !== -1,
|
|
1013
986
|
value: optionValue
|
|
1014
|
-
}, optionLabel), !inline && /*#__PURE__*/React__default.createElement("br", null));
|
|
987
|
+
}, optionLabel), !inline && /*#__PURE__*/React__default["default"].createElement("br", null));
|
|
1015
988
|
})) : null;
|
|
1016
989
|
};
|
|
1017
990
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
991
|
+
const CheckboxWidget = _ref => {
|
|
992
|
+
let {
|
|
993
|
+
autofocus,
|
|
994
|
+
disabled,
|
|
995
|
+
formContext,
|
|
996
|
+
id,
|
|
997
|
+
label,
|
|
998
|
+
onBlur,
|
|
999
|
+
onChange,
|
|
1000
|
+
onFocus,
|
|
1001
|
+
// options,
|
|
1002
|
+
// placeholder,
|
|
1003
|
+
readonly,
|
|
1004
|
+
// required,
|
|
1005
|
+
// schema,
|
|
1006
|
+
value
|
|
1007
|
+
} = _ref;
|
|
1008
|
+
const {
|
|
1009
|
+
readonlyAsDisabled = true
|
|
1010
|
+
} = formContext;
|
|
1011
|
+
|
|
1012
|
+
const handleChange = _ref2 => {
|
|
1013
|
+
let {
|
|
1014
|
+
target
|
|
1015
|
+
} = _ref2;
|
|
1034
1016
|
return onChange(target.checked);
|
|
1035
1017
|
};
|
|
1036
1018
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1019
|
+
const handleBlur = _ref3 => {
|
|
1020
|
+
let {
|
|
1021
|
+
target
|
|
1022
|
+
} = _ref3;
|
|
1039
1023
|
return onBlur(id, target.checked);
|
|
1040
1024
|
};
|
|
1041
1025
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1026
|
+
const handleFocus = _ref4 => {
|
|
1027
|
+
let {
|
|
1028
|
+
target
|
|
1029
|
+
} = _ref4;
|
|
1044
1030
|
return onFocus(id, target.checked);
|
|
1045
1031
|
};
|
|
1046
1032
|
|
|
1047
|
-
return /*#__PURE__*/React__default.createElement(
|
|
1033
|
+
return /*#__PURE__*/React__default["default"].createElement(Checkbox__default["default"], {
|
|
1048
1034
|
autoFocus: autofocus,
|
|
1049
|
-
checked: typeof value ===
|
|
1035
|
+
checked: typeof value === "undefined" ? false : value,
|
|
1050
1036
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1051
1037
|
id: id,
|
|
1052
1038
|
name: id,
|
|
@@ -1056,88 +1042,42 @@ var CheckboxWidget = function CheckboxWidget(_ref) {
|
|
|
1056
1042
|
}, label);
|
|
1057
1043
|
};
|
|
1058
1044
|
|
|
1059
|
-
|
|
1060
|
-
width: '100%'
|
|
1061
|
-
};
|
|
1062
|
-
|
|
1063
|
-
var ColorWidget = function ColorWidget(_ref) {
|
|
1064
|
-
var disabled = _ref.disabled,
|
|
1065
|
-
formContext = _ref.formContext,
|
|
1066
|
-
id = _ref.id,
|
|
1067
|
-
onBlur = _ref.onBlur,
|
|
1068
|
-
onChange = _ref.onChange,
|
|
1069
|
-
onFocus = _ref.onFocus,
|
|
1070
|
-
placeholder = _ref.placeholder,
|
|
1071
|
-
readonly = _ref.readonly,
|
|
1072
|
-
value = _ref.value;
|
|
1073
|
-
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1074
|
-
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1075
|
-
|
|
1076
|
-
var handleChange = function handleChange(_ref2) {
|
|
1077
|
-
var target = _ref2.target;
|
|
1078
|
-
return onChange(target.value);
|
|
1079
|
-
};
|
|
1080
|
-
|
|
1081
|
-
var handleBlur = function handleBlur(_ref3) {
|
|
1082
|
-
var target = _ref3.target;
|
|
1083
|
-
return onBlur(id, target.value);
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
var handleFocus = function handleFocus(_ref4) {
|
|
1087
|
-
var target = _ref4.target;
|
|
1088
|
-
return onFocus(id, target.value);
|
|
1089
|
-
};
|
|
1045
|
+
const DatePicker = /*#__PURE__*/generatePicker__default["default"](dayjsGenerateConfig__default["default"]);
|
|
1090
1046
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
id: id,
|
|
1094
|
-
name: id,
|
|
1095
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
1096
|
-
onChange: !readonly ? handleChange : undefined,
|
|
1097
|
-
onFocus: !readonly ? handleFocus : undefined,
|
|
1098
|
-
placeholder: placeholder,
|
|
1099
|
-
style: INPUT_STYLE$1,
|
|
1100
|
-
type: "color",
|
|
1101
|
-
value: value
|
|
1102
|
-
});
|
|
1047
|
+
const DATE_PICKER_STYLE$1 = {
|
|
1048
|
+
width: "100%"
|
|
1103
1049
|
};
|
|
1104
1050
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
var getPopupContainer = function getPopupContainer(node) {
|
|
1137
|
-
return node.parentNode;
|
|
1138
|
-
};
|
|
1139
|
-
|
|
1140
|
-
return /*#__PURE__*/React__default.createElement(DatePicker, {
|
|
1051
|
+
const DateTimeWidget = _ref => {
|
|
1052
|
+
let {
|
|
1053
|
+
// autofocus,
|
|
1054
|
+
disabled,
|
|
1055
|
+
formContext,
|
|
1056
|
+
id,
|
|
1057
|
+
// label,
|
|
1058
|
+
onBlur,
|
|
1059
|
+
onChange,
|
|
1060
|
+
onFocus,
|
|
1061
|
+
// options,
|
|
1062
|
+
placeholder,
|
|
1063
|
+
readonly,
|
|
1064
|
+
// required,
|
|
1065
|
+
// schema,
|
|
1066
|
+
value
|
|
1067
|
+
} = _ref;
|
|
1068
|
+
const {
|
|
1069
|
+
readonlyAsDisabled = true
|
|
1070
|
+
} = formContext;
|
|
1071
|
+
|
|
1072
|
+
const handleChange = nextValue => onChange(nextValue && nextValue.toISOString());
|
|
1073
|
+
|
|
1074
|
+
const handleBlur = () => onBlur(id, value);
|
|
1075
|
+
|
|
1076
|
+
const handleFocus = () => onFocus(id, value);
|
|
1077
|
+
|
|
1078
|
+
const getPopupContainer = node => node.parentNode;
|
|
1079
|
+
|
|
1080
|
+
return /*#__PURE__*/React__default["default"].createElement(DatePicker, {
|
|
1141
1081
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1142
1082
|
getPopupContainer: getPopupContainer,
|
|
1143
1083
|
id: id,
|
|
@@ -1147,45 +1087,45 @@ var DateTimeWidget = function DateTimeWidget(_ref) {
|
|
|
1147
1087
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1148
1088
|
placeholder: placeholder,
|
|
1149
1089
|
showTime: true,
|
|
1150
|
-
style: DATE_PICKER_STYLE,
|
|
1151
|
-
value: value &&
|
|
1090
|
+
style: DATE_PICKER_STYLE$1,
|
|
1091
|
+
value: value && dayjs__default["default"](value)
|
|
1152
1092
|
});
|
|
1153
1093
|
};
|
|
1154
1094
|
|
|
1155
|
-
|
|
1156
|
-
width:
|
|
1095
|
+
const DATE_PICKER_STYLE = {
|
|
1096
|
+
width: "100%"
|
|
1157
1097
|
};
|
|
1158
1098
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
};
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
return /*#__PURE__*/React__default.createElement(DatePicker, {
|
|
1099
|
+
const DateWidget = _ref => {
|
|
1100
|
+
let {
|
|
1101
|
+
// autofocus,
|
|
1102
|
+
disabled,
|
|
1103
|
+
formContext,
|
|
1104
|
+
id,
|
|
1105
|
+
// label,
|
|
1106
|
+
onBlur,
|
|
1107
|
+
onChange,
|
|
1108
|
+
onFocus,
|
|
1109
|
+
// options,
|
|
1110
|
+
placeholder,
|
|
1111
|
+
readonly,
|
|
1112
|
+
// required,
|
|
1113
|
+
// schema,
|
|
1114
|
+
value
|
|
1115
|
+
} = _ref;
|
|
1116
|
+
const {
|
|
1117
|
+
readonlyAsDisabled = true
|
|
1118
|
+
} = formContext;
|
|
1119
|
+
|
|
1120
|
+
const handleChange = nextValue => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
1121
|
+
|
|
1122
|
+
const handleBlur = () => onBlur(id, value);
|
|
1123
|
+
|
|
1124
|
+
const handleFocus = () => onFocus(id, value);
|
|
1125
|
+
|
|
1126
|
+
const getPopupContainer = node => node.parentNode;
|
|
1127
|
+
|
|
1128
|
+
return /*#__PURE__*/React__default["default"].createElement(DatePicker, {
|
|
1189
1129
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1190
1130
|
getPopupContainer: getPopupContainer,
|
|
1191
1131
|
id: id,
|
|
@@ -1195,89 +1135,55 @@ var DateWidget = function DateWidget(_ref) {
|
|
|
1195
1135
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1196
1136
|
placeholder: placeholder,
|
|
1197
1137
|
showTime: false,
|
|
1198
|
-
style: DATE_PICKER_STYLE
|
|
1199
|
-
value: value &&
|
|
1200
|
-
});
|
|
1201
|
-
};
|
|
1202
|
-
|
|
1203
|
-
var INPUT_STYLE$2 = {
|
|
1204
|
-
width: '100%'
|
|
1205
|
-
};
|
|
1206
|
-
|
|
1207
|
-
var EmailWidget = function EmailWidget(_ref) {
|
|
1208
|
-
var disabled = _ref.disabled,
|
|
1209
|
-
formContext = _ref.formContext,
|
|
1210
|
-
id = _ref.id,
|
|
1211
|
-
onBlur = _ref.onBlur,
|
|
1212
|
-
onChange = _ref.onChange,
|
|
1213
|
-
onFocus = _ref.onFocus,
|
|
1214
|
-
options = _ref.options,
|
|
1215
|
-
placeholder = _ref.placeholder,
|
|
1216
|
-
readonly = _ref.readonly,
|
|
1217
|
-
value = _ref.value;
|
|
1218
|
-
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1219
|
-
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1220
|
-
|
|
1221
|
-
var handleChange = function handleChange(_ref2) {
|
|
1222
|
-
var target = _ref2.target;
|
|
1223
|
-
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
1224
|
-
};
|
|
1225
|
-
|
|
1226
|
-
var handleBlur = function handleBlur(_ref3) {
|
|
1227
|
-
var target = _ref3.target;
|
|
1228
|
-
return onBlur(id, target.value);
|
|
1229
|
-
};
|
|
1230
|
-
|
|
1231
|
-
var handleFocus = function handleFocus(_ref4) {
|
|
1232
|
-
var target = _ref4.target;
|
|
1233
|
-
return onFocus(id, target.value);
|
|
1234
|
-
};
|
|
1235
|
-
|
|
1236
|
-
return /*#__PURE__*/React__default.createElement(Input, {
|
|
1237
|
-
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1238
|
-
id: id,
|
|
1239
|
-
name: id,
|
|
1240
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
1241
|
-
onChange: !readonly ? handleChange : undefined,
|
|
1242
|
-
onFocus: !readonly ? handleFocus : undefined,
|
|
1243
|
-
placeholder: placeholder,
|
|
1244
|
-
style: INPUT_STYLE$2,
|
|
1245
|
-
type: "email",
|
|
1246
|
-
value: value
|
|
1138
|
+
style: DATE_PICKER_STYLE,
|
|
1139
|
+
value: value && dayjs__default["default"](value)
|
|
1247
1140
|
});
|
|
1248
1141
|
};
|
|
1249
1142
|
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1143
|
+
const PasswordWidget = _ref => {
|
|
1144
|
+
let {
|
|
1145
|
+
// autofocus,
|
|
1146
|
+
disabled,
|
|
1147
|
+
formContext,
|
|
1148
|
+
id,
|
|
1149
|
+
// label,
|
|
1150
|
+
onBlur,
|
|
1151
|
+
onChange,
|
|
1152
|
+
onFocus,
|
|
1153
|
+
options,
|
|
1154
|
+
placeholder,
|
|
1155
|
+
readonly,
|
|
1156
|
+
// required,
|
|
1157
|
+
// schema,
|
|
1158
|
+
value
|
|
1159
|
+
} = _ref;
|
|
1160
|
+
const {
|
|
1161
|
+
readonlyAsDisabled = true
|
|
1162
|
+
} = formContext;
|
|
1163
|
+
const emptyValue = options.emptyValue || "";
|
|
1164
|
+
|
|
1165
|
+
const handleChange = _ref2 => {
|
|
1166
|
+
let {
|
|
1167
|
+
target
|
|
1168
|
+
} = _ref2;
|
|
1169
|
+
return onChange(target.value === "" ? emptyValue : target.value);
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
const handleBlur = _ref3 => {
|
|
1173
|
+
let {
|
|
1174
|
+
target
|
|
1175
|
+
} = _ref3;
|
|
1272
1176
|
return onBlur(id, target.value);
|
|
1273
1177
|
};
|
|
1274
1178
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1179
|
+
const handleFocus = _ref4 => {
|
|
1180
|
+
let {
|
|
1181
|
+
target
|
|
1182
|
+
} = _ref4;
|
|
1277
1183
|
return onFocus(id, target.value);
|
|
1278
1184
|
};
|
|
1279
1185
|
|
|
1280
|
-
return /*#__PURE__*/React__default.createElement(
|
|
1186
|
+
return /*#__PURE__*/React__default["default"].createElement(Input__default["default"].Password, {
|
|
1281
1187
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1282
1188
|
id: id,
|
|
1283
1189
|
name: id,
|
|
@@ -1285,45 +1191,61 @@ var PasswordWidget = function PasswordWidget(_ref) {
|
|
|
1285
1191
|
onChange: !readonly ? handleChange : undefined,
|
|
1286
1192
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1287
1193
|
placeholder: placeholder,
|
|
1288
|
-
value: value ||
|
|
1194
|
+
value: value || ""
|
|
1289
1195
|
});
|
|
1290
1196
|
};
|
|
1291
1197
|
|
|
1292
1198
|
/* eslint-disable no-else-return */
|
|
1293
1199
|
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1200
|
+
const RadioWidget = _ref => {
|
|
1201
|
+
let {
|
|
1202
|
+
autofocus,
|
|
1203
|
+
disabled,
|
|
1204
|
+
formContext,
|
|
1205
|
+
id,
|
|
1206
|
+
// label,
|
|
1207
|
+
onBlur,
|
|
1208
|
+
onChange,
|
|
1209
|
+
onFocus,
|
|
1210
|
+
options,
|
|
1211
|
+
// placeholder,
|
|
1212
|
+
readonly,
|
|
1213
|
+
// required,
|
|
1214
|
+
schema,
|
|
1215
|
+
value
|
|
1216
|
+
} = _ref;
|
|
1217
|
+
const {
|
|
1218
|
+
readonlyAsDisabled = true
|
|
1219
|
+
} = formContext;
|
|
1220
|
+
const {
|
|
1221
|
+
enumOptions,
|
|
1222
|
+
enumDisabled
|
|
1223
|
+
} = options;
|
|
1224
|
+
|
|
1225
|
+
const handleChange = _ref2 => {
|
|
1226
|
+
let {
|
|
1227
|
+
target: {
|
|
1228
|
+
value: nextValue
|
|
1229
|
+
}
|
|
1230
|
+
} = _ref2;
|
|
1231
|
+
return onChange(schema.type === "boolean" ? nextValue !== "false" : nextValue);
|
|
1314
1232
|
};
|
|
1315
1233
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1234
|
+
const handleBlur = _ref3 => {
|
|
1235
|
+
let {
|
|
1236
|
+
target
|
|
1237
|
+
} = _ref3;
|
|
1318
1238
|
return onBlur(id, target.value);
|
|
1319
1239
|
};
|
|
1320
1240
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1241
|
+
const handleFocus = _ref4 => {
|
|
1242
|
+
let {
|
|
1243
|
+
target
|
|
1244
|
+
} = _ref4;
|
|
1323
1245
|
return onFocus(id, target.value);
|
|
1324
1246
|
};
|
|
1325
1247
|
|
|
1326
|
-
return /*#__PURE__*/React__default.createElement(
|
|
1248
|
+
return /*#__PURE__*/React__default["default"].createElement(Radio__default["default"].Group, {
|
|
1327
1249
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1328
1250
|
id: id,
|
|
1329
1251
|
name: id,
|
|
@@ -1331,10 +1253,12 @@ var RadioWidget = function RadioWidget(_ref) {
|
|
|
1331
1253
|
onChange: !readonly ? handleChange : undefined,
|
|
1332
1254
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1333
1255
|
value: "" + value
|
|
1334
|
-
}, enumOptions.map(
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1256
|
+
}, enumOptions.map((_ref5, i) => {
|
|
1257
|
+
let {
|
|
1258
|
+
value: optionValue,
|
|
1259
|
+
label: optionLabel
|
|
1260
|
+
} = _ref5;
|
|
1261
|
+
return /*#__PURE__*/React__default["default"].createElement(Radio__default["default"], {
|
|
1338
1262
|
autoFocus: i === 0 ? autofocus : false,
|
|
1339
1263
|
disabled: enumDisabled && enumDisabled.indexOf(value) !== -1,
|
|
1340
1264
|
key: "" + optionValue,
|
|
@@ -1344,44 +1268,41 @@ var RadioWidget = function RadioWidget(_ref) {
|
|
|
1344
1268
|
};
|
|
1345
1269
|
|
|
1346
1270
|
/* eslint-disable no-else-return */
|
|
1347
|
-
var rangeSpec = core.utils.rangeSpec;
|
|
1348
|
-
|
|
1349
|
-
var RangeWidget = function RangeWidget(_ref) {
|
|
1350
|
-
var autofocus = _ref.autofocus,
|
|
1351
|
-
disabled = _ref.disabled,
|
|
1352
|
-
formContext = _ref.formContext,
|
|
1353
|
-
id = _ref.id,
|
|
1354
|
-
onBlur = _ref.onBlur,
|
|
1355
|
-
onChange = _ref.onChange,
|
|
1356
|
-
onFocus = _ref.onFocus,
|
|
1357
|
-
options = _ref.options,
|
|
1358
|
-
placeholder = _ref.placeholder,
|
|
1359
|
-
readonly = _ref.readonly,
|
|
1360
|
-
schema = _ref.schema,
|
|
1361
|
-
value = _ref.value;
|
|
1362
|
-
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1363
|
-
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1364
|
-
|
|
1365
|
-
var _rangeSpec = rangeSpec(schema),
|
|
1366
|
-
min = _rangeSpec.min,
|
|
1367
|
-
max = _rangeSpec.max,
|
|
1368
|
-
step = _rangeSpec.step;
|
|
1369
|
-
|
|
1370
|
-
var emptyValue = options.emptyValue || '';
|
|
1371
|
-
|
|
1372
|
-
var handleChange = function handleChange(nextValue) {
|
|
1373
|
-
return onChange(nextValue === '' ? emptyValue : nextValue);
|
|
1374
|
-
};
|
|
1375
|
-
|
|
1376
|
-
var handleBlur = function handleBlur() {
|
|
1377
|
-
return onBlur(id, value);
|
|
1378
|
-
};
|
|
1379
1271
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1272
|
+
const RangeWidget = _ref => {
|
|
1273
|
+
let {
|
|
1274
|
+
autofocus,
|
|
1275
|
+
disabled,
|
|
1276
|
+
formContext,
|
|
1277
|
+
id,
|
|
1278
|
+
// label,
|
|
1279
|
+
onBlur,
|
|
1280
|
+
onChange,
|
|
1281
|
+
onFocus,
|
|
1282
|
+
options,
|
|
1283
|
+
placeholder,
|
|
1284
|
+
readonly,
|
|
1285
|
+
// required,
|
|
1286
|
+
schema,
|
|
1287
|
+
value
|
|
1288
|
+
} = _ref;
|
|
1289
|
+
const {
|
|
1290
|
+
readonlyAsDisabled = true
|
|
1291
|
+
} = formContext;
|
|
1292
|
+
const {
|
|
1293
|
+
min,
|
|
1294
|
+
max,
|
|
1295
|
+
step
|
|
1296
|
+
} = utils.rangeSpec(schema);
|
|
1297
|
+
const emptyValue = options.emptyValue || "";
|
|
1298
|
+
|
|
1299
|
+
const handleChange = nextValue => onChange(nextValue === "" ? emptyValue : nextValue);
|
|
1300
|
+
|
|
1301
|
+
const handleBlur = () => onBlur(id, value);
|
|
1302
|
+
|
|
1303
|
+
const handleFocus = () => onFocus(id, value);
|
|
1304
|
+
|
|
1305
|
+
return /*#__PURE__*/React__default["default"].createElement(Slider__default["default"], {
|
|
1385
1306
|
autoFocus: autofocus,
|
|
1386
1307
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1387
1308
|
id: id,
|
|
@@ -1398,105 +1319,65 @@ var RangeWidget = function RangeWidget(_ref) {
|
|
|
1398
1319
|
};
|
|
1399
1320
|
|
|
1400
1321
|
/* eslint-disable no-else-return */
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
var SELECT_STYLE = {
|
|
1404
|
-
width: '100%'
|
|
1405
|
-
};
|
|
1406
|
-
var nums = /*#__PURE__*/new Set(['number', 'integer']);
|
|
1407
|
-
/**
|
|
1408
|
-
* This is a silly limitation in the DOM where option change event values are
|
|
1409
|
-
* always retrieved as strings.
|
|
1410
|
-
*/
|
|
1411
|
-
|
|
1412
|
-
var processValue = function processValue(schema, value) {
|
|
1413
|
-
// "enum" is a reserved word, so only "type" and "items" can be destructured
|
|
1414
|
-
var type = schema.type,
|
|
1415
|
-
items = schema.items;
|
|
1416
|
-
|
|
1417
|
-
if (value === '') {
|
|
1418
|
-
return undefined;
|
|
1419
|
-
} else if (type === 'array' && items && nums.has(items.type)) {
|
|
1420
|
-
return value.map(asNumber);
|
|
1421
|
-
} else if (type === 'boolean') {
|
|
1422
|
-
return value === 'true';
|
|
1423
|
-
} else if (type === 'number') {
|
|
1424
|
-
return asNumber(value);
|
|
1425
|
-
} // If type is undefined, but an enum is present, try and infer the type from
|
|
1426
|
-
// the enum values
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
if (schema.enum) {
|
|
1430
|
-
if (schema.enum.every(function (x) {
|
|
1431
|
-
return guessType(x) === 'number';
|
|
1432
|
-
})) {
|
|
1433
|
-
return asNumber(value);
|
|
1434
|
-
} else if (schema.enum.every(function (x) {
|
|
1435
|
-
return guessType(x) === 'boolean';
|
|
1436
|
-
})) {
|
|
1437
|
-
return value === 'true';
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
return value;
|
|
1322
|
+
const SELECT_STYLE = {
|
|
1323
|
+
width: "100%"
|
|
1442
1324
|
};
|
|
1443
1325
|
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
};
|
|
1482
|
-
|
|
1483
|
-
return /*#__PURE__*/React__default.createElement(Select, {
|
|
1326
|
+
const SelectWidget = _ref => {
|
|
1327
|
+
let {
|
|
1328
|
+
autofocus,
|
|
1329
|
+
disabled,
|
|
1330
|
+
formContext,
|
|
1331
|
+
id,
|
|
1332
|
+
// label,
|
|
1333
|
+
multiple,
|
|
1334
|
+
onBlur,
|
|
1335
|
+
onChange,
|
|
1336
|
+
onFocus,
|
|
1337
|
+
options,
|
|
1338
|
+
placeholder,
|
|
1339
|
+
readonly,
|
|
1340
|
+
// required,
|
|
1341
|
+
schema,
|
|
1342
|
+
value
|
|
1343
|
+
} = _ref;
|
|
1344
|
+
const {
|
|
1345
|
+
readonlyAsDisabled = true
|
|
1346
|
+
} = formContext;
|
|
1347
|
+
const {
|
|
1348
|
+
enumOptions,
|
|
1349
|
+
enumDisabled
|
|
1350
|
+
} = options;
|
|
1351
|
+
|
|
1352
|
+
const handleChange = nextValue => onChange(utils.processSelectValue(schema, nextValue, options));
|
|
1353
|
+
|
|
1354
|
+
const handleBlur = () => onBlur(id, utils.processSelectValue(schema, value, options));
|
|
1355
|
+
|
|
1356
|
+
const handleFocus = () => onFocus(id, utils.processSelectValue(schema, value, options));
|
|
1357
|
+
|
|
1358
|
+
const getPopupContainer = node => node.parentNode;
|
|
1359
|
+
|
|
1360
|
+
const stringify = currentValue => Array.isArray(currentValue) ? value.map(String) : String(value);
|
|
1361
|
+
|
|
1362
|
+
return /*#__PURE__*/React__default["default"].createElement(Select__default["default"], {
|
|
1484
1363
|
autoFocus: autofocus,
|
|
1485
1364
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1486
1365
|
getPopupContainer: getPopupContainer,
|
|
1487
1366
|
id: id,
|
|
1488
|
-
mode: typeof multiple !==
|
|
1367
|
+
mode: typeof multiple !== "undefined" ? "multiple" : undefined,
|
|
1489
1368
|
name: id,
|
|
1490
1369
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1491
1370
|
onChange: !readonly ? handleChange : undefined,
|
|
1492
1371
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1493
1372
|
placeholder: placeholder,
|
|
1494
1373
|
style: SELECT_STYLE,
|
|
1495
|
-
value: typeof value !==
|
|
1496
|
-
}, enumOptions.map(
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1374
|
+
value: typeof value !== "undefined" ? stringify(value) : undefined
|
|
1375
|
+
}, enumOptions.map(_ref2 => {
|
|
1376
|
+
let {
|
|
1377
|
+
value: optionValue,
|
|
1378
|
+
label: optionLabel
|
|
1379
|
+
} = _ref2;
|
|
1380
|
+
return /*#__PURE__*/React__default["default"].createElement(Select__default["default"].Option, {
|
|
1500
1381
|
disabled: enumDisabled && enumDisabled.indexOf(optionValue) !== -1,
|
|
1501
1382
|
key: String(optionValue),
|
|
1502
1383
|
value: String(optionValue)
|
|
@@ -1508,40 +1389,53 @@ SelectWidget.defaultProps = {
|
|
|
1508
1389
|
formContext: {}
|
|
1509
1390
|
};
|
|
1510
1391
|
|
|
1511
|
-
|
|
1512
|
-
width:
|
|
1392
|
+
const INPUT_STYLE = {
|
|
1393
|
+
width: "100%"
|
|
1513
1394
|
};
|
|
1514
1395
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1396
|
+
const TextareaWidget = _ref => {
|
|
1397
|
+
let {
|
|
1398
|
+
// autofocus,
|
|
1399
|
+
disabled,
|
|
1400
|
+
formContext,
|
|
1401
|
+
id,
|
|
1402
|
+
// label,
|
|
1403
|
+
onBlur,
|
|
1404
|
+
onChange,
|
|
1405
|
+
onFocus,
|
|
1406
|
+
options,
|
|
1407
|
+
placeholder,
|
|
1408
|
+
readonly,
|
|
1409
|
+
// required,
|
|
1410
|
+
// schema,
|
|
1411
|
+
value
|
|
1412
|
+
} = _ref;
|
|
1413
|
+
const {
|
|
1414
|
+
readonlyAsDisabled = true
|
|
1415
|
+
} = formContext;
|
|
1416
|
+
|
|
1417
|
+
const handleChange = _ref2 => {
|
|
1418
|
+
let {
|
|
1419
|
+
target
|
|
1420
|
+
} = _ref2;
|
|
1421
|
+
return onChange(target.value === "" ? options.emptyValue : target.value);
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
const handleBlur = _ref3 => {
|
|
1425
|
+
let {
|
|
1426
|
+
target
|
|
1427
|
+
} = _ref3;
|
|
1536
1428
|
return onBlur(id, target.value);
|
|
1537
1429
|
};
|
|
1538
1430
|
|
|
1539
|
-
|
|
1540
|
-
|
|
1431
|
+
const handleFocus = _ref4 => {
|
|
1432
|
+
let {
|
|
1433
|
+
target
|
|
1434
|
+
} = _ref4;
|
|
1541
1435
|
return onFocus(id, target.value);
|
|
1542
1436
|
};
|
|
1543
1437
|
|
|
1544
|
-
return /*#__PURE__*/React__default.createElement(
|
|
1438
|
+
return /*#__PURE__*/React__default["default"].createElement(Input__default["default"].TextArea, {
|
|
1545
1439
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1546
1440
|
id: id,
|
|
1547
1441
|
name: id,
|
|
@@ -1550,249 +1444,49 @@ var TextareaWidget = function TextareaWidget(_ref) {
|
|
|
1550
1444
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1551
1445
|
placeholder: placeholder,
|
|
1552
1446
|
rows: options.rows || 4,
|
|
1553
|
-
style: INPUT_STYLE
|
|
1447
|
+
style: INPUT_STYLE,
|
|
1554
1448
|
type: "textarea",
|
|
1555
1449
|
value: value
|
|
1556
1450
|
});
|
|
1557
1451
|
};
|
|
1558
1452
|
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
placeholder = _ref.placeholder,
|
|
1572
|
-
readonly = _ref.readonly,
|
|
1573
|
-
schema = _ref.schema,
|
|
1574
|
-
value = _ref.value;
|
|
1575
|
-
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1576
|
-
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1577
|
-
|
|
1578
|
-
var handleNumberChange = function handleNumberChange(nextValue) {
|
|
1579
|
-
return onChange(nextValue);
|
|
1580
|
-
};
|
|
1581
|
-
|
|
1582
|
-
var handleTextChange = function handleTextChange(_ref2) {
|
|
1583
|
-
var target = _ref2.target;
|
|
1584
|
-
return onChange(target.value === '' ? options.emptyValue : target.value);
|
|
1585
|
-
};
|
|
1586
|
-
|
|
1587
|
-
var handleBlur = function handleBlur(_ref3) {
|
|
1588
|
-
var target = _ref3.target;
|
|
1589
|
-
return onBlur(id, target.value);
|
|
1590
|
-
};
|
|
1591
|
-
|
|
1592
|
-
var handleFocus = function handleFocus(_ref4) {
|
|
1593
|
-
var target = _ref4.target;
|
|
1594
|
-
return onFocus(id, target.value);
|
|
1595
|
-
};
|
|
1596
|
-
|
|
1597
|
-
return schema.type === 'number' || schema.type === 'integer' ? /*#__PURE__*/React__default.createElement(InputNumber, {
|
|
1598
|
-
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1599
|
-
id: id,
|
|
1600
|
-
name: id,
|
|
1601
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
1602
|
-
onChange: !readonly ? handleNumberChange : undefined,
|
|
1603
|
-
onFocus: !readonly ? handleFocus : undefined,
|
|
1604
|
-
placeholder: placeholder,
|
|
1605
|
-
style: INPUT_STYLE$4,
|
|
1606
|
-
type: "number",
|
|
1607
|
-
value: value
|
|
1608
|
-
}) : /*#__PURE__*/React__default.createElement(Input, {
|
|
1609
|
-
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1610
|
-
id: id,
|
|
1611
|
-
name: id,
|
|
1612
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
1613
|
-
onChange: !readonly ? handleTextChange : undefined,
|
|
1614
|
-
onFocus: !readonly ? handleFocus : undefined,
|
|
1615
|
-
placeholder: placeholder,
|
|
1616
|
-
style: INPUT_STYLE$4,
|
|
1617
|
-
type: options.inputType || 'text',
|
|
1618
|
-
value: value
|
|
1619
|
-
});
|
|
1620
|
-
};
|
|
1621
|
-
|
|
1622
|
-
var INPUT_STYLE$5 = {
|
|
1623
|
-
width: '100%'
|
|
1624
|
-
};
|
|
1625
|
-
|
|
1626
|
-
var UpDownWidget = function UpDownWidget(_ref) {
|
|
1627
|
-
var disabled = _ref.disabled,
|
|
1628
|
-
formContext = _ref.formContext,
|
|
1629
|
-
id = _ref.id,
|
|
1630
|
-
onBlur = _ref.onBlur,
|
|
1631
|
-
onChange = _ref.onChange,
|
|
1632
|
-
onFocus = _ref.onFocus,
|
|
1633
|
-
placeholder = _ref.placeholder,
|
|
1634
|
-
readonly = _ref.readonly,
|
|
1635
|
-
value = _ref.value;
|
|
1636
|
-
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1637
|
-
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1638
|
-
|
|
1639
|
-
var handleChange = function handleChange(nextValue) {
|
|
1640
|
-
return onChange(nextValue);
|
|
1641
|
-
};
|
|
1642
|
-
|
|
1643
|
-
var handleBlur = function handleBlur(_ref2) {
|
|
1644
|
-
var target = _ref2.target;
|
|
1645
|
-
return onBlur(id, target.value);
|
|
1646
|
-
};
|
|
1647
|
-
|
|
1648
|
-
var handleFocus = function handleFocus(_ref3) {
|
|
1649
|
-
var target = _ref3.target;
|
|
1650
|
-
return onFocus(id, target.value);
|
|
1651
|
-
};
|
|
1652
|
-
|
|
1653
|
-
return /*#__PURE__*/React__default.createElement(InputNumber, {
|
|
1654
|
-
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1655
|
-
id: id,
|
|
1656
|
-
name: id,
|
|
1657
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
1658
|
-
onChange: !readonly ? handleChange : undefined,
|
|
1659
|
-
onFocus: !readonly ? handleFocus : undefined,
|
|
1660
|
-
placeholder: placeholder,
|
|
1661
|
-
style: INPUT_STYLE$5,
|
|
1662
|
-
type: "number",
|
|
1663
|
-
value: value
|
|
1664
|
-
});
|
|
1665
|
-
};
|
|
1666
|
-
|
|
1667
|
-
var INPUT_STYLE$6 = {
|
|
1668
|
-
width: '100%'
|
|
1453
|
+
const Widgets = {
|
|
1454
|
+
AltDateTimeWidget,
|
|
1455
|
+
AltDateWidget,
|
|
1456
|
+
CheckboxesWidget,
|
|
1457
|
+
CheckboxWidget,
|
|
1458
|
+
DateTimeWidget,
|
|
1459
|
+
DateWidget,
|
|
1460
|
+
PasswordWidget,
|
|
1461
|
+
RadioWidget,
|
|
1462
|
+
RangeWidget,
|
|
1463
|
+
SelectWidget,
|
|
1464
|
+
TextareaWidget
|
|
1669
1465
|
};
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
var handleBlur = function handleBlur(_ref3) {
|
|
1691
|
-
var target = _ref3.target;
|
|
1692
|
-
return onBlur(id, target.value);
|
|
1693
|
-
};
|
|
1694
|
-
|
|
1695
|
-
var handleFocus = function handleFocus(_ref4) {
|
|
1696
|
-
var target = _ref4.target;
|
|
1697
|
-
return onFocus(id, target.value);
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
|
-
return /*#__PURE__*/React__default.createElement(Input, {
|
|
1701
|
-
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1702
|
-
id: id,
|
|
1703
|
-
name: id,
|
|
1704
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
1705
|
-
onChange: !readonly ? handleChange : undefined,
|
|
1706
|
-
onFocus: !readonly ? handleFocus : undefined,
|
|
1707
|
-
placeholder: placeholder,
|
|
1708
|
-
style: INPUT_STYLE$6,
|
|
1709
|
-
type: "url",
|
|
1710
|
-
value: value
|
|
1711
|
-
});
|
|
1712
|
-
};
|
|
1713
|
-
|
|
1714
|
-
var getSubmitButtonOptions = core.utils.getSubmitButtonOptions;
|
|
1715
|
-
var SubmitButton = (function (_ref) {
|
|
1716
|
-
var uiSchema = _ref.uiSchema;
|
|
1717
|
-
|
|
1718
|
-
var _getSubmitButtonOptio = getSubmitButtonOptions(uiSchema),
|
|
1719
|
-
submitText = _getSubmitButtonOptio.submitText,
|
|
1720
|
-
norender = _getSubmitButtonOptio.norender,
|
|
1721
|
-
submitButtonProps = _getSubmitButtonOptio.props;
|
|
1722
|
-
|
|
1723
|
-
if (norender) {
|
|
1724
|
-
return null;
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
return /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
1728
|
-
htmlType: "submit"
|
|
1729
|
-
}, submitButtonProps), submitText);
|
|
1730
|
-
});
|
|
1731
|
-
|
|
1732
|
-
var ErrorList = function ErrorList(_ref) {
|
|
1733
|
-
var errors = _ref.errors;
|
|
1734
|
-
|
|
1735
|
-
var renderErrors = function renderErrors() {
|
|
1736
|
-
return /*#__PURE__*/React__default.createElement(List, {
|
|
1737
|
-
className: "list-group",
|
|
1738
|
-
size: "small"
|
|
1739
|
-
}, errors.map(function (error, index) {
|
|
1740
|
-
return /*#__PURE__*/React__default.createElement(List.Item, {
|
|
1741
|
-
key: index
|
|
1742
|
-
}, /*#__PURE__*/React__default.createElement(Space, null, /*#__PURE__*/React__default.createElement(ExclamationCircleOutlined, null), error.stack));
|
|
1743
|
-
}));
|
|
1744
|
-
};
|
|
1745
|
-
|
|
1746
|
-
return /*#__PURE__*/React__default.createElement(Alert, {
|
|
1747
|
-
className: "panel panel-danger errors",
|
|
1748
|
-
description: renderErrors(),
|
|
1749
|
-
message: "Errors",
|
|
1750
|
-
type: "error"
|
|
1751
|
-
});
|
|
1752
|
-
};
|
|
1753
|
-
|
|
1754
|
-
var getDefaultRegistry = core.utils.getDefaultRegistry;
|
|
1755
|
-
|
|
1756
|
-
var _getDefaultRegistry = /*#__PURE__*/getDefaultRegistry(),
|
|
1757
|
-
fields = _getDefaultRegistry.fields,
|
|
1758
|
-
widgets = _getDefaultRegistry.widgets;
|
|
1759
|
-
|
|
1760
|
-
var Fields = {
|
|
1761
|
-
DescriptionField: DescriptionField,
|
|
1762
|
-
TitleField: TitleField$1
|
|
1763
|
-
};
|
|
1764
|
-
var Widgets = {
|
|
1765
|
-
AltDateTimeWidget: AltDateTimeWidget,
|
|
1766
|
-
AltDateWidget: AltDateWidget,
|
|
1767
|
-
CheckboxesWidget: CheckboxesWidget,
|
|
1768
|
-
CheckboxWidget: CheckboxWidget,
|
|
1769
|
-
ColorWidget: ColorWidget,
|
|
1770
|
-
DateTimeWidget: DateTimeWidget,
|
|
1771
|
-
DateWidget: DateWidget,
|
|
1772
|
-
EmailWidget: EmailWidget,
|
|
1773
|
-
PasswordWidget: PasswordWidget,
|
|
1774
|
-
RadioWidget: RadioWidget,
|
|
1775
|
-
RangeWidget: RangeWidget,
|
|
1776
|
-
SelectWidget: SelectWidget,
|
|
1777
|
-
TextareaWidget: TextareaWidget,
|
|
1778
|
-
TextWidget: TextWidget,
|
|
1779
|
-
UpDownWidget: UpDownWidget,
|
|
1780
|
-
URLWidget: URLWidget,
|
|
1781
|
-
SubmitButton: SubmitButton
|
|
1782
|
-
};
|
|
1783
|
-
var Theme = {
|
|
1784
|
-
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
1785
|
-
fields: /*#__PURE__*/_extends({}, fields, Fields),
|
|
1786
|
-
FieldTemplate: FieldTemplate,
|
|
1787
|
-
ObjectFieldTemplate: ObjectFieldTemplate$1,
|
|
1788
|
-
widgets: /*#__PURE__*/_extends({}, widgets, Widgets),
|
|
1789
|
-
ErrorList: ErrorList
|
|
1466
|
+
const Theme = {
|
|
1467
|
+
templates: {
|
|
1468
|
+
ArrayFieldItemTemplate,
|
|
1469
|
+
ArrayFieldTemplate: ArrayFieldTemplate$1,
|
|
1470
|
+
BaseInputTemplate: TextWidget,
|
|
1471
|
+
ButtonTemplates: {
|
|
1472
|
+
AddButton,
|
|
1473
|
+
MoveDownButton,
|
|
1474
|
+
MoveUpButton,
|
|
1475
|
+
RemoveButton,
|
|
1476
|
+
SubmitButton
|
|
1477
|
+
},
|
|
1478
|
+
DescriptionFieldTemplate: DescriptionField,
|
|
1479
|
+
ErrorListTemplate: ErrorList,
|
|
1480
|
+
FieldTemplate,
|
|
1481
|
+
ObjectFieldTemplate: ObjectFieldTemplate$1,
|
|
1482
|
+
TitleFieldTemplate: TitleField$1
|
|
1483
|
+
},
|
|
1484
|
+
widgets: Widgets
|
|
1790
1485
|
};
|
|
1791
|
-
|
|
1486
|
+
const Form = /*#__PURE__*/core.withTheme(Theme);
|
|
1792
1487
|
|
|
1793
|
-
exports.Fields = Fields;
|
|
1794
1488
|
exports.Form = Form;
|
|
1795
1489
|
exports.Theme = Theme;
|
|
1796
1490
|
exports.Widgets = Widgets;
|
|
1797
|
-
exports
|
|
1491
|
+
exports["default"] = Form;
|
|
1798
1492
|
//# sourceMappingURL=antd.cjs.development.js.map
|