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