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