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