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