@rjsf/antd 5.0.0-beta.13 → 5.0.0-beta.15
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/dist/antd.cjs.development.js +687 -735
- 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 +688 -736
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +687 -735
- package/dist/antd.umd.development.js.map +1 -1
- package/dist/antd.umd.production.min.js +1 -1
- package/dist/antd.umd.production.min.js.map +1 -1
- package/package.json +5 -5
package/dist/antd.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
3
3
|
import Button from 'antd/es/button';
|
|
4
4
|
import Col from 'antd/es/col';
|
|
5
5
|
import Row from 'antd/es/row';
|
|
6
|
-
import { getUiOptions, getTemplate, getInputProps, canExpand, getSubmitButtonOptions,
|
|
6
|
+
import { getUiOptions, getTemplate, getInputProps, canExpand, getSubmitButtonOptions, UI_OPTIONS_KEY, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, rangeSpec, processSelectValue } from '@rjsf/utils';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { withConfigConsumer } from 'antd/es/config-provider/context';
|
|
9
9
|
import Input from 'antd/es/input';
|
|
@@ -28,39 +28,37 @@ import Radio from 'antd/es/radio';
|
|
|
28
28
|
import Slider from 'antd/es/slider';
|
|
29
29
|
import Select from 'antd/es/select';
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
var BTN_GRP_STYLE = {
|
|
32
32
|
width: "100%"
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
var BTN_STYLE = {
|
|
35
35
|
width: "calc(100% / 3)"
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
toolbarAlign = "top"
|
|
60
|
-
} = registry.formContext;
|
|
37
|
+
var ArrayFieldItemTemplate = function ArrayFieldItemTemplate(_ref) {
|
|
38
|
+
var children = _ref.children,
|
|
39
|
+
disabled = _ref.disabled,
|
|
40
|
+
hasMoveDown = _ref.hasMoveDown,
|
|
41
|
+
hasMoveUp = _ref.hasMoveUp,
|
|
42
|
+
hasRemove = _ref.hasRemove,
|
|
43
|
+
hasToolbar = _ref.hasToolbar,
|
|
44
|
+
index = _ref.index,
|
|
45
|
+
onDropIndexClick = _ref.onDropIndexClick,
|
|
46
|
+
onReorderClick = _ref.onReorderClick,
|
|
47
|
+
readonly = _ref.readonly,
|
|
48
|
+
registry = _ref.registry,
|
|
49
|
+
uiSchema = _ref.uiSchema;
|
|
50
|
+
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
51
|
+
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
52
|
+
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
53
|
+
RemoveButton = _registry$templates$B.RemoveButton;
|
|
54
|
+
var _registry$formContext = registry.formContext,
|
|
55
|
+
_registry$formContext2 = _registry$formContext.rowGutter,
|
|
56
|
+
rowGutter = _registry$formContext2 === void 0 ? 24 : _registry$formContext2,
|
|
57
|
+
_registry$formContext3 = _registry$formContext.toolbarAlign,
|
|
58
|
+
toolbarAlign = _registry$formContext3 === void 0 ? "top" : _registry$formContext3;
|
|
61
59
|
return /*#__PURE__*/React.createElement(Row, {
|
|
62
60
|
align: toolbarAlign,
|
|
63
|
-
key:
|
|
61
|
+
key: "array-item-" + index,
|
|
64
62
|
gutter: rowGutter
|
|
65
63
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
66
64
|
flex: "1"
|
|
@@ -86,42 +84,64 @@ const ArrayFieldItemTemplate = _ref => {
|
|
|
86
84
|
}))));
|
|
87
85
|
};
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
function _extends() {
|
|
88
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
89
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
90
|
+
var source = arguments[i];
|
|
91
|
+
for (var key in source) {
|
|
92
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
93
|
+
target[key] = source[key];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return target;
|
|
98
|
+
};
|
|
99
|
+
return _extends.apply(this, arguments);
|
|
100
|
+
}
|
|
101
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
102
|
+
if (source == null) return {};
|
|
103
|
+
var target = {};
|
|
104
|
+
var sourceKeys = Object.keys(source);
|
|
105
|
+
var key, i;
|
|
106
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
107
|
+
key = sourceKeys[i];
|
|
108
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
109
|
+
target[key] = source[key];
|
|
110
|
+
}
|
|
111
|
+
return target;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var _excluded$1 = ["key"];
|
|
115
|
+
var DESCRIPTION_COL_STYLE$1 = {
|
|
90
116
|
paddingBottom: "8px"
|
|
91
117
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const ArrayFieldItemTemplate = getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
112
|
-
const ArrayFieldTitleTemplate = getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
|
|
118
|
+
var ArrayFieldTemplate = function ArrayFieldTemplate(_ref) {
|
|
119
|
+
var canAdd = _ref.canAdd,
|
|
120
|
+
className = _ref.className,
|
|
121
|
+
disabled = _ref.disabled,
|
|
122
|
+
formContext = _ref.formContext,
|
|
123
|
+
idSchema = _ref.idSchema,
|
|
124
|
+
items = _ref.items,
|
|
125
|
+
onAddClick = _ref.onAddClick,
|
|
126
|
+
prefixCls = _ref.prefixCls,
|
|
127
|
+
readonly = _ref.readonly,
|
|
128
|
+
registry = _ref.registry,
|
|
129
|
+
required = _ref.required,
|
|
130
|
+
schema = _ref.schema,
|
|
131
|
+
title = _ref.title,
|
|
132
|
+
uiSchema = _ref.uiSchema;
|
|
133
|
+
var uiOptions = getUiOptions(uiSchema);
|
|
134
|
+
var ArrayFieldDescriptionTemplate = getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
|
|
135
|
+
var ArrayFieldItemTemplate = getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
136
|
+
var ArrayFieldTitleTemplate = getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
|
|
113
137
|
// Button templates are not overridden in the uiSchema
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
rowGutter = 24
|
|
122
|
-
} = formContext;
|
|
123
|
-
const labelClsBasic = `${prefixCls}-item-label`;
|
|
124
|
-
const labelColClassName = classNames(labelClsBasic, labelAlign === "left" && `${labelClsBasic}-left`
|
|
138
|
+
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
139
|
+
var _formContext$labelAli = formContext.labelAlign,
|
|
140
|
+
labelAlign = _formContext$labelAli === void 0 ? "right" : _formContext$labelAli,
|
|
141
|
+
_formContext$rowGutte = formContext.rowGutter,
|
|
142
|
+
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
143
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
144
|
+
var labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left"
|
|
125
145
|
// labelCol.className,
|
|
126
146
|
);
|
|
127
147
|
|
|
@@ -152,15 +172,12 @@ const ArrayFieldTemplate = _ref => {
|
|
|
152
172
|
})), /*#__PURE__*/React.createElement(Col, {
|
|
153
173
|
className: "row array-item-list",
|
|
154
174
|
span: 24
|
|
155
|
-
}, items && items.map(_ref2
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
key: key,
|
|
162
|
-
...itemProps
|
|
163
|
-
});
|
|
175
|
+
}, items && items.map(function (_ref2) {
|
|
176
|
+
var key = _ref2.key,
|
|
177
|
+
itemProps = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
|
|
178
|
+
return /*#__PURE__*/React.createElement(ArrayFieldItemTemplate, _extends({
|
|
179
|
+
key: key
|
|
180
|
+
}, itemProps));
|
|
164
181
|
})), canAdd && /*#__PURE__*/React.createElement(Col, {
|
|
165
182
|
span: 24
|
|
166
183
|
}, /*#__PURE__*/React.createElement(Row, {
|
|
@@ -179,48 +196,41 @@ var ArrayFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
|
|
|
179
196
|
prefixCls: "form"
|
|
180
197
|
})(ArrayFieldTemplate);
|
|
181
198
|
|
|
182
|
-
|
|
199
|
+
var INPUT_STYLE$2 = {
|
|
183
200
|
width: "100%"
|
|
184
201
|
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
let {
|
|
207
|
-
target
|
|
208
|
-
} = _ref2;
|
|
202
|
+
var BaseInputTemplate = function BaseInputTemplate(_ref) {
|
|
203
|
+
var disabled = _ref.disabled,
|
|
204
|
+
formContext = _ref.formContext,
|
|
205
|
+
id = _ref.id,
|
|
206
|
+
onBlur = _ref.onBlur,
|
|
207
|
+
onChange = _ref.onChange,
|
|
208
|
+
onFocus = _ref.onFocus,
|
|
209
|
+
options = _ref.options,
|
|
210
|
+
placeholder = _ref.placeholder,
|
|
211
|
+
readonly = _ref.readonly,
|
|
212
|
+
schema = _ref.schema,
|
|
213
|
+
value = _ref.value,
|
|
214
|
+
type = _ref.type;
|
|
215
|
+
var inputProps = getInputProps(schema, type, options, false);
|
|
216
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
217
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
218
|
+
var handleNumberChange = function handleNumberChange(nextValue) {
|
|
219
|
+
return onChange(nextValue);
|
|
220
|
+
};
|
|
221
|
+
var handleTextChange = function handleTextChange(_ref2) {
|
|
222
|
+
var target = _ref2.target;
|
|
209
223
|
return onChange(target.value === "" ? options.emptyValue : target.value);
|
|
210
224
|
};
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
target
|
|
214
|
-
} = _ref3;
|
|
225
|
+
var handleBlur = function handleBlur(_ref3) {
|
|
226
|
+
var target = _ref3.target;
|
|
215
227
|
return onBlur(id, target.value);
|
|
216
228
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
target
|
|
220
|
-
} = _ref4;
|
|
229
|
+
var handleFocus = function handleFocus(_ref4) {
|
|
230
|
+
var target = _ref4.target;
|
|
221
231
|
return onFocus(id, target.value);
|
|
222
232
|
};
|
|
223
|
-
|
|
233
|
+
var input = inputProps.type === "number" || inputProps.type === "integer" ? /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
224
234
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
225
235
|
id: id,
|
|
226
236
|
name: id,
|
|
@@ -229,10 +239,10 @@ const BaseInputTemplate = _ref => {
|
|
|
229
239
|
onFocus: !readonly ? handleFocus : undefined,
|
|
230
240
|
placeholder: placeholder,
|
|
231
241
|
style: INPUT_STYLE$2,
|
|
232
|
-
list: schema.examples ?
|
|
233
|
-
|
|
242
|
+
list: schema.examples ? "examples_" + id : undefined
|
|
243
|
+
}, inputProps, {
|
|
234
244
|
value: value
|
|
235
|
-
}) : /*#__PURE__*/React.createElement(Input, {
|
|
245
|
+
})) : /*#__PURE__*/React.createElement(Input, _extends({
|
|
236
246
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
237
247
|
id: id,
|
|
238
248
|
name: id,
|
|
@@ -241,13 +251,13 @@ const BaseInputTemplate = _ref => {
|
|
|
241
251
|
onFocus: !readonly ? handleFocus : undefined,
|
|
242
252
|
placeholder: placeholder,
|
|
243
253
|
style: INPUT_STYLE$2,
|
|
244
|
-
list: schema.examples ?
|
|
245
|
-
|
|
254
|
+
list: schema.examples ? "examples_" + id : undefined
|
|
255
|
+
}, inputProps, {
|
|
246
256
|
value: value
|
|
247
|
-
});
|
|
257
|
+
}));
|
|
248
258
|
return /*#__PURE__*/React.createElement(React.Fragment, null, input, schema.examples && /*#__PURE__*/React.createElement("datalist", {
|
|
249
|
-
id:
|
|
250
|
-
}, schema.examples.concat(schema
|
|
259
|
+
id: "examples_" + id
|
|
260
|
+
}, schema.examples.concat(schema["default"] ? [schema["default"]] : []).map(function (example) {
|
|
251
261
|
return /*#__PURE__*/React.createElement("option", {
|
|
252
262
|
key: example,
|
|
253
263
|
value: example
|
|
@@ -255,11 +265,9 @@ const BaseInputTemplate = _ref => {
|
|
|
255
265
|
})));
|
|
256
266
|
};
|
|
257
267
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
id
|
|
262
|
-
} = _ref;
|
|
268
|
+
var DescriptionField = function DescriptionField(_ref) {
|
|
269
|
+
var description = _ref.description,
|
|
270
|
+
id = _ref.id;
|
|
263
271
|
if (!description) {
|
|
264
272
|
return null;
|
|
265
273
|
}
|
|
@@ -268,16 +276,18 @@ const DescriptionField = _ref => {
|
|
|
268
276
|
}, description);
|
|
269
277
|
};
|
|
270
278
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
var ErrorList = function ErrorList(_ref) {
|
|
280
|
+
var errors = _ref.errors;
|
|
281
|
+
var renderErrors = function renderErrors() {
|
|
282
|
+
return /*#__PURE__*/React.createElement(List, {
|
|
283
|
+
className: "list-group",
|
|
284
|
+
size: "small"
|
|
285
|
+
}, errors.map(function (error, index) {
|
|
286
|
+
return /*#__PURE__*/React.createElement(List.Item, {
|
|
287
|
+
key: index
|
|
288
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null), error.stack));
|
|
289
|
+
}));
|
|
290
|
+
};
|
|
281
291
|
return /*#__PURE__*/React.createElement(Alert, {
|
|
282
292
|
className: "panel panel-danger errors",
|
|
283
293
|
description: renderErrors(),
|
|
@@ -286,53 +296,51 @@ const ErrorList = _ref => {
|
|
|
286
296
|
});
|
|
287
297
|
};
|
|
288
298
|
|
|
299
|
+
var _excluded = ["iconType", "icon", "uiSchema"];
|
|
289
300
|
function IconButton(props) {
|
|
290
|
-
|
|
291
|
-
iconType = "default",
|
|
292
|
-
icon,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
} = props;
|
|
296
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
301
|
+
var _props$iconType = props.iconType,
|
|
302
|
+
iconType = _props$iconType === void 0 ? "default" : _props$iconType,
|
|
303
|
+
icon = props.icon,
|
|
304
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
305
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
297
306
|
type: iconType,
|
|
298
|
-
icon: icon
|
|
299
|
-
|
|
300
|
-
});
|
|
307
|
+
icon: icon
|
|
308
|
+
}, otherProps));
|
|
301
309
|
}
|
|
302
310
|
function AddButton(props) {
|
|
303
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
304
|
-
title: "Add Item"
|
|
305
|
-
|
|
311
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
312
|
+
title: "Add Item"
|
|
313
|
+
}, props, {
|
|
306
314
|
block: true,
|
|
307
315
|
iconType: "primary",
|
|
308
316
|
icon: /*#__PURE__*/React.createElement(PlusCircleOutlined, null)
|
|
309
|
-
});
|
|
317
|
+
}));
|
|
310
318
|
}
|
|
311
319
|
function MoveDownButton(props) {
|
|
312
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
313
|
-
title: "Move down"
|
|
314
|
-
|
|
320
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
321
|
+
title: "Move down"
|
|
322
|
+
}, props, {
|
|
315
323
|
icon: /*#__PURE__*/React.createElement(ArrowDownOutlined, null)
|
|
316
|
-
});
|
|
324
|
+
}));
|
|
317
325
|
}
|
|
318
326
|
function MoveUpButton(props) {
|
|
319
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
320
|
-
title: "Move up"
|
|
321
|
-
|
|
327
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
328
|
+
title: "Move up"
|
|
329
|
+
}, props, {
|
|
322
330
|
icon: /*#__PURE__*/React.createElement(ArrowUpOutlined, null)
|
|
323
|
-
});
|
|
331
|
+
}));
|
|
324
332
|
}
|
|
325
333
|
function RemoveButton(props) {
|
|
326
334
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
|
|
327
|
-
|
|
328
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
329
|
-
title: "Remove"
|
|
330
|
-
|
|
335
|
+
var options = getUiOptions(props.uiSchema);
|
|
336
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
337
|
+
title: "Remove"
|
|
338
|
+
}, props, {
|
|
331
339
|
danger: true,
|
|
332
340
|
block: !!options.block,
|
|
333
341
|
iconType: "primary",
|
|
334
342
|
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
|
335
|
-
});
|
|
343
|
+
}));
|
|
336
344
|
}
|
|
337
345
|
|
|
338
346
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -340,59 +348,58 @@ function RemoveButton(props) {
|
|
|
340
348
|
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
341
349
|
*/
|
|
342
350
|
function FieldErrorTemplate(props) {
|
|
343
|
-
|
|
344
|
-
errors = [],
|
|
345
|
-
idSchema
|
|
346
|
-
} = props;
|
|
351
|
+
var _props$errors = props.errors,
|
|
352
|
+
errors = _props$errors === void 0 ? [] : _props$errors,
|
|
353
|
+
idSchema = props.idSchema;
|
|
347
354
|
if (errors.length === 0) {
|
|
348
355
|
return null;
|
|
349
356
|
}
|
|
350
|
-
|
|
357
|
+
var id = idSchema.$id + "__error";
|
|
351
358
|
return /*#__PURE__*/React.createElement("div", {
|
|
352
359
|
id: id
|
|
353
|
-
}, errors.map(
|
|
354
|
-
|
|
355
|
-
|
|
360
|
+
}, errors.map(function (error) {
|
|
361
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
362
|
+
key: "field-" + id + "-error-" + error
|
|
363
|
+
}, error);
|
|
364
|
+
}));
|
|
356
365
|
}
|
|
357
366
|
|
|
358
|
-
|
|
367
|
+
var VERTICAL_LABEL_COL$1 = {
|
|
359
368
|
span: 24
|
|
360
369
|
};
|
|
361
|
-
|
|
370
|
+
var VERTICAL_WRAPPER_COL$1 = {
|
|
362
371
|
span: 24
|
|
363
372
|
};
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const uiOptions = getUiOptions(uiSchema);
|
|
395
|
-
const WrapIfAdditionalTemplate = getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
|
|
373
|
+
var FieldTemplate = function FieldTemplate(_ref) {
|
|
374
|
+
var children = _ref.children,
|
|
375
|
+
classNames = _ref.classNames,
|
|
376
|
+
description = _ref.description,
|
|
377
|
+
disabled = _ref.disabled,
|
|
378
|
+
displayLabel = _ref.displayLabel,
|
|
379
|
+
errors = _ref.errors,
|
|
380
|
+
formContext = _ref.formContext,
|
|
381
|
+
help = _ref.help,
|
|
382
|
+
hidden = _ref.hidden,
|
|
383
|
+
id = _ref.id,
|
|
384
|
+
label = _ref.label,
|
|
385
|
+
onDropPropertyClick = _ref.onDropPropertyClick,
|
|
386
|
+
onKeyChange = _ref.onKeyChange,
|
|
387
|
+
rawErrors = _ref.rawErrors,
|
|
388
|
+
rawDescription = _ref.rawDescription,
|
|
389
|
+
rawHelp = _ref.rawHelp,
|
|
390
|
+
readonly = _ref.readonly,
|
|
391
|
+
registry = _ref.registry,
|
|
392
|
+
required = _ref.required,
|
|
393
|
+
schema = _ref.schema,
|
|
394
|
+
uiSchema = _ref.uiSchema;
|
|
395
|
+
var colon = formContext.colon,
|
|
396
|
+
_formContext$labelCol = formContext.labelCol,
|
|
397
|
+
labelCol = _formContext$labelCol === void 0 ? VERTICAL_LABEL_COL$1 : _formContext$labelCol,
|
|
398
|
+
_formContext$wrapperC = formContext.wrapperCol,
|
|
399
|
+
wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
|
|
400
|
+
wrapperStyle = formContext.wrapperStyle;
|
|
401
|
+
var uiOptions = getUiOptions(uiSchema);
|
|
402
|
+
var WrapIfAdditionalTemplate = getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
|
|
396
403
|
if (hidden) {
|
|
397
404
|
return /*#__PURE__*/React.createElement("div", {
|
|
398
405
|
className: "field-hidden"
|
|
@@ -414,7 +421,7 @@ const FieldTemplate = _ref => {
|
|
|
414
421
|
colon: colon,
|
|
415
422
|
extra: rawDescription && description,
|
|
416
423
|
hasFeedback: schema.type !== "array" && schema.type !== "object",
|
|
417
|
-
help: !!rawHelp && help || (rawErrors
|
|
424
|
+
help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
|
|
418
425
|
htmlFor: id,
|
|
419
426
|
label: displayLabel && label,
|
|
420
427
|
labelCol: labelCol,
|
|
@@ -425,59 +432,64 @@ const FieldTemplate = _ref => {
|
|
|
425
432
|
}, children));
|
|
426
433
|
};
|
|
427
434
|
|
|
428
|
-
|
|
435
|
+
var DESCRIPTION_COL_STYLE = {
|
|
429
436
|
paddingBottom: "8px"
|
|
430
437
|
};
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
const TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, uiOptions);
|
|
450
|
-
const DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
438
|
+
var ObjectFieldTemplate = function ObjectFieldTemplate(_ref) {
|
|
439
|
+
var description = _ref.description,
|
|
440
|
+
disabled = _ref.disabled,
|
|
441
|
+
formContext = _ref.formContext,
|
|
442
|
+
formData = _ref.formData,
|
|
443
|
+
idSchema = _ref.idSchema,
|
|
444
|
+
onAddClick = _ref.onAddClick,
|
|
445
|
+
prefixCls = _ref.prefixCls,
|
|
446
|
+
properties = _ref.properties,
|
|
447
|
+
readonly = _ref.readonly,
|
|
448
|
+
required = _ref.required,
|
|
449
|
+
registry = _ref.registry,
|
|
450
|
+
schema = _ref.schema,
|
|
451
|
+
title = _ref.title,
|
|
452
|
+
uiSchema = _ref.uiSchema;
|
|
453
|
+
var uiOptions = getUiOptions(uiSchema);
|
|
454
|
+
var TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, uiOptions);
|
|
455
|
+
var DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
451
456
|
// Button templates are not overridden in the uiSchema
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
} = formContext;
|
|
462
|
-
const labelClsBasic = `${prefixCls}-item-label`;
|
|
463
|
-
const labelColClassName = classNames(labelClsBasic, labelAlign === "left" && `${labelClsBasic}-left`
|
|
457
|
+
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
458
|
+
var _formContext$colSpan = formContext.colSpan,
|
|
459
|
+
colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
|
|
460
|
+
_formContext$labelAli = formContext.labelAlign,
|
|
461
|
+
labelAlign = _formContext$labelAli === void 0 ? "right" : _formContext$labelAli,
|
|
462
|
+
_formContext$rowGutte = formContext.rowGutter,
|
|
463
|
+
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
464
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
465
|
+
var labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left"
|
|
464
466
|
// labelCol.className,
|
|
465
467
|
);
|
|
466
468
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
469
|
+
var findSchema = function findSchema(element) {
|
|
470
|
+
return element.content.props.schema;
|
|
471
|
+
};
|
|
472
|
+
var findSchemaType = function findSchemaType(element) {
|
|
473
|
+
return findSchema(element).type;
|
|
474
|
+
};
|
|
475
|
+
var findUiSchema = function findUiSchema(element) {
|
|
476
|
+
return element.content.props.uiSchema;
|
|
477
|
+
};
|
|
478
|
+
var findUiSchemaField = function findUiSchemaField(element) {
|
|
479
|
+
return getUiOptions(findUiSchema(element)).field;
|
|
480
|
+
};
|
|
481
|
+
var findUiSchemaWidget = function findUiSchemaWidget(element) {
|
|
482
|
+
return getUiOptions(findUiSchema(element)).widget;
|
|
483
|
+
};
|
|
484
|
+
var calculateColSpan = function calculateColSpan(element) {
|
|
485
|
+
var type = findSchemaType(element);
|
|
486
|
+
var field = findUiSchemaField(element);
|
|
487
|
+
var widget = findUiSchemaWidget(element);
|
|
488
|
+
var defaultColSpan = properties.length < 2 ||
|
|
477
489
|
// Single or no field in object.
|
|
478
490
|
type === "object" || type === "array" || widget === "textarea" ? 24 : 12;
|
|
479
491
|
if (isObject(colSpan)) {
|
|
480
|
-
|
|
492
|
+
var colSpanObj = colSpan;
|
|
481
493
|
if (isString(widget)) {
|
|
482
494
|
return colSpanObj[widget];
|
|
483
495
|
}
|
|
@@ -501,7 +513,7 @@ const ObjectFieldTemplate = _ref => {
|
|
|
501
513
|
className: labelColClassName,
|
|
502
514
|
span: 24
|
|
503
515
|
}, /*#__PURE__*/React.createElement(TitleFieldTemplate, {
|
|
504
|
-
id:
|
|
516
|
+
id: idSchema.$id + "-title",
|
|
505
517
|
required: required,
|
|
506
518
|
title: uiOptions.title || title,
|
|
507
519
|
schema: schema,
|
|
@@ -512,14 +524,18 @@ const ObjectFieldTemplate = _ref => {
|
|
|
512
524
|
style: DESCRIPTION_COL_STYLE
|
|
513
525
|
}, /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
|
|
514
526
|
description: uiOptions.description || description,
|
|
515
|
-
id:
|
|
527
|
+
id: idSchema.$id + "-description",
|
|
516
528
|
schema: schema,
|
|
517
529
|
uiSchema: uiSchema,
|
|
518
530
|
registry: registry
|
|
519
|
-
})), properties.filter(
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
531
|
+
})), properties.filter(function (e) {
|
|
532
|
+
return !e.hidden;
|
|
533
|
+
}).map(function (element) {
|
|
534
|
+
return /*#__PURE__*/React.createElement(Col, {
|
|
535
|
+
key: element.name,
|
|
536
|
+
span: calculateColSpan(element)
|
|
537
|
+
}, element.content);
|
|
538
|
+
})), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(Col, {
|
|
523
539
|
span: 24
|
|
524
540
|
}, /*#__PURE__*/React.createElement(Row, {
|
|
525
541
|
gutter: rowGutter,
|
|
@@ -537,56 +553,44 @@ var ObjectFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
|
|
|
537
553
|
prefixCls: "form"
|
|
538
554
|
})(ObjectFieldTemplate);
|
|
539
555
|
|
|
540
|
-
var SubmitButton = (_ref
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
norender,
|
|
547
|
-
props: submitButtonProps
|
|
548
|
-
} = getSubmitButtonOptions(uiSchema);
|
|
556
|
+
var SubmitButton = (function (_ref) {
|
|
557
|
+
var uiSchema = _ref.uiSchema;
|
|
558
|
+
var _getSubmitButtonOptio = getSubmitButtonOptions(uiSchema),
|
|
559
|
+
submitText = _getSubmitButtonOptio.submitText,
|
|
560
|
+
norender = _getSubmitButtonOptio.norender,
|
|
561
|
+
submitButtonProps = _getSubmitButtonOptio.props;
|
|
549
562
|
if (norender) {
|
|
550
563
|
return null;
|
|
551
564
|
}
|
|
552
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
553
|
-
type: "submit"
|
|
554
|
-
|
|
565
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
566
|
+
type: "submit"
|
|
567
|
+
}, submitButtonProps, {
|
|
555
568
|
htmlType: "submit"
|
|
556
|
-
}, submitText);
|
|
569
|
+
}), submitText);
|
|
557
570
|
});
|
|
558
571
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
prefixCls,
|
|
563
|
-
required,
|
|
564
|
-
registry,
|
|
565
|
-
formContext
|
|
566
|
-
title
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
colon = true
|
|
573
|
-
} = {
|
|
574
|
-
...formContext1,
|
|
575
|
-
...formContext
|
|
576
|
-
};
|
|
577
|
-
let labelChildren = title;
|
|
572
|
+
var TitleField = function TitleField(_ref) {
|
|
573
|
+
var _classNames;
|
|
574
|
+
var id = _ref.id,
|
|
575
|
+
prefixCls = _ref.prefixCls,
|
|
576
|
+
required = _ref.required,
|
|
577
|
+
registry = _ref.registry,
|
|
578
|
+
formContext1 = _ref.formContext,
|
|
579
|
+
title = _ref.title;
|
|
580
|
+
var formContext = registry.formContext;
|
|
581
|
+
var _formContext1$formCon = _extends({}, formContext1, formContext),
|
|
582
|
+
_formContext1$formCon2 = _formContext1$formCon.colon,
|
|
583
|
+
colon = _formContext1$formCon2 === void 0 ? true : _formContext1$formCon2;
|
|
584
|
+
var labelChildren = title;
|
|
578
585
|
if (colon && typeof title === "string" && title.trim() !== "") {
|
|
579
586
|
labelChildren = title.replace(/[::]\s*$/, "");
|
|
580
587
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
[`${prefixCls}-item-no-colon`]: !colon
|
|
584
|
-
});
|
|
585
|
-
const handleLabelClick = () => {
|
|
588
|
+
var labelClassName = classNames((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
|
|
589
|
+
var handleLabelClick = function handleLabelClick() {
|
|
586
590
|
if (!id) {
|
|
587
591
|
return;
|
|
588
592
|
}
|
|
589
|
-
|
|
593
|
+
var control = document.querySelector("[id=\"" + id + "\"]");
|
|
590
594
|
if (control && control.focus) {
|
|
591
595
|
control.focus();
|
|
592
596
|
}
|
|
@@ -605,65 +609,60 @@ var TitleField$1 = /*#__PURE__*/withConfigConsumer({
|
|
|
605
609
|
prefixCls: "form"
|
|
606
610
|
})(TitleField);
|
|
607
611
|
|
|
608
|
-
|
|
612
|
+
var VERTICAL_LABEL_COL = {
|
|
609
613
|
span: 24
|
|
610
614
|
};
|
|
611
|
-
|
|
615
|
+
var VERTICAL_WRAPPER_COL = {
|
|
612
616
|
span: 24
|
|
613
617
|
};
|
|
614
|
-
|
|
618
|
+
var INPUT_STYLE$1 = {
|
|
615
619
|
width: "100%"
|
|
616
620
|
};
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
classNames,
|
|
621
|
-
disabled,
|
|
622
|
-
id,
|
|
623
|
-
label,
|
|
624
|
-
onDropPropertyClick,
|
|
625
|
-
onKeyChange,
|
|
626
|
-
readonly,
|
|
627
|
-
required,
|
|
628
|
-
registry,
|
|
629
|
-
schema,
|
|
630
|
-
uiSchema
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
labelCol = VERTICAL_LABEL_COL,
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
621
|
+
var WrapIfAdditionalTemplate = function WrapIfAdditionalTemplate(_ref) {
|
|
622
|
+
var _extends2;
|
|
623
|
+
var children = _ref.children,
|
|
624
|
+
classNames = _ref.classNames,
|
|
625
|
+
disabled = _ref.disabled,
|
|
626
|
+
id = _ref.id,
|
|
627
|
+
label = _ref.label,
|
|
628
|
+
onDropPropertyClick = _ref.onDropPropertyClick,
|
|
629
|
+
onKeyChange = _ref.onKeyChange,
|
|
630
|
+
readonly = _ref.readonly,
|
|
631
|
+
required = _ref.required,
|
|
632
|
+
registry = _ref.registry,
|
|
633
|
+
schema = _ref.schema,
|
|
634
|
+
uiSchema = _ref.uiSchema;
|
|
635
|
+
var _registry$formContext = registry.formContext,
|
|
636
|
+
colon = _registry$formContext.colon,
|
|
637
|
+
_registry$formContext2 = _registry$formContext.labelCol,
|
|
638
|
+
labelCol = _registry$formContext2 === void 0 ? VERTICAL_LABEL_COL : _registry$formContext2,
|
|
639
|
+
_registry$formContext3 = _registry$formContext.readonlyAsDisabled,
|
|
640
|
+
readonlyAsDisabled = _registry$formContext3 === void 0 ? true : _registry$formContext3,
|
|
641
|
+
_registry$formContext4 = _registry$formContext.rowGutter,
|
|
642
|
+
rowGutter = _registry$formContext4 === void 0 ? 24 : _registry$formContext4,
|
|
643
|
+
_registry$formContext5 = _registry$formContext.toolbarAlign,
|
|
644
|
+
toolbarAlign = _registry$formContext5 === void 0 ? "top" : _registry$formContext5,
|
|
645
|
+
_registry$formContext6 = _registry$formContext.wrapperCol,
|
|
646
|
+
wrapperCol = _registry$formContext6 === void 0 ? VERTICAL_WRAPPER_COL : _registry$formContext6,
|
|
647
|
+
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
641
648
|
// Button templates are not overridden in the uiSchema
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
const keyLabel = `${label} Key`; // i18n ?
|
|
646
|
-
const additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
649
|
+
var RemoveButton = registry.templates.ButtonTemplates.RemoveButton;
|
|
650
|
+
var keyLabel = label + " Key"; // i18n ?
|
|
651
|
+
var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
647
652
|
if (!additional) {
|
|
648
653
|
return /*#__PURE__*/React.createElement("div", {
|
|
649
654
|
className: classNames
|
|
650
655
|
}, children);
|
|
651
656
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
target
|
|
655
|
-
} = _ref2;
|
|
657
|
+
var handleBlur = function handleBlur(_ref2) {
|
|
658
|
+
var target = _ref2.target;
|
|
656
659
|
return onKeyChange(target.value);
|
|
657
660
|
};
|
|
658
661
|
// The `block` prop is not part of the `IconButtonProps` defined in the template, so put it into the uiSchema instead
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
...uiOptions,
|
|
664
|
-
block: true
|
|
665
|
-
}
|
|
666
|
-
};
|
|
662
|
+
var uiOptions = uiSchema ? uiSchema[UI_OPTIONS_KEY] : {};
|
|
663
|
+
var buttonUiOptions = _extends({}, uiSchema, (_extends2 = {}, _extends2[UI_OPTIONS_KEY] = _extends({}, uiOptions, {
|
|
664
|
+
block: true
|
|
665
|
+
}), _extends2));
|
|
667
666
|
return /*#__PURE__*/React.createElement("div", {
|
|
668
667
|
className: classNames
|
|
669
668
|
}, /*#__PURE__*/React.createElement(Row, {
|
|
@@ -678,7 +677,7 @@ const WrapIfAdditionalTemplate = _ref => {
|
|
|
678
677
|
colon: colon,
|
|
679
678
|
className: "form-group",
|
|
680
679
|
hasFeedback: true,
|
|
681
|
-
htmlFor:
|
|
680
|
+
htmlFor: id + "-key",
|
|
682
681
|
label: keyLabel,
|
|
683
682
|
labelCol: labelCol,
|
|
684
683
|
required: required,
|
|
@@ -688,8 +687,8 @@ const WrapIfAdditionalTemplate = _ref => {
|
|
|
688
687
|
className: "form-control",
|
|
689
688
|
defaultValue: label,
|
|
690
689
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
691
|
-
id:
|
|
692
|
-
name:
|
|
690
|
+
id: id + "-key",
|
|
691
|
+
name: id + "-key",
|
|
693
692
|
onBlur: !readonly ? handleBlur : undefined,
|
|
694
693
|
style: INPUT_STYLE$1,
|
|
695
694
|
type: "text"
|
|
@@ -706,29 +705,29 @@ const WrapIfAdditionalTemplate = _ref => {
|
|
|
706
705
|
}))));
|
|
707
706
|
};
|
|
708
707
|
|
|
709
|
-
|
|
710
|
-
ArrayFieldItemTemplate,
|
|
708
|
+
var Index = {
|
|
709
|
+
ArrayFieldItemTemplate: ArrayFieldItemTemplate,
|
|
711
710
|
ArrayFieldTemplate: ArrayFieldTemplate$1,
|
|
712
|
-
BaseInputTemplate,
|
|
711
|
+
BaseInputTemplate: BaseInputTemplate,
|
|
713
712
|
ButtonTemplates: {
|
|
714
|
-
AddButton,
|
|
715
|
-
MoveDownButton,
|
|
716
|
-
MoveUpButton,
|
|
717
|
-
RemoveButton,
|
|
718
|
-
SubmitButton
|
|
713
|
+
AddButton: AddButton,
|
|
714
|
+
MoveDownButton: MoveDownButton,
|
|
715
|
+
MoveUpButton: MoveUpButton,
|
|
716
|
+
RemoveButton: RemoveButton,
|
|
717
|
+
SubmitButton: SubmitButton
|
|
719
718
|
},
|
|
720
719
|
DescriptionFieldTemplate: DescriptionField,
|
|
721
720
|
ErrorListTemplate: ErrorList,
|
|
722
|
-
FieldErrorTemplate,
|
|
723
|
-
FieldTemplate,
|
|
721
|
+
FieldErrorTemplate: FieldErrorTemplate,
|
|
722
|
+
FieldTemplate: FieldTemplate,
|
|
724
723
|
ObjectFieldTemplate: ObjectFieldTemplate$1,
|
|
725
724
|
TitleFieldTemplate: TitleField$1,
|
|
726
|
-
WrapIfAdditionalTemplate
|
|
725
|
+
WrapIfAdditionalTemplate: WrapIfAdditionalTemplate
|
|
727
726
|
};
|
|
728
727
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
for (
|
|
728
|
+
var rangeOptions = function rangeOptions(start, stop) {
|
|
729
|
+
var options = [];
|
|
730
|
+
for (var i = start; i <= stop; i++) {
|
|
732
731
|
options.push({
|
|
733
732
|
value: i,
|
|
734
733
|
label: pad(i, 2)
|
|
@@ -736,22 +735,22 @@ const rangeOptions = (start, stop) => {
|
|
|
736
735
|
}
|
|
737
736
|
return options;
|
|
738
737
|
};
|
|
739
|
-
|
|
740
|
-
return Object.values(state).every(
|
|
738
|
+
var readyForChange = function readyForChange(state) {
|
|
739
|
+
return Object.values(state).every(function (value) {
|
|
740
|
+
return value !== -1;
|
|
741
|
+
});
|
|
741
742
|
};
|
|
742
743
|
function dateElementProps(state, time, yearsRange) {
|
|
743
744
|
if (yearsRange === void 0) {
|
|
744
745
|
yearsRange = [1900, new Date().getFullYear() + 2];
|
|
745
746
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
} = state;
|
|
754
|
-
const data = [{
|
|
747
|
+
var year = state.year,
|
|
748
|
+
month = state.month,
|
|
749
|
+
day = state.day,
|
|
750
|
+
hour = state.hour,
|
|
751
|
+
minute = state.minute,
|
|
752
|
+
second = state.second;
|
|
753
|
+
var data = [{
|
|
755
754
|
type: "year",
|
|
756
755
|
range: yearsRange,
|
|
757
756
|
value: year
|
|
@@ -781,100 +780,98 @@ function dateElementProps(state, time, yearsRange) {
|
|
|
781
780
|
}
|
|
782
781
|
return data;
|
|
783
782
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
} = formContext;
|
|
805
|
-
const [state, setState] = useState(parseDateString(value, showTime));
|
|
806
|
-
useEffect(() => {
|
|
783
|
+
var AltDateWidget = function AltDateWidget(_ref) {
|
|
784
|
+
var autofocus = _ref.autofocus,
|
|
785
|
+
disabled = _ref.disabled,
|
|
786
|
+
formContext = _ref.formContext,
|
|
787
|
+
id = _ref.id,
|
|
788
|
+
onBlur = _ref.onBlur,
|
|
789
|
+
onChange = _ref.onChange,
|
|
790
|
+
onFocus = _ref.onFocus,
|
|
791
|
+
options = _ref.options,
|
|
792
|
+
readonly = _ref.readonly,
|
|
793
|
+
registry = _ref.registry,
|
|
794
|
+
showTime = _ref.showTime,
|
|
795
|
+
value = _ref.value;
|
|
796
|
+
var SelectWidget = registry.widgets.SelectWidget;
|
|
797
|
+
var _formContext$rowGutte = formContext.rowGutter,
|
|
798
|
+
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
799
|
+
var _useState = useState(parseDateString(value, showTime)),
|
|
800
|
+
state = _useState[0],
|
|
801
|
+
setState = _useState[1];
|
|
802
|
+
useEffect(function () {
|
|
807
803
|
setState(parseDateString(value, showTime));
|
|
808
804
|
}, [showTime, value]);
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
813
|
-
};
|
|
805
|
+
var handleChange = function handleChange(property, nextValue) {
|
|
806
|
+
var _extends2;
|
|
807
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === "undefined" ? -1 : nextValue, _extends2));
|
|
814
808
|
if (readyForChange(nextState)) {
|
|
815
809
|
onChange(toDateString(nextState, showTime));
|
|
816
810
|
} else {
|
|
817
811
|
setState(nextState);
|
|
818
812
|
}
|
|
819
813
|
};
|
|
820
|
-
|
|
814
|
+
var handleNow = function handleNow(event) {
|
|
821
815
|
event.preventDefault();
|
|
822
816
|
if (disabled || readonly) {
|
|
823
817
|
return;
|
|
824
818
|
}
|
|
825
|
-
|
|
819
|
+
var nextState = parseDateString(new Date().toJSON(), showTime);
|
|
826
820
|
onChange(toDateString(nextState, showTime));
|
|
827
821
|
};
|
|
828
|
-
|
|
822
|
+
var handleClear = function handleClear(event) {
|
|
829
823
|
event.preventDefault();
|
|
830
824
|
if (disabled || readonly) {
|
|
831
825
|
return;
|
|
832
826
|
}
|
|
833
827
|
onChange(undefined);
|
|
834
828
|
};
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
829
|
+
var renderDateElement = function renderDateElement(elemProps) {
|
|
830
|
+
return /*#__PURE__*/React.createElement(SelectWidget, {
|
|
831
|
+
autofocus: elemProps.autofocus,
|
|
832
|
+
className: "form-control",
|
|
833
|
+
disabled: elemProps.disabled,
|
|
834
|
+
id: elemProps.id,
|
|
835
|
+
name: elemProps.name,
|
|
836
|
+
onBlur: elemProps.onBlur,
|
|
837
|
+
onChange: function onChange(elemValue) {
|
|
838
|
+
return elemProps.select(elemProps.type, elemValue);
|
|
839
|
+
},
|
|
840
|
+
onFocus: elemProps.onFocus,
|
|
841
|
+
options: {
|
|
842
|
+
enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
|
|
843
|
+
},
|
|
844
|
+
placeholder: elemProps.type,
|
|
845
|
+
readonly: elemProps.readonly,
|
|
846
|
+
schema: {
|
|
847
|
+
type: "integer"
|
|
848
|
+
},
|
|
849
|
+
value: elemProps.value,
|
|
850
|
+
registry: registry,
|
|
851
|
+
label: ""
|
|
852
|
+
});
|
|
853
|
+
};
|
|
856
854
|
return /*#__PURE__*/React.createElement(Row, {
|
|
857
855
|
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
|
|
858
|
-
}, dateElementProps(state, showTime, options.yearsRange).map((elemProps, i)
|
|
859
|
-
|
|
856
|
+
}, dateElementProps(state, showTime, options.yearsRange).map(function (elemProps, i) {
|
|
857
|
+
var elemId = id + "_" + elemProps.type;
|
|
860
858
|
return /*#__PURE__*/React.createElement(Col, {
|
|
861
859
|
flex: "88px",
|
|
862
860
|
key: elemId
|
|
863
|
-
}, renderDateElement({
|
|
864
|
-
...elemProps,
|
|
861
|
+
}, renderDateElement(_extends({}, elemProps, {
|
|
865
862
|
autofocus: autofocus && i === 0,
|
|
866
|
-
disabled,
|
|
863
|
+
disabled: disabled,
|
|
867
864
|
id: elemId,
|
|
868
865
|
name: id,
|
|
869
|
-
onBlur,
|
|
870
|
-
onFocus,
|
|
871
|
-
readonly,
|
|
872
|
-
registry,
|
|
866
|
+
onBlur: onBlur,
|
|
867
|
+
onFocus: onFocus,
|
|
868
|
+
readonly: readonly,
|
|
869
|
+
registry: registry,
|
|
873
870
|
select: handleChange,
|
|
874
871
|
// NOTE: antd components accept -1 rather than issue a warning
|
|
875
872
|
// like material-ui, so we need to convert -1 to undefined here.
|
|
876
873
|
value: elemProps.value < 0 ? undefined : elemProps.value
|
|
877
|
-
}));
|
|
874
|
+
})));
|
|
878
875
|
}), !options.hideNowButton && /*#__PURE__*/React.createElement(Col, {
|
|
879
876
|
flex: "88px"
|
|
880
877
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -902,76 +899,62 @@ AltDateWidget.defaultProps = {
|
|
|
902
899
|
showTime: false
|
|
903
900
|
};
|
|
904
901
|
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
showTime: true,
|
|
911
|
-
...props
|
|
912
|
-
});
|
|
902
|
+
var AltDateTimeWidget = function AltDateTimeWidget(props) {
|
|
903
|
+
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
904
|
+
return /*#__PURE__*/React.createElement(AltDateWidget, _extends({
|
|
905
|
+
showTime: true
|
|
906
|
+
}, props));
|
|
913
907
|
};
|
|
914
|
-
AltDateTimeWidget.defaultProps = {
|
|
915
|
-
...AltDateWidget.defaultProps,
|
|
908
|
+
AltDateTimeWidget.defaultProps = /*#__PURE__*/_extends({}, AltDateWidget.defaultProps, {
|
|
916
909
|
showTime: true
|
|
917
|
-
};
|
|
910
|
+
});
|
|
918
911
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
const handleChange = nextValue => onChange(nextValue);
|
|
941
|
-
const handleBlur = _ref2 => {
|
|
942
|
-
let {
|
|
943
|
-
target
|
|
944
|
-
} = _ref2;
|
|
912
|
+
var CheckboxesWidget = function CheckboxesWidget(_ref) {
|
|
913
|
+
var autofocus = _ref.autofocus,
|
|
914
|
+
disabled = _ref.disabled,
|
|
915
|
+
formContext = _ref.formContext,
|
|
916
|
+
id = _ref.id,
|
|
917
|
+
onBlur = _ref.onBlur,
|
|
918
|
+
onChange = _ref.onChange,
|
|
919
|
+
onFocus = _ref.onFocus,
|
|
920
|
+
options = _ref.options,
|
|
921
|
+
readonly = _ref.readonly,
|
|
922
|
+
value = _ref.value;
|
|
923
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
924
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
925
|
+
var enumOptions = options.enumOptions,
|
|
926
|
+
enumDisabled = options.enumDisabled,
|
|
927
|
+
inline = options.inline;
|
|
928
|
+
var handleChange = function handleChange(nextValue) {
|
|
929
|
+
return onChange(nextValue);
|
|
930
|
+
};
|
|
931
|
+
var handleBlur = function handleBlur(_ref2) {
|
|
932
|
+
var target = _ref2.target;
|
|
945
933
|
return onBlur(id, target.value);
|
|
946
934
|
};
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
target
|
|
950
|
-
} = _ref3;
|
|
935
|
+
var handleFocus = function handleFocus(_ref3) {
|
|
936
|
+
var target = _ref3.target;
|
|
951
937
|
return onFocus(id, target.value);
|
|
952
938
|
};
|
|
953
939
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
954
940
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
955
|
-
|
|
956
|
-
id,
|
|
941
|
+
var extraProps = {
|
|
942
|
+
id: id,
|
|
957
943
|
onBlur: !readonly ? handleBlur : undefined,
|
|
958
944
|
onFocus: !readonly ? handleFocus : undefined
|
|
959
945
|
};
|
|
960
|
-
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /*#__PURE__*/React.createElement(Checkbox.Group, {
|
|
946
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /*#__PURE__*/React.createElement(Checkbox.Group, _extends({
|
|
961
947
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
962
948
|
name: id,
|
|
963
949
|
onChange: !readonly ? handleChange : undefined,
|
|
964
|
-
value: value
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
value: optionValue,
|
|
969
|
-
label: optionLabel
|
|
970
|
-
} = _ref4;
|
|
950
|
+
value: value
|
|
951
|
+
}, extraProps), Array.isArray(enumOptions) && enumOptions.map(function (_ref4, i) {
|
|
952
|
+
var optionValue = _ref4.value,
|
|
953
|
+
optionLabel = _ref4.label;
|
|
971
954
|
return /*#__PURE__*/React.createElement("span", {
|
|
972
955
|
key: optionValue
|
|
973
956
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
974
|
-
id:
|
|
957
|
+
id: id + "-" + optionValue,
|
|
975
958
|
name: id,
|
|
976
959
|
autoFocus: i === 0 ? autofocus : false,
|
|
977
960
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
@@ -980,81 +963,76 @@ const CheckboxesWidget = _ref => {
|
|
|
980
963
|
})) : null;
|
|
981
964
|
};
|
|
982
965
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
} = formContext;
|
|
999
|
-
const handleChange = _ref2 => {
|
|
1000
|
-
let {
|
|
1001
|
-
target
|
|
1002
|
-
} = _ref2;
|
|
966
|
+
var CheckboxWidget = function CheckboxWidget(_ref) {
|
|
967
|
+
var autofocus = _ref.autofocus,
|
|
968
|
+
disabled = _ref.disabled,
|
|
969
|
+
formContext = _ref.formContext,
|
|
970
|
+
id = _ref.id,
|
|
971
|
+
label = _ref.label,
|
|
972
|
+
onBlur = _ref.onBlur,
|
|
973
|
+
onChange = _ref.onChange,
|
|
974
|
+
onFocus = _ref.onFocus,
|
|
975
|
+
readonly = _ref.readonly,
|
|
976
|
+
value = _ref.value;
|
|
977
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
978
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
979
|
+
var handleChange = function handleChange(_ref2) {
|
|
980
|
+
var target = _ref2.target;
|
|
1003
981
|
return onChange(target.checked);
|
|
1004
982
|
};
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
target
|
|
1008
|
-
} = _ref3;
|
|
983
|
+
var handleBlur = function handleBlur(_ref3) {
|
|
984
|
+
var target = _ref3.target;
|
|
1009
985
|
return onBlur(id, target.checked);
|
|
1010
986
|
};
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
target
|
|
1014
|
-
} = _ref4;
|
|
987
|
+
var handleFocus = function handleFocus(_ref4) {
|
|
988
|
+
var target = _ref4.target;
|
|
1015
989
|
return onFocus(id, target.checked);
|
|
1016
990
|
};
|
|
1017
991
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1018
992
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1019
|
-
|
|
993
|
+
var extraProps = {
|
|
1020
994
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1021
995
|
onFocus: !readonly ? handleFocus : undefined
|
|
1022
996
|
};
|
|
1023
|
-
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
997
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({
|
|
1024
998
|
autoFocus: autofocus,
|
|
1025
999
|
checked: typeof value === "undefined" ? false : value,
|
|
1026
1000
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1027
1001
|
id: id,
|
|
1028
1002
|
name: id,
|
|
1029
|
-
onChange: !readonly ? handleChange : undefined
|
|
1030
|
-
|
|
1031
|
-
}, label);
|
|
1003
|
+
onChange: !readonly ? handleChange : undefined
|
|
1004
|
+
}, extraProps), label);
|
|
1032
1005
|
};
|
|
1033
1006
|
|
|
1034
|
-
|
|
1007
|
+
var DatePicker = /*#__PURE__*/generatePicker(dayjsGenerateConfig);
|
|
1035
1008
|
|
|
1036
|
-
|
|
1009
|
+
var DATE_PICKER_STYLE$1 = {
|
|
1037
1010
|
width: "100%"
|
|
1038
1011
|
};
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1012
|
+
var DateTimeWidget = function DateTimeWidget(_ref) {
|
|
1013
|
+
var disabled = _ref.disabled,
|
|
1014
|
+
formContext = _ref.formContext,
|
|
1015
|
+
id = _ref.id,
|
|
1016
|
+
onBlur = _ref.onBlur,
|
|
1017
|
+
onChange = _ref.onChange,
|
|
1018
|
+
onFocus = _ref.onFocus,
|
|
1019
|
+
placeholder = _ref.placeholder,
|
|
1020
|
+
readonly = _ref.readonly,
|
|
1021
|
+
value = _ref.value;
|
|
1022
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1023
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1024
|
+
var handleChange = function handleChange(nextValue) {
|
|
1025
|
+
return onChange(nextValue && nextValue.toISOString());
|
|
1026
|
+
};
|
|
1027
|
+
var handleBlur = function handleBlur() {
|
|
1028
|
+
return onBlur(id, value);
|
|
1029
|
+
};
|
|
1030
|
+
var handleFocus = function handleFocus() {
|
|
1031
|
+
return onFocus(id, value);
|
|
1032
|
+
};
|
|
1033
|
+
var getPopupContainer = function getPopupContainer(node) {
|
|
1034
|
+
return node.parentNode;
|
|
1035
|
+
};
|
|
1058
1036
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
1059
1037
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1060
1038
|
getPopupContainer: getPopupContainer,
|
|
@@ -1070,28 +1048,33 @@ const DateTimeWidget = _ref => {
|
|
|
1070
1048
|
});
|
|
1071
1049
|
};
|
|
1072
1050
|
|
|
1073
|
-
|
|
1051
|
+
var DATE_PICKER_STYLE = {
|
|
1074
1052
|
width: "100%"
|
|
1075
1053
|
};
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1054
|
+
var DateWidget = function DateWidget(_ref) {
|
|
1055
|
+
var disabled = _ref.disabled,
|
|
1056
|
+
formContext = _ref.formContext,
|
|
1057
|
+
id = _ref.id,
|
|
1058
|
+
onBlur = _ref.onBlur,
|
|
1059
|
+
onChange = _ref.onChange,
|
|
1060
|
+
onFocus = _ref.onFocus,
|
|
1061
|
+
placeholder = _ref.placeholder,
|
|
1062
|
+
readonly = _ref.readonly,
|
|
1063
|
+
value = _ref.value;
|
|
1064
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1065
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1066
|
+
var handleChange = function handleChange(nextValue) {
|
|
1067
|
+
return onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
1068
|
+
};
|
|
1069
|
+
var handleBlur = function handleBlur() {
|
|
1070
|
+
return onBlur(id, value);
|
|
1071
|
+
};
|
|
1072
|
+
var handleFocus = function handleFocus() {
|
|
1073
|
+
return onFocus(id, value);
|
|
1074
|
+
};
|
|
1075
|
+
var getPopupContainer = function getPopupContainer(node) {
|
|
1076
|
+
return node.parentNode;
|
|
1077
|
+
};
|
|
1095
1078
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
1096
1079
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1097
1080
|
getPopupContainer: getPopupContainer,
|
|
@@ -1107,39 +1090,30 @@ const DateWidget = _ref => {
|
|
|
1107
1090
|
});
|
|
1108
1091
|
};
|
|
1109
1092
|
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
const emptyValue = options.emptyValue || "";
|
|
1127
|
-
const handleChange = _ref2 => {
|
|
1128
|
-
let {
|
|
1129
|
-
target
|
|
1130
|
-
} = _ref2;
|
|
1093
|
+
var PasswordWidget = function PasswordWidget(_ref) {
|
|
1094
|
+
var disabled = _ref.disabled,
|
|
1095
|
+
formContext = _ref.formContext,
|
|
1096
|
+
id = _ref.id,
|
|
1097
|
+
onBlur = _ref.onBlur,
|
|
1098
|
+
onChange = _ref.onChange,
|
|
1099
|
+
onFocus = _ref.onFocus,
|
|
1100
|
+
options = _ref.options,
|
|
1101
|
+
placeholder = _ref.placeholder,
|
|
1102
|
+
readonly = _ref.readonly,
|
|
1103
|
+
value = _ref.value;
|
|
1104
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1105
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1106
|
+
var emptyValue = options.emptyValue || "";
|
|
1107
|
+
var handleChange = function handleChange(_ref2) {
|
|
1108
|
+
var target = _ref2.target;
|
|
1131
1109
|
return onChange(target.value === "" ? emptyValue : target.value);
|
|
1132
1110
|
};
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
target
|
|
1136
|
-
} = _ref3;
|
|
1111
|
+
var handleBlur = function handleBlur(_ref3) {
|
|
1112
|
+
var target = _ref3.target;
|
|
1137
1113
|
return onBlur(id, target.value);
|
|
1138
1114
|
};
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
target
|
|
1142
|
-
} = _ref4;
|
|
1115
|
+
var handleFocus = function handleFocus(_ref4) {
|
|
1116
|
+
var target = _ref4.target;
|
|
1143
1117
|
return onFocus(id, target.value);
|
|
1144
1118
|
};
|
|
1145
1119
|
return /*#__PURE__*/React.createElement(Input.Password, {
|
|
@@ -1154,45 +1128,32 @@ const PasswordWidget = _ref => {
|
|
|
1154
1128
|
});
|
|
1155
1129
|
};
|
|
1156
1130
|
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
enumOptions,
|
|
1176
|
-
enumDisabled
|
|
1177
|
-
} = options;
|
|
1178
|
-
const handleChange = _ref2 => {
|
|
1179
|
-
let {
|
|
1180
|
-
target: {
|
|
1181
|
-
value: nextValue
|
|
1182
|
-
}
|
|
1183
|
-
} = _ref2;
|
|
1131
|
+
var RadioWidget = function RadioWidget(_ref) {
|
|
1132
|
+
var autofocus = _ref.autofocus,
|
|
1133
|
+
disabled = _ref.disabled,
|
|
1134
|
+
formContext = _ref.formContext,
|
|
1135
|
+
id = _ref.id,
|
|
1136
|
+
onBlur = _ref.onBlur,
|
|
1137
|
+
onChange = _ref.onChange,
|
|
1138
|
+
onFocus = _ref.onFocus,
|
|
1139
|
+
options = _ref.options,
|
|
1140
|
+
readonly = _ref.readonly,
|
|
1141
|
+
schema = _ref.schema,
|
|
1142
|
+
value = _ref.value;
|
|
1143
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1144
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1145
|
+
var enumOptions = options.enumOptions,
|
|
1146
|
+
enumDisabled = options.enumDisabled;
|
|
1147
|
+
var handleChange = function handleChange(_ref2) {
|
|
1148
|
+
var nextValue = _ref2.target.value;
|
|
1184
1149
|
return onChange(schema.type === "boolean" ? nextValue !== "false" : nextValue);
|
|
1185
1150
|
};
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
target
|
|
1189
|
-
} = _ref3;
|
|
1151
|
+
var handleBlur = function handleBlur(_ref3) {
|
|
1152
|
+
var target = _ref3.target;
|
|
1190
1153
|
return onBlur(id, target.value);
|
|
1191
1154
|
};
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
target
|
|
1195
|
-
} = _ref4;
|
|
1155
|
+
var handleFocus = function handleFocus(_ref4) {
|
|
1156
|
+
var target = _ref4.target;
|
|
1196
1157
|
return onFocus(id, target.value);
|
|
1197
1158
|
};
|
|
1198
1159
|
return /*#__PURE__*/React.createElement(Radio.Group, {
|
|
@@ -1202,58 +1163,58 @@ const RadioWidget = _ref => {
|
|
|
1202
1163
|
onChange: !readonly ? handleChange : undefined,
|
|
1203
1164
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1204
1165
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1205
|
-
value:
|
|
1206
|
-
}, Array.isArray(enumOptions) && enumOptions.map((_ref5, i)
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
label: optionLabel
|
|
1210
|
-
} = _ref5;
|
|
1166
|
+
value: "" + value
|
|
1167
|
+
}, Array.isArray(enumOptions) && enumOptions.map(function (_ref5, i) {
|
|
1168
|
+
var optionValue = _ref5.value,
|
|
1169
|
+
optionLabel = _ref5.label;
|
|
1211
1170
|
return /*#__PURE__*/React.createElement(Radio, {
|
|
1212
|
-
id:
|
|
1171
|
+
id: id + "-" + optionValue,
|
|
1213
1172
|
name: id,
|
|
1214
1173
|
autoFocus: i === 0 ? autofocus : false,
|
|
1215
1174
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1216
1175
|
key: optionValue,
|
|
1217
|
-
value:
|
|
1176
|
+
value: "" + optionValue
|
|
1218
1177
|
}, optionLabel);
|
|
1219
1178
|
}));
|
|
1220
1179
|
};
|
|
1221
1180
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1181
|
+
var RangeWidget = function RangeWidget(_ref) {
|
|
1182
|
+
var autofocus = _ref.autofocus,
|
|
1183
|
+
disabled = _ref.disabled,
|
|
1184
|
+
formContext = _ref.formContext,
|
|
1185
|
+
id = _ref.id,
|
|
1186
|
+
onBlur = _ref.onBlur,
|
|
1187
|
+
onChange = _ref.onChange,
|
|
1188
|
+
onFocus = _ref.onFocus,
|
|
1189
|
+
options = _ref.options,
|
|
1190
|
+
placeholder = _ref.placeholder,
|
|
1191
|
+
readonly = _ref.readonly,
|
|
1192
|
+
schema = _ref.schema,
|
|
1193
|
+
value = _ref.value;
|
|
1194
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1195
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1196
|
+
var _rangeSpec = rangeSpec(schema),
|
|
1197
|
+
min = _rangeSpec.min,
|
|
1198
|
+
max = _rangeSpec.max,
|
|
1199
|
+
step = _rangeSpec.step;
|
|
1200
|
+
var emptyValue = options.emptyValue || "";
|
|
1201
|
+
var handleChange = function handleChange(nextValue) {
|
|
1202
|
+
return onChange(nextValue === "" ? emptyValue : nextValue);
|
|
1203
|
+
};
|
|
1204
|
+
var handleBlur = function handleBlur() {
|
|
1205
|
+
return onBlur(id, value);
|
|
1206
|
+
};
|
|
1207
|
+
var handleFocus = function handleFocus() {
|
|
1208
|
+
return onFocus(id, value);
|
|
1209
|
+
};
|
|
1249
1210
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1250
1211
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1251
|
-
|
|
1252
|
-
placeholder,
|
|
1212
|
+
var extraProps = {
|
|
1213
|
+
placeholder: placeholder,
|
|
1253
1214
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1254
1215
|
onFocus: !readonly ? handleFocus : undefined
|
|
1255
1216
|
};
|
|
1256
|
-
return /*#__PURE__*/React.createElement(Slider, {
|
|
1217
|
+
return /*#__PURE__*/React.createElement(Slider, _extends({
|
|
1257
1218
|
autoFocus: autofocus,
|
|
1258
1219
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1259
1220
|
id: id,
|
|
@@ -1262,48 +1223,52 @@ const RangeWidget = _ref => {
|
|
|
1262
1223
|
onChange: !readonly ? handleChange : undefined,
|
|
1263
1224
|
range: false,
|
|
1264
1225
|
step: step,
|
|
1265
|
-
value: value
|
|
1266
|
-
|
|
1267
|
-
});
|
|
1226
|
+
value: value
|
|
1227
|
+
}, extraProps));
|
|
1268
1228
|
};
|
|
1269
1229
|
|
|
1270
|
-
|
|
1230
|
+
var SELECT_STYLE = {
|
|
1271
1231
|
width: "100%"
|
|
1272
1232
|
};
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1233
|
+
var SelectWidget = function SelectWidget(_ref) {
|
|
1234
|
+
var autofocus = _ref.autofocus,
|
|
1235
|
+
disabled = _ref.disabled,
|
|
1236
|
+
formContext = _ref.formContext,
|
|
1237
|
+
id = _ref.id,
|
|
1238
|
+
multiple = _ref.multiple,
|
|
1239
|
+
onBlur = _ref.onBlur,
|
|
1240
|
+
onChange = _ref.onChange,
|
|
1241
|
+
onFocus = _ref.onFocus,
|
|
1242
|
+
options = _ref.options,
|
|
1243
|
+
placeholder = _ref.placeholder,
|
|
1244
|
+
readonly = _ref.readonly,
|
|
1245
|
+
schema = _ref.schema,
|
|
1246
|
+
value = _ref.value;
|
|
1247
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1248
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1249
|
+
var enumOptions = options.enumOptions,
|
|
1250
|
+
enumDisabled = options.enumDisabled;
|
|
1251
|
+
var handleChange = function handleChange(nextValue) {
|
|
1252
|
+
return onChange(processSelectValue(schema, nextValue, options));
|
|
1253
|
+
};
|
|
1254
|
+
var handleBlur = function handleBlur() {
|
|
1255
|
+
return onBlur(id, processSelectValue(schema, value, options));
|
|
1256
|
+
};
|
|
1257
|
+
var handleFocus = function handleFocus() {
|
|
1258
|
+
return onFocus(id, processSelectValue(schema, value, options));
|
|
1259
|
+
};
|
|
1260
|
+
var getPopupContainer = function getPopupContainer(node) {
|
|
1261
|
+
return node.parentNode;
|
|
1262
|
+
};
|
|
1263
|
+
var stringify = function stringify(currentValue) {
|
|
1264
|
+
return Array.isArray(currentValue) ? value.map(String) : String(value);
|
|
1265
|
+
};
|
|
1301
1266
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1302
1267
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1303
|
-
|
|
1268
|
+
var extraProps = {
|
|
1304
1269
|
name: id
|
|
1305
1270
|
};
|
|
1306
|
-
return /*#__PURE__*/React.createElement(Select, {
|
|
1271
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
1307
1272
|
autoFocus: autofocus,
|
|
1308
1273
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1309
1274
|
getPopupContainer: getPopupContainer,
|
|
@@ -1314,13 +1279,10 @@ const SelectWidget = _ref => {
|
|
|
1314
1279
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1315
1280
|
placeholder: placeholder,
|
|
1316
1281
|
style: SELECT_STYLE,
|
|
1317
|
-
value: typeof value !== "undefined" ? stringify(value) : undefined
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
value: optionValue,
|
|
1322
|
-
label: optionLabel
|
|
1323
|
-
} = _ref2;
|
|
1282
|
+
value: typeof value !== "undefined" ? stringify(value) : undefined
|
|
1283
|
+
}, extraProps), Array.isArray(enumOptions) && enumOptions.map(function (_ref2) {
|
|
1284
|
+
var optionValue = _ref2.value,
|
|
1285
|
+
optionLabel = _ref2.label;
|
|
1324
1286
|
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
1325
1287
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
1326
1288
|
key: String(optionValue),
|
|
@@ -1332,49 +1294,40 @@ SelectWidget.defaultProps = {
|
|
|
1332
1294
|
formContext: {}
|
|
1333
1295
|
};
|
|
1334
1296
|
|
|
1335
|
-
|
|
1297
|
+
var INPUT_STYLE = {
|
|
1336
1298
|
width: "100%"
|
|
1337
1299
|
};
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
} = formContext;
|
|
1354
|
-
const handleChange = _ref2 => {
|
|
1355
|
-
let {
|
|
1356
|
-
target
|
|
1357
|
-
} = _ref2;
|
|
1300
|
+
var TextareaWidget = function TextareaWidget(_ref) {
|
|
1301
|
+
var disabled = _ref.disabled,
|
|
1302
|
+
formContext = _ref.formContext,
|
|
1303
|
+
id = _ref.id,
|
|
1304
|
+
onBlur = _ref.onBlur,
|
|
1305
|
+
onChange = _ref.onChange,
|
|
1306
|
+
onFocus = _ref.onFocus,
|
|
1307
|
+
options = _ref.options,
|
|
1308
|
+
placeholder = _ref.placeholder,
|
|
1309
|
+
readonly = _ref.readonly,
|
|
1310
|
+
value = _ref.value;
|
|
1311
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1312
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1313
|
+
var handleChange = function handleChange(_ref2) {
|
|
1314
|
+
var target = _ref2.target;
|
|
1358
1315
|
return onChange(target.value === "" ? options.emptyValue : target.value);
|
|
1359
1316
|
};
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
target
|
|
1363
|
-
} = _ref3;
|
|
1317
|
+
var handleBlur = function handleBlur(_ref3) {
|
|
1318
|
+
var target = _ref3.target;
|
|
1364
1319
|
return onBlur(id, target.value);
|
|
1365
1320
|
};
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
target
|
|
1369
|
-
} = _ref4;
|
|
1321
|
+
var handleFocus = function handleFocus(_ref4) {
|
|
1322
|
+
var target = _ref4.target;
|
|
1370
1323
|
return onFocus(id, target.value);
|
|
1371
1324
|
};
|
|
1372
1325
|
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1373
1326
|
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1374
|
-
|
|
1327
|
+
var extraProps = {
|
|
1375
1328
|
type: "textarea"
|
|
1376
1329
|
};
|
|
1377
|
-
return /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
1330
|
+
return /*#__PURE__*/React.createElement(Input.TextArea, _extends({
|
|
1378
1331
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1379
1332
|
id: id,
|
|
1380
1333
|
name: id,
|
|
@@ -1384,30 +1337,29 @@ const TextareaWidget = _ref => {
|
|
|
1384
1337
|
placeholder: placeholder,
|
|
1385
1338
|
rows: options.rows || 4,
|
|
1386
1339
|
style: INPUT_STYLE,
|
|
1387
|
-
value: value
|
|
1388
|
-
|
|
1389
|
-
});
|
|
1340
|
+
value: value
|
|
1341
|
+
}, extraProps));
|
|
1390
1342
|
};
|
|
1391
1343
|
|
|
1392
|
-
|
|
1393
|
-
AltDateTimeWidget,
|
|
1394
|
-
AltDateWidget,
|
|
1395
|
-
CheckboxesWidget,
|
|
1396
|
-
CheckboxWidget,
|
|
1397
|
-
DateTimeWidget,
|
|
1398
|
-
DateWidget,
|
|
1399
|
-
PasswordWidget,
|
|
1400
|
-
RadioWidget,
|
|
1401
|
-
RangeWidget,
|
|
1402
|
-
SelectWidget,
|
|
1403
|
-
TextareaWidget
|
|
1344
|
+
var Widgets = {
|
|
1345
|
+
AltDateTimeWidget: AltDateTimeWidget,
|
|
1346
|
+
AltDateWidget: AltDateWidget,
|
|
1347
|
+
CheckboxesWidget: CheckboxesWidget,
|
|
1348
|
+
CheckboxWidget: CheckboxWidget,
|
|
1349
|
+
DateTimeWidget: DateTimeWidget,
|
|
1350
|
+
DateWidget: DateWidget,
|
|
1351
|
+
PasswordWidget: PasswordWidget,
|
|
1352
|
+
RadioWidget: RadioWidget,
|
|
1353
|
+
RangeWidget: RangeWidget,
|
|
1354
|
+
SelectWidget: SelectWidget,
|
|
1355
|
+
TextareaWidget: TextareaWidget
|
|
1404
1356
|
};
|
|
1405
1357
|
|
|
1406
|
-
|
|
1358
|
+
var Theme = {
|
|
1407
1359
|
templates: Index,
|
|
1408
1360
|
widgets: Widgets
|
|
1409
1361
|
};
|
|
1410
|
-
|
|
1362
|
+
var Form = /*#__PURE__*/withTheme(Theme);
|
|
1411
1363
|
|
|
1412
1364
|
export { Form, Index as Templates, Theme, Widgets, Form as default };
|
|
1413
1365
|
//# sourceMappingURL=antd.esm.js.map
|