@rjsf/mantine 6.0.0-beta.14
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 +153 -0
- package/dist/index.js +1918 -0
- package/dist/index.js.map +7 -0
- package/dist/mantine.esm.js +1967 -0
- package/dist/mantine.esm.js.map +7 -0
- package/dist/mantine.umd.js +1714 -0
- package/lib/Form/index.d.ts +6 -0
- package/lib/Form/index.js +7 -0
- package/lib/Form/index.js.map +1 -0
- package/lib/Theme/index.d.ts +5 -0
- package/lib/Theme/index.js +10 -0
- package/lib/Theme/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/templates/ArrayFieldItemTemplate.d.ts +6 -0
- package/lib/templates/ArrayFieldItemTemplate.js +14 -0
- package/lib/templates/ArrayFieldItemTemplate.js.map +1 -0
- package/lib/templates/ArrayFieldTemplate.d.ts +6 -0
- package/lib/templates/ArrayFieldTemplate.js +20 -0
- package/lib/templates/ArrayFieldTemplate.js.map +1 -0
- package/lib/templates/ArrayFieldTitleTemplate.d.ts +7 -0
- package/lib/templates/ArrayFieldTitleTemplate.js +18 -0
- package/lib/templates/ArrayFieldTitleTemplate.js.map +1 -0
- package/lib/templates/BaseInputTemplate.d.ts +8 -0
- package/lib/templates/BaseInputTemplate.js +36 -0
- package/lib/templates/BaseInputTemplate.js.map +1 -0
- package/lib/templates/ButtonTemplates/AddButton.d.ts +4 -0
- package/lib/templates/ButtonTemplates/AddButton.js +11 -0
- package/lib/templates/ButtonTemplates/AddButton.js.map +1 -0
- package/lib/templates/ButtonTemplates/IconButton.d.ts +8 -0
- package/lib/templates/ButtonTemplates/IconButton.js +25 -0
- package/lib/templates/ButtonTemplates/IconButton.js.map +1 -0
- package/lib/templates/ButtonTemplates/SubmitButton.d.ts +4 -0
- package/lib/templates/ButtonTemplates/SubmitButton.js +13 -0
- package/lib/templates/ButtonTemplates/SubmitButton.js.map +1 -0
- package/lib/templates/ButtonTemplates/index.d.ts +3 -0
- package/lib/templates/ButtonTemplates/index.js +15 -0
- package/lib/templates/ButtonTemplates/index.js.map +1 -0
- package/lib/templates/DescriptionField.d.ts +6 -0
- package/lib/templates/DescriptionField.js +15 -0
- package/lib/templates/DescriptionField.js.map +1 -0
- package/lib/templates/ErrorList.d.ts +6 -0
- package/lib/templates/ErrorList.js +13 -0
- package/lib/templates/ErrorList.js.map +1 -0
- package/lib/templates/FieldErrorTemplate.d.ts +6 -0
- package/lib/templates/FieldErrorTemplate.js +16 -0
- package/lib/templates/FieldErrorTemplate.js.map +1 -0
- package/lib/templates/FieldHelpTemplate.d.ts +6 -0
- package/lib/templates/FieldHelpTemplate.js +13 -0
- package/lib/templates/FieldHelpTemplate.js.map +1 -0
- package/lib/templates/FieldTemplate.d.ts +7 -0
- package/lib/templates/FieldTemplate.js +18 -0
- package/lib/templates/FieldTemplate.js.map +1 -0
- package/lib/templates/GridTemplate.d.ts +7 -0
- package/lib/templates/GridTemplate.js +20 -0
- package/lib/templates/GridTemplate.js.map +1 -0
- package/lib/templates/MultiSchemaFieldTemplate.d.ts +2 -0
- package/lib/templates/MultiSchemaFieldTemplate.js +6 -0
- package/lib/templates/MultiSchemaFieldTemplate.js.map +1 -0
- package/lib/templates/ObjectFieldTemplate.d.ts +8 -0
- package/lib/templates/ObjectFieldTemplate.js +24 -0
- package/lib/templates/ObjectFieldTemplate.js.map +1 -0
- package/lib/templates/TitleField.d.ts +6 -0
- package/lib/templates/TitleField.js +11 -0
- package/lib/templates/TitleField.js.map +1 -0
- package/lib/templates/WrapIfAdditionalTemplate.d.ts +7 -0
- package/lib/templates/WrapIfAdditionalTemplate.js +29 -0
- package/lib/templates/WrapIfAdditionalTemplate.js.map +1 -0
- package/lib/templates/icons.d.ts +11 -0
- package/lib/templates/icons.js +20 -0
- package/lib/templates/icons.js.map +1 -0
- package/lib/templates/index.d.ts +4 -0
- package/lib/templates/index.js +36 -0
- package/lib/templates/index.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +35 -0
- package/lib/utils.js.map +1 -0
- package/lib/widgets/CheckboxWidget.d.ts +8 -0
- package/lib/widgets/CheckboxWidget.js +33 -0
- package/lib/widgets/CheckboxWidget.js.map +1 -0
- package/lib/widgets/CheckboxesWidget.d.ts +7 -0
- package/lib/widgets/CheckboxesWidget.js +33 -0
- package/lib/widgets/CheckboxesWidget.js.map +1 -0
- package/lib/widgets/ColorWidget.d.ts +6 -0
- package/lib/widgets/ColorWidget.js +28 -0
- package/lib/widgets/ColorWidget.js.map +1 -0
- package/lib/widgets/DateTime/AltDateTimeWidget.d.ts +13 -0
- package/lib/widgets/DateTime/AltDateTimeWidget.js +16 -0
- package/lib/widgets/DateTime/AltDateTimeWidget.js.map +1 -0
- package/lib/widgets/DateTime/AltDateWidget.d.ts +11 -0
- package/lib/widgets/DateTime/AltDateWidget.js +51 -0
- package/lib/widgets/DateTime/AltDateWidget.js.map +1 -0
- package/lib/widgets/DateTime/DateTimeInput.d.ts +5 -0
- package/lib/widgets/DateTime/DateTimeInput.js +39 -0
- package/lib/widgets/DateTime/DateTimeInput.js.map +1 -0
- package/lib/widgets/DateTime/DateTimeWidget.d.ts +6 -0
- package/lib/widgets/DateTime/DateTimeWidget.js +11 -0
- package/lib/widgets/DateTime/DateTimeWidget.js.map +1 -0
- package/lib/widgets/DateTime/DateWidget.d.ts +6 -0
- package/lib/widgets/DateTime/DateWidget.js +11 -0
- package/lib/widgets/DateTime/DateWidget.js.map +1 -0
- package/lib/widgets/DateTime/TimeWidget.d.ts +6 -0
- package/lib/widgets/DateTime/TimeWidget.js +27 -0
- package/lib/widgets/DateTime/TimeWidget.js.map +1 -0
- package/lib/widgets/DateTime/index.d.ts +5 -0
- package/lib/widgets/DateTime/index.js +6 -0
- package/lib/widgets/DateTime/index.js.map +1 -0
- package/lib/widgets/FileWidget.d.ts +7 -0
- package/lib/widgets/FileWidget.js +106 -0
- package/lib/widgets/FileWidget.js.map +1 -0
- package/lib/widgets/PasswordWidget.d.ts +7 -0
- package/lib/widgets/PasswordWidget.js +30 -0
- package/lib/widgets/PasswordWidget.js.map +1 -0
- package/lib/widgets/RadioWidget.d.ts +7 -0
- package/lib/widgets/RadioWidget.js +33 -0
- package/lib/widgets/RadioWidget.js.map +1 -0
- package/lib/widgets/RangeWidget.d.ts +7 -0
- package/lib/widgets/RangeWidget.js +34 -0
- package/lib/widgets/RangeWidget.js.map +1 -0
- package/lib/widgets/SelectWidget.d.ts +7 -0
- package/lib/widgets/SelectWidget.js +45 -0
- package/lib/widgets/SelectWidget.js.map +1 -0
- package/lib/widgets/TextareaWidget.d.ts +7 -0
- package/lib/widgets/TextareaWidget.js +30 -0
- package/lib/widgets/TextareaWidget.js.map +1 -0
- package/lib/widgets/index.d.ts +4 -0
- package/lib/widgets/index.js +34 -0
- package/lib/widgets/index.js.map +1 -0
- package/package.json +110 -0
- package/src/Form/index.ts +15 -0
- package/src/Theme/index.ts +18 -0
- package/src/index.ts +8 -0
- package/src/templates/ArrayFieldItemTemplate.tsx +40 -0
- package/src/templates/ArrayFieldTemplate.tsx +103 -0
- package/src/templates/ArrayFieldTitleTemplate.tsx +33 -0
- package/src/templates/BaseInputTemplate.tsx +134 -0
- package/src/templates/ButtonTemplates/AddButton.tsx +17 -0
- package/src/templates/ButtonTemplates/IconButton.tsx +87 -0
- package/src/templates/ButtonTemplates/SubmitButton.tsx +20 -0
- package/src/templates/ButtonTemplates/index.ts +21 -0
- package/src/templates/DescriptionField.tsx +24 -0
- package/src/templates/ErrorList.tsx +36 -0
- package/src/templates/FieldErrorTemplate.tsx +27 -0
- package/src/templates/FieldHelpTemplate.tsx +22 -0
- package/src/templates/FieldTemplate.tsx +66 -0
- package/src/templates/GridTemplate.tsx +30 -0
- package/src/templates/MultiSchemaFieldTemplate.tsx +15 -0
- package/src/templates/ObjectFieldTemplate.tsx +104 -0
- package/src/templates/TitleField.tsx +17 -0
- package/src/templates/WrapIfAdditionalTemplate.tsx +99 -0
- package/src/templates/icons.tsx +141 -0
- package/src/templates/index.ts +43 -0
- package/src/tsconfig.json +23 -0
- package/src/utils.ts +37 -0
- package/src/widgets/CheckboxWidget.tsx +110 -0
- package/src/widgets/CheckboxesWidget.tsx +112 -0
- package/src/widgets/ColorWidget.tsx +85 -0
- package/src/widgets/DateTime/AltDateTimeWidget.tsx +22 -0
- package/src/widgets/DateTime/AltDateWidget.tsx +139 -0
- package/src/widgets/DateTime/DateTimeInput.tsx +97 -0
- package/src/widgets/DateTime/DateTimeWidget.tsx +24 -0
- package/src/widgets/DateTime/DateWidget.tsx +22 -0
- package/src/widgets/DateTime/TimeWidget.tsx +83 -0
- package/src/widgets/DateTime/index.ts +5 -0
- package/src/widgets/FileWidget.tsx +176 -0
- package/src/widgets/PasswordWidget.tsx +88 -0
- package/src/widgets/RadioWidget.tsx +103 -0
- package/src/widgets/RangeWidget.tsx +95 -0
- package/src/widgets/SelectWidget.tsx +109 -0
- package/src/widgets/TextareaWidget.tsx +87 -0
- package/src/widgets/index.ts +42 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1918 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
Form: () => Form_default,
|
|
34
|
+
Templates: () => templates_default,
|
|
35
|
+
Theme: () => Theme_default,
|
|
36
|
+
Widgets: () => widgets_default,
|
|
37
|
+
default: () => index_default,
|
|
38
|
+
generateForm: () => generateForm,
|
|
39
|
+
generateTemplates: () => generateTemplates,
|
|
40
|
+
generateTheme: () => generateTheme,
|
|
41
|
+
generateWidgets: () => generateWidgets
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
|
+
|
|
45
|
+
// src/Form/index.ts
|
|
46
|
+
var import_core28 = require("@rjsf/core");
|
|
47
|
+
|
|
48
|
+
// src/templates/ArrayFieldItemTemplate.tsx
|
|
49
|
+
var import_utils = require("@rjsf/utils");
|
|
50
|
+
var import_core = require("@mantine/core");
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
function ArrayFieldItemTemplate(props) {
|
|
53
|
+
const { buttonsProps, className, hasToolbar, index, uiSchema, registry, children } = props;
|
|
54
|
+
const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
|
|
55
|
+
const ArrayFieldItemButtonsTemplate = (0, import_utils.getTemplate)(
|
|
56
|
+
"ArrayFieldItemButtonsTemplate",
|
|
57
|
+
registry,
|
|
58
|
+
uiOptions
|
|
59
|
+
);
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Box, { className: className || "rjsf-array-item", mb: "xs", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Flex, { gap: "xs", align: "end", justify: "center", children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Box, { w: "100%", children }),
|
|
62
|
+
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Group, { wrap: "nowrap", gap: 2, mb: 7, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) })
|
|
63
|
+
] }) }, `array-item-${index}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/templates/ArrayFieldTemplate.tsx
|
|
67
|
+
var import_utils2 = require("@rjsf/utils");
|
|
68
|
+
var import_core2 = require("@mantine/core");
|
|
69
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
70
|
+
function ArrayFieldTemplate(props) {
|
|
71
|
+
const {
|
|
72
|
+
canAdd,
|
|
73
|
+
className,
|
|
74
|
+
disabled,
|
|
75
|
+
idSchema,
|
|
76
|
+
items,
|
|
77
|
+
onAddClick,
|
|
78
|
+
readonly,
|
|
79
|
+
required,
|
|
80
|
+
schema,
|
|
81
|
+
uiSchema,
|
|
82
|
+
title,
|
|
83
|
+
registry
|
|
84
|
+
} = props;
|
|
85
|
+
const uiOptions = (0, import_utils2.getUiOptions)(uiSchema);
|
|
86
|
+
const ArrayFieldDescriptionTemplate = (0, import_utils2.getTemplate)(
|
|
87
|
+
"ArrayFieldDescriptionTemplate",
|
|
88
|
+
registry,
|
|
89
|
+
uiOptions
|
|
90
|
+
);
|
|
91
|
+
const ArrayFieldItemTemplate2 = (0, import_utils2.getTemplate)(
|
|
92
|
+
"ArrayFieldItemTemplate",
|
|
93
|
+
registry,
|
|
94
|
+
uiOptions
|
|
95
|
+
);
|
|
96
|
+
const ArrayFieldTitleTemplate2 = (0, import_utils2.getTemplate)(
|
|
97
|
+
"ArrayFieldTitleTemplate",
|
|
98
|
+
registry,
|
|
99
|
+
uiOptions
|
|
100
|
+
);
|
|
101
|
+
const {
|
|
102
|
+
ButtonTemplates: { AddButton: AddButton2 }
|
|
103
|
+
} = registry.templates;
|
|
104
|
+
const legend = (uiOptions.title || title) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
105
|
+
ArrayFieldTitleTemplate2,
|
|
106
|
+
{
|
|
107
|
+
idSchema,
|
|
108
|
+
required,
|
|
109
|
+
title: uiOptions.title || title,
|
|
110
|
+
schema,
|
|
111
|
+
uiSchema,
|
|
112
|
+
registry
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Fieldset, { legend, className, id: idSchema.$id, children: [
|
|
116
|
+
(uiOptions.description || schema.description) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
117
|
+
ArrayFieldDescriptionTemplate,
|
|
118
|
+
{
|
|
119
|
+
description: uiOptions.description || schema.description,
|
|
120
|
+
idSchema,
|
|
121
|
+
schema,
|
|
122
|
+
uiSchema,
|
|
123
|
+
registry
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.Box, { className: "row rjsf-array-item-list", children: items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ArrayFieldItemTemplate2, { ...itemProps }, key)) }),
|
|
127
|
+
canAdd && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.Group, { justify: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
128
|
+
AddButton2,
|
|
129
|
+
{
|
|
130
|
+
id: (0, import_utils2.buttonId)(idSchema, "add"),
|
|
131
|
+
className: "rjsf-array-item-add",
|
|
132
|
+
disabled: disabled || readonly,
|
|
133
|
+
onClick: onAddClick,
|
|
134
|
+
uiSchema,
|
|
135
|
+
registry,
|
|
136
|
+
iconType: "md"
|
|
137
|
+
}
|
|
138
|
+
) })
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// src/templates/ArrayFieldTitleTemplate.tsx
|
|
143
|
+
var import_utils3 = require("@rjsf/utils");
|
|
144
|
+
var import_core3 = require("@mantine/core");
|
|
145
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
146
|
+
function ArrayFieldTitleTemplate(props) {
|
|
147
|
+
const { idSchema, title, uiSchema, registry } = props;
|
|
148
|
+
const options = (0, import_utils3.getUiOptions)(uiSchema, registry.globalUiOptions);
|
|
149
|
+
const { label: displayLabel = true } = options;
|
|
150
|
+
if (!title || !displayLabel) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Title, { id: (0, import_utils3.titleId)(idSchema), order: 4, fw: "normal", children: title });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/templates/BaseInputTemplate.tsx
|
|
157
|
+
var import_react = require("react");
|
|
158
|
+
var import_utils4 = require("@rjsf/utils");
|
|
159
|
+
var import_core4 = require("@mantine/core");
|
|
160
|
+
|
|
161
|
+
// src/utils.ts
|
|
162
|
+
var uiOptionsKeys = [
|
|
163
|
+
"emptyValue",
|
|
164
|
+
"classNames",
|
|
165
|
+
"title",
|
|
166
|
+
"help",
|
|
167
|
+
"autocomplete",
|
|
168
|
+
"disabled",
|
|
169
|
+
"enumDisabled",
|
|
170
|
+
"hideError",
|
|
171
|
+
"readonly",
|
|
172
|
+
"order",
|
|
173
|
+
"filePreview",
|
|
174
|
+
"inline",
|
|
175
|
+
"inputType",
|
|
176
|
+
"submitButtonOptions",
|
|
177
|
+
"widget",
|
|
178
|
+
"enumNames",
|
|
179
|
+
"addable",
|
|
180
|
+
"copyable",
|
|
181
|
+
"orderable",
|
|
182
|
+
"removable",
|
|
183
|
+
"duplicateKeySuffixSeparator",
|
|
184
|
+
"enumOptions",
|
|
185
|
+
"enableMarkdownInDescription"
|
|
186
|
+
];
|
|
187
|
+
function cleanupOptions(options) {
|
|
188
|
+
const result = {};
|
|
189
|
+
for (const key in options) {
|
|
190
|
+
if (!uiOptionsKeys.includes(key)) {
|
|
191
|
+
result[key] = options[key];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/templates/BaseInputTemplate.tsx
|
|
198
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
199
|
+
function BaseInputTemplate(props) {
|
|
200
|
+
const {
|
|
201
|
+
id,
|
|
202
|
+
type,
|
|
203
|
+
schema,
|
|
204
|
+
value,
|
|
205
|
+
placeholder,
|
|
206
|
+
required,
|
|
207
|
+
disabled,
|
|
208
|
+
readonly,
|
|
209
|
+
autofocus,
|
|
210
|
+
label,
|
|
211
|
+
hideLabel,
|
|
212
|
+
onChange,
|
|
213
|
+
onChangeOverride,
|
|
214
|
+
onBlur,
|
|
215
|
+
onFocus,
|
|
216
|
+
options,
|
|
217
|
+
rawErrors,
|
|
218
|
+
children
|
|
219
|
+
} = props;
|
|
220
|
+
const inputProps = (0, import_utils4.getInputProps)(schema, type, options, false);
|
|
221
|
+
const themeProps = cleanupOptions(options);
|
|
222
|
+
const handleNumberChange = (0, import_react.useCallback)((value2) => onChange(value2), [onChange]);
|
|
223
|
+
const handleChange = (0, import_react.useCallback)(
|
|
224
|
+
(e) => {
|
|
225
|
+
const handler = onChangeOverride ? onChangeOverride : onChange;
|
|
226
|
+
const value2 = e.target.value === "" ? options.emptyValue ?? "" : e.target.value;
|
|
227
|
+
handler(value2);
|
|
228
|
+
},
|
|
229
|
+
[onChange, onChangeOverride, options]
|
|
230
|
+
);
|
|
231
|
+
const handleBlur = (0, import_react.useCallback)(
|
|
232
|
+
(e) => {
|
|
233
|
+
onBlur(id, e.target && e.target.value);
|
|
234
|
+
},
|
|
235
|
+
[onBlur, id]
|
|
236
|
+
);
|
|
237
|
+
const handleFocus = (0, import_react.useCallback)(
|
|
238
|
+
(e) => {
|
|
239
|
+
onFocus(id, e.target && e.target.value);
|
|
240
|
+
},
|
|
241
|
+
[onFocus, id]
|
|
242
|
+
);
|
|
243
|
+
const input = inputProps.type === "number" || inputProps.type === "integer" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
244
|
+
import_core4.NumberInput,
|
|
245
|
+
{
|
|
246
|
+
id,
|
|
247
|
+
name: id,
|
|
248
|
+
label: (0, import_utils4.labelValue)(label || void 0, hideLabel, false),
|
|
249
|
+
required,
|
|
250
|
+
autoFocus: autofocus,
|
|
251
|
+
disabled: disabled || readonly,
|
|
252
|
+
onBlur: !readonly ? handleBlur : void 0,
|
|
253
|
+
onChange: !readonly ? handleNumberChange : void 0,
|
|
254
|
+
onFocus: !readonly ? handleFocus : void 0,
|
|
255
|
+
placeholder,
|
|
256
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
257
|
+
list: schema.examples ? (0, import_utils4.examplesId)(id) : void 0,
|
|
258
|
+
...inputProps,
|
|
259
|
+
...themeProps,
|
|
260
|
+
step: typeof inputProps.step === "number" ? inputProps.step : 1,
|
|
261
|
+
type: "text",
|
|
262
|
+
value,
|
|
263
|
+
"aria-describedby": (0, import_utils4.ariaDescribedByIds)(id, !!schema.examples)
|
|
264
|
+
}
|
|
265
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
266
|
+
import_core4.TextInput,
|
|
267
|
+
{
|
|
268
|
+
id,
|
|
269
|
+
name: id,
|
|
270
|
+
label: (0, import_utils4.labelValue)(label || void 0, hideLabel, false),
|
|
271
|
+
required,
|
|
272
|
+
autoFocus: autofocus,
|
|
273
|
+
disabled: disabled || readonly,
|
|
274
|
+
onBlur: !readonly ? handleBlur : void 0,
|
|
275
|
+
onChange: !readonly ? handleChange : void 0,
|
|
276
|
+
onFocus: !readonly ? handleFocus : void 0,
|
|
277
|
+
placeholder,
|
|
278
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
279
|
+
list: schema.examples ? (0, import_utils4.examplesId)(id) : void 0,
|
|
280
|
+
...inputProps,
|
|
281
|
+
...themeProps,
|
|
282
|
+
value,
|
|
283
|
+
"aria-describedby": (0, import_utils4.ariaDescribedByIds)(id, !!schema.examples)
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
287
|
+
input,
|
|
288
|
+
children,
|
|
289
|
+
Array.isArray(schema.examples) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("datalist", { id: (0, import_utils4.examplesId)(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
|
|
290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: example }, example);
|
|
291
|
+
}) })
|
|
292
|
+
] });
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/templates/DescriptionField.tsx
|
|
296
|
+
var import_core5 = require("@rjsf/core");
|
|
297
|
+
var import_core6 = require("@mantine/core");
|
|
298
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
299
|
+
function DescriptionField(props) {
|
|
300
|
+
const { id, description, registry, uiSchema } = props;
|
|
301
|
+
if (description) {
|
|
302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core6.Text, { id, mt: 3, mb: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core5.RichDescription, { description, registry, uiSchema }) });
|
|
303
|
+
}
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// src/templates/ErrorList.tsx
|
|
308
|
+
var import_utils6 = require("@rjsf/utils");
|
|
309
|
+
var import_core7 = require("@mantine/core");
|
|
310
|
+
|
|
311
|
+
// src/templates/icons.tsx
|
|
312
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
313
|
+
function Plus({ size, style, ...others }) {
|
|
314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
315
|
+
"svg",
|
|
316
|
+
{
|
|
317
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
318
|
+
width: "24",
|
|
319
|
+
height: "24",
|
|
320
|
+
viewBox: "0 0 24 24",
|
|
321
|
+
fill: "none",
|
|
322
|
+
stroke: "currentColor",
|
|
323
|
+
strokeWidth: "2",
|
|
324
|
+
strokeLinecap: "round",
|
|
325
|
+
strokeLinejoin: "round",
|
|
326
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-plus",
|
|
327
|
+
style: { width: size, height: size, ...style },
|
|
328
|
+
...others,
|
|
329
|
+
children: [
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 5l0 14" }),
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M5 12l14 0" })
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
function Copy({ size, style, ...others }) {
|
|
338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
339
|
+
"svg",
|
|
340
|
+
{
|
|
341
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
342
|
+
width: "24",
|
|
343
|
+
height: "24",
|
|
344
|
+
viewBox: "0 0 24 24",
|
|
345
|
+
fill: "none",
|
|
346
|
+
stroke: "currentColor",
|
|
347
|
+
strokeWidth: "2",
|
|
348
|
+
strokeLinecap: "round",
|
|
349
|
+
strokeLinejoin: "round",
|
|
350
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-copy",
|
|
351
|
+
style: { width: size, height: size, ...style },
|
|
352
|
+
...others,
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" }),
|
|
356
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" })
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
function ChevronDown({ size, style, ...others }) {
|
|
362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
363
|
+
"svg",
|
|
364
|
+
{
|
|
365
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
366
|
+
width: "24",
|
|
367
|
+
height: "24",
|
|
368
|
+
viewBox: "0 0 24 24",
|
|
369
|
+
fill: "none",
|
|
370
|
+
stroke: "currentColor",
|
|
371
|
+
strokeWidth: "2",
|
|
372
|
+
strokeLinecap: "round",
|
|
373
|
+
strokeLinejoin: "round",
|
|
374
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down",
|
|
375
|
+
style: { width: size, height: size, ...style },
|
|
376
|
+
...others,
|
|
377
|
+
children: [
|
|
378
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M6 9l6 6l6 -6" })
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
function ChevronUp({ size, style, ...others }) {
|
|
385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
386
|
+
"svg",
|
|
387
|
+
{
|
|
388
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
389
|
+
width: "24",
|
|
390
|
+
height: "24",
|
|
391
|
+
viewBox: "0 0 24 24",
|
|
392
|
+
fill: "none",
|
|
393
|
+
stroke: "currentColor",
|
|
394
|
+
strokeWidth: "2",
|
|
395
|
+
strokeLinecap: "round",
|
|
396
|
+
strokeLinejoin: "round",
|
|
397
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-up",
|
|
398
|
+
style: { width: size, height: size, ...style },
|
|
399
|
+
...others,
|
|
400
|
+
children: [
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
402
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M6 15l6 -6l6 6" })
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
function X({ size, style, ...others }) {
|
|
408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
409
|
+
"svg",
|
|
410
|
+
{
|
|
411
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
412
|
+
width: "24",
|
|
413
|
+
height: "24",
|
|
414
|
+
viewBox: "0 0 24 24",
|
|
415
|
+
fill: "none",
|
|
416
|
+
stroke: "currentColor",
|
|
417
|
+
strokeWidth: "2",
|
|
418
|
+
strokeLinecap: "round",
|
|
419
|
+
strokeLinejoin: "round",
|
|
420
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-x",
|
|
421
|
+
style: { width: size, height: size, ...style },
|
|
422
|
+
...others,
|
|
423
|
+
children: [
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M18 6l-12 12" }),
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M6 6l12 12" })
|
|
427
|
+
]
|
|
428
|
+
}
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
function ExclamationCircle({ size, style, ...others }) {
|
|
432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
433
|
+
"svg",
|
|
434
|
+
{
|
|
435
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
436
|
+
width: "24",
|
|
437
|
+
height: "24",
|
|
438
|
+
viewBox: "0 0 24 24",
|
|
439
|
+
fill: "none",
|
|
440
|
+
stroke: "currentColor",
|
|
441
|
+
strokeWidth: "2",
|
|
442
|
+
strokeLinecap: "round",
|
|
443
|
+
strokeLinejoin: "round",
|
|
444
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-exclamation-circle",
|
|
445
|
+
style: { width: size, height: size, ...style },
|
|
446
|
+
...others,
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 9v4" }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 16v.01" })
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// src/templates/ErrorList.tsx
|
|
457
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
458
|
+
function ErrorList({
|
|
459
|
+
errors,
|
|
460
|
+
registry
|
|
461
|
+
}) {
|
|
462
|
+
const { translateString } = registry;
|
|
463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
464
|
+
import_core7.Alert,
|
|
465
|
+
{
|
|
466
|
+
color: "red",
|
|
467
|
+
variant: "transparent",
|
|
468
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.Title, { order: 5, fw: "normal", children: translateString(import_utils6.TranslatableString.ErrorsLabel) }),
|
|
469
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ExclamationCircle, {}),
|
|
470
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.List, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core7.List.Item, { c: "red", children: error.stack }, `error-${index}`)) })
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// src/templates/ButtonTemplates/SubmitButton.tsx
|
|
476
|
+
var import_core8 = require("@mantine/core");
|
|
477
|
+
var import_utils7 = require("@rjsf/utils");
|
|
478
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
479
|
+
function SubmitButton({ uiSchema }) {
|
|
480
|
+
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils7.getSubmitButtonOptions)(uiSchema);
|
|
481
|
+
if (norender) {
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core8.Button, { type: "submit", variant: "filled", ...submitButtonProps, children: submitText });
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// src/templates/ButtonTemplates/AddButton.tsx
|
|
488
|
+
var import_utils9 = require("@rjsf/utils");
|
|
489
|
+
|
|
490
|
+
// src/templates/ButtonTemplates/IconButton.tsx
|
|
491
|
+
var import_core9 = require("@mantine/core");
|
|
492
|
+
var import_utils8 = require("@rjsf/utils");
|
|
493
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
494
|
+
function IconButton(props) {
|
|
495
|
+
const { icon, iconType = "sm", color, onClick, uiSchema, registry, ...otherProps } = props;
|
|
496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
497
|
+
import_core9.ActionIcon,
|
|
498
|
+
{
|
|
499
|
+
size: iconType,
|
|
500
|
+
color,
|
|
501
|
+
onClick,
|
|
502
|
+
...otherProps,
|
|
503
|
+
children: icon
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
function CopyButton(props) {
|
|
508
|
+
const {
|
|
509
|
+
registry: { translateString }
|
|
510
|
+
} = props;
|
|
511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { title: translateString(import_utils8.TranslatableString.CopyButton), variant: "subtle", ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, {}) });
|
|
512
|
+
}
|
|
513
|
+
function MoveDownButton(props) {
|
|
514
|
+
const {
|
|
515
|
+
registry: { translateString }
|
|
516
|
+
} = props;
|
|
517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
518
|
+
IconButton,
|
|
519
|
+
{
|
|
520
|
+
title: translateString(import_utils8.TranslatableString.MoveDownButton),
|
|
521
|
+
variant: "subtle",
|
|
522
|
+
...props,
|
|
523
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronDown, {})
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
function MoveUpButton(props) {
|
|
528
|
+
const {
|
|
529
|
+
registry: { translateString }
|
|
530
|
+
} = props;
|
|
531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
532
|
+
IconButton,
|
|
533
|
+
{
|
|
534
|
+
title: translateString(import_utils8.TranslatableString.MoveUpButton),
|
|
535
|
+
variant: "subtle",
|
|
536
|
+
...props,
|
|
537
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronUp, {})
|
|
538
|
+
}
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
function RemoveButton(props) {
|
|
542
|
+
const {
|
|
543
|
+
registry: { translateString }
|
|
544
|
+
} = props;
|
|
545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
546
|
+
IconButton,
|
|
547
|
+
{
|
|
548
|
+
title: translateString(import_utils8.TranslatableString.RemoveButton),
|
|
549
|
+
variant: "subtle",
|
|
550
|
+
color: "red",
|
|
551
|
+
...props,
|
|
552
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(X, {})
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// src/templates/ButtonTemplates/AddButton.tsx
|
|
558
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
559
|
+
function AddButton(props) {
|
|
560
|
+
const {
|
|
561
|
+
registry: { translateString }
|
|
562
|
+
} = props;
|
|
563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconButton, { title: translateString(import_utils9.TranslatableString.AddItemButton), variant: "subtle", ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Plus, {}) });
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// src/templates/ButtonTemplates/index.ts
|
|
567
|
+
function buttonTemplates() {
|
|
568
|
+
return {
|
|
569
|
+
SubmitButton,
|
|
570
|
+
AddButton,
|
|
571
|
+
CopyButton,
|
|
572
|
+
MoveDownButton,
|
|
573
|
+
MoveUpButton,
|
|
574
|
+
RemoveButton
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
var ButtonTemplates_default = buttonTemplates;
|
|
578
|
+
|
|
579
|
+
// src/templates/FieldErrorTemplate.tsx
|
|
580
|
+
var import_utils10 = require("@rjsf/utils");
|
|
581
|
+
var import_core10 = require("@mantine/core");
|
|
582
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
583
|
+
function FieldErrorTemplate({ errors, idSchema }) {
|
|
584
|
+
if (!errors || !errors.length) {
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
const id = (0, import_utils10.errorId)(idSchema);
|
|
588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core10.Box, { id, c: "red", display: "none", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core10.List, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core10.List.Item, { children: error }, `field-error-${index}`)) }) });
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// src/templates/FieldTemplate.tsx
|
|
592
|
+
var import_core11 = require("@mantine/core");
|
|
593
|
+
var import_utils11 = require("@rjsf/utils");
|
|
594
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
595
|
+
function FieldTemplate(props) {
|
|
596
|
+
const {
|
|
597
|
+
id,
|
|
598
|
+
classNames,
|
|
599
|
+
style,
|
|
600
|
+
label,
|
|
601
|
+
errors,
|
|
602
|
+
help,
|
|
603
|
+
displayLabel,
|
|
604
|
+
description,
|
|
605
|
+
rawDescription,
|
|
606
|
+
hidden,
|
|
607
|
+
schema,
|
|
608
|
+
uiSchema,
|
|
609
|
+
registry,
|
|
610
|
+
children,
|
|
611
|
+
...otherProps
|
|
612
|
+
} = props;
|
|
613
|
+
const uiOptions = (0, import_utils11.getUiOptions)(uiSchema);
|
|
614
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils11.getTemplate)(
|
|
615
|
+
"WrapIfAdditionalTemplate",
|
|
616
|
+
registry,
|
|
617
|
+
uiOptions
|
|
618
|
+
);
|
|
619
|
+
if (hidden) {
|
|
620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_core11.Box, { display: "none", children });
|
|
621
|
+
}
|
|
622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
623
|
+
WrapIfAdditionalTemplate2,
|
|
624
|
+
{
|
|
625
|
+
id,
|
|
626
|
+
classNames,
|
|
627
|
+
style,
|
|
628
|
+
label,
|
|
629
|
+
schema,
|
|
630
|
+
uiSchema,
|
|
631
|
+
registry,
|
|
632
|
+
...otherProps,
|
|
633
|
+
children: [
|
|
634
|
+
children,
|
|
635
|
+
errors,
|
|
636
|
+
help
|
|
637
|
+
]
|
|
638
|
+
}
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// src/templates/FieldHelpTemplate.tsx
|
|
643
|
+
var import_utils12 = require("@rjsf/utils");
|
|
644
|
+
var import_core12 = require("@mantine/core");
|
|
645
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
646
|
+
function FieldHelpTemplate(props) {
|
|
647
|
+
const { idSchema, help } = props;
|
|
648
|
+
const id = (0, import_utils12.helpId)(idSchema);
|
|
649
|
+
return !help ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core12.Text, { id, size: "sm", my: "xs", c: "dimmed", children: help });
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// src/templates/GridTemplate.tsx
|
|
653
|
+
var import_core13 = require("@mantine/core");
|
|
654
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
655
|
+
function GridTemplate(props) {
|
|
656
|
+
const { children, column, fluid = true, ...rest } = props;
|
|
657
|
+
if (column) {
|
|
658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core13.Grid.Col, { ...rest, children });
|
|
659
|
+
}
|
|
660
|
+
if (fluid) {
|
|
661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core13.Container, { p: "4", mx: 0, w: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core13.Grid, { ...rest, children }) });
|
|
662
|
+
}
|
|
663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core13.Grid, { grow: true, ...rest, children });
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// src/templates/ObjectFieldTemplate.tsx
|
|
667
|
+
var import_core14 = require("@mantine/core");
|
|
668
|
+
var import_utils13 = require("@rjsf/utils");
|
|
669
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
670
|
+
function ObjectFieldTemplate(props) {
|
|
671
|
+
const {
|
|
672
|
+
title,
|
|
673
|
+
description,
|
|
674
|
+
disabled,
|
|
675
|
+
properties,
|
|
676
|
+
onAddClick,
|
|
677
|
+
readonly,
|
|
678
|
+
required,
|
|
679
|
+
schema,
|
|
680
|
+
uiSchema,
|
|
681
|
+
idSchema,
|
|
682
|
+
formData,
|
|
683
|
+
registry
|
|
684
|
+
} = props;
|
|
685
|
+
const uiOptions = (0, import_utils13.getUiOptions)(uiSchema);
|
|
686
|
+
const TitleFieldTemplate = (0, import_utils13.getTemplate)("TitleFieldTemplate", registry, uiOptions);
|
|
687
|
+
const DescriptionFieldTemplate = (0, import_utils13.getTemplate)(
|
|
688
|
+
"DescriptionFieldTemplate",
|
|
689
|
+
registry,
|
|
690
|
+
uiOptions
|
|
691
|
+
);
|
|
692
|
+
const {
|
|
693
|
+
ButtonTemplates: { AddButton: AddButton2 }
|
|
694
|
+
} = registry.templates;
|
|
695
|
+
const gridCols = typeof uiOptions?.gridCols === "number" && uiOptions?.gridCols || void 0;
|
|
696
|
+
const gridSpacing = uiOptions?.gridSpacing;
|
|
697
|
+
const gridVerticalSpacing = uiOptions?.gridVerticalSpacing;
|
|
698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_core14.Container, { id: idSchema.$id, p: 0, children: [
|
|
699
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
700
|
+
TitleFieldTemplate,
|
|
701
|
+
{
|
|
702
|
+
id: (0, import_utils13.titleId)(idSchema),
|
|
703
|
+
title,
|
|
704
|
+
required,
|
|
705
|
+
schema,
|
|
706
|
+
uiSchema,
|
|
707
|
+
registry
|
|
708
|
+
}
|
|
709
|
+
),
|
|
710
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
711
|
+
DescriptionFieldTemplate,
|
|
712
|
+
{
|
|
713
|
+
id: (0, import_utils13.descriptionId)(idSchema),
|
|
714
|
+
description,
|
|
715
|
+
schema,
|
|
716
|
+
uiSchema,
|
|
717
|
+
registry
|
|
718
|
+
}
|
|
719
|
+
),
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
721
|
+
import_core14.SimpleGrid,
|
|
722
|
+
{
|
|
723
|
+
cols: gridCols,
|
|
724
|
+
spacing: gridSpacing,
|
|
725
|
+
verticalSpacing: gridVerticalSpacing,
|
|
726
|
+
mb: "sm",
|
|
727
|
+
children: properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_core14.Box, { children: element.content }, element.name))
|
|
728
|
+
}
|
|
729
|
+
),
|
|
730
|
+
(0, import_utils13.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_core14.Group, { mt: "xs", justify: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
731
|
+
AddButton2,
|
|
732
|
+
{
|
|
733
|
+
id: (0, import_utils13.buttonId)(idSchema, "add"),
|
|
734
|
+
disabled: disabled || readonly,
|
|
735
|
+
onClick: onAddClick(schema),
|
|
736
|
+
className: "rjsf-object-property-expand",
|
|
737
|
+
uiSchema,
|
|
738
|
+
registry
|
|
739
|
+
}
|
|
740
|
+
) })
|
|
741
|
+
] });
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// src/templates/TitleField.tsx
|
|
745
|
+
var import_core15 = require("@mantine/core");
|
|
746
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
747
|
+
function TitleField(props) {
|
|
748
|
+
const { id, title } = props;
|
|
749
|
+
return title ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_core15.Title, { id, order: 3, fw: "normal", children: title }) : null;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// src/templates/WrapIfAdditionalTemplate.tsx
|
|
753
|
+
var import_react2 = require("react");
|
|
754
|
+
var import_utils14 = require("@rjsf/utils");
|
|
755
|
+
var import_core16 = require("@mantine/core");
|
|
756
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
757
|
+
function WrapIfAdditionalTemplate(props) {
|
|
758
|
+
const {
|
|
759
|
+
id,
|
|
760
|
+
classNames,
|
|
761
|
+
style,
|
|
762
|
+
label,
|
|
763
|
+
required,
|
|
764
|
+
readonly,
|
|
765
|
+
disabled,
|
|
766
|
+
schema,
|
|
767
|
+
uiSchema,
|
|
768
|
+
onKeyChange,
|
|
769
|
+
onDropPropertyClick,
|
|
770
|
+
registry,
|
|
771
|
+
children
|
|
772
|
+
} = props;
|
|
773
|
+
const { templates, translateString } = registry;
|
|
774
|
+
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
775
|
+
const keyLabel = translateString(import_utils14.TranslatableString.KeyLabel, [label]);
|
|
776
|
+
const additional = import_utils14.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
777
|
+
const handleBlur = (0, import_react2.useCallback)(
|
|
778
|
+
({ target }) => onKeyChange(target && target.value),
|
|
779
|
+
[onKeyChange]
|
|
780
|
+
);
|
|
781
|
+
if (!additional) {
|
|
782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classNames, style, children });
|
|
783
|
+
}
|
|
784
|
+
const uiOptions = uiSchema ? uiSchema[import_utils14.UI_OPTIONS_KEY] : {};
|
|
785
|
+
const buttonUiOptions = {
|
|
786
|
+
...uiSchema,
|
|
787
|
+
[import_utils14.UI_OPTIONS_KEY]: { ...uiOptions, block: true }
|
|
788
|
+
};
|
|
789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_core16.Flex, { gap: "xs", align: "end", justify: "center", children: [
|
|
790
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_core16.Grid, { w: "100%", align: "center", children: [
|
|
791
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core16.Grid.Col, { span: 6, className: "form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
792
|
+
import_core16.TextInput,
|
|
793
|
+
{
|
|
794
|
+
className: "form-group",
|
|
795
|
+
label: keyLabel,
|
|
796
|
+
defaultValue: label,
|
|
797
|
+
required,
|
|
798
|
+
disabled: disabled || readonly,
|
|
799
|
+
id: `${id}-key`,
|
|
800
|
+
name: `${id}-key`,
|
|
801
|
+
onBlur: !readonly ? handleBlur : void 0
|
|
802
|
+
}
|
|
803
|
+
) }) }),
|
|
804
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core16.Grid.Col, { span: 6, className: "form-additional", children })
|
|
805
|
+
] }),
|
|
806
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
807
|
+
RemoveButton2,
|
|
808
|
+
{
|
|
809
|
+
id: (0, import_utils14.buttonId)(id, "remove"),
|
|
810
|
+
iconType: "sm",
|
|
811
|
+
className: "rjsf-array-item-remove",
|
|
812
|
+
disabled: disabled || readonly,
|
|
813
|
+
onClick: onDropPropertyClick(label),
|
|
814
|
+
uiSchema: buttonUiOptions,
|
|
815
|
+
registry
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
] }) });
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// src/templates/MultiSchemaFieldTemplate.tsx
|
|
822
|
+
var import_core17 = require("@mantine/core");
|
|
823
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
824
|
+
function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
|
|
825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_core17.Stack, { style: { marginBottom: "1rem" }, children: [
|
|
826
|
+
selector,
|
|
827
|
+
optionSchemaField
|
|
828
|
+
] });
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// src/templates/index.ts
|
|
832
|
+
function generateTemplates() {
|
|
833
|
+
return {
|
|
834
|
+
ArrayFieldItemTemplate,
|
|
835
|
+
ArrayFieldTemplate,
|
|
836
|
+
ArrayFieldTitleTemplate,
|
|
837
|
+
BaseInputTemplate,
|
|
838
|
+
ButtonTemplates: ButtonTemplates_default(),
|
|
839
|
+
DescriptionFieldTemplate: DescriptionField,
|
|
840
|
+
ErrorListTemplate: ErrorList,
|
|
841
|
+
FieldErrorTemplate,
|
|
842
|
+
FieldTemplate,
|
|
843
|
+
FieldHelpTemplate,
|
|
844
|
+
GridTemplate,
|
|
845
|
+
ObjectFieldTemplate,
|
|
846
|
+
TitleFieldTemplate: TitleField,
|
|
847
|
+
WrapIfAdditionalTemplate,
|
|
848
|
+
MultiSchemaFieldTemplate
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
var templates_default = generateTemplates();
|
|
852
|
+
|
|
853
|
+
// src/widgets/index.ts
|
|
854
|
+
var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
855
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"), 1);
|
|
856
|
+
|
|
857
|
+
// src/widgets/DateTime/AltDateWidget.tsx
|
|
858
|
+
var import_react3 = require("react");
|
|
859
|
+
var import_utils15 = require("@rjsf/utils");
|
|
860
|
+
var import_core18 = require("@mantine/core");
|
|
861
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
862
|
+
function readyForChange(state) {
|
|
863
|
+
return Object.values(state).every((value) => value !== -1);
|
|
864
|
+
}
|
|
865
|
+
function AltDateWidget(props) {
|
|
866
|
+
const {
|
|
867
|
+
id,
|
|
868
|
+
value,
|
|
869
|
+
required,
|
|
870
|
+
disabled,
|
|
871
|
+
readonly,
|
|
872
|
+
label,
|
|
873
|
+
hideLabel,
|
|
874
|
+
rawErrors,
|
|
875
|
+
options,
|
|
876
|
+
onChange,
|
|
877
|
+
showTime = false,
|
|
878
|
+
registry
|
|
879
|
+
} = props;
|
|
880
|
+
const { translateString } = registry;
|
|
881
|
+
const [state, setState] = (0, import_react3.useState)((0, import_utils15.parseDateString)(value, showTime));
|
|
882
|
+
(0, import_react3.useEffect)(() => {
|
|
883
|
+
setState((0, import_utils15.parseDateString)(value, showTime));
|
|
884
|
+
}, [showTime, value]);
|
|
885
|
+
const handleChange = (0, import_react3.useCallback)(
|
|
886
|
+
(property, nextValue) => {
|
|
887
|
+
const nextState = {
|
|
888
|
+
...state,
|
|
889
|
+
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
890
|
+
};
|
|
891
|
+
if (readyForChange(nextState)) {
|
|
892
|
+
onChange((0, import_utils15.toDateString)(nextState, showTime));
|
|
893
|
+
} else {
|
|
894
|
+
setState(nextState);
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
[state, onChange, showTime]
|
|
898
|
+
);
|
|
899
|
+
const handleSetNow = (0, import_react3.useCallback)(() => {
|
|
900
|
+
if (!disabled && !readonly) {
|
|
901
|
+
const nextState = (0, import_utils15.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
902
|
+
onChange((0, import_utils15.toDateString)(nextState, showTime));
|
|
903
|
+
}
|
|
904
|
+
}, [disabled, readonly, showTime, onChange]);
|
|
905
|
+
const handleClear = (0, import_react3.useCallback)(() => {
|
|
906
|
+
if (!disabled && !readonly) {
|
|
907
|
+
onChange("");
|
|
908
|
+
}
|
|
909
|
+
}, [disabled, readonly, onChange]);
|
|
910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
911
|
+
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core18.Input.Label, { id: (0, import_utils15.titleId)(id), required, children: label }),
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_core18.Flex, { gap: "xs", align: "center", wrap: "nowrap", children: [
|
|
913
|
+
(0, import_utils15.getDateElementProps)(
|
|
914
|
+
state,
|
|
915
|
+
showTime,
|
|
916
|
+
options.yearsRange,
|
|
917
|
+
options.format
|
|
918
|
+
).map((elemProps, i) => {
|
|
919
|
+
const elemId = id + "_" + elemProps.type;
|
|
920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core18.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
921
|
+
import_core18.Select,
|
|
922
|
+
{
|
|
923
|
+
id: elemId,
|
|
924
|
+
name: elemId,
|
|
925
|
+
placeholder: elemProps.type,
|
|
926
|
+
disabled: disabled || readonly,
|
|
927
|
+
data: (0, import_utils15.dateRangeOptions)(elemProps.range[0], elemProps.range[1]).map((item) => item.value.toString()),
|
|
928
|
+
value: !elemProps.value || elemProps.value < 0 ? null : elemProps.value.toString(),
|
|
929
|
+
onChange: (v) => handleChange(elemProps.type, v),
|
|
930
|
+
searchable: false,
|
|
931
|
+
allowDeselect: false,
|
|
932
|
+
comboboxProps: { withinPortal: false },
|
|
933
|
+
"aria-describedby": (0, import_utils15.ariaDescribedByIds)(elemId)
|
|
934
|
+
}
|
|
935
|
+
) }, i);
|
|
936
|
+
}),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_core18.Group, { wrap: "nowrap", gap: 3, children: [
|
|
938
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core18.Button, { variant: "subtle", size: "xs", onClick: handleSetNow, children: translateString(import_utils15.TranslatableString.NowLabel) }),
|
|
939
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core18.Button, { variant: "subtle", size: "xs", onClick: handleClear, children: translateString(import_utils15.TranslatableString.ClearLabel) })
|
|
940
|
+
] })
|
|
941
|
+
] }),
|
|
942
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core18.Input.Error, { children: error }, `alt-date-widget-input-errors-${index}`))
|
|
943
|
+
] });
|
|
944
|
+
}
|
|
945
|
+
AltDateWidget.defaultProps = {
|
|
946
|
+
showTime: false
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
// src/widgets/DateTime/AltDateTimeWidget.tsx
|
|
950
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
951
|
+
function AltDateTimeWidget(props) {
|
|
952
|
+
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltDateWidget2, { showTime: true, ...props });
|
|
954
|
+
}
|
|
955
|
+
AltDateTimeWidget.defaultProps = {
|
|
956
|
+
...AltDateWidget?.defaultProps,
|
|
957
|
+
showTime: true
|
|
958
|
+
};
|
|
959
|
+
|
|
960
|
+
// src/widgets/DateTime/DateTimeInput.tsx
|
|
961
|
+
var import_react4 = require("react");
|
|
962
|
+
var import_utils16 = require("@rjsf/utils");
|
|
963
|
+
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
964
|
+
var import_dates = require("@mantine/dates");
|
|
965
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
966
|
+
var dateParser = (input, format) => {
|
|
967
|
+
if (!input) {
|
|
968
|
+
return null;
|
|
969
|
+
}
|
|
970
|
+
const d = (0, import_dayjs.default)(input, format);
|
|
971
|
+
return d.isValid() ? d.toDate() : null;
|
|
972
|
+
};
|
|
973
|
+
var dateFormat = (date, format) => {
|
|
974
|
+
if (!date) {
|
|
975
|
+
return "";
|
|
976
|
+
}
|
|
977
|
+
return (0, import_dayjs.default)(date).format(format || "YYYY-MM-DD");
|
|
978
|
+
};
|
|
979
|
+
function DateTimeInput(props) {
|
|
980
|
+
const {
|
|
981
|
+
id,
|
|
982
|
+
name,
|
|
983
|
+
value,
|
|
984
|
+
placeholder,
|
|
985
|
+
required,
|
|
986
|
+
disabled,
|
|
987
|
+
readonly,
|
|
988
|
+
autofocus,
|
|
989
|
+
label,
|
|
990
|
+
hideLabel,
|
|
991
|
+
rawErrors,
|
|
992
|
+
options,
|
|
993
|
+
onChange,
|
|
994
|
+
onBlur,
|
|
995
|
+
onFocus,
|
|
996
|
+
valueFormat,
|
|
997
|
+
displayFormat
|
|
998
|
+
} = props;
|
|
999
|
+
const handleChange = (0, import_react4.useCallback)(
|
|
1000
|
+
(nextValue) => {
|
|
1001
|
+
onChange(dateFormat(nextValue, valueFormat));
|
|
1002
|
+
},
|
|
1003
|
+
[onChange, valueFormat]
|
|
1004
|
+
);
|
|
1005
|
+
const handleBlur = (0, import_react4.useCallback)(() => {
|
|
1006
|
+
if (onBlur) {
|
|
1007
|
+
onBlur(id, value);
|
|
1008
|
+
}
|
|
1009
|
+
}, [onBlur, id, value]);
|
|
1010
|
+
const handleFocus = (0, import_react4.useCallback)(() => {
|
|
1011
|
+
if (onFocus) {
|
|
1012
|
+
onFocus(id, value);
|
|
1013
|
+
}
|
|
1014
|
+
}, [onFocus, id, value]);
|
|
1015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1016
|
+
import_dates.DateInput,
|
|
1017
|
+
{
|
|
1018
|
+
id,
|
|
1019
|
+
name,
|
|
1020
|
+
value: dateParser(value, valueFormat),
|
|
1021
|
+
dateParser: (v) => dateParser(v, displayFormat),
|
|
1022
|
+
placeholder: placeholder || void 0,
|
|
1023
|
+
required,
|
|
1024
|
+
disabled: disabled || readonly,
|
|
1025
|
+
autoFocus: autofocus,
|
|
1026
|
+
label: (0, import_utils16.labelValue)(label || void 0, hideLabel, false),
|
|
1027
|
+
onChange: handleChange,
|
|
1028
|
+
onBlur: handleBlur,
|
|
1029
|
+
onFocus: handleFocus,
|
|
1030
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1031
|
+
...options,
|
|
1032
|
+
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id),
|
|
1033
|
+
popoverProps: { withinPortal: false },
|
|
1034
|
+
classNames: typeof options?.classNames === "object" ? options.classNames : void 0,
|
|
1035
|
+
valueFormat: displayFormat
|
|
1036
|
+
}
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
// src/widgets/DateTime/DateWidget.tsx
|
|
1041
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1042
|
+
function DateWidget(props) {
|
|
1043
|
+
const { valueFormat = "YYYY-MM-DD", displayFormat, ...otherOptions } = props.options;
|
|
1044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1045
|
+
DateTimeInput,
|
|
1046
|
+
{
|
|
1047
|
+
...props,
|
|
1048
|
+
options: otherOptions,
|
|
1049
|
+
valueFormat,
|
|
1050
|
+
displayFormat: displayFormat || valueFormat
|
|
1051
|
+
}
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// src/widgets/DateTime/DateTimeWidget.tsx
|
|
1056
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1057
|
+
function DateTimeWidget(props) {
|
|
1058
|
+
const { valueFormat = "YYYY-MM-DD HH:mm:ss", displayFormat, ...otherOptions } = props.options;
|
|
1059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1060
|
+
DateTimeInput,
|
|
1061
|
+
{
|
|
1062
|
+
...props,
|
|
1063
|
+
options: otherOptions,
|
|
1064
|
+
valueFormat,
|
|
1065
|
+
displayFormat: displayFormat || valueFormat
|
|
1066
|
+
}
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
// src/widgets/DateTime/TimeWidget.tsx
|
|
1071
|
+
var import_react5 = require("react");
|
|
1072
|
+
var import_utils17 = require("@rjsf/utils");
|
|
1073
|
+
var import_dates2 = require("@mantine/dates");
|
|
1074
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1075
|
+
function TimeWidget(props) {
|
|
1076
|
+
const {
|
|
1077
|
+
id,
|
|
1078
|
+
name,
|
|
1079
|
+
value,
|
|
1080
|
+
placeholder,
|
|
1081
|
+
required,
|
|
1082
|
+
disabled,
|
|
1083
|
+
readonly,
|
|
1084
|
+
autofocus,
|
|
1085
|
+
label,
|
|
1086
|
+
hideLabel,
|
|
1087
|
+
rawErrors,
|
|
1088
|
+
options,
|
|
1089
|
+
onChange,
|
|
1090
|
+
onBlur,
|
|
1091
|
+
onFocus
|
|
1092
|
+
} = props;
|
|
1093
|
+
const emptyValue = options.emptyValue || "";
|
|
1094
|
+
const handleChange = (0, import_react5.useCallback)(
|
|
1095
|
+
(e) => {
|
|
1096
|
+
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1097
|
+
},
|
|
1098
|
+
[onChange, emptyValue]
|
|
1099
|
+
);
|
|
1100
|
+
const handleBlur = (0, import_react5.useCallback)(
|
|
1101
|
+
({ target }) => {
|
|
1102
|
+
if (onBlur) {
|
|
1103
|
+
onBlur(id, target && target.value);
|
|
1104
|
+
}
|
|
1105
|
+
},
|
|
1106
|
+
[onBlur, id]
|
|
1107
|
+
);
|
|
1108
|
+
const handleFocus = (0, import_react5.useCallback)(
|
|
1109
|
+
({ target }) => {
|
|
1110
|
+
if (onFocus) {
|
|
1111
|
+
onFocus(id, target && target.value);
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
[onFocus, id]
|
|
1115
|
+
);
|
|
1116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1117
|
+
import_dates2.TimeInput,
|
|
1118
|
+
{
|
|
1119
|
+
id,
|
|
1120
|
+
name,
|
|
1121
|
+
value: value || "",
|
|
1122
|
+
placeholder: placeholder || void 0,
|
|
1123
|
+
required,
|
|
1124
|
+
disabled: disabled || readonly,
|
|
1125
|
+
autoFocus: autofocus,
|
|
1126
|
+
label: (0, import_utils17.labelValue)(label || void 0, hideLabel, false),
|
|
1127
|
+
onChange: handleChange,
|
|
1128
|
+
onBlur: handleBlur,
|
|
1129
|
+
onFocus: handleFocus,
|
|
1130
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1131
|
+
...options,
|
|
1132
|
+
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id),
|
|
1133
|
+
classNames: typeof options?.classNames === "object" ? options.classNames : void 0
|
|
1134
|
+
}
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
// src/widgets/CheckboxesWidget.tsx
|
|
1139
|
+
var import_react6 = require("react");
|
|
1140
|
+
var import_utils18 = require("@rjsf/utils");
|
|
1141
|
+
var import_core19 = require("@mantine/core");
|
|
1142
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1143
|
+
function CheckboxesWidget(props) {
|
|
1144
|
+
const {
|
|
1145
|
+
id,
|
|
1146
|
+
value,
|
|
1147
|
+
required,
|
|
1148
|
+
disabled,
|
|
1149
|
+
readonly,
|
|
1150
|
+
autofocus,
|
|
1151
|
+
label,
|
|
1152
|
+
hideLabel,
|
|
1153
|
+
rawErrors,
|
|
1154
|
+
options,
|
|
1155
|
+
onChange,
|
|
1156
|
+
onBlur,
|
|
1157
|
+
onFocus
|
|
1158
|
+
} = props;
|
|
1159
|
+
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1160
|
+
const themeProps = cleanupOptions(options);
|
|
1161
|
+
const handleChange = (0, import_react6.useCallback)(
|
|
1162
|
+
(nextValue) => {
|
|
1163
|
+
if (!disabled && !readonly && onChange) {
|
|
1164
|
+
onChange((0, import_utils18.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1168
|
+
);
|
|
1169
|
+
const handleBlur = (0, import_react6.useCallback)(
|
|
1170
|
+
({ target }) => {
|
|
1171
|
+
if (onBlur) {
|
|
1172
|
+
onBlur(id, (0, import_utils18.enumOptionsValueForIndex)(target.value, enumOptions, emptyValue));
|
|
1173
|
+
}
|
|
1174
|
+
},
|
|
1175
|
+
[onBlur, id, enumOptions, emptyValue]
|
|
1176
|
+
);
|
|
1177
|
+
const handleFocus = (0, import_react6.useCallback)(
|
|
1178
|
+
({ target }) => {
|
|
1179
|
+
if (onFocus) {
|
|
1180
|
+
onFocus(id, (0, import_utils18.enumOptionsValueForIndex)(target.value, enumOptions, emptyValue));
|
|
1181
|
+
}
|
|
1182
|
+
},
|
|
1183
|
+
[onFocus, id, enumOptions, emptyValue]
|
|
1184
|
+
);
|
|
1185
|
+
const selectedIndexes = (0, import_utils18.enumOptionsIndexForValue)(value, enumOptions, true);
|
|
1186
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1187
|
+
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_core19.Input.Label, { id: (0, import_utils18.titleId)(id), required, children: label }),
|
|
1188
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1189
|
+
import_core19.Checkbox.Group,
|
|
1190
|
+
{
|
|
1191
|
+
id,
|
|
1192
|
+
value: selectedIndexes,
|
|
1193
|
+
onChange: handleChange,
|
|
1194
|
+
required,
|
|
1195
|
+
readOnly: disabled || readonly,
|
|
1196
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1197
|
+
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id),
|
|
1198
|
+
...themeProps,
|
|
1199
|
+
children: Array.isArray(enumOptions) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_core19.Flex, { mt: "xs", direction: inline ? "row" : "column", gap: "xs", wrap: "wrap", children: enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1200
|
+
import_core19.Checkbox,
|
|
1201
|
+
{
|
|
1202
|
+
id: (0, import_utils18.optionId)(id, i),
|
|
1203
|
+
name: id,
|
|
1204
|
+
value: String(i),
|
|
1205
|
+
label: option.label,
|
|
1206
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
1207
|
+
autoFocus: i === 0 && autofocus,
|
|
1208
|
+
onBlur: handleBlur,
|
|
1209
|
+
onFocus: handleFocus
|
|
1210
|
+
},
|
|
1211
|
+
i
|
|
1212
|
+
)) }) : null
|
|
1213
|
+
}
|
|
1214
|
+
)
|
|
1215
|
+
] }) : null;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
// src/widgets/CheckboxWidget.tsx
|
|
1219
|
+
var import_react7 = require("react");
|
|
1220
|
+
var import_utils20 = require("@rjsf/utils");
|
|
1221
|
+
var import_core20 = require("@mantine/core");
|
|
1222
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1223
|
+
function CheckboxWidget(props) {
|
|
1224
|
+
const {
|
|
1225
|
+
id,
|
|
1226
|
+
name,
|
|
1227
|
+
value = false,
|
|
1228
|
+
required,
|
|
1229
|
+
disabled,
|
|
1230
|
+
readonly,
|
|
1231
|
+
autofocus,
|
|
1232
|
+
label,
|
|
1233
|
+
hideLabel,
|
|
1234
|
+
schema,
|
|
1235
|
+
rawErrors,
|
|
1236
|
+
options,
|
|
1237
|
+
onChange,
|
|
1238
|
+
onBlur,
|
|
1239
|
+
onFocus,
|
|
1240
|
+
registry,
|
|
1241
|
+
uiSchema
|
|
1242
|
+
} = props;
|
|
1243
|
+
const themeProps = cleanupOptions(options);
|
|
1244
|
+
const DescriptionFieldTemplate = (0, import_utils20.getTemplate)(
|
|
1245
|
+
"DescriptionFieldTemplate",
|
|
1246
|
+
registry,
|
|
1247
|
+
options
|
|
1248
|
+
);
|
|
1249
|
+
const handleCheckboxChange = (0, import_react7.useCallback)(
|
|
1250
|
+
(e) => {
|
|
1251
|
+
if (!disabled && !readonly && onChange) {
|
|
1252
|
+
onChange(e.currentTarget.checked);
|
|
1253
|
+
}
|
|
1254
|
+
},
|
|
1255
|
+
[onChange, disabled, readonly]
|
|
1256
|
+
);
|
|
1257
|
+
const handleBlur = (0, import_react7.useCallback)(
|
|
1258
|
+
({ target }) => {
|
|
1259
|
+
if (onBlur) {
|
|
1260
|
+
onBlur(id, target.checked);
|
|
1261
|
+
}
|
|
1262
|
+
},
|
|
1263
|
+
[onBlur, id]
|
|
1264
|
+
);
|
|
1265
|
+
const handleFocus = (0, import_react7.useCallback)(
|
|
1266
|
+
({ target }) => {
|
|
1267
|
+
if (onFocus) {
|
|
1268
|
+
onFocus(id, target.checked);
|
|
1269
|
+
}
|
|
1270
|
+
},
|
|
1271
|
+
[onFocus, id]
|
|
1272
|
+
);
|
|
1273
|
+
const description = options.description || schema.description;
|
|
1274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1275
|
+
!hideLabel && !!description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1276
|
+
DescriptionFieldTemplate,
|
|
1277
|
+
{
|
|
1278
|
+
id: (0, import_utils20.descriptionId)(id),
|
|
1279
|
+
description,
|
|
1280
|
+
schema,
|
|
1281
|
+
uiSchema,
|
|
1282
|
+
registry
|
|
1283
|
+
}
|
|
1284
|
+
),
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1286
|
+
import_core20.Checkbox,
|
|
1287
|
+
{
|
|
1288
|
+
id,
|
|
1289
|
+
name,
|
|
1290
|
+
label: (0, import_utils20.labelValue)(label || void 0, hideLabel, false),
|
|
1291
|
+
disabled: disabled || readonly,
|
|
1292
|
+
required,
|
|
1293
|
+
autoFocus: autofocus,
|
|
1294
|
+
checked: typeof value === "undefined" ? false : value === "true" || value,
|
|
1295
|
+
onChange: handleCheckboxChange,
|
|
1296
|
+
onBlur: handleBlur,
|
|
1297
|
+
onFocus: handleFocus,
|
|
1298
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1299
|
+
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(id),
|
|
1300
|
+
...themeProps
|
|
1301
|
+
}
|
|
1302
|
+
)
|
|
1303
|
+
] });
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
// src/widgets/ColorWidget.tsx
|
|
1307
|
+
var import_react8 = require("react");
|
|
1308
|
+
var import_utils22 = require("@rjsf/utils");
|
|
1309
|
+
var import_core21 = require("@mantine/core");
|
|
1310
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1311
|
+
function ColorWidget(props) {
|
|
1312
|
+
const {
|
|
1313
|
+
id,
|
|
1314
|
+
name,
|
|
1315
|
+
value,
|
|
1316
|
+
placeholder,
|
|
1317
|
+
required,
|
|
1318
|
+
disabled,
|
|
1319
|
+
readonly,
|
|
1320
|
+
autofocus,
|
|
1321
|
+
label,
|
|
1322
|
+
hideLabel,
|
|
1323
|
+
rawErrors,
|
|
1324
|
+
options,
|
|
1325
|
+
onChange,
|
|
1326
|
+
onBlur,
|
|
1327
|
+
onFocus
|
|
1328
|
+
} = props;
|
|
1329
|
+
const themeProps = cleanupOptions(options);
|
|
1330
|
+
const handleChange = (0, import_react8.useCallback)(
|
|
1331
|
+
(nextValue) => {
|
|
1332
|
+
onChange(nextValue);
|
|
1333
|
+
},
|
|
1334
|
+
[onChange]
|
|
1335
|
+
);
|
|
1336
|
+
const handleBlur = (0, import_react8.useCallback)(
|
|
1337
|
+
({ target }) => {
|
|
1338
|
+
if (onBlur) {
|
|
1339
|
+
onBlur(id, target && target.value);
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
[onBlur, id]
|
|
1343
|
+
);
|
|
1344
|
+
const handleFocus = (0, import_react8.useCallback)(
|
|
1345
|
+
({ target }) => {
|
|
1346
|
+
if (onFocus) {
|
|
1347
|
+
onFocus(id, target && target.value);
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
[onFocus, id]
|
|
1351
|
+
);
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1353
|
+
import_core21.ColorInput,
|
|
1354
|
+
{
|
|
1355
|
+
id,
|
|
1356
|
+
name,
|
|
1357
|
+
value: value || "",
|
|
1358
|
+
placeholder: placeholder || void 0,
|
|
1359
|
+
required,
|
|
1360
|
+
disabled: disabled || readonly,
|
|
1361
|
+
autoFocus: autofocus,
|
|
1362
|
+
label: (0, import_utils22.labelValue)(label || void 0, hideLabel, false),
|
|
1363
|
+
onChange: handleChange,
|
|
1364
|
+
onBlur: handleBlur,
|
|
1365
|
+
onFocus: handleFocus,
|
|
1366
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1367
|
+
...themeProps,
|
|
1368
|
+
"aria-describedby": (0, import_utils22.ariaDescribedByIds)(id),
|
|
1369
|
+
popoverProps: { withinPortal: false }
|
|
1370
|
+
}
|
|
1371
|
+
);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
// src/widgets/FileWidget.tsx
|
|
1375
|
+
var import_react9 = require("react");
|
|
1376
|
+
var import_utils24 = require("@rjsf/utils");
|
|
1377
|
+
var import_core22 = require("@mantine/core");
|
|
1378
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1379
|
+
function addNameToDataURL(dataURL, name) {
|
|
1380
|
+
if (dataURL === null) {
|
|
1381
|
+
return null;
|
|
1382
|
+
}
|
|
1383
|
+
return dataURL.replace(";base64", `;name=${encodeURIComponent(name)};base64`);
|
|
1384
|
+
}
|
|
1385
|
+
function processFile(file) {
|
|
1386
|
+
const { name, size, type } = file;
|
|
1387
|
+
return new Promise((resolve, reject) => {
|
|
1388
|
+
const reader = new window.FileReader();
|
|
1389
|
+
reader.onerror = reject;
|
|
1390
|
+
reader.onload = (event) => {
|
|
1391
|
+
if (typeof event.target?.result === "string") {
|
|
1392
|
+
resolve({
|
|
1393
|
+
dataURL: addNameToDataURL(event.target.result, name),
|
|
1394
|
+
name,
|
|
1395
|
+
size,
|
|
1396
|
+
type
|
|
1397
|
+
});
|
|
1398
|
+
} else {
|
|
1399
|
+
resolve({
|
|
1400
|
+
dataURL: null,
|
|
1401
|
+
name,
|
|
1402
|
+
size,
|
|
1403
|
+
type
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
reader.readAsDataURL(file);
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
function processFiles(files) {
|
|
1411
|
+
return Promise.all(Array.from(files).map(processFile));
|
|
1412
|
+
}
|
|
1413
|
+
function extractFileInfo(dataURLs) {
|
|
1414
|
+
return dataURLs.reduce((acc, dataURL) => {
|
|
1415
|
+
if (!dataURL) {
|
|
1416
|
+
return acc;
|
|
1417
|
+
}
|
|
1418
|
+
try {
|
|
1419
|
+
const { blob, name } = (0, import_utils24.dataURItoBlob)(dataURL);
|
|
1420
|
+
return [
|
|
1421
|
+
...acc,
|
|
1422
|
+
{
|
|
1423
|
+
dataURL,
|
|
1424
|
+
name,
|
|
1425
|
+
size: blob.size,
|
|
1426
|
+
type: blob.type
|
|
1427
|
+
}
|
|
1428
|
+
];
|
|
1429
|
+
} catch (e) {
|
|
1430
|
+
console.log(e);
|
|
1431
|
+
return acc;
|
|
1432
|
+
}
|
|
1433
|
+
}, []);
|
|
1434
|
+
}
|
|
1435
|
+
function FileWidget(props) {
|
|
1436
|
+
const {
|
|
1437
|
+
id,
|
|
1438
|
+
name,
|
|
1439
|
+
value,
|
|
1440
|
+
placeholder,
|
|
1441
|
+
required,
|
|
1442
|
+
disabled,
|
|
1443
|
+
readonly,
|
|
1444
|
+
autofocus,
|
|
1445
|
+
label,
|
|
1446
|
+
hideLabel,
|
|
1447
|
+
rawErrors,
|
|
1448
|
+
options,
|
|
1449
|
+
multiple,
|
|
1450
|
+
onChange
|
|
1451
|
+
} = props;
|
|
1452
|
+
const themeProps = cleanupOptions(options);
|
|
1453
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
1454
|
+
(files) => {
|
|
1455
|
+
if (typeof files === "object") {
|
|
1456
|
+
processFiles(multiple ? files : [files]).then((filesInfoEvent) => {
|
|
1457
|
+
const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL);
|
|
1458
|
+
if (multiple) {
|
|
1459
|
+
onChange(value.concat(newValue));
|
|
1460
|
+
} else {
|
|
1461
|
+
onChange(newValue[0]);
|
|
1462
|
+
}
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
return;
|
|
1466
|
+
},
|
|
1467
|
+
[multiple, value, onChange]
|
|
1468
|
+
);
|
|
1469
|
+
const handleRemoveFile = (0, import_react9.useCallback)(
|
|
1470
|
+
(index) => {
|
|
1471
|
+
if (multiple) {
|
|
1472
|
+
const newValue = value.filter((_, i) => i !== index);
|
|
1473
|
+
onChange(newValue);
|
|
1474
|
+
} else {
|
|
1475
|
+
onChange(void 0);
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
[multiple, value, onChange]
|
|
1479
|
+
);
|
|
1480
|
+
const ValueComponent = (0, import_react9.useCallback)(
|
|
1481
|
+
(props2) => {
|
|
1482
|
+
const filesInfo = props2.value ? extractFileInfo(Array.isArray(props2.value) ? props2.value : [props2.value]) : null;
|
|
1483
|
+
if (Array.isArray(filesInfo) && filesInfo.length > 0) {
|
|
1484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_core22.Pill.Group, { children: filesInfo.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_core22.Pill, { withRemoveButton: true, onRemove: () => handleRemoveFile(index), children: file.name }, index)) });
|
|
1485
|
+
}
|
|
1486
|
+
return null;
|
|
1487
|
+
},
|
|
1488
|
+
[handleRemoveFile]
|
|
1489
|
+
);
|
|
1490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1491
|
+
import_core22.FileInput,
|
|
1492
|
+
{
|
|
1493
|
+
id,
|
|
1494
|
+
name,
|
|
1495
|
+
value: value || "",
|
|
1496
|
+
placeholder: placeholder || void 0,
|
|
1497
|
+
required,
|
|
1498
|
+
disabled: disabled || readonly,
|
|
1499
|
+
autoFocus: autofocus,
|
|
1500
|
+
label: (0, import_utils24.labelValue)(label || void 0, hideLabel, false),
|
|
1501
|
+
multiple: !!multiple,
|
|
1502
|
+
valueComponent: ValueComponent,
|
|
1503
|
+
onChange: handleChange,
|
|
1504
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1505
|
+
...themeProps,
|
|
1506
|
+
"aria-describedby": (0, import_utils24.ariaDescribedByIds)(id)
|
|
1507
|
+
}
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
// src/widgets/PasswordWidget.tsx
|
|
1512
|
+
var import_react10 = require("react");
|
|
1513
|
+
var import_utils26 = require("@rjsf/utils");
|
|
1514
|
+
var import_core23 = require("@mantine/core");
|
|
1515
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1516
|
+
function PasswordWidget(props) {
|
|
1517
|
+
const {
|
|
1518
|
+
id,
|
|
1519
|
+
name,
|
|
1520
|
+
value,
|
|
1521
|
+
placeholder,
|
|
1522
|
+
required,
|
|
1523
|
+
disabled,
|
|
1524
|
+
readonly,
|
|
1525
|
+
autofocus,
|
|
1526
|
+
label,
|
|
1527
|
+
hideLabel,
|
|
1528
|
+
rawErrors,
|
|
1529
|
+
options,
|
|
1530
|
+
onChange,
|
|
1531
|
+
onBlur,
|
|
1532
|
+
onFocus
|
|
1533
|
+
} = props;
|
|
1534
|
+
const emptyValue = options.emptyValue || "";
|
|
1535
|
+
const themeProps = cleanupOptions(options);
|
|
1536
|
+
const handleChange = (0, import_react10.useCallback)(
|
|
1537
|
+
(e) => {
|
|
1538
|
+
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1539
|
+
},
|
|
1540
|
+
[onChange, emptyValue]
|
|
1541
|
+
);
|
|
1542
|
+
const handleBlur = (0, import_react10.useCallback)(
|
|
1543
|
+
({ target }) => {
|
|
1544
|
+
if (onBlur) {
|
|
1545
|
+
onBlur(id, target && target.value);
|
|
1546
|
+
}
|
|
1547
|
+
},
|
|
1548
|
+
[onBlur, id]
|
|
1549
|
+
);
|
|
1550
|
+
const handleFocus = (0, import_react10.useCallback)(
|
|
1551
|
+
({ target }) => {
|
|
1552
|
+
if (onFocus) {
|
|
1553
|
+
onFocus(id, target && target.value);
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
[onFocus, id]
|
|
1557
|
+
);
|
|
1558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1559
|
+
import_core23.PasswordInput,
|
|
1560
|
+
{
|
|
1561
|
+
id,
|
|
1562
|
+
name,
|
|
1563
|
+
value: value || "",
|
|
1564
|
+
placeholder: placeholder || void 0,
|
|
1565
|
+
required,
|
|
1566
|
+
disabled: disabled || readonly,
|
|
1567
|
+
autoFocus: autofocus,
|
|
1568
|
+
label: (0, import_utils26.labelValue)(label || void 0, hideLabel, false),
|
|
1569
|
+
onChange: handleChange,
|
|
1570
|
+
onBlur: handleBlur,
|
|
1571
|
+
onFocus: handleFocus,
|
|
1572
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1573
|
+
...themeProps,
|
|
1574
|
+
"aria-describedby": (0, import_utils26.ariaDescribedByIds)(id)
|
|
1575
|
+
}
|
|
1576
|
+
);
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
// src/widgets/RadioWidget.tsx
|
|
1580
|
+
var import_react11 = require("react");
|
|
1581
|
+
var import_utils28 = require("@rjsf/utils");
|
|
1582
|
+
var import_core24 = require("@mantine/core");
|
|
1583
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1584
|
+
function RadioWidget(props) {
|
|
1585
|
+
const {
|
|
1586
|
+
id,
|
|
1587
|
+
value,
|
|
1588
|
+
required,
|
|
1589
|
+
disabled,
|
|
1590
|
+
readonly,
|
|
1591
|
+
autofocus,
|
|
1592
|
+
label,
|
|
1593
|
+
hideLabel,
|
|
1594
|
+
rawErrors,
|
|
1595
|
+
options,
|
|
1596
|
+
onChange,
|
|
1597
|
+
onBlur,
|
|
1598
|
+
onFocus
|
|
1599
|
+
} = props;
|
|
1600
|
+
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1601
|
+
const themeProps = cleanupOptions(options);
|
|
1602
|
+
const handleChange = (0, import_react11.useCallback)(
|
|
1603
|
+
(nextValue) => {
|
|
1604
|
+
if (!disabled && !readonly && onChange) {
|
|
1605
|
+
onChange((0, import_utils28.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1609
|
+
);
|
|
1610
|
+
const handleBlur = (0, import_react11.useCallback)(
|
|
1611
|
+
({ target }) => {
|
|
1612
|
+
if (onBlur) {
|
|
1613
|
+
onBlur(id, (0, import_utils28.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
1614
|
+
}
|
|
1615
|
+
},
|
|
1616
|
+
[onBlur, id, enumOptions, emptyValue]
|
|
1617
|
+
);
|
|
1618
|
+
const handleFocus = (0, import_react11.useCallback)(
|
|
1619
|
+
({ target }) => {
|
|
1620
|
+
if (onFocus) {
|
|
1621
|
+
onFocus(id, (0, import_utils28.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
[onFocus, id, enumOptions, emptyValue]
|
|
1625
|
+
);
|
|
1626
|
+
const selected = (0, import_utils28.enumOptionsIndexForValue)(value, enumOptions);
|
|
1627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1628
|
+
import_core24.Radio.Group,
|
|
1629
|
+
{
|
|
1630
|
+
id,
|
|
1631
|
+
name: id,
|
|
1632
|
+
value: selected,
|
|
1633
|
+
label: !hideLabel ? label : void 0,
|
|
1634
|
+
onChange: handleChange,
|
|
1635
|
+
required,
|
|
1636
|
+
readOnly: disabled || readonly,
|
|
1637
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1638
|
+
"aria-describedby": (0, import_utils28.ariaDescribedByIds)(id),
|
|
1639
|
+
...themeProps,
|
|
1640
|
+
children: Array.isArray(enumOptions) ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_core24.Flex, { mt: "xs", direction: inline ? "row" : "column", gap: "xs", wrap: "wrap", children: enumOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1641
|
+
import_core24.Radio,
|
|
1642
|
+
{
|
|
1643
|
+
id: (0, import_utils28.optionId)(id, i),
|
|
1644
|
+
value: String(i),
|
|
1645
|
+
label: option.label,
|
|
1646
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
1647
|
+
autoFocus: i === 0 && autofocus,
|
|
1648
|
+
onBlur: handleBlur,
|
|
1649
|
+
onFocus: handleFocus
|
|
1650
|
+
},
|
|
1651
|
+
i
|
|
1652
|
+
)) }) : null
|
|
1653
|
+
}
|
|
1654
|
+
);
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
// src/widgets/RangeWidget.tsx
|
|
1658
|
+
var import_react12 = require("react");
|
|
1659
|
+
var import_utils30 = require("@rjsf/utils");
|
|
1660
|
+
var import_core25 = require("@mantine/core");
|
|
1661
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1662
|
+
function RangeWidget(props) {
|
|
1663
|
+
const {
|
|
1664
|
+
id,
|
|
1665
|
+
name,
|
|
1666
|
+
value,
|
|
1667
|
+
required,
|
|
1668
|
+
disabled,
|
|
1669
|
+
readonly,
|
|
1670
|
+
autofocus,
|
|
1671
|
+
label,
|
|
1672
|
+
hideLabel,
|
|
1673
|
+
rawErrors,
|
|
1674
|
+
options,
|
|
1675
|
+
onChange,
|
|
1676
|
+
onBlur,
|
|
1677
|
+
onFocus,
|
|
1678
|
+
schema
|
|
1679
|
+
} = props;
|
|
1680
|
+
const themeProps = cleanupOptions(options);
|
|
1681
|
+
const { min, max, step } = (0, import_utils30.rangeSpec)(schema);
|
|
1682
|
+
const handleChange = (0, import_react12.useCallback)(
|
|
1683
|
+
(nextValue) => {
|
|
1684
|
+
if (!disabled && !readonly && onChange) {
|
|
1685
|
+
onChange(nextValue);
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
[onChange, disabled, readonly]
|
|
1689
|
+
);
|
|
1690
|
+
const handleBlur = (0, import_react12.useCallback)(() => {
|
|
1691
|
+
if (onBlur) {
|
|
1692
|
+
onBlur(id, value);
|
|
1693
|
+
}
|
|
1694
|
+
}, [onBlur, id, value]);
|
|
1695
|
+
const handleFocus = (0, import_react12.useCallback)(() => {
|
|
1696
|
+
if (onFocus) {
|
|
1697
|
+
onFocus(id, value);
|
|
1698
|
+
}
|
|
1699
|
+
}, [onFocus, id, value]);
|
|
1700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
1701
|
+
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_core25.Input.Label, { id: (0, import_utils30.titleId)(id), required, children: label }),
|
|
1702
|
+
options?.description && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_core25.Input.Description, { children: options.description }),
|
|
1703
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1704
|
+
import_core25.Slider,
|
|
1705
|
+
{
|
|
1706
|
+
id,
|
|
1707
|
+
name,
|
|
1708
|
+
value,
|
|
1709
|
+
max,
|
|
1710
|
+
min,
|
|
1711
|
+
step,
|
|
1712
|
+
disabled: disabled || readonly,
|
|
1713
|
+
autoFocus: autofocus,
|
|
1714
|
+
onChange: handleChange,
|
|
1715
|
+
onBlur: handleBlur,
|
|
1716
|
+
onFocus: handleFocus,
|
|
1717
|
+
...themeProps,
|
|
1718
|
+
"aria-describedby": (0, import_utils30.ariaDescribedByIds)(id)
|
|
1719
|
+
}
|
|
1720
|
+
),
|
|
1721
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_core25.Input.Error, { children: error }, `range-widget-input-errors-${index}`))
|
|
1722
|
+
] });
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
// src/widgets/SelectWidget.tsx
|
|
1726
|
+
var import_react13 = require("react");
|
|
1727
|
+
var import_utils32 = require("@rjsf/utils");
|
|
1728
|
+
var import_core26 = require("@mantine/core");
|
|
1729
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1730
|
+
function SelectWidget(props) {
|
|
1731
|
+
const {
|
|
1732
|
+
id,
|
|
1733
|
+
value,
|
|
1734
|
+
placeholder,
|
|
1735
|
+
required,
|
|
1736
|
+
disabled,
|
|
1737
|
+
readonly,
|
|
1738
|
+
autofocus,
|
|
1739
|
+
label,
|
|
1740
|
+
hideLabel,
|
|
1741
|
+
multiple,
|
|
1742
|
+
rawErrors,
|
|
1743
|
+
options,
|
|
1744
|
+
onChange,
|
|
1745
|
+
onBlur,
|
|
1746
|
+
onFocus
|
|
1747
|
+
} = props;
|
|
1748
|
+
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1749
|
+
const themeProps = cleanupOptions(options);
|
|
1750
|
+
const handleChange = (0, import_react13.useCallback)(
|
|
1751
|
+
(nextValue) => {
|
|
1752
|
+
if (!disabled && !readonly && onChange) {
|
|
1753
|
+
onChange((0, import_utils32.enumOptionsValueForIndex)(nextValue, enumOptions, emptyValue));
|
|
1754
|
+
}
|
|
1755
|
+
},
|
|
1756
|
+
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1757
|
+
);
|
|
1758
|
+
const handleBlur = (0, import_react13.useCallback)(
|
|
1759
|
+
({ target }) => {
|
|
1760
|
+
if (onBlur) {
|
|
1761
|
+
onBlur(id, (0, import_utils32.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1764
|
+
[onBlur, id, enumOptions, emptyValue]
|
|
1765
|
+
);
|
|
1766
|
+
const handleFocus = (0, import_react13.useCallback)(
|
|
1767
|
+
({ target }) => {
|
|
1768
|
+
if (onFocus) {
|
|
1769
|
+
onFocus(id, (0, import_utils32.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
1770
|
+
}
|
|
1771
|
+
},
|
|
1772
|
+
[onFocus, id, enumOptions, emptyValue]
|
|
1773
|
+
);
|
|
1774
|
+
const selectedIndexes = (0, import_utils32.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
1775
|
+
const selectOptions = (0, import_react13.useMemo)(() => {
|
|
1776
|
+
if (Array.isArray(enumOptions)) {
|
|
1777
|
+
return enumOptions.map((option, index) => ({
|
|
1778
|
+
key: String(index),
|
|
1779
|
+
value: String(index),
|
|
1780
|
+
label: option.label,
|
|
1781
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1
|
|
1782
|
+
}));
|
|
1783
|
+
}
|
|
1784
|
+
return [];
|
|
1785
|
+
}, [enumDisabled, enumOptions]);
|
|
1786
|
+
const Component = multiple ? import_core26.MultiSelect : import_core26.Select;
|
|
1787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1788
|
+
Component,
|
|
1789
|
+
{
|
|
1790
|
+
id,
|
|
1791
|
+
name: id,
|
|
1792
|
+
label: (0, import_utils32.labelValue)(label || void 0, hideLabel, false),
|
|
1793
|
+
data: selectOptions,
|
|
1794
|
+
value: multiple ? selectedIndexes : selectedIndexes,
|
|
1795
|
+
onChange: !readonly ? handleChange : void 0,
|
|
1796
|
+
onBlur: !readonly ? handleBlur : void 0,
|
|
1797
|
+
onFocus: !readonly ? handleFocus : void 0,
|
|
1798
|
+
autoFocus: autofocus,
|
|
1799
|
+
placeholder,
|
|
1800
|
+
disabled: disabled || readonly,
|
|
1801
|
+
required,
|
|
1802
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1803
|
+
searchable: true,
|
|
1804
|
+
...themeProps,
|
|
1805
|
+
"aria-describedby": (0, import_utils32.ariaDescribedByIds)(id),
|
|
1806
|
+
comboboxProps: { withinPortal: false }
|
|
1807
|
+
}
|
|
1808
|
+
);
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// src/widgets/TextareaWidget.tsx
|
|
1812
|
+
var import_react14 = require("react");
|
|
1813
|
+
var import_utils34 = require("@rjsf/utils");
|
|
1814
|
+
var import_core27 = require("@mantine/core");
|
|
1815
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1816
|
+
function TextareaWidget(props) {
|
|
1817
|
+
const {
|
|
1818
|
+
id,
|
|
1819
|
+
name,
|
|
1820
|
+
value,
|
|
1821
|
+
placeholder,
|
|
1822
|
+
required,
|
|
1823
|
+
disabled,
|
|
1824
|
+
readonly,
|
|
1825
|
+
autofocus,
|
|
1826
|
+
label,
|
|
1827
|
+
hideLabel,
|
|
1828
|
+
rawErrors,
|
|
1829
|
+
options,
|
|
1830
|
+
onChange,
|
|
1831
|
+
onBlur,
|
|
1832
|
+
onFocus
|
|
1833
|
+
} = props;
|
|
1834
|
+
const themeProps = cleanupOptions(options);
|
|
1835
|
+
const emptyValue = options?.emptyValue ?? "";
|
|
1836
|
+
const handleChange = (0, import_react14.useCallback)(
|
|
1837
|
+
(e) => {
|
|
1838
|
+
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1839
|
+
},
|
|
1840
|
+
[onChange, emptyValue]
|
|
1841
|
+
);
|
|
1842
|
+
const handleBlur = (0, import_react14.useCallback)(
|
|
1843
|
+
({ target }) => {
|
|
1844
|
+
if (onBlur) {
|
|
1845
|
+
onBlur(id, target && target.value);
|
|
1846
|
+
}
|
|
1847
|
+
},
|
|
1848
|
+
[onBlur, id]
|
|
1849
|
+
);
|
|
1850
|
+
const handleFocus = (0, import_react14.useCallback)(
|
|
1851
|
+
({ target }) => {
|
|
1852
|
+
if (onFocus) {
|
|
1853
|
+
onFocus(id, target && target.value);
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
[onFocus, id]
|
|
1857
|
+
);
|
|
1858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1859
|
+
import_core27.Textarea,
|
|
1860
|
+
{
|
|
1861
|
+
id,
|
|
1862
|
+
name,
|
|
1863
|
+
value: value || "",
|
|
1864
|
+
placeholder: placeholder || void 0,
|
|
1865
|
+
required,
|
|
1866
|
+
disabled: disabled || readonly,
|
|
1867
|
+
autoFocus: autofocus,
|
|
1868
|
+
label: (0, import_utils34.labelValue)(label || void 0, hideLabel, false),
|
|
1869
|
+
onChange: handleChange,
|
|
1870
|
+
onBlur: handleBlur,
|
|
1871
|
+
onFocus: handleFocus,
|
|
1872
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1873
|
+
"aria-describedby": (0, import_utils34.ariaDescribedByIds)(id),
|
|
1874
|
+
...themeProps
|
|
1875
|
+
}
|
|
1876
|
+
);
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
// src/widgets/index.ts
|
|
1880
|
+
import_dayjs2.default.extend(import_customParseFormat.default);
|
|
1881
|
+
function generateWidgets() {
|
|
1882
|
+
return {
|
|
1883
|
+
AltDateTimeWidget,
|
|
1884
|
+
AltDateWidget,
|
|
1885
|
+
CheckboxesWidget,
|
|
1886
|
+
CheckboxWidget,
|
|
1887
|
+
ColorWidget,
|
|
1888
|
+
FileWidget,
|
|
1889
|
+
DateTimeWidget,
|
|
1890
|
+
DateWidget,
|
|
1891
|
+
PasswordWidget,
|
|
1892
|
+
RadioWidget,
|
|
1893
|
+
RangeWidget,
|
|
1894
|
+
SelectWidget,
|
|
1895
|
+
TextareaWidget,
|
|
1896
|
+
TimeWidget
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
var widgets_default = generateWidgets();
|
|
1900
|
+
|
|
1901
|
+
// src/Theme/index.ts
|
|
1902
|
+
function generateTheme() {
|
|
1903
|
+
return {
|
|
1904
|
+
templates: generateTemplates(),
|
|
1905
|
+
widgets: generateWidgets()
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
var Theme_default = generateTheme();
|
|
1909
|
+
|
|
1910
|
+
// src/Form/index.ts
|
|
1911
|
+
function generateForm() {
|
|
1912
|
+
return (0, import_core28.withTheme)(generateTheme());
|
|
1913
|
+
}
|
|
1914
|
+
var Form_default = generateForm();
|
|
1915
|
+
|
|
1916
|
+
// src/index.ts
|
|
1917
|
+
var index_default = Form_default;
|
|
1918
|
+
//# sourceMappingURL=index.js.map
|