@rjsf/semantic-ui 5.11.2 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1128 -5
- package/dist/index.js.map +7 -0
- package/dist/semantic-ui.esm.js +641 -809
- package/dist/semantic-ui.esm.js.map +7 -1
- package/dist/semantic-ui.umd.js +997 -0
- package/lib/AddButton/AddButton.d.ts +5 -0
- package/lib/AddButton/AddButton.js +12 -0
- package/lib/AddButton/AddButton.js.map +1 -0
- package/lib/AddButton/index.d.ts +2 -0
- package/lib/AddButton/index.js +3 -0
- package/lib/AddButton/index.js.map +1 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +7 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +21 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -0
- package/lib/ArrayFieldItemTemplate/index.d.ts +2 -0
- package/lib/ArrayFieldItemTemplate/index.js +3 -0
- package/lib/ArrayFieldItemTemplate/index.js.map +1 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +7 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +40 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -0
- package/lib/ArrayFieldTemplate/index.d.ts +2 -0
- package/lib/ArrayFieldTemplate/index.js +3 -0
- package/lib/ArrayFieldTemplate/index.js.map +1 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +9 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.js +28 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -0
- package/lib/BaseInputTemplate/index.d.ts +2 -0
- package/lib/BaseInputTemplate/index.js +3 -0
- package/lib/BaseInputTemplate/index.js.map +1 -0
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +8 -0
- package/lib/CheckboxWidget/CheckboxWidget.js +33 -0
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -0
- package/lib/CheckboxWidget/index.d.ts +2 -0
- package/lib/CheckboxWidget/index.js +3 -0
- package/lib/CheckboxWidget/index.js.map +1 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +8 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.js +42 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -0
- package/lib/CheckboxesWidget/index.d.ts +2 -0
- package/lib/CheckboxesWidget/index.js +3 -0
- package/lib/CheckboxesWidget/index.js.map +1 -0
- package/lib/DescriptionField/DescriptionField.d.ts +7 -0
- package/lib/DescriptionField/DescriptionField.js +13 -0
- package/lib/DescriptionField/DescriptionField.js.map +1 -0
- package/lib/DescriptionField/index.d.ts +2 -0
- package/lib/DescriptionField/index.js +3 -0
- package/lib/DescriptionField/index.js.map +1 -0
- package/lib/ErrorList/ErrorList.d.ts +7 -0
- package/lib/ErrorList/ErrorList.js +12 -0
- package/lib/ErrorList/ErrorList.js.map +1 -0
- package/lib/ErrorList/index.d.ts +2 -0
- package/lib/ErrorList/index.js +3 -0
- package/lib/ErrorList/index.js.map +1 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +7 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +30 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -0
- package/lib/FieldErrorTemplate/index.d.ts +2 -0
- package/lib/FieldErrorTemplate/index.js +3 -0
- package/lib/FieldErrorTemplate/index.js.map +1 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +7 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +16 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -0
- package/lib/FieldHelpTemplate/index.d.ts +2 -0
- package/lib/FieldHelpTemplate/index.js +3 -0
- package/lib/FieldHelpTemplate/index.js.map +1 -0
- package/lib/FieldTemplate/FieldTemplate.d.ts +8 -0
- package/lib/FieldTemplate/FieldTemplate.js +22 -0
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -0
- package/lib/FieldTemplate/index.d.ts +2 -0
- package/lib/FieldTemplate/index.js +3 -0
- package/lib/FieldTemplate/index.js.map +1 -0
- package/lib/IconButton/IconButton.d.ts +8 -0
- package/lib/IconButton/IconButton.js +26 -0
- package/lib/IconButton/IconButton.js.map +1 -0
- package/lib/IconButton/index.d.ts +2 -0
- package/lib/IconButton/index.js +3 -0
- package/lib/IconButton/index.js.map +1 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +9 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +23 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -0
- package/lib/ObjectFieldTemplate/index.d.ts +2 -0
- package/lib/ObjectFieldTemplate/index.js +3 -0
- package/lib/ObjectFieldTemplate/index.js.map +1 -0
- package/lib/RadioWidget/RadioWidget.d.ts +8 -0
- package/lib/RadioWidget/RadioWidget.js +32 -0
- package/lib/RadioWidget/RadioWidget.js.map +1 -0
- package/lib/RadioWidget/index.d.ts +2 -0
- package/lib/RadioWidget/index.js +3 -0
- package/lib/RadioWidget/index.js.map +1 -0
- package/lib/RangeWidget/RangeWidget.d.ts +8 -0
- package/lib/RangeWidget/RangeWidget.js +26 -0
- package/lib/RangeWidget/RangeWidget.js.map +1 -0
- package/lib/RangeWidget/index.d.ts +2 -0
- package/lib/RangeWidget/index.js +3 -0
- package/lib/RangeWidget/index.js.map +1 -0
- package/lib/SelectWidget/SelectWidget.d.ts +8 -0
- package/lib/SelectWidget/SelectWidget.js +51 -0
- package/lib/SelectWidget/SelectWidget.js.map +1 -0
- package/lib/SelectWidget/index.d.ts +2 -0
- package/lib/SelectWidget/index.js +3 -0
- package/lib/SelectWidget/index.js.map +1 -0
- package/lib/SemanticUIForm/SemanticUIForm.d.ts +6 -0
- package/lib/SemanticUIForm/SemanticUIForm.js +7 -0
- package/lib/SemanticUIForm/SemanticUIForm.js.map +1 -0
- package/lib/SemanticUIForm/index.d.ts +2 -0
- package/lib/SemanticUIForm/index.js +3 -0
- package/lib/SemanticUIForm/index.js.map +1 -0
- package/lib/SubmitButton/SubmitButton.d.ts +5 -0
- package/lib/SubmitButton/SubmitButton.js +13 -0
- package/lib/SubmitButton/SubmitButton.js.map +1 -0
- package/lib/SubmitButton/index.d.ts +2 -0
- package/lib/SubmitButton/index.js +3 -0
- package/lib/SubmitButton/index.js.map +1 -0
- package/lib/Templates/Templates.d.ts +4 -0
- package/lib/Templates/Templates.js +39 -0
- package/lib/Templates/Templates.js.map +1 -0
- package/lib/Templates/index.d.ts +2 -0
- package/lib/Templates/index.js +3 -0
- package/lib/Templates/index.js.map +1 -0
- package/lib/TextareaWidget/TextareaWidget.d.ts +7 -0
- package/lib/TextareaWidget/TextareaWidget.js +22 -0
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -0
- package/lib/TextareaWidget/index.d.ts +2 -0
- package/lib/TextareaWidget/index.js +3 -0
- package/lib/TextareaWidget/index.js.map +1 -0
- package/lib/Theme/Theme.d.ts +5 -0
- package/lib/Theme/Theme.js +12 -0
- package/lib/Theme/Theme.js.map +1 -0
- package/lib/Theme/index.d.ts +2 -0
- package/lib/Theme/index.js +3 -0
- package/lib/Theme/index.js.map +1 -0
- package/lib/TitleField/TitleField.d.ts +7 -0
- package/lib/TitleField/TitleField.js +22 -0
- package/lib/TitleField/TitleField.js.map +1 -0
- package/lib/TitleField/index.d.ts +2 -0
- package/lib/TitleField/index.js +3 -0
- package/lib/TitleField/index.js.map +1 -0
- package/lib/Widgets/Widgets.d.ts +4 -0
- package/lib/Widgets/Widgets.js +18 -0
- package/lib/Widgets/Widgets.js.map +1 -0
- package/lib/Widgets/index.d.ts +2 -0
- package/lib/Widgets/index.js +3 -0
- package/lib/Widgets/index.js.map +1 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +8 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +23 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -0
- package/lib/WrapIfAdditionalTemplate/index.d.ts +2 -0
- package/lib/WrapIfAdditionalTemplate/index.js +3 -0
- package/lib/WrapIfAdditionalTemplate/index.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -0
- package/lib/util.d.ts +60 -0
- package/lib/util.js +69 -0
- package/lib/util.js.map +1 -0
- package/package.json +23 -15
- package/src/AddButton/AddButton.tsx +24 -0
- package/src/AddButton/index.ts +2 -0
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +102 -0
- package/src/ArrayFieldItemTemplate/index.ts +2 -0
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +114 -0
- package/src/ArrayFieldTemplate/index.ts +2 -0
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +90 -0
- package/src/BaseInputTemplate/index.ts +2 -0
- package/src/CheckboxWidget/CheckboxWidget.tsx +95 -0
- package/src/CheckboxWidget/index.ts +2 -0
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +102 -0
- package/src/CheckboxesWidget/index.ts +2 -0
- package/src/DescriptionField/DescriptionField.tsx +21 -0
- package/src/DescriptionField/index.ts +2 -0
- package/src/ErrorList/ErrorList.tsx +23 -0
- package/src/ErrorList/index.ts +2 -0
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +43 -0
- package/src/FieldErrorTemplate/index.ts +2 -0
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +19 -0
- package/src/FieldHelpTemplate/index.ts +2 -0
- package/src/FieldTemplate/FieldTemplate.tsx +77 -0
- package/src/FieldTemplate/index.ts +2 -0
- package/src/IconButton/IconButton.tsx +55 -0
- package/src/IconButton/index.ts +2 -0
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +94 -0
- package/src/ObjectFieldTemplate/index.ts +2 -0
- package/src/RadioWidget/RadioWidget.tsx +78 -0
- package/src/RadioWidget/index.ts +2 -0
- package/src/RangeWidget/RangeWidget.tsx +65 -0
- package/src/RangeWidget/index.ts +2 -0
- package/src/SelectWidget/SelectWidget.tsx +111 -0
- package/src/SelectWidget/index.ts +2 -0
- package/src/SemanticUIForm/SemanticUIForm.ts +15 -0
- package/src/SemanticUIForm/index.ts +2 -0
- package/src/SubmitButton/SubmitButton.tsx +20 -0
- package/src/SubmitButton/index.ts +2 -0
- package/src/Templates/Templates.ts +46 -0
- package/src/Templates/index.ts +2 -0
- package/src/TextareaWidget/TextareaWidget.tsx +69 -0
- package/src/TextareaWidget/index.ts +2 -0
- package/src/Theme/Theme.ts +20 -0
- package/src/Theme/index.ts +2 -0
- package/src/TitleField/TitleField.tsx +32 -0
- package/src/TitleField/index.ts +2 -0
- package/src/Widgets/Widgets.tsx +25 -0
- package/src/Widgets/index.ts +2 -0
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +95 -0
- package/src/WrapIfAdditionalTemplate/index.ts +2 -0
- package/src/index.ts +8 -0
- package/src/util.tsx +126 -0
- package/dist/index.d.ts +0 -17
- package/dist/semantic-ui.cjs.development.js +0 -1335
- package/dist/semantic-ui.cjs.development.js.map +0 -1
- package/dist/semantic-ui.cjs.production.min.js +0 -2
- package/dist/semantic-ui.cjs.production.min.js.map +0 -1
- package/dist/semantic-ui.umd.development.js +0 -1333
- package/dist/semantic-ui.umd.development.js.map +0 -1
- package/dist/semantic-ui.umd.production.min.js +0 -2
- package/dist/semantic-ui.umd.production.min.js.map +0 -1
package/dist/semantic-ui.esm.js
CHANGED
|
@@ -1,134 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { TranslatableString, getUiOptions, getTemplate, isFixedItems, UI_OPTIONS_KEY, getInputProps, labelValue, examplesId, ariaDescribedByIds, errorId, helpId, titleId, descriptionId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, schemaRequiresTrueValue, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, enumOptionsValueForIndex, rangeSpec, enumOptionsIndexForValue } from '@rjsf/utils';
|
|
5
|
-
import { nanoid } from 'nanoid';
|
|
6
|
-
import { createElement } from 'react';
|
|
7
|
-
import map from 'lodash-es/map';
|
|
1
|
+
// src/SemanticUIForm/SemanticUIForm.ts
|
|
2
|
+
import { withTheme } from "@rjsf/core";
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
// src/Theme/Theme.ts
|
|
5
|
+
import { Form as SuiForm } from "semantic-ui-react";
|
|
6
|
+
|
|
7
|
+
// src/AddButton/AddButton.tsx
|
|
8
|
+
import { Button, Icon } from "semantic-ui-react";
|
|
9
|
+
import { TranslatableString } from "@rjsf/utils";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
11
|
function AddButton({
|
|
12
12
|
uiSchema,
|
|
13
13
|
registry,
|
|
14
14
|
color,
|
|
15
15
|
...props
|
|
16
16
|
}) {
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
17
|
+
const { translateString } = registry;
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
Button,
|
|
20
|
+
{
|
|
21
|
+
title: translateString(TranslatableString.AddItemButton),
|
|
22
|
+
color,
|
|
23
|
+
...props,
|
|
24
|
+
icon: true,
|
|
25
|
+
size: "tiny",
|
|
26
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "plus" })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
32
|
+
import {
|
|
33
|
+
getUiOptions as getUiOptions2
|
|
34
|
+
} from "@rjsf/utils";
|
|
35
|
+
import { Button as Button2, Grid, Segment } from "semantic-ui-react";
|
|
36
|
+
|
|
37
|
+
// src/util.tsx
|
|
38
|
+
import {
|
|
39
|
+
getUiOptions
|
|
40
|
+
} from "@rjsf/utils";
|
|
41
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
43
42
|
function getSemanticProps({
|
|
44
43
|
formContext = {},
|
|
45
44
|
uiSchema = {},
|
|
46
45
|
options = {},
|
|
47
|
-
defaultSchemaProps = {
|
|
48
|
-
fluid: true,
|
|
49
|
-
inverted: false
|
|
50
|
-
},
|
|
46
|
+
defaultSchemaProps = { fluid: true, inverted: false },
|
|
51
47
|
defaultContextProps = {}
|
|
52
48
|
}) {
|
|
53
49
|
const formContextProps = formContext.semantic;
|
|
54
50
|
const schemaProps = getUiOptions(uiSchema).semantic;
|
|
55
51
|
const optionProps = options.semantic;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
...defaultSchemaProps
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
return Object.assign(
|
|
53
|
+
{},
|
|
54
|
+
{ ...defaultSchemaProps },
|
|
55
|
+
{ ...defaultContextProps },
|
|
56
|
+
schemaProps,
|
|
57
|
+
optionProps,
|
|
58
|
+
formContextProps
|
|
59
|
+
);
|
|
62
60
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Extract error props meant for semantic UI components from props that are
|
|
65
|
-
* passed to Widgets, Templates and Fields.
|
|
66
|
-
* @param {Object} params
|
|
67
|
-
* @param {Object?} params.formContext
|
|
68
|
-
* @param {Object?} params.uiSchema
|
|
69
|
-
* @param {Object?} params.defaultProps
|
|
70
|
-
* @returns {any}
|
|
71
|
-
*/
|
|
72
61
|
function getSemanticErrorProps({
|
|
73
62
|
formContext = {},
|
|
74
63
|
uiSchema = {},
|
|
75
64
|
options = {},
|
|
76
|
-
defaultProps = {
|
|
77
|
-
size: 'small',
|
|
78
|
-
pointing: 'above'
|
|
79
|
-
}
|
|
65
|
+
defaultProps = { size: "small", pointing: "above" }
|
|
80
66
|
}) {
|
|
81
67
|
const formContextProps = formContext.semantic && formContext.semantic.errorOptions;
|
|
82
68
|
const semanticOptions = getUiOptions(uiSchema).semantic;
|
|
83
69
|
const schemaProps = semanticOptions && semanticOptions.errorOptions;
|
|
84
70
|
const optionProps = options.semantic && options.semantic.errorOptions;
|
|
85
|
-
return Object.assign({}, {
|
|
86
|
-
...defaultProps
|
|
87
|
-
}, schemaProps, optionProps, formContextProps);
|
|
71
|
+
return Object.assign({}, { ...defaultProps }, schemaProps, optionProps, formContextProps);
|
|
88
72
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Combine multiple strings containing class names into a single string,
|
|
91
|
-
* removing duplicates. E.g.
|
|
92
|
-
* cleanClassNames('bar', 'baz bar', 'x y ', undefined)
|
|
93
|
-
* // 'bar baz x y'
|
|
94
|
-
* @param {Array} classNameArr
|
|
95
|
-
* @param {Array} omit
|
|
96
|
-
* @returns {string}
|
|
97
|
-
*/
|
|
98
73
|
function cleanClassNames(classNameArr, omit = []) {
|
|
99
|
-
// Split each arg on whitespace, and add it to an array. Skip false-y args
|
|
100
|
-
// like "" and undefined.
|
|
101
74
|
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
|
|
102
|
-
|
|
103
|
-
// returning them as a string
|
|
104
|
-
return [...new Set(classList.filter(cn => !omit.includes(cn)))].join(' ');
|
|
75
|
+
return [...new Set(classList.filter((cn) => !omit.includes(cn)))].join(" ");
|
|
105
76
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
* @param {boolean} wrap
|
|
109
|
-
* @param Component
|
|
110
|
-
* @param {Object} props
|
|
111
|
-
* @returns {*}
|
|
112
|
-
* @constructor
|
|
113
|
-
*/
|
|
114
|
-
function MaybeWrap({
|
|
115
|
-
wrap,
|
|
116
|
-
component: Component = 'div',
|
|
117
|
-
...props
|
|
118
|
-
}) {
|
|
119
|
-
return wrap ? jsx(Component, {
|
|
120
|
-
...props
|
|
121
|
-
}) : props.children;
|
|
77
|
+
function MaybeWrap({ wrap, component: Component = "div", ...props }) {
|
|
78
|
+
return wrap ? /* @__PURE__ */ jsx2(Component, { ...props }) : props.children;
|
|
122
79
|
}
|
|
123
80
|
|
|
124
|
-
|
|
125
|
-
|
|
81
|
+
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
82
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
83
|
+
var gridStyle = (vertical) => ({
|
|
84
|
+
display: "grid",
|
|
126
85
|
gridTemplateColumns: `1fr ${vertical ? 65 : 150}px`
|
|
127
86
|
});
|
|
128
|
-
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
129
|
-
*
|
|
130
|
-
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
131
|
-
*/
|
|
132
87
|
function ArrayFieldItemTemplate(props) {
|
|
133
88
|
const {
|
|
134
89
|
children,
|
|
@@ -146,72 +101,64 @@ function ArrayFieldItemTemplate(props) {
|
|
|
146
101
|
uiSchema,
|
|
147
102
|
registry
|
|
148
103
|
} = props;
|
|
149
|
-
const {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}), hasRemove && jsx(RemoveButton, {
|
|
198
|
-
className: 'array-item-remove',
|
|
199
|
-
disabled: disabled || readonly,
|
|
200
|
-
onClick: onDropIndexClick(index),
|
|
201
|
-
uiSchema: uiSchema,
|
|
202
|
-
registry: registry
|
|
203
|
-
})]
|
|
204
|
-
})
|
|
205
|
-
})]
|
|
206
|
-
})
|
|
207
|
-
})
|
|
208
|
-
});
|
|
104
|
+
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
105
|
+
const uiOptions = getUiOptions2(uiSchema);
|
|
106
|
+
const { horizontalButtons = true, wrapItem = false } = uiOptions.semantic;
|
|
107
|
+
return /* @__PURE__ */ jsx3("div", { className: "array-item", children: /* @__PURE__ */ jsx3(MaybeWrap, { wrap: wrapItem, component: Segment, children: /* @__PURE__ */ jsxs(Grid, { style: { ...gridStyle(!horizontalButtons), alignItems: "center" }, children: [
|
|
108
|
+
/* @__PURE__ */ jsx3(Grid.Column, { width: 16, verticalAlign: "middle", children }),
|
|
109
|
+
hasToolbar && /* @__PURE__ */ jsx3(Grid.Column, { children: (hasMoveUp || hasMoveDown || hasRemove) && /* @__PURE__ */ jsxs(Button2.Group, { size: "mini", vertical: !horizontalButtons, children: [
|
|
110
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx3(
|
|
111
|
+
MoveUpButton2,
|
|
112
|
+
{
|
|
113
|
+
className: "array-item-move-up",
|
|
114
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
115
|
+
onClick: onReorderClick(index, index - 1),
|
|
116
|
+
uiSchema,
|
|
117
|
+
registry
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx3(
|
|
121
|
+
MoveDownButton2,
|
|
122
|
+
{
|
|
123
|
+
className: "array-item-move-down",
|
|
124
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
125
|
+
onClick: onReorderClick(index, index + 1),
|
|
126
|
+
uiSchema,
|
|
127
|
+
registry
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
hasCopy && /* @__PURE__ */ jsx3(
|
|
131
|
+
CopyButton2,
|
|
132
|
+
{
|
|
133
|
+
className: "array-item-copy",
|
|
134
|
+
disabled: disabled || readonly,
|
|
135
|
+
onClick: onCopyIndexClick(index),
|
|
136
|
+
uiSchema,
|
|
137
|
+
registry
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
hasRemove && /* @__PURE__ */ jsx3(
|
|
141
|
+
RemoveButton2,
|
|
142
|
+
{
|
|
143
|
+
className: "array-item-remove",
|
|
144
|
+
disabled: disabled || readonly,
|
|
145
|
+
onClick: onDropIndexClick(index),
|
|
146
|
+
uiSchema,
|
|
147
|
+
registry
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] }) })
|
|
151
|
+
] }) }) });
|
|
209
152
|
}
|
|
210
153
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
154
|
+
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
155
|
+
import {
|
|
156
|
+
getTemplate,
|
|
157
|
+
getUiOptions as getUiOptions3,
|
|
158
|
+
isFixedItems,
|
|
159
|
+
UI_OPTIONS_KEY
|
|
160
|
+
} from "@rjsf/utils";
|
|
161
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
215
162
|
function ArrayFieldTemplate(props) {
|
|
216
163
|
const {
|
|
217
164
|
uiSchema,
|
|
@@ -233,88 +180,86 @@ function ArrayFieldTemplate(props) {
|
|
|
233
180
|
const semanticProps = getSemanticProps({
|
|
234
181
|
uiSchema,
|
|
235
182
|
formContext,
|
|
236
|
-
defaultSchemaProps: {
|
|
237
|
-
horizontalButtons: true,
|
|
238
|
-
wrapItem: false
|
|
239
|
-
}
|
|
183
|
+
defaultSchemaProps: { horizontalButtons: true, wrapItem: false }
|
|
240
184
|
});
|
|
185
|
+
const { horizontalButtons, wrapItem } = semanticProps;
|
|
186
|
+
const semantic = { horizontalButtons, wrapItem };
|
|
187
|
+
const uiOptions = getUiOptions3(uiSchema);
|
|
188
|
+
const ArrayFieldDescriptionTemplate = getTemplate(
|
|
189
|
+
"ArrayFieldDescriptionTemplate",
|
|
190
|
+
registry,
|
|
191
|
+
uiOptions
|
|
192
|
+
);
|
|
193
|
+
const ArrayFieldItemTemplate2 = getTemplate(
|
|
194
|
+
"ArrayFieldItemTemplate",
|
|
195
|
+
registry,
|
|
196
|
+
uiOptions
|
|
197
|
+
);
|
|
198
|
+
const ArrayFieldTitleTemplate = getTemplate(
|
|
199
|
+
"ArrayFieldTitleTemplate",
|
|
200
|
+
registry,
|
|
201
|
+
uiOptions
|
|
202
|
+
);
|
|
241
203
|
const {
|
|
242
|
-
|
|
243
|
-
wrapItem
|
|
244
|
-
} = semanticProps;
|
|
245
|
-
const semantic = {
|
|
246
|
-
horizontalButtons,
|
|
247
|
-
wrapItem
|
|
248
|
-
};
|
|
249
|
-
const uiOptions = getUiOptions(uiSchema);
|
|
250
|
-
const ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
251
|
-
const ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
252
|
-
const ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
253
|
-
// Button templates are not overridden in the uiSchema
|
|
254
|
-
const {
|
|
255
|
-
ButtonTemplates: {
|
|
256
|
-
AddButton
|
|
257
|
-
}
|
|
204
|
+
ButtonTemplates: { AddButton: AddButton2 }
|
|
258
205
|
} = registry.templates;
|
|
259
|
-
return
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
registry: registry
|
|
306
|
-
})
|
|
307
|
-
})]
|
|
308
|
-
}, `array-item-list-${idSchema.$id}`)]
|
|
309
|
-
});
|
|
206
|
+
return /* @__PURE__ */ jsxs2("div", { className: cleanClassNames([className, isFixedItems(schema) ? "" : "sortable-form-fields"]), children: [
|
|
207
|
+
/* @__PURE__ */ jsx4(
|
|
208
|
+
ArrayFieldTitleTemplate,
|
|
209
|
+
{
|
|
210
|
+
idSchema,
|
|
211
|
+
title: uiOptions.title || title,
|
|
212
|
+
schema,
|
|
213
|
+
uiSchema,
|
|
214
|
+
required,
|
|
215
|
+
registry
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ jsx4(
|
|
219
|
+
ArrayFieldDescriptionTemplate,
|
|
220
|
+
{
|
|
221
|
+
idSchema,
|
|
222
|
+
description: uiOptions.description || schema.description,
|
|
223
|
+
schema,
|
|
224
|
+
uiSchema,
|
|
225
|
+
registry
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
229
|
+
/* @__PURE__ */ jsx4("div", { className: "row array-item-list", children: items && items.map(({ key, uiSchema: itemUiSchema = {}, ...props2 }) => {
|
|
230
|
+
const mergedUiSchema = {
|
|
231
|
+
...itemUiSchema,
|
|
232
|
+
[UI_OPTIONS_KEY]: {
|
|
233
|
+
...itemUiSchema[UI_OPTIONS_KEY],
|
|
234
|
+
semantic
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
return /* @__PURE__ */ jsx4(ArrayFieldItemTemplate2, { ...props2, uiSchema: mergedUiSchema }, key);
|
|
238
|
+
}) }),
|
|
239
|
+
canAdd && /* @__PURE__ */ jsx4(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
style: {
|
|
243
|
+
marginTop: "1rem",
|
|
244
|
+
position: "relative",
|
|
245
|
+
textAlign: "right"
|
|
246
|
+
},
|
|
247
|
+
children: /* @__PURE__ */ jsx4(AddButton2, { onClick: onAddClick, disabled: disabled || readonly, uiSchema, registry })
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] }, `array-item-list-${idSchema.$id}`)
|
|
251
|
+
] });
|
|
310
252
|
}
|
|
311
253
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
254
|
+
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
255
|
+
import { Form } from "semantic-ui-react";
|
|
256
|
+
import {
|
|
257
|
+
ariaDescribedByIds,
|
|
258
|
+
examplesId,
|
|
259
|
+
getInputProps,
|
|
260
|
+
labelValue
|
|
261
|
+
} from "@rjsf/utils";
|
|
262
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
318
263
|
function BaseInputTemplate(props) {
|
|
319
264
|
const {
|
|
320
265
|
id,
|
|
@@ -343,224 +288,151 @@ function BaseInputTemplate(props) {
|
|
|
343
288
|
formContext,
|
|
344
289
|
options
|
|
345
290
|
});
|
|
346
|
-
const _onChange = ({
|
|
347
|
-
target: {
|
|
348
|
-
value
|
|
349
|
-
}
|
|
350
|
-
}) => onChange(value === '' ? options.emptyValue : value);
|
|
291
|
+
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
351
292
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
352
293
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
353
|
-
return
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
})
|
|
378
|
-
})
|
|
379
|
-
});
|
|
294
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
295
|
+
/* @__PURE__ */ jsx5(
|
|
296
|
+
Form.Input,
|
|
297
|
+
{
|
|
298
|
+
id,
|
|
299
|
+
name: id,
|
|
300
|
+
placeholder,
|
|
301
|
+
...inputProps,
|
|
302
|
+
label: labelValue(label || void 0, hideLabel, false),
|
|
303
|
+
required,
|
|
304
|
+
autoFocus: autofocus,
|
|
305
|
+
disabled: disabled || readonly,
|
|
306
|
+
list: schema.examples ? examplesId(id) : void 0,
|
|
307
|
+
...semanticProps,
|
|
308
|
+
value: value || value === 0 ? value : "",
|
|
309
|
+
error: rawErrors.length > 0,
|
|
310
|
+
onChange: onChangeOverride || _onChange,
|
|
311
|
+
onBlur: _onBlur,
|
|
312
|
+
onFocus: _onFocus,
|
|
313
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
314
|
+
},
|
|
315
|
+
id
|
|
316
|
+
),
|
|
317
|
+
Array.isArray(schema.examples) && /* @__PURE__ */ jsx5("datalist", { id: examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
|
|
318
|
+
return /* @__PURE__ */ jsx5("option", { value: example }, example);
|
|
319
|
+
}) })
|
|
320
|
+
] });
|
|
380
321
|
}
|
|
381
322
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
* @param props - The `DescriptionFieldProps` for this component
|
|
385
|
-
*/
|
|
323
|
+
// src/DescriptionField/DescriptionField.tsx
|
|
324
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
386
325
|
function DescriptionField(props) {
|
|
387
|
-
const {
|
|
388
|
-
id,
|
|
389
|
-
description
|
|
390
|
-
} = props;
|
|
326
|
+
const { id, description } = props;
|
|
391
327
|
if (!description) {
|
|
392
328
|
return null;
|
|
393
329
|
}
|
|
394
|
-
return
|
|
395
|
-
id: id,
|
|
396
|
-
className: 'sui-description',
|
|
397
|
-
children: description
|
|
398
|
-
});
|
|
330
|
+
return /* @__PURE__ */ jsx6("p", { id, className: "sui-description", children: description });
|
|
399
331
|
}
|
|
400
332
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
333
|
+
// src/ErrorList/ErrorList.tsx
|
|
334
|
+
import { Message } from "semantic-ui-react";
|
|
335
|
+
import { TranslatableString as TranslatableString2 } from "@rjsf/utils";
|
|
336
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
405
337
|
function ErrorList({
|
|
406
338
|
errors,
|
|
407
339
|
registry
|
|
408
340
|
}) {
|
|
409
|
-
const {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
children: [jsx(Message.Header, {
|
|
415
|
-
children: translateString(TranslatableString.ErrorsLabel)
|
|
416
|
-
}), jsx(Message.List, {
|
|
417
|
-
children: errors.map((error, index) => jsx(Message.Item, {
|
|
418
|
-
children: error.stack
|
|
419
|
-
}, `error-${index}`))
|
|
420
|
-
})]
|
|
421
|
-
});
|
|
341
|
+
const { translateString } = registry;
|
|
342
|
+
return /* @__PURE__ */ jsxs4(Message, { negative: true, children: [
|
|
343
|
+
/* @__PURE__ */ jsx7(Message.Header, { children: translateString(TranslatableString2.ErrorsLabel) }),
|
|
344
|
+
/* @__PURE__ */ jsx7(Message.List, { children: errors.map((error, index) => /* @__PURE__ */ jsx7(Message.Item, { children: error.stack }, `error-${index}`)) })
|
|
345
|
+
] });
|
|
422
346
|
}
|
|
423
347
|
|
|
348
|
+
// src/IconButton/IconButton.tsx
|
|
349
|
+
import { Button as Button3 } from "semantic-ui-react";
|
|
350
|
+
import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
|
|
351
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
424
352
|
function IconButton(props) {
|
|
425
|
-
const {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
size: iconType,
|
|
437
|
-
color: color,
|
|
438
|
-
className: className,
|
|
439
|
-
...otherProps
|
|
440
|
-
});
|
|
353
|
+
const { icon, iconType, color, className, uiSchema, registry, ...otherProps } = props;
|
|
354
|
+
return /* @__PURE__ */ jsx8(
|
|
355
|
+
Button3,
|
|
356
|
+
{
|
|
357
|
+
icon,
|
|
358
|
+
size: iconType,
|
|
359
|
+
color,
|
|
360
|
+
className,
|
|
361
|
+
...otherProps
|
|
362
|
+
}
|
|
363
|
+
);
|
|
441
364
|
}
|
|
442
365
|
function CopyButton(props) {
|
|
443
366
|
const {
|
|
444
|
-
registry: {
|
|
445
|
-
translateString
|
|
446
|
-
}
|
|
367
|
+
registry: { translateString }
|
|
447
368
|
} = props;
|
|
448
|
-
return
|
|
449
|
-
title: translateString(TranslatableString.CopyButton),
|
|
450
|
-
...props,
|
|
451
|
-
icon: 'copy'
|
|
452
|
-
});
|
|
369
|
+
return /* @__PURE__ */ jsx8(IconButton, { title: translateString(TranslatableString3.CopyButton), ...props, icon: "copy" });
|
|
453
370
|
}
|
|
454
371
|
function MoveDownButton(props) {
|
|
455
372
|
const {
|
|
456
|
-
registry: {
|
|
457
|
-
translateString
|
|
458
|
-
}
|
|
373
|
+
registry: { translateString }
|
|
459
374
|
} = props;
|
|
460
|
-
return
|
|
461
|
-
title: translateString(TranslatableString.MoveDownButton),
|
|
462
|
-
...props,
|
|
463
|
-
icon: 'angle down'
|
|
464
|
-
});
|
|
375
|
+
return /* @__PURE__ */ jsx8(IconButton, { title: translateString(TranslatableString3.MoveDownButton), ...props, icon: "angle down" });
|
|
465
376
|
}
|
|
466
377
|
function MoveUpButton(props) {
|
|
467
378
|
const {
|
|
468
|
-
registry: {
|
|
469
|
-
translateString
|
|
470
|
-
}
|
|
379
|
+
registry: { translateString }
|
|
471
380
|
} = props;
|
|
472
|
-
return
|
|
473
|
-
title: translateString(TranslatableString.MoveUpButton),
|
|
474
|
-
...props,
|
|
475
|
-
icon: 'angle up'
|
|
476
|
-
});
|
|
381
|
+
return /* @__PURE__ */ jsx8(IconButton, { title: translateString(TranslatableString3.MoveUpButton), ...props, icon: "angle up" });
|
|
477
382
|
}
|
|
478
383
|
function RemoveButton(props) {
|
|
479
384
|
const {
|
|
480
|
-
registry: {
|
|
481
|
-
translateString
|
|
482
|
-
}
|
|
385
|
+
registry: { translateString }
|
|
483
386
|
} = props;
|
|
484
|
-
return
|
|
485
|
-
title: translateString(TranslatableString.RemoveButton),
|
|
486
|
-
...props,
|
|
487
|
-
icon: 'trash'
|
|
488
|
-
});
|
|
387
|
+
return /* @__PURE__ */ jsx8(IconButton, { title: translateString(TranslatableString3.RemoveButton), ...props, icon: "trash" });
|
|
489
388
|
}
|
|
490
389
|
|
|
491
|
-
|
|
390
|
+
// src/FieldErrorTemplate/FieldErrorTemplate.tsx
|
|
391
|
+
import { errorId } from "@rjsf/utils";
|
|
392
|
+
import { nanoid } from "nanoid";
|
|
393
|
+
import { Label, List } from "semantic-ui-react";
|
|
394
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
395
|
+
var DEFAULT_OPTIONS = {
|
|
492
396
|
options: {
|
|
493
|
-
pointing:
|
|
494
|
-
size:
|
|
397
|
+
pointing: "above",
|
|
398
|
+
size: "small"
|
|
495
399
|
}
|
|
496
400
|
};
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
500
|
-
*/
|
|
501
|
-
function FieldErrorTemplate({
|
|
502
|
-
errors,
|
|
503
|
-
idSchema,
|
|
504
|
-
uiSchema,
|
|
505
|
-
registry
|
|
506
|
-
}) {
|
|
507
|
-
const {
|
|
508
|
-
formContext
|
|
509
|
-
} = registry;
|
|
401
|
+
function FieldErrorTemplate({ errors, idSchema, uiSchema, registry }) {
|
|
402
|
+
const { formContext } = registry;
|
|
510
403
|
const options = getSemanticErrorProps({
|
|
511
404
|
formContext,
|
|
512
405
|
uiSchema,
|
|
513
|
-
defaultProps: DEFAULT_OPTIONS
|
|
406
|
+
defaultProps: DEFAULT_OPTIONS
|
|
514
407
|
});
|
|
515
|
-
const {
|
|
516
|
-
pointing,
|
|
517
|
-
size
|
|
518
|
-
} = options;
|
|
408
|
+
const { pointing, size } = options;
|
|
519
409
|
if (errors && errors.length > 0) {
|
|
520
410
|
const id = errorId(idSchema);
|
|
521
|
-
return
|
|
522
|
-
id: id,
|
|
523
|
-
color: 'red',
|
|
524
|
-
pointing: pointing || 'above',
|
|
525
|
-
size: size || 'small',
|
|
526
|
-
basic: true,
|
|
527
|
-
children: jsx(List, {
|
|
528
|
-
bulleted: true,
|
|
529
|
-
children: errors.map(error => jsx(List.Item, {
|
|
530
|
-
children: error
|
|
531
|
-
}, nanoid()))
|
|
532
|
-
})
|
|
533
|
-
});
|
|
411
|
+
return /* @__PURE__ */ jsx9(Label, { id, color: "red", pointing: pointing || "above", size: size || "small", basic: true, children: /* @__PURE__ */ jsx9(List, { bulleted: true, children: errors.map((error) => /* @__PURE__ */ jsx9(List.Item, { children: error }, nanoid())) }) });
|
|
534
412
|
}
|
|
535
413
|
return null;
|
|
536
414
|
}
|
|
537
415
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
416
|
+
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
417
|
+
import { Message as Message2 } from "semantic-ui-react";
|
|
418
|
+
import { helpId } from "@rjsf/utils";
|
|
419
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
542
420
|
function FieldHelpTemplate(props) {
|
|
543
|
-
const {
|
|
544
|
-
idSchema,
|
|
545
|
-
help
|
|
546
|
-
} = props;
|
|
421
|
+
const { idSchema, help } = props;
|
|
547
422
|
if (help) {
|
|
548
423
|
const id = helpId(idSchema);
|
|
549
|
-
return
|
|
550
|
-
size: 'mini',
|
|
551
|
-
info: true,
|
|
552
|
-
id: id,
|
|
553
|
-
content: help
|
|
554
|
-
});
|
|
424
|
+
return /* @__PURE__ */ jsx10(Message2, { size: "mini", info: true, id, content: help });
|
|
555
425
|
}
|
|
556
426
|
return null;
|
|
557
427
|
}
|
|
558
428
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
429
|
+
// src/FieldTemplate/FieldTemplate.tsx
|
|
430
|
+
import {
|
|
431
|
+
getTemplate as getTemplate2,
|
|
432
|
+
getUiOptions as getUiOptions4
|
|
433
|
+
} from "@rjsf/utils";
|
|
434
|
+
import { Form as Form2 } from "semantic-ui-react";
|
|
435
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
564
436
|
function FieldTemplate(props) {
|
|
565
437
|
const {
|
|
566
438
|
id,
|
|
@@ -580,51 +452,47 @@ function FieldTemplate(props) {
|
|
|
580
452
|
...otherProps
|
|
581
453
|
} = props;
|
|
582
454
|
const semanticProps = getSemanticProps(otherProps);
|
|
583
|
-
const {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
455
|
+
const { wrapLabel, wrapContent } = semanticProps;
|
|
456
|
+
const uiOptions = getUiOptions4(uiSchema);
|
|
457
|
+
const WrapIfAdditionalTemplate2 = getTemplate2(
|
|
458
|
+
"WrapIfAdditionalTemplate",
|
|
459
|
+
registry,
|
|
460
|
+
uiOptions
|
|
461
|
+
);
|
|
589
462
|
if (hidden) {
|
|
590
|
-
return
|
|
591
|
-
style: {
|
|
592
|
-
display: 'none'
|
|
593
|
-
},
|
|
594
|
-
children: children
|
|
595
|
-
});
|
|
463
|
+
return /* @__PURE__ */ jsx11("div", { style: { display: "none" }, children });
|
|
596
464
|
}
|
|
597
|
-
return
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
grouped: true,
|
|
609
|
-
|
|
610
|
-
wrap:
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
}), help, errors]
|
|
617
|
-
})
|
|
618
|
-
}, id)
|
|
619
|
-
});
|
|
465
|
+
return /* @__PURE__ */ jsx11(
|
|
466
|
+
WrapIfAdditionalTemplate2,
|
|
467
|
+
{
|
|
468
|
+
classNames,
|
|
469
|
+
style,
|
|
470
|
+
id,
|
|
471
|
+
label,
|
|
472
|
+
registry,
|
|
473
|
+
schema,
|
|
474
|
+
uiSchema,
|
|
475
|
+
...otherProps,
|
|
476
|
+
children: /* @__PURE__ */ jsx11(Form2.Group, { widths: "equal", grouped: true, children: /* @__PURE__ */ jsxs5(MaybeWrap, { wrap: wrapContent, className: "sui-field-content", children: [
|
|
477
|
+
children,
|
|
478
|
+
displayLabel && rawDescription && /* @__PURE__ */ jsx11(MaybeWrap, { wrap: wrapLabel, className: "sui-field-label", children: description }),
|
|
479
|
+
help,
|
|
480
|
+
errors
|
|
481
|
+
] }) }, id)
|
|
482
|
+
}
|
|
483
|
+
);
|
|
620
484
|
}
|
|
621
485
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
486
|
+
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
487
|
+
import { Grid as Grid2 } from "semantic-ui-react";
|
|
488
|
+
import {
|
|
489
|
+
canExpand,
|
|
490
|
+
descriptionId,
|
|
491
|
+
getTemplate as getTemplate3,
|
|
492
|
+
getUiOptions as getUiOptions5,
|
|
493
|
+
titleId
|
|
494
|
+
} from "@rjsf/utils";
|
|
495
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
628
496
|
function ObjectFieldTemplate(props) {
|
|
629
497
|
const {
|
|
630
498
|
description,
|
|
@@ -640,80 +508,80 @@ function ObjectFieldTemplate(props) {
|
|
|
640
508
|
idSchema,
|
|
641
509
|
registry
|
|
642
510
|
} = props;
|
|
643
|
-
const uiOptions =
|
|
644
|
-
const TitleFieldTemplate =
|
|
645
|
-
const DescriptionFieldTemplate =
|
|
646
|
-
|
|
511
|
+
const uiOptions = getUiOptions5(uiSchema);
|
|
512
|
+
const TitleFieldTemplate = getTemplate3("TitleFieldTemplate", registry, uiOptions);
|
|
513
|
+
const DescriptionFieldTemplate = getTemplate3(
|
|
514
|
+
"DescriptionFieldTemplate",
|
|
515
|
+
registry,
|
|
516
|
+
uiOptions
|
|
517
|
+
);
|
|
647
518
|
const {
|
|
648
|
-
ButtonTemplates: {
|
|
649
|
-
AddButton
|
|
650
|
-
}
|
|
519
|
+
ButtonTemplates: { AddButton: AddButton2 }
|
|
651
520
|
} = registry.templates;
|
|
652
|
-
return
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
521
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
522
|
+
title && /* @__PURE__ */ jsx12(
|
|
523
|
+
TitleFieldTemplate,
|
|
524
|
+
{
|
|
525
|
+
id: titleId(idSchema),
|
|
526
|
+
title,
|
|
527
|
+
required,
|
|
528
|
+
schema,
|
|
529
|
+
uiSchema,
|
|
530
|
+
registry
|
|
531
|
+
}
|
|
532
|
+
),
|
|
533
|
+
description && /* @__PURE__ */ jsx12(
|
|
534
|
+
DescriptionFieldTemplate,
|
|
535
|
+
{
|
|
536
|
+
id: descriptionId(idSchema),
|
|
537
|
+
description,
|
|
538
|
+
schema,
|
|
539
|
+
uiSchema,
|
|
540
|
+
registry
|
|
541
|
+
}
|
|
542
|
+
),
|
|
543
|
+
properties.map((prop) => prop.content),
|
|
544
|
+
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx12(Grid2.Column, { width: 16, verticalAlign: "middle", children: /* @__PURE__ */ jsx12(Grid2.Row, { children: /* @__PURE__ */ jsx12(
|
|
545
|
+
"div",
|
|
546
|
+
{
|
|
547
|
+
style: {
|
|
548
|
+
marginTop: "1rem",
|
|
549
|
+
position: "relative",
|
|
550
|
+
textAlign: "right"
|
|
551
|
+
},
|
|
552
|
+
children: /* @__PURE__ */ jsx12(
|
|
553
|
+
AddButton2,
|
|
554
|
+
{
|
|
677
555
|
onClick: onAddClick(schema),
|
|
678
556
|
disabled: disabled || readonly,
|
|
679
|
-
uiSchema
|
|
680
|
-
registry
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
})
|
|
685
|
-
});
|
|
557
|
+
uiSchema,
|
|
558
|
+
registry
|
|
559
|
+
}
|
|
560
|
+
)
|
|
561
|
+
}
|
|
562
|
+
) }) })
|
|
563
|
+
] });
|
|
686
564
|
}
|
|
687
565
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
}) {
|
|
693
|
-
const {
|
|
694
|
-
submitText,
|
|
695
|
-
norender,
|
|
696
|
-
props: submitButtonProps = {}
|
|
697
|
-
} = getSubmitButtonOptions(uiSchema);
|
|
566
|
+
// src/SubmitButton/SubmitButton.tsx
|
|
567
|
+
import { Button as Button4 } from "semantic-ui-react";
|
|
568
|
+
import { getSubmitButtonOptions } from "@rjsf/utils";
|
|
569
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
570
|
+
function SubmitButton({ uiSchema }) {
|
|
571
|
+
const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
|
|
698
572
|
if (norender) {
|
|
699
573
|
return null;
|
|
700
574
|
}
|
|
701
|
-
return
|
|
702
|
-
type: 'submit',
|
|
703
|
-
primary: true,
|
|
704
|
-
...submitButtonProps,
|
|
705
|
-
children: submitText
|
|
706
|
-
});
|
|
575
|
+
return /* @__PURE__ */ jsx13(Button4, { type: "submit", primary: true, ...submitButtonProps, children: submitText });
|
|
707
576
|
}
|
|
708
577
|
|
|
709
|
-
|
|
578
|
+
// src/TitleField/TitleField.tsx
|
|
579
|
+
import { Header } from "semantic-ui-react";
|
|
580
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
581
|
+
var DEFAULT_OPTIONS2 = {
|
|
710
582
|
inverted: false,
|
|
711
583
|
dividing: true
|
|
712
584
|
};
|
|
713
|
-
/** The `TitleField` is the template to use to render the title of a field
|
|
714
|
-
*
|
|
715
|
-
* @param props - The `TitleFieldProps` for this component
|
|
716
|
-
*/
|
|
717
585
|
function TitleField({
|
|
718
586
|
id,
|
|
719
587
|
title,
|
|
@@ -721,24 +589,21 @@ function TitleField({
|
|
|
721
589
|
}) {
|
|
722
590
|
const semanticProps = getSemanticProps({
|
|
723
591
|
uiSchema,
|
|
724
|
-
defaultSchemaProps:
|
|
592
|
+
defaultSchemaProps: DEFAULT_OPTIONS2
|
|
725
593
|
});
|
|
726
594
|
if (!title) {
|
|
727
595
|
return null;
|
|
728
596
|
}
|
|
729
|
-
return
|
|
730
|
-
id: id,
|
|
731
|
-
...semanticProps,
|
|
732
|
-
as: 'h5',
|
|
733
|
-
children: title
|
|
734
|
-
});
|
|
597
|
+
return /* @__PURE__ */ jsx14(Header, { id, ...semanticProps, as: "h5", children: title });
|
|
735
598
|
}
|
|
736
599
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
600
|
+
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
601
|
+
import {
|
|
602
|
+
ADDITIONAL_PROPERTY_FLAG,
|
|
603
|
+
TranslatableString as TranslatableString4
|
|
604
|
+
} from "@rjsf/utils";
|
|
605
|
+
import { Form as Form3, Grid as Grid3 } from "semantic-ui-react";
|
|
606
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
742
607
|
function WrapIfAdditionalTemplate(props) {
|
|
743
608
|
const {
|
|
744
609
|
children,
|
|
@@ -755,76 +620,50 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
755
620
|
uiSchema,
|
|
756
621
|
registry
|
|
757
622
|
} = props;
|
|
758
|
-
const {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
} = registry;
|
|
762
|
-
|
|
763
|
-
const {
|
|
764
|
-
RemoveButton
|
|
765
|
-
} = templates.ButtonTemplates;
|
|
766
|
-
const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
767
|
-
const {
|
|
768
|
-
readonlyAsDisabled = true,
|
|
769
|
-
wrapperStyle
|
|
770
|
-
} = registry.formContext;
|
|
771
|
-
const additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
623
|
+
const { templates, translateString } = registry;
|
|
624
|
+
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
625
|
+
const keyLabel = translateString(TranslatableString4.KeyLabel, [label]);
|
|
626
|
+
const { readonlyAsDisabled = true, wrapperStyle } = registry.formContext;
|
|
627
|
+
const additional = ADDITIONAL_PROPERTY_FLAG in schema;
|
|
772
628
|
if (!additional) {
|
|
773
|
-
return
|
|
774
|
-
className: classNames,
|
|
775
|
-
style: style,
|
|
776
|
-
children: children
|
|
777
|
-
});
|
|
629
|
+
return /* @__PURE__ */ jsx15("div", { className: classNames, style, children });
|
|
778
630
|
}
|
|
779
|
-
const handleBlur = ({
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
children: children
|
|
813
|
-
}), jsx(Grid.Column, {
|
|
814
|
-
children: jsx(RemoveButton, {
|
|
815
|
-
iconType: 'mini',
|
|
816
|
-
className: 'array-item-remove',
|
|
817
|
-
disabled: disabled || readonly,
|
|
818
|
-
onClick: onDropPropertyClick(label),
|
|
819
|
-
uiSchema: uiSchema,
|
|
820
|
-
registry: registry
|
|
821
|
-
})
|
|
822
|
-
})]
|
|
823
|
-
})
|
|
824
|
-
})
|
|
825
|
-
}, `${id}-key`);
|
|
631
|
+
const handleBlur = ({ target }) => onKeyChange(target.value);
|
|
632
|
+
return /* @__PURE__ */ jsx15("div", { className: classNames, style, children: /* @__PURE__ */ jsx15(Grid3, { columns: "equal", children: /* @__PURE__ */ jsxs7(Grid3.Row, { children: [
|
|
633
|
+
/* @__PURE__ */ jsx15(Grid3.Column, { className: "form-additional", children: /* @__PURE__ */ jsx15(Form3.Group, { widths: "equal", grouped: true, children: /* @__PURE__ */ jsx15(
|
|
634
|
+
Form3.Input,
|
|
635
|
+
{
|
|
636
|
+
className: "form-group",
|
|
637
|
+
hasFeedback: true,
|
|
638
|
+
fluid: true,
|
|
639
|
+
htmlFor: `${id}`,
|
|
640
|
+
label: keyLabel,
|
|
641
|
+
required,
|
|
642
|
+
defaultValue: label,
|
|
643
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
644
|
+
id: `${id}`,
|
|
645
|
+
name: `${id}`,
|
|
646
|
+
onBlur: !readonly ? handleBlur : void 0,
|
|
647
|
+
style: wrapperStyle,
|
|
648
|
+
type: "text"
|
|
649
|
+
}
|
|
650
|
+
) }) }),
|
|
651
|
+
/* @__PURE__ */ jsx15(Grid3.Column, { className: "form-additional", verticalAlign: "middle", children }),
|
|
652
|
+
/* @__PURE__ */ jsx15(Grid3.Column, { children: /* @__PURE__ */ jsx15(
|
|
653
|
+
RemoveButton2,
|
|
654
|
+
{
|
|
655
|
+
iconType: "mini",
|
|
656
|
+
className: "array-item-remove",
|
|
657
|
+
disabled: disabled || readonly,
|
|
658
|
+
onClick: onDropPropertyClick(label),
|
|
659
|
+
uiSchema,
|
|
660
|
+
registry
|
|
661
|
+
}
|
|
662
|
+
) })
|
|
663
|
+
] }) }) }, `${id}-key`);
|
|
826
664
|
}
|
|
827
665
|
|
|
666
|
+
// src/Templates/Templates.ts
|
|
828
667
|
function generateTemplates() {
|
|
829
668
|
return {
|
|
830
669
|
ArrayFieldItemTemplate,
|
|
@@ -848,20 +687,25 @@ function generateTemplates() {
|
|
|
848
687
|
WrapIfAdditionalTemplate
|
|
849
688
|
};
|
|
850
689
|
}
|
|
851
|
-
var
|
|
690
|
+
var Templates_default = generateTemplates();
|
|
852
691
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
692
|
+
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
693
|
+
import {
|
|
694
|
+
ariaDescribedByIds as ariaDescribedByIds2,
|
|
695
|
+
descriptionId as descriptionId2,
|
|
696
|
+
getTemplate as getTemplate4,
|
|
697
|
+
labelValue as labelValue2,
|
|
698
|
+
schemaRequiresTrueValue
|
|
699
|
+
} from "@rjsf/utils";
|
|
700
|
+
import { Form as Form4 } from "semantic-ui-react";
|
|
701
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
858
702
|
function CheckboxWidget(props) {
|
|
859
703
|
const {
|
|
860
704
|
id,
|
|
861
705
|
value,
|
|
862
706
|
disabled,
|
|
863
707
|
readonly,
|
|
864
|
-
label =
|
|
708
|
+
label = "",
|
|
865
709
|
hideLabel,
|
|
866
710
|
autofocus,
|
|
867
711
|
onChange,
|
|
@@ -879,49 +723,64 @@ function CheckboxWidget(props) {
|
|
|
879
723
|
formContext,
|
|
880
724
|
uiSchema,
|
|
881
725
|
defaultSchemaProps: {
|
|
882
|
-
inverted:
|
|
726
|
+
inverted: "false"
|
|
883
727
|
}
|
|
884
728
|
});
|
|
885
|
-
const DescriptionFieldTemplate =
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
729
|
+
const DescriptionFieldTemplate = getTemplate4(
|
|
730
|
+
"DescriptionFieldTemplate",
|
|
731
|
+
registry,
|
|
732
|
+
options
|
|
733
|
+
);
|
|
889
734
|
const required = schemaRequiresTrueValue(schema);
|
|
890
735
|
const _onChange = (_, data) => onChange && onChange(data.checked);
|
|
891
736
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
892
737
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
893
|
-
const checked = value ==
|
|
738
|
+
const checked = value == "true" || value == true;
|
|
894
739
|
const description = options.description ?? schema.description;
|
|
895
|
-
return
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
740
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
741
|
+
!hideLabel && !!description && /* @__PURE__ */ jsx16(
|
|
742
|
+
DescriptionFieldTemplate,
|
|
743
|
+
{
|
|
744
|
+
id: descriptionId2(id),
|
|
745
|
+
description,
|
|
746
|
+
schema,
|
|
747
|
+
uiSchema,
|
|
748
|
+
registry
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
/* @__PURE__ */ jsx16(
|
|
752
|
+
Form4.Checkbox,
|
|
753
|
+
{
|
|
754
|
+
id,
|
|
755
|
+
name: id,
|
|
756
|
+
disabled: disabled || readonly,
|
|
757
|
+
autoFocus: autofocus,
|
|
758
|
+
...semanticProps,
|
|
759
|
+
checked: typeof value === "undefined" ? false : checked,
|
|
760
|
+
error: rawErrors.length > 0,
|
|
761
|
+
onChange: _onChange,
|
|
762
|
+
onBlur: _onBlur,
|
|
763
|
+
onFocus: _onFocus,
|
|
764
|
+
required,
|
|
765
|
+
label: labelValue2(label, hideLabel, false),
|
|
766
|
+
"aria-describedby": ariaDescribedByIds2(id)
|
|
767
|
+
}
|
|
768
|
+
)
|
|
769
|
+
] });
|
|
918
770
|
}
|
|
919
771
|
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
772
|
+
// src/CheckboxesWidget/CheckboxesWidget.tsx
|
|
773
|
+
import { Form as Form5 } from "semantic-ui-react";
|
|
774
|
+
import {
|
|
775
|
+
ariaDescribedByIds as ariaDescribedByIds3,
|
|
776
|
+
enumOptionsDeselectValue,
|
|
777
|
+
enumOptionsIsSelected,
|
|
778
|
+
enumOptionsSelectValue,
|
|
779
|
+
getTemplate as getTemplate5,
|
|
780
|
+
optionId,
|
|
781
|
+
titleId as titleId2
|
|
782
|
+
} from "@rjsf/utils";
|
|
783
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
925
784
|
function CheckboxesWidget(props) {
|
|
926
785
|
const {
|
|
927
786
|
id,
|
|
@@ -941,27 +800,18 @@ function CheckboxesWidget(props) {
|
|
|
941
800
|
rawErrors = [],
|
|
942
801
|
registry
|
|
943
802
|
} = props;
|
|
944
|
-
const TitleFieldTemplate =
|
|
945
|
-
const {
|
|
946
|
-
enumOptions,
|
|
947
|
-
enumDisabled,
|
|
948
|
-
inline
|
|
949
|
-
} = options;
|
|
803
|
+
const TitleFieldTemplate = getTemplate5("TitleFieldTemplate", registry, options);
|
|
804
|
+
const { enumOptions, enumDisabled, inline } = options;
|
|
950
805
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
951
806
|
const semanticProps = getSemanticProps({
|
|
952
807
|
options,
|
|
953
808
|
formContext,
|
|
954
809
|
uiSchema,
|
|
955
810
|
defaultSchemaProps: {
|
|
956
|
-
inverted:
|
|
811
|
+
inverted: "false"
|
|
957
812
|
}
|
|
958
813
|
});
|
|
959
|
-
const _onChange = index => ({
|
|
960
|
-
target: {
|
|
961
|
-
checked
|
|
962
|
-
}
|
|
963
|
-
}) => {
|
|
964
|
-
// eslint-disable-next-line no-shadow
|
|
814
|
+
const _onChange = (index) => ({ target: { checked } }) => {
|
|
965
815
|
if (checked) {
|
|
966
816
|
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
967
817
|
} else {
|
|
@@ -970,49 +820,44 @@ function CheckboxesWidget(props) {
|
|
|
970
820
|
};
|
|
971
821
|
const _onBlur = () => onBlur(id, value);
|
|
972
822
|
const _onFocus = () => onFocus(id, value);
|
|
973
|
-
const inlineOption = inline ? {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
schema: schema,
|
|
983
|
-
uiSchema: uiSchema,
|
|
984
|
-
registry: registry
|
|
985
|
-
}), jsx(Form.Group, {
|
|
986
|
-
id: id,
|
|
987
|
-
name: id,
|
|
988
|
-
...inlineOption,
|
|
989
|
-
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
990
|
-
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
991
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
992
|
-
return jsx(Form.Checkbox, {
|
|
823
|
+
const inlineOption = inline ? { inline: true } : { grouped: true };
|
|
824
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
825
|
+
!hideLabel && !!label && /* @__PURE__ */ jsx17(TitleFieldTemplate, { id: titleId2(id), title: label, schema, uiSchema, registry }),
|
|
826
|
+
/* @__PURE__ */ jsx17(Form5.Group, { id, name: id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
827
|
+
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
828
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
829
|
+
return /* @__PURE__ */ jsx17(
|
|
830
|
+
Form5.Checkbox,
|
|
831
|
+
{
|
|
993
832
|
id: optionId(id, index),
|
|
994
833
|
name: id,
|
|
995
834
|
label: option.label,
|
|
996
835
|
...semanticProps,
|
|
997
|
-
checked
|
|
836
|
+
checked,
|
|
998
837
|
error: rawErrors.length > 0,
|
|
999
838
|
disabled: disabled || itemDisabled || readonly,
|
|
1000
839
|
autoFocus: autofocus && index === 0,
|
|
1001
840
|
onChange: _onChange(index),
|
|
1002
841
|
onBlur: _onBlur,
|
|
1003
842
|
onFocus: _onFocus,
|
|
1004
|
-
"aria-describedby":
|
|
1005
|
-
},
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
843
|
+
"aria-describedby": ariaDescribedByIds3(id)
|
|
844
|
+
},
|
|
845
|
+
index
|
|
846
|
+
);
|
|
847
|
+
}) })
|
|
848
|
+
] });
|
|
1009
849
|
}
|
|
1010
850
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
851
|
+
// src/RadioWidget/RadioWidget.tsx
|
|
852
|
+
import {
|
|
853
|
+
ariaDescribedByIds as ariaDescribedByIds4,
|
|
854
|
+
enumOptionsIsSelected as enumOptionsIsSelected2,
|
|
855
|
+
enumOptionsValueForIndex,
|
|
856
|
+
optionId as optionId2
|
|
857
|
+
} from "@rjsf/utils";
|
|
858
|
+
import { Form as Form6, Radio } from "semantic-ui-react";
|
|
859
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
860
|
+
import { createElement } from "react";
|
|
1016
861
|
function RadioWidget(props) {
|
|
1017
862
|
const {
|
|
1018
863
|
id,
|
|
@@ -1028,37 +873,27 @@ function RadioWidget(props) {
|
|
|
1028
873
|
uiSchema,
|
|
1029
874
|
rawErrors = []
|
|
1030
875
|
} = props;
|
|
1031
|
-
const {
|
|
1032
|
-
enumOptions,
|
|
1033
|
-
enumDisabled,
|
|
1034
|
-
emptyValue
|
|
1035
|
-
} = options;
|
|
876
|
+
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1036
877
|
const semanticProps = getSemanticProps({
|
|
1037
878
|
formContext,
|
|
1038
879
|
options,
|
|
1039
880
|
uiSchema
|
|
1040
881
|
});
|
|
1041
|
-
const _onChange = (_, {
|
|
1042
|
-
value: eventValue
|
|
1043
|
-
}) => {
|
|
882
|
+
const _onChange = (_, { value: eventValue }) => {
|
|
1044
883
|
return onChange(enumOptionsValueForIndex(eventValue, enumOptions, emptyValue));
|
|
1045
884
|
};
|
|
1046
885
|
const _onBlur = () => onBlur(id, value);
|
|
1047
886
|
const _onFocus = () => onFocus(id, value);
|
|
1048
|
-
const inlineOption = options.inline ? {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
const checked = enumOptionsIsSelected(option.value, value);
|
|
1057
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
1058
|
-
return /*#__PURE__*/createElement(Form.Field, {
|
|
1059
|
-
required: required,
|
|
887
|
+
const inlineOption = options.inline ? { inline: true } : { grouped: true };
|
|
888
|
+
return /* @__PURE__ */ jsx18(Form6.Group, { ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
889
|
+
const checked = enumOptionsIsSelected2(option.value, value);
|
|
890
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
891
|
+
return /* @__PURE__ */ createElement(
|
|
892
|
+
Form6.Field,
|
|
893
|
+
{
|
|
894
|
+
required,
|
|
1060
895
|
control: Radio,
|
|
1061
|
-
id:
|
|
896
|
+
id: optionId2(id, index),
|
|
1062
897
|
name: id,
|
|
1063
898
|
...semanticProps,
|
|
1064
899
|
onFocus: _onFocus,
|
|
@@ -1068,19 +903,18 @@ function RadioWidget(props) {
|
|
|
1068
903
|
value: String(index),
|
|
1069
904
|
error: rawErrors.length > 0,
|
|
1070
905
|
key: index,
|
|
1071
|
-
checked
|
|
906
|
+
checked,
|
|
1072
907
|
disabled: disabled || itemDisabled || readonly,
|
|
1073
|
-
"aria-describedby":
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
});
|
|
908
|
+
"aria-describedby": ariaDescribedByIds4(id)
|
|
909
|
+
}
|
|
910
|
+
);
|
|
911
|
+
}) });
|
|
1077
912
|
}
|
|
1078
913
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
*/
|
|
914
|
+
// src/RangeWidget/RangeWidget.tsx
|
|
915
|
+
import { Input } from "semantic-ui-react";
|
|
916
|
+
import { ariaDescribedByIds as ariaDescribedByIds5, rangeSpec } from "@rjsf/utils";
|
|
917
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1084
918
|
function RangeWidget(props) {
|
|
1085
919
|
const {
|
|
1086
920
|
id,
|
|
@@ -1105,47 +939,46 @@ function RangeWidget(props) {
|
|
|
1105
939
|
fluid: true
|
|
1106
940
|
}
|
|
1107
941
|
});
|
|
1108
|
-
|
|
1109
|
-
const _onChange = ({
|
|
1110
|
-
target: {
|
|
1111
|
-
value
|
|
1112
|
-
}
|
|
1113
|
-
}) => onChange && onChange(value === '' ? options.emptyValue : value);
|
|
942
|
+
const _onChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
|
|
1114
943
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
1115
944
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
1116
|
-
return
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
945
|
+
return /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
946
|
+
/* @__PURE__ */ jsx19(
|
|
947
|
+
Input,
|
|
948
|
+
{
|
|
949
|
+
id,
|
|
950
|
+
name: id,
|
|
951
|
+
type: "range",
|
|
952
|
+
required,
|
|
953
|
+
disabled: disabled || readonly,
|
|
954
|
+
...rangeSpec(schema),
|
|
955
|
+
...semanticProps,
|
|
956
|
+
value: value || "",
|
|
957
|
+
error: rawErrors.length > 0,
|
|
958
|
+
onChange: _onChange,
|
|
959
|
+
onBlur: _onBlur,
|
|
960
|
+
onFocus: _onFocus,
|
|
961
|
+
"aria-describedby": ariaDescribedByIds5(id)
|
|
962
|
+
},
|
|
963
|
+
id
|
|
964
|
+
),
|
|
965
|
+
/* @__PURE__ */ jsx19("span", { children: value })
|
|
966
|
+
] });
|
|
1135
967
|
}
|
|
1136
968
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
969
|
+
// src/SelectWidget/SelectWidget.tsx
|
|
970
|
+
import {
|
|
971
|
+
ariaDescribedByIds as ariaDescribedByIds6,
|
|
972
|
+
enumOptionsIndexForValue,
|
|
973
|
+
enumOptionsValueForIndex as enumOptionsValueForIndex2,
|
|
974
|
+
labelValue as labelValue3
|
|
975
|
+
} from "@rjsf/utils";
|
|
976
|
+
import map from "lodash/map";
|
|
977
|
+
import { Form as Form7 } from "semantic-ui-react";
|
|
978
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1143
979
|
function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled) {
|
|
1144
980
|
const disabledOptions = enumDisabled || [];
|
|
1145
|
-
const options = map(enumOptions, ({
|
|
1146
|
-
label,
|
|
1147
|
-
value
|
|
1148
|
-
}, index) => ({
|
|
981
|
+
const options = map(enumOptions, ({ label, value }, index) => ({
|
|
1149
982
|
disabled: disabledOptions.indexOf(value) !== -1,
|
|
1150
983
|
key: label,
|
|
1151
984
|
text: label,
|
|
@@ -1153,11 +986,6 @@ function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled) {
|
|
|
1153
986
|
}));
|
|
1154
987
|
return options;
|
|
1155
988
|
}
|
|
1156
|
-
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
1157
|
-
* It is typically used with string properties constrained with enum options.
|
|
1158
|
-
*
|
|
1159
|
-
* @param props - The `WidgetProps` for this component
|
|
1160
|
-
*/
|
|
1161
989
|
function SelectWidget(props) {
|
|
1162
990
|
const {
|
|
1163
991
|
uiSchema,
|
|
@@ -1183,60 +1011,52 @@ function SelectWidget(props) {
|
|
|
1183
1011
|
formContext,
|
|
1184
1012
|
options,
|
|
1185
1013
|
defaultSchemaProps: {
|
|
1186
|
-
inverted:
|
|
1014
|
+
inverted: "false",
|
|
1187
1015
|
selection: true,
|
|
1188
1016
|
fluid: true,
|
|
1189
1017
|
scrolling: true,
|
|
1190
1018
|
upward: false
|
|
1191
1019
|
}
|
|
1192
1020
|
});
|
|
1193
|
-
const {
|
|
1194
|
-
|
|
1195
|
-
enumOptions,
|
|
1196
|
-
emptyValue: optEmptyVal
|
|
1197
|
-
} = options;
|
|
1198
|
-
const emptyValue = multiple ? [] : '';
|
|
1021
|
+
const { enumDisabled, enumOptions, emptyValue: optEmptyVal } = options;
|
|
1022
|
+
const emptyValue = multiple ? [] : "";
|
|
1199
1023
|
const dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
|
|
1200
|
-
const _onChange = (_, {
|
|
1201
|
-
|
|
1202
|
-
}) =>
|
|
1203
|
-
// eslint-disable-next-line no-shadow
|
|
1204
|
-
const _onBlur = (_, {
|
|
1205
|
-
target: {
|
|
1206
|
-
value
|
|
1207
|
-
}
|
|
1208
|
-
}) => onBlur(id, enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1209
|
-
const _onFocus = (_, {
|
|
1210
|
-
target: {
|
|
1211
|
-
value
|
|
1212
|
-
}
|
|
1213
|
-
}) => onFocus(id, enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1024
|
+
const _onChange = (_, { value: value2 }) => onChange(enumOptionsValueForIndex2(value2, enumOptions, optEmptyVal));
|
|
1025
|
+
const _onBlur = (_, { target: { value: value2 } }) => onBlur(id, enumOptionsValueForIndex2(value2, enumOptions, optEmptyVal));
|
|
1026
|
+
const _onFocus = (_, { target: { value: value2 } }) => onFocus(id, enumOptionsValueForIndex2(value2, enumOptions, optEmptyVal));
|
|
1214
1027
|
const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1215
|
-
return
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1028
|
+
return /* @__PURE__ */ jsx20(
|
|
1029
|
+
Form7.Dropdown,
|
|
1030
|
+
{
|
|
1031
|
+
id,
|
|
1032
|
+
name: id,
|
|
1033
|
+
label: labelValue3(label || void 0, hideLabel, false),
|
|
1034
|
+
multiple: typeof multiple === "undefined" ? false : multiple,
|
|
1035
|
+
value: typeof value === "undefined" ? emptyValue : selectedIndexes,
|
|
1036
|
+
error: rawErrors.length > 0,
|
|
1037
|
+
disabled,
|
|
1038
|
+
placeholder,
|
|
1039
|
+
...semanticProps,
|
|
1040
|
+
required,
|
|
1041
|
+
autoFocus: autofocus,
|
|
1042
|
+
readOnly: readonly,
|
|
1043
|
+
options: dropdownOptions,
|
|
1044
|
+
onChange: _onChange,
|
|
1045
|
+
onBlur: _onBlur,
|
|
1046
|
+
onFocus: _onFocus,
|
|
1047
|
+
"aria-describedby": ariaDescribedByIds6(id)
|
|
1048
|
+
},
|
|
1049
|
+
id
|
|
1050
|
+
);
|
|
1234
1051
|
}
|
|
1235
1052
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1053
|
+
// src/TextareaWidget/TextareaWidget.tsx
|
|
1054
|
+
import {
|
|
1055
|
+
ariaDescribedByIds as ariaDescribedByIds7,
|
|
1056
|
+
labelValue as labelValue4
|
|
1057
|
+
} from "@rjsf/utils";
|
|
1058
|
+
import { Form as Form8 } from "semantic-ui-react";
|
|
1059
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1240
1060
|
function TextareaWidget(props) {
|
|
1241
1061
|
const {
|
|
1242
1062
|
id,
|
|
@@ -1258,37 +1078,35 @@ function TextareaWidget(props) {
|
|
|
1258
1078
|
const semanticProps = getSemanticProps({
|
|
1259
1079
|
formContext,
|
|
1260
1080
|
options,
|
|
1261
|
-
defaultSchemaProps: {
|
|
1262
|
-
inverted: 'false'
|
|
1263
|
-
}
|
|
1081
|
+
defaultSchemaProps: { inverted: "false" }
|
|
1264
1082
|
});
|
|
1265
|
-
|
|
1266
|
-
const _onChange = ({
|
|
1267
|
-
target: {
|
|
1268
|
-
value
|
|
1269
|
-
}
|
|
1270
|
-
}) => onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1083
|
+
const _onChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
|
|
1271
1084
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
1272
1085
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
1273
|
-
return
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1086
|
+
return /* @__PURE__ */ jsx21(
|
|
1087
|
+
Form8.TextArea,
|
|
1088
|
+
{
|
|
1089
|
+
id,
|
|
1090
|
+
name: id,
|
|
1091
|
+
label: labelValue4(label || void 0, hideLabel, false),
|
|
1092
|
+
placeholder,
|
|
1093
|
+
autoFocus: autofocus,
|
|
1094
|
+
required,
|
|
1095
|
+
disabled: disabled || readonly,
|
|
1096
|
+
...semanticProps,
|
|
1097
|
+
value: value || "",
|
|
1098
|
+
error: rawErrors.length > 0,
|
|
1099
|
+
rows: options.rows || 5,
|
|
1100
|
+
onChange: _onChange,
|
|
1101
|
+
onBlur: _onBlur,
|
|
1102
|
+
onFocus: _onFocus,
|
|
1103
|
+
"aria-describedby": ariaDescribedByIds7(id)
|
|
1104
|
+
},
|
|
1105
|
+
id
|
|
1106
|
+
);
|
|
1290
1107
|
}
|
|
1291
1108
|
|
|
1109
|
+
// src/Widgets/Widgets.tsx
|
|
1292
1110
|
function generateWidgets() {
|
|
1293
1111
|
return {
|
|
1294
1112
|
CheckboxWidget,
|
|
@@ -1299,21 +1117,35 @@ function generateWidgets() {
|
|
|
1299
1117
|
TextareaWidget
|
|
1300
1118
|
};
|
|
1301
1119
|
}
|
|
1302
|
-
var
|
|
1120
|
+
var Widgets_default = generateWidgets();
|
|
1303
1121
|
|
|
1122
|
+
// src/Theme/Theme.ts
|
|
1304
1123
|
function generateTheme() {
|
|
1305
1124
|
return {
|
|
1306
1125
|
templates: generateTemplates(),
|
|
1307
1126
|
widgets: generateWidgets(),
|
|
1308
|
-
_internalFormWrapper:
|
|
1127
|
+
_internalFormWrapper: SuiForm
|
|
1309
1128
|
};
|
|
1310
1129
|
}
|
|
1311
|
-
var
|
|
1130
|
+
var Theme_default = generateTheme();
|
|
1312
1131
|
|
|
1132
|
+
// src/SemanticUIForm/SemanticUIForm.ts
|
|
1313
1133
|
function generateForm() {
|
|
1314
1134
|
return withTheme(generateTheme());
|
|
1315
1135
|
}
|
|
1316
|
-
var
|
|
1136
|
+
var SemanticUIForm_default = generateForm();
|
|
1317
1137
|
|
|
1318
|
-
|
|
1138
|
+
// src/index.ts
|
|
1139
|
+
var src_default = SemanticUIForm_default;
|
|
1140
|
+
export {
|
|
1141
|
+
SemanticUIForm_default as Form,
|
|
1142
|
+
Templates_default as Templates,
|
|
1143
|
+
Theme_default as Theme,
|
|
1144
|
+
Widgets_default as Widgets,
|
|
1145
|
+
src_default as default,
|
|
1146
|
+
generateForm,
|
|
1147
|
+
generateTemplates,
|
|
1148
|
+
generateTheme,
|
|
1149
|
+
generateWidgets
|
|
1150
|
+
};
|
|
1319
1151
|
//# sourceMappingURL=semantic-ui.esm.js.map
|