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