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