@rjsf/semantic-ui 6.6.1 → 6.7.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/LICENSE.md +201 -0
- package/dist/index.cjs +268 -241
- package/dist/index.cjs.map +4 -4
- package/dist/semantic-ui.esm.js +209 -218
- package/dist/semantic-ui.esm.js.map +4 -4
- package/dist/semantic-ui.umd.js +117 -96
- package/lib/AddButton/AddButton.d.ts +3 -3
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +2 -2
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +2 -2
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +2 -2
- package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +2 -2
- package/lib/CheckboxWidget/CheckboxWidget.js +7 -7
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +2 -2
- package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.d.ts +6 -0
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.js +14 -0
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.js.map +1 -0
- package/lib/CyclicSchemaExpandTemplate/index.d.ts +2 -0
- package/lib/CyclicSchemaExpandTemplate/index.js +3 -0
- package/lib/CyclicSchemaExpandTemplate/index.js.map +1 -0
- package/lib/DescriptionField/DescriptionField.d.ts +2 -2
- package/lib/ErrorList/ErrorList.d.ts +2 -2
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +2 -2
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +2 -2
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +2 -2
- package/lib/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +2 -2
- package/lib/IconButton/IconButton.d.ts +15 -8
- package/lib/IconButton/IconButton.js +14 -6
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +2 -2
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +2 -2
- package/lib/RadioWidget/RadioWidget.js +5 -7
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +2 -2
- package/lib/RangeWidget/RangeWidget.js +5 -5
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +2 -2
- package/lib/SelectWidget/SelectWidget.js +8 -8
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SemanticUIForm/SemanticUIForm.d.ts +3 -3
- package/lib/SemanticUIForm/SemanticUIForm.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +2 -2
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/Templates/Templates.js +2 -0
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +2 -2
- package/lib/TextareaWidget/TextareaWidget.js +6 -6
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +2 -2
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +2 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.d.ts +7 -7
- package/lib/util.js +13 -6
- package/lib/util.js.map +1 -1
- package/package.json +25 -23
- package/src/AddButton/AddButton.tsx +5 -3
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -8
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -10
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -20
- package/src/CheckboxWidget/CheckboxWidget.tsx +13 -21
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +11 -14
- package/src/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.tsx +25 -0
- package/src/CyclicSchemaExpandTemplate/index.ts +2 -0
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +3 -1
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +2 -1
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
- package/src/FieldTemplate/FieldTemplate.tsx +2 -8
- package/src/GridTemplate/GridTemplate.tsx +1 -1
- package/src/IconButton/IconButton.tsx +18 -8
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +2 -12
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +13 -16
- package/src/RangeWidget/RangeWidget.tsx +11 -10
- package/src/SelectWidget/SelectWidget.tsx +45 -37
- package/src/SemanticUIForm/SemanticUIForm.ts +4 -3
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +3 -1
- package/src/TextareaWidget/TextareaWidget.tsx +11 -17
- package/src/Theme/Theme.ts +2 -2
- package/src/TitleField/TitleField.tsx +1 -1
- package/src/Widgets/Widgets.tsx +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -13
- package/src/util.tsx +20 -21
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
46
46
|
var import_core4 = require("@rjsf/core");
|
|
47
47
|
|
|
48
48
|
// src/Theme/Theme.ts
|
|
49
|
-
var
|
|
49
|
+
var import_semantic_ui_react21 = require("semantic-ui-react");
|
|
50
50
|
|
|
51
51
|
// src/AddButton/AddButton.tsx
|
|
52
52
|
var import_utils = require("@rjsf/utils");
|
|
@@ -89,14 +89,13 @@ function getSemanticProps({
|
|
|
89
89
|
const formContextProps = formContext.semantic;
|
|
90
90
|
const schemaProps = (0, import_utils2.getUiOptions)(uiSchema).semantic;
|
|
91
91
|
const optionProps = options.semantic;
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
92
|
+
return {
|
|
93
|
+
...defaultSchemaProps,
|
|
94
|
+
...defaultContextProps,
|
|
95
|
+
...schemaProps,
|
|
96
|
+
...optionProps,
|
|
97
|
+
...formContextProps
|
|
98
|
+
};
|
|
100
99
|
}
|
|
101
100
|
function getSemanticErrorProps({
|
|
102
101
|
formContext = {},
|
|
@@ -104,11 +103,11 @@ function getSemanticErrorProps({
|
|
|
104
103
|
options = {},
|
|
105
104
|
defaultProps = { size: "small", pointing: "above" }
|
|
106
105
|
}) {
|
|
107
|
-
const formContextProps = formContext.semantic
|
|
106
|
+
const formContextProps = formContext.semantic?.errorOptions;
|
|
108
107
|
const semanticOptions = (0, import_utils2.getUiOptions)(uiSchema).semantic;
|
|
109
|
-
const schemaProps = semanticOptions
|
|
110
|
-
const optionProps = options.semantic
|
|
111
|
-
return
|
|
108
|
+
const schemaProps = semanticOptions?.errorOptions;
|
|
109
|
+
const optionProps = options.semantic?.errorOptions;
|
|
110
|
+
return { ...defaultProps, ...schemaProps, ...optionProps, ...formContextProps };
|
|
112
111
|
}
|
|
113
112
|
function cleanClassNames(classNameArr, omit = []) {
|
|
114
113
|
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
|
|
@@ -278,10 +277,10 @@ function BaseInputTemplate(props) {
|
|
|
278
277
|
formContext: registry.formContext,
|
|
279
278
|
options
|
|
280
279
|
});
|
|
281
|
-
const
|
|
282
|
-
const
|
|
283
|
-
const
|
|
284
|
-
const
|
|
280
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
281
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
282
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
283
|
+
const handleClear = (0, import_react.useCallback)(
|
|
285
284
|
(e) => {
|
|
286
285
|
e.preventDefault();
|
|
287
286
|
e.stopPropagation();
|
|
@@ -305,49 +304,66 @@ function BaseInputTemplate(props) {
|
|
|
305
304
|
...semanticProps,
|
|
306
305
|
value: value || value === 0 ? value : "",
|
|
307
306
|
error: rawErrors.length > 0,
|
|
308
|
-
onChange: onChangeOverride ||
|
|
309
|
-
onBlur:
|
|
310
|
-
onFocus:
|
|
307
|
+
onChange: onChangeOverride || handleChange,
|
|
308
|
+
onBlur: handleBlur,
|
|
309
|
+
onFocus: handleFocus,
|
|
311
310
|
"aria-describedby": (0, import_utils5.ariaDescribedByIds)(id, !!schema.examples)
|
|
312
311
|
},
|
|
313
312
|
id
|
|
314
313
|
),
|
|
315
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClearButton2, { registry, onClick:
|
|
314
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClearButton2, { registry, onClick: handleClear }),
|
|
316
315
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core.SchemaExamples, { id, schema })
|
|
317
316
|
] });
|
|
318
317
|
}
|
|
319
318
|
|
|
319
|
+
// src/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.tsx
|
|
320
|
+
var import_utils6 = require("@rjsf/utils");
|
|
321
|
+
var import_semantic_ui_react4 = require("semantic-ui-react");
|
|
322
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
323
|
+
function CyclicSchemaExpandTemplate(props) {
|
|
324
|
+
const { name, fieldPathId, registry, onExpand } = props;
|
|
325
|
+
const { translateString } = registry;
|
|
326
|
+
const buttonId4 = `${fieldPathId[import_utils6.ID_KEY]}-button`;
|
|
327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { marginTop: "1rem", marginBottom: "1rem" }, children: [
|
|
328
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { style: { color: "red" }, children: translateString(import_utils6.TranslatableString.CycleDetected, [name]) }),
|
|
329
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_semantic_ui_react4.Button, { id: buttonId4, type: "button", size: "mini", onClick: () => onExpand(fieldPathId[import_utils6.ID_KEY]), children: translateString(import_utils6.TranslatableString.ExpandButton) })
|
|
330
|
+
] });
|
|
331
|
+
}
|
|
332
|
+
|
|
320
333
|
// src/DescriptionField/DescriptionField.tsx
|
|
321
334
|
var import_core2 = require("@rjsf/core");
|
|
322
|
-
var
|
|
335
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
323
336
|
function DescriptionField(props) {
|
|
324
337
|
const { id, description, registry, uiSchema } = props;
|
|
325
338
|
if (!description) {
|
|
326
339
|
return null;
|
|
327
340
|
}
|
|
328
|
-
return /* @__PURE__ */ (0,
|
|
341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id, className: "sui-description", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core2.RichDescription, { description, registry, uiSchema }) });
|
|
329
342
|
}
|
|
330
343
|
|
|
331
344
|
// src/ErrorList/ErrorList.tsx
|
|
332
|
-
var
|
|
333
|
-
var
|
|
334
|
-
var
|
|
345
|
+
var import_utils7 = require("@rjsf/utils");
|
|
346
|
+
var import_semantic_ui_react5 = require("semantic-ui-react");
|
|
347
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
335
348
|
function ErrorList({
|
|
336
349
|
errors,
|
|
337
350
|
registry
|
|
338
351
|
}) {
|
|
339
352
|
const { translateString } = registry;
|
|
340
|
-
return /* @__PURE__ */ (0,
|
|
341
|
-
/* @__PURE__ */ (0,
|
|
342
|
-
/* @__PURE__ */ (0,
|
|
353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_semantic_ui_react5.Message, { negative: true, children: [
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_semantic_ui_react5.Message.Header, { children: translateString(import_utils7.TranslatableString.ErrorsLabel) }),
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_semantic_ui_react5.Message.List, { children: errors.map((error, index) => (
|
|
356
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_semantic_ui_react5.Message.Item, { children: error.stack }, `error-${index}`)
|
|
358
|
+
)) })
|
|
343
359
|
] });
|
|
344
360
|
}
|
|
345
361
|
|
|
346
362
|
// src/FieldErrorTemplate/FieldErrorTemplate.tsx
|
|
347
|
-
var
|
|
363
|
+
var import_utils8 = require("@rjsf/utils");
|
|
348
364
|
var import_uniqueId = __toESM(require("lodash/uniqueId"), 1);
|
|
349
|
-
var
|
|
350
|
-
var
|
|
365
|
+
var import_semantic_ui_react6 = require("semantic-ui-react");
|
|
366
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
351
367
|
var DEFAULT_OPTIONS = {
|
|
352
368
|
options: {
|
|
353
369
|
pointing: "above",
|
|
@@ -363,29 +379,29 @@ function FieldErrorTemplate({ errors, fieldPathId, uiSchema, registry }) {
|
|
|
363
379
|
});
|
|
364
380
|
const { pointing, size } = options;
|
|
365
381
|
if (errors && errors.length > 0) {
|
|
366
|
-
const id = (0,
|
|
367
|
-
return /* @__PURE__ */ (0,
|
|
382
|
+
const id = (0, import_utils8.errorId)(fieldPathId);
|
|
383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_semantic_ui_react6.Label, { id, color: "red", pointing: pointing || "above", size: size || "small", basic: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_semantic_ui_react6.List, { bulleted: true, children: errors.map((error) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_semantic_ui_react6.List.Item, { children: error }, (0, import_uniqueId.default)("field-error-"))) }) });
|
|
368
384
|
}
|
|
369
385
|
return null;
|
|
370
386
|
}
|
|
371
387
|
|
|
372
388
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
373
389
|
var import_core3 = require("@rjsf/core");
|
|
374
|
-
var
|
|
375
|
-
var
|
|
376
|
-
var
|
|
390
|
+
var import_utils9 = require("@rjsf/utils");
|
|
391
|
+
var import_semantic_ui_react7 = require("semantic-ui-react");
|
|
392
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
377
393
|
function FieldHelpTemplate(props) {
|
|
378
394
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
379
395
|
if (help) {
|
|
380
|
-
return /* @__PURE__ */ (0,
|
|
396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_semantic_ui_react7.Message, { size: "mini", info: true, id: (0, import_utils9.helpId)(fieldPathId), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core3.RichHelp, { help, registry, uiSchema }) });
|
|
381
397
|
}
|
|
382
398
|
return null;
|
|
383
399
|
}
|
|
384
400
|
|
|
385
401
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
386
|
-
var
|
|
387
|
-
var
|
|
388
|
-
var
|
|
402
|
+
var import_utils10 = require("@rjsf/utils");
|
|
403
|
+
var import_semantic_ui_react8 = require("semantic-ui-react");
|
|
404
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
389
405
|
function FieldTemplate(props) {
|
|
390
406
|
const {
|
|
391
407
|
id,
|
|
@@ -409,17 +425,17 @@ function FieldTemplate(props) {
|
|
|
409
425
|
formContext: registry.formContext
|
|
410
426
|
});
|
|
411
427
|
const { wrapLabel, wrapContent } = semanticProps;
|
|
412
|
-
const uiOptions = (0,
|
|
413
|
-
const WrapIfAdditionalTemplate2 = (0,
|
|
428
|
+
const uiOptions = (0, import_utils10.getUiOptions)(uiSchema);
|
|
429
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils10.getTemplate)(
|
|
414
430
|
"WrapIfAdditionalTemplate",
|
|
415
431
|
registry,
|
|
416
432
|
uiOptions
|
|
417
433
|
);
|
|
418
434
|
if (hidden) {
|
|
419
|
-
return /* @__PURE__ */ (0,
|
|
435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "none" }, children });
|
|
420
436
|
}
|
|
421
437
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
422
|
-
return /* @__PURE__ */ (0,
|
|
438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
423
439
|
WrapIfAdditionalTemplate2,
|
|
424
440
|
{
|
|
425
441
|
classNames,
|
|
@@ -432,9 +448,9 @@ function FieldTemplate(props) {
|
|
|
432
448
|
schema,
|
|
433
449
|
uiSchema,
|
|
434
450
|
...otherProps,
|
|
435
|
-
children: /* @__PURE__ */ (0,
|
|
451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_semantic_ui_react8.Form.Group, { widths: "equal", grouped: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(MaybeWrap, { wrap: wrapContent, className: "sui-field-content", children: [
|
|
436
452
|
children,
|
|
437
|
-
displayLabel && rawDescription && !isCheckbox && /* @__PURE__ */ (0,
|
|
453
|
+
displayLabel && rawDescription && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MaybeWrap, { wrap: wrapLabel, className: "sui-field-label", children: description }),
|
|
438
454
|
help,
|
|
439
455
|
errors
|
|
440
456
|
] }) }, id)
|
|
@@ -443,24 +459,25 @@ function FieldTemplate(props) {
|
|
|
443
459
|
}
|
|
444
460
|
|
|
445
461
|
// src/GridTemplate/GridTemplate.tsx
|
|
446
|
-
var
|
|
447
|
-
var
|
|
462
|
+
var import_semantic_ui_react9 = require("semantic-ui-react");
|
|
463
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
448
464
|
function GridTemplate(props) {
|
|
449
465
|
const { children, column, ...rest } = props;
|
|
450
466
|
if (column) {
|
|
451
|
-
return /* @__PURE__ */ (0,
|
|
467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_semantic_ui_react9.Grid.Column, { ...rest, children });
|
|
452
468
|
}
|
|
453
|
-
return /* @__PURE__ */ (0,
|
|
469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_semantic_ui_react9.Grid, { ...rest, children });
|
|
454
470
|
}
|
|
455
471
|
|
|
456
472
|
// src/IconButton/IconButton.tsx
|
|
457
|
-
var
|
|
458
|
-
var
|
|
459
|
-
var
|
|
460
|
-
|
|
473
|
+
var import_react2 = require("react");
|
|
474
|
+
var import_utils11 = require("@rjsf/utils");
|
|
475
|
+
var import_semantic_ui_react10 = require("semantic-ui-react");
|
|
476
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
477
|
+
function IconButtonFn(props) {
|
|
461
478
|
const { icon, iconType, color, className, uiSchema, registry, ...otherProps } = props;
|
|
462
|
-
return /* @__PURE__ */ (0,
|
|
463
|
-
|
|
479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
480
|
+
import_semantic_ui_react10.Button,
|
|
464
481
|
{
|
|
465
482
|
icon,
|
|
466
483
|
size: iconType,
|
|
@@ -470,51 +487,57 @@ function IconButton(props) {
|
|
|
470
487
|
}
|
|
471
488
|
);
|
|
472
489
|
}
|
|
473
|
-
|
|
490
|
+
var IconButton = (0, import_react2.memo)(IconButtonFn);
|
|
491
|
+
function CopyButtonFn(props) {
|
|
474
492
|
const {
|
|
475
493
|
registry: { translateString }
|
|
476
494
|
} = props;
|
|
477
|
-
return /* @__PURE__ */ (0,
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils11.TranslatableString.CopyButton), ...props, icon: "copy" });
|
|
478
496
|
}
|
|
479
|
-
|
|
497
|
+
var CopyButton = (0, import_react2.memo)(CopyButtonFn);
|
|
498
|
+
function MoveDownButtonFn(props) {
|
|
480
499
|
const {
|
|
481
500
|
registry: { translateString }
|
|
482
501
|
} = props;
|
|
483
|
-
return /* @__PURE__ */ (0,
|
|
502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils11.TranslatableString.MoveDownButton), ...props, icon: "angle down" });
|
|
484
503
|
}
|
|
485
|
-
|
|
504
|
+
var MoveDownButton = (0, import_react2.memo)(MoveDownButtonFn);
|
|
505
|
+
function MoveUpButtonFn(props) {
|
|
486
506
|
const {
|
|
487
507
|
registry: { translateString }
|
|
488
508
|
} = props;
|
|
489
|
-
return /* @__PURE__ */ (0,
|
|
509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils11.TranslatableString.MoveUpButton), ...props, icon: "angle up" });
|
|
490
510
|
}
|
|
491
|
-
|
|
511
|
+
var MoveUpButton = (0, import_react2.memo)(MoveUpButtonFn);
|
|
512
|
+
function RemoveButtonFn(props) {
|
|
492
513
|
const {
|
|
493
514
|
registry: { translateString }
|
|
494
515
|
} = props;
|
|
495
|
-
return /* @__PURE__ */ (0,
|
|
516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils11.TranslatableString.RemoveButton), ...props, icon: "trash" });
|
|
496
517
|
}
|
|
497
|
-
|
|
518
|
+
var RemoveButton = (0, import_react2.memo)(RemoveButtonFn);
|
|
519
|
+
function ClearButtonFn(props) {
|
|
498
520
|
const {
|
|
499
521
|
registry: { translateString }
|
|
500
522
|
} = props;
|
|
501
|
-
return /* @__PURE__ */ (0,
|
|
523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: translateString(import_utils11.TranslatableString.ClearButton), ...props, icon: "close" });
|
|
502
524
|
}
|
|
525
|
+
var ClearButton = (0, import_react2.memo)(ClearButtonFn);
|
|
503
526
|
|
|
504
527
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
505
|
-
var
|
|
528
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
506
529
|
function MultiSchemaFieldTemplate(props) {
|
|
507
530
|
const { selector, optionSchemaField } = props;
|
|
508
|
-
return /* @__PURE__ */ (0,
|
|
509
|
-
/* @__PURE__ */ (0,
|
|
531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
532
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: selector }),
|
|
510
533
|
optionSchemaField
|
|
511
534
|
] });
|
|
512
535
|
}
|
|
513
536
|
|
|
514
537
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
515
|
-
var
|
|
516
|
-
var
|
|
517
|
-
var
|
|
538
|
+
var import_utils12 = require("@rjsf/utils");
|
|
539
|
+
var import_semantic_ui_react11 = require("semantic-ui-react");
|
|
540
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
518
541
|
function ObjectFieldTemplate(props) {
|
|
519
542
|
const {
|
|
520
543
|
description,
|
|
@@ -531,9 +554,9 @@ function ObjectFieldTemplate(props) {
|
|
|
531
554
|
fieldPathId,
|
|
532
555
|
registry
|
|
533
556
|
} = props;
|
|
534
|
-
const uiOptions = (0,
|
|
535
|
-
const TitleFieldTemplate = (0,
|
|
536
|
-
const DescriptionFieldTemplate = (0,
|
|
557
|
+
const uiOptions = (0, import_utils12.getUiOptions)(uiSchema);
|
|
558
|
+
const TitleFieldTemplate = (0, import_utils12.getTemplate)("TitleFieldTemplate", registry, uiOptions);
|
|
559
|
+
const DescriptionFieldTemplate = (0, import_utils12.getTemplate)(
|
|
537
560
|
"DescriptionFieldTemplate",
|
|
538
561
|
registry,
|
|
539
562
|
uiOptions
|
|
@@ -542,11 +565,11 @@ function ObjectFieldTemplate(props) {
|
|
|
542
565
|
const {
|
|
543
566
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
544
567
|
} = registry.templates;
|
|
545
|
-
return /* @__PURE__ */ (0,
|
|
546
|
-
title && /* @__PURE__ */ (0,
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
569
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
547
570
|
TitleFieldTemplate,
|
|
548
571
|
{
|
|
549
|
-
id: (0,
|
|
572
|
+
id: (0, import_utils12.titleId)(fieldPathId),
|
|
550
573
|
title,
|
|
551
574
|
required,
|
|
552
575
|
schema,
|
|
@@ -555,10 +578,10 @@ function ObjectFieldTemplate(props) {
|
|
|
555
578
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
556
579
|
}
|
|
557
580
|
),
|
|
558
|
-
description && /* @__PURE__ */ (0,
|
|
581
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
559
582
|
DescriptionFieldTemplate,
|
|
560
583
|
{
|
|
561
|
-
id: (0,
|
|
584
|
+
id: (0, import_utils12.descriptionId)(fieldPathId),
|
|
562
585
|
description,
|
|
563
586
|
schema,
|
|
564
587
|
uiSchema,
|
|
@@ -567,7 +590,7 @@ function ObjectFieldTemplate(props) {
|
|
|
567
590
|
),
|
|
568
591
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
569
592
|
properties.map((prop) => prop.content),
|
|
570
|
-
(0,
|
|
593
|
+
(0, import_utils12.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_semantic_ui_react11.Grid.Column, { width: 16, verticalAlign: "middle", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_semantic_ui_react11.Grid.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
571
594
|
"div",
|
|
572
595
|
{
|
|
573
596
|
style: {
|
|
@@ -575,10 +598,10 @@ function ObjectFieldTemplate(props) {
|
|
|
575
598
|
position: "relative",
|
|
576
599
|
textAlign: "right"
|
|
577
600
|
},
|
|
578
|
-
children: /* @__PURE__ */ (0,
|
|
601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
579
602
|
AddButton2,
|
|
580
603
|
{
|
|
581
|
-
id: (0,
|
|
604
|
+
id: (0, import_utils12.buttonId)(fieldPathId, "add"),
|
|
582
605
|
className: "rjsf-object-property-expand",
|
|
583
606
|
onClick: onAddProperty,
|
|
584
607
|
disabled: disabled || readonly,
|
|
@@ -592,11 +615,11 @@ function ObjectFieldTemplate(props) {
|
|
|
592
615
|
}
|
|
593
616
|
|
|
594
617
|
// src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx
|
|
595
|
-
var
|
|
618
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
596
619
|
function OptionalDataControlsTemplate(props) {
|
|
597
620
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
598
621
|
if (onAddClick) {
|
|
599
|
-
return /* @__PURE__ */ (0,
|
|
622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
600
623
|
AddButton,
|
|
601
624
|
{
|
|
602
625
|
id,
|
|
@@ -607,8 +630,9 @@ function OptionalDataControlsTemplate(props) {
|
|
|
607
630
|
size: "mini"
|
|
608
631
|
}
|
|
609
632
|
);
|
|
610
|
-
}
|
|
611
|
-
|
|
633
|
+
}
|
|
634
|
+
if (onRemoveClick) {
|
|
635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
612
636
|
RemoveButton,
|
|
613
637
|
{
|
|
614
638
|
id,
|
|
@@ -620,24 +644,24 @@ function OptionalDataControlsTemplate(props) {
|
|
|
620
644
|
}
|
|
621
645
|
);
|
|
622
646
|
}
|
|
623
|
-
return /* @__PURE__ */ (0,
|
|
647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("em", { id, children: label });
|
|
624
648
|
}
|
|
625
649
|
|
|
626
650
|
// src/SubmitButton/SubmitButton.tsx
|
|
627
|
-
var
|
|
628
|
-
var
|
|
629
|
-
var
|
|
651
|
+
var import_utils13 = require("@rjsf/utils");
|
|
652
|
+
var import_semantic_ui_react12 = require("semantic-ui-react");
|
|
653
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
630
654
|
function SubmitButton({ uiSchema }) {
|
|
631
|
-
const { submitText, norender, props: submitButtonProps = {} } = (0,
|
|
655
|
+
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils13.getSubmitButtonOptions)(uiSchema);
|
|
632
656
|
if (norender) {
|
|
633
657
|
return null;
|
|
634
658
|
}
|
|
635
|
-
return /* @__PURE__ */ (0,
|
|
659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_semantic_ui_react12.Button, { type: "submit", primary: true, ...submitButtonProps, children: submitText });
|
|
636
660
|
}
|
|
637
661
|
|
|
638
662
|
// src/TitleField/TitleField.tsx
|
|
639
|
-
var
|
|
640
|
-
var
|
|
663
|
+
var import_semantic_ui_react13 = require("semantic-ui-react");
|
|
664
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
641
665
|
var DEFAULT_OPTIONS2 = {
|
|
642
666
|
inverted: false,
|
|
643
667
|
dividing: true
|
|
@@ -652,20 +676,20 @@ function TitleField({
|
|
|
652
676
|
uiSchema,
|
|
653
677
|
defaultSchemaProps: DEFAULT_OPTIONS2
|
|
654
678
|
});
|
|
655
|
-
let heading = title ? /* @__PURE__ */ (0,
|
|
679
|
+
let heading = title ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_semantic_ui_react13.Header, { id, ...semanticProps, as: "h5", children: title }) : null;
|
|
656
680
|
if (optionalDataControl) {
|
|
657
|
-
heading = /* @__PURE__ */ (0,
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
659
|
-
/* @__PURE__ */ (0,
|
|
681
|
+
heading = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_semantic_ui_react13.Grid, { colums: 2, relaxed: true, children: [
|
|
682
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_semantic_ui_react13.Grid.Column, { width: 14, style: { paddingRight: 0 }, children: heading }),
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_semantic_ui_react13.Grid.Column, { width: 2, children: optionalDataControl })
|
|
660
684
|
] });
|
|
661
685
|
}
|
|
662
686
|
return heading;
|
|
663
687
|
}
|
|
664
688
|
|
|
665
689
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
666
|
-
var
|
|
667
|
-
var
|
|
668
|
-
var
|
|
690
|
+
var import_utils14 = require("@rjsf/utils");
|
|
691
|
+
var import_semantic_ui_react14 = require("semantic-ui-react");
|
|
692
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
669
693
|
function WrapIfAdditionalTemplate(props) {
|
|
670
694
|
const {
|
|
671
695
|
children,
|
|
@@ -686,38 +710,38 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
686
710
|
} = props;
|
|
687
711
|
const { templates, translateString } = registry;
|
|
688
712
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
689
|
-
const keyLabel = translateString(
|
|
713
|
+
const keyLabel = translateString(import_utils14.TranslatableString.KeyLabel, [label]);
|
|
690
714
|
const { readonlyAsDisabled = true, wrapperStyle } = registry.formContext;
|
|
691
|
-
const additional =
|
|
715
|
+
const additional = import_utils14.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
692
716
|
const margin = rawDescription ? 4 : 24;
|
|
693
717
|
if (!additional) {
|
|
694
|
-
return /* @__PURE__ */ (0,
|
|
718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: classNames, style, children });
|
|
695
719
|
}
|
|
696
|
-
return /* @__PURE__ */ (0,
|
|
697
|
-
/* @__PURE__ */ (0,
|
|
698
|
-
|
|
720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: classNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_semantic_ui_react14.Grid, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_semantic_ui_react14.Grid.Row, { children: [
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_semantic_ui_react14.Grid.Column, { width: 7, className: "form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_semantic_ui_react14.Form.Group, { widths: "equal", grouped: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
722
|
+
import_semantic_ui_react14.Form.Input,
|
|
699
723
|
{
|
|
700
724
|
className: "form-group",
|
|
701
725
|
hasFeedback: true,
|
|
702
726
|
fluid: true,
|
|
703
|
-
htmlFor:
|
|
727
|
+
htmlFor: id,
|
|
704
728
|
label: displayLabel ? keyLabel : void 0,
|
|
705
729
|
required,
|
|
706
730
|
defaultValue: label,
|
|
707
731
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
708
|
-
id
|
|
709
|
-
name:
|
|
732
|
+
id,
|
|
733
|
+
name: id,
|
|
710
734
|
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
711
735
|
style: wrapperStyle,
|
|
712
736
|
type: "text"
|
|
713
737
|
},
|
|
714
738
|
label
|
|
715
739
|
) }) }),
|
|
716
|
-
/* @__PURE__ */ (0,
|
|
717
|
-
/* @__PURE__ */ (0,
|
|
740
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_semantic_ui_react14.Grid.Column, { width: 7, className: "form-additional", verticalAlign: "middle", children }),
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_semantic_ui_react14.Grid.Column, { verticalAlign: "middle", style: displayLabel ? { marginTop: `${margin}px` } : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
718
742
|
RemoveButton2,
|
|
719
743
|
{
|
|
720
|
-
id: (0,
|
|
744
|
+
id: (0, import_utils14.buttonId)(id, "remove"),
|
|
721
745
|
iconType: "mini",
|
|
722
746
|
className: "rjsf-object-property-remove",
|
|
723
747
|
disabled: disabled || readonly,
|
|
@@ -735,6 +759,7 @@ function generateTemplates() {
|
|
|
735
759
|
ArrayFieldItemTemplate,
|
|
736
760
|
ArrayFieldTemplate,
|
|
737
761
|
BaseInputTemplate,
|
|
762
|
+
CyclicSchemaExpandTemplate,
|
|
738
763
|
ButtonTemplates: {
|
|
739
764
|
AddButton,
|
|
740
765
|
CopyButton,
|
|
@@ -760,9 +785,9 @@ function generateTemplates() {
|
|
|
760
785
|
var Templates_default = generateTemplates();
|
|
761
786
|
|
|
762
787
|
// src/CheckboxesWidget/CheckboxesWidget.tsx
|
|
763
|
-
var
|
|
764
|
-
var
|
|
765
|
-
var
|
|
788
|
+
var import_utils15 = require("@rjsf/utils");
|
|
789
|
+
var import_semantic_ui_react15 = require("semantic-ui-react");
|
|
790
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
766
791
|
function CheckboxesWidget(props) {
|
|
767
792
|
const {
|
|
768
793
|
id,
|
|
@@ -782,7 +807,7 @@ function CheckboxesWidget(props) {
|
|
|
782
807
|
rawErrors = [],
|
|
783
808
|
registry
|
|
784
809
|
} = props;
|
|
785
|
-
const TitleFieldTemplate = (0,
|
|
810
|
+
const TitleFieldTemplate = (0, import_utils15.getTemplate)("TitleFieldTemplate", registry, options);
|
|
786
811
|
const { enumOptions, enumDisabled, inline } = options;
|
|
787
812
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
788
813
|
const semanticProps = getSemanticProps({
|
|
@@ -793,25 +818,25 @@ function CheckboxesWidget(props) {
|
|
|
793
818
|
inverted: "false"
|
|
794
819
|
}
|
|
795
820
|
});
|
|
796
|
-
const
|
|
821
|
+
const handleChange = (index) => ({ target: { checked } }) => {
|
|
797
822
|
if (checked) {
|
|
798
|
-
onChange((0,
|
|
823
|
+
onChange((0, import_utils15.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
799
824
|
} else {
|
|
800
|
-
onChange((0,
|
|
825
|
+
onChange((0, import_utils15.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
801
826
|
}
|
|
802
827
|
};
|
|
803
|
-
const
|
|
804
|
-
const
|
|
828
|
+
const handleBlur = () => onBlur(id, value);
|
|
829
|
+
const handleFocus = () => onFocus(id, value);
|
|
805
830
|
const inlineOption = inline ? { inline: true } : { grouped: true };
|
|
806
|
-
return /* @__PURE__ */ (0,
|
|
807
|
-
!hideLabel && !!label && /* @__PURE__ */ (0,
|
|
808
|
-
/* @__PURE__ */ (0,
|
|
809
|
-
const checked = (0,
|
|
810
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
811
|
-
return /* @__PURE__ */ (0,
|
|
812
|
-
|
|
831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
832
|
+
!hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TitleFieldTemplate, { id: (0, import_utils15.titleId)(id), title: label, schema, uiSchema, registry }),
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_semantic_ui_react15.Form.Group, { id, name: htmlName || id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
834
|
+
const checked = (0, import_utils15.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
835
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
837
|
+
import_semantic_ui_react15.Form.Checkbox,
|
|
813
838
|
{
|
|
814
|
-
id: (0,
|
|
839
|
+
id: (0, import_utils15.optionId)(id, index),
|
|
815
840
|
name: htmlName || id,
|
|
816
841
|
label: option.label,
|
|
817
842
|
...semanticProps,
|
|
@@ -819,21 +844,21 @@ function CheckboxesWidget(props) {
|
|
|
819
844
|
error: rawErrors.length > 0,
|
|
820
845
|
disabled: disabled || itemDisabled || readonly,
|
|
821
846
|
autoFocus: autofocus && index === 0,
|
|
822
|
-
onChange:
|
|
823
|
-
onBlur:
|
|
824
|
-
onFocus:
|
|
825
|
-
"aria-describedby": (0,
|
|
847
|
+
onChange: handleChange(index),
|
|
848
|
+
onBlur: handleBlur,
|
|
849
|
+
onFocus: handleFocus,
|
|
850
|
+
"aria-describedby": (0, import_utils15.ariaDescribedByIds)(id)
|
|
826
851
|
},
|
|
827
|
-
|
|
852
|
+
String(option.value)
|
|
828
853
|
);
|
|
829
854
|
}) })
|
|
830
855
|
] });
|
|
831
856
|
}
|
|
832
857
|
|
|
833
858
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
834
|
-
var
|
|
835
|
-
var
|
|
836
|
-
var
|
|
859
|
+
var import_utils16 = require("@rjsf/utils");
|
|
860
|
+
var import_semantic_ui_react16 = require("semantic-ui-react");
|
|
861
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
837
862
|
function CheckboxWidget(props) {
|
|
838
863
|
const {
|
|
839
864
|
id,
|
|
@@ -841,7 +866,7 @@ function CheckboxWidget(props) {
|
|
|
841
866
|
value,
|
|
842
867
|
disabled,
|
|
843
868
|
readonly,
|
|
844
|
-
label
|
|
869
|
+
label,
|
|
845
870
|
hideLabel,
|
|
846
871
|
autofocus,
|
|
847
872
|
onChange,
|
|
@@ -861,30 +886,30 @@ function CheckboxWidget(props) {
|
|
|
861
886
|
inverted: "false"
|
|
862
887
|
}
|
|
863
888
|
});
|
|
864
|
-
const DescriptionFieldTemplate = (0,
|
|
889
|
+
const DescriptionFieldTemplate = (0, import_utils16.getTemplate)(
|
|
865
890
|
"DescriptionFieldTemplate",
|
|
866
891
|
registry,
|
|
867
892
|
options
|
|
868
893
|
);
|
|
869
|
-
const required = (0,
|
|
870
|
-
const checked = value
|
|
871
|
-
const
|
|
872
|
-
const
|
|
873
|
-
const
|
|
894
|
+
const required = (0, import_utils16.schemaRequiresTrueValue)(schema);
|
|
895
|
+
const checked = value === "true" || value === true;
|
|
896
|
+
const handleChange = (_, data) => onChange?.(data.checked);
|
|
897
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
898
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
874
899
|
const description = options.description ?? schema.description;
|
|
875
|
-
return /* @__PURE__ */ (0,
|
|
876
|
-
!hideLabel && description && /* @__PURE__ */ (0,
|
|
900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
901
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
877
902
|
DescriptionFieldTemplate,
|
|
878
903
|
{
|
|
879
|
-
id: (0,
|
|
904
|
+
id: (0, import_utils16.descriptionId)(id),
|
|
880
905
|
description,
|
|
881
906
|
schema,
|
|
882
907
|
uiSchema,
|
|
883
908
|
registry
|
|
884
909
|
}
|
|
885
910
|
),
|
|
886
|
-
/* @__PURE__ */ (0,
|
|
887
|
-
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
912
|
+
import_semantic_ui_react16.Form.Checkbox,
|
|
888
913
|
{
|
|
889
914
|
id,
|
|
890
915
|
name: htmlName || id,
|
|
@@ -893,22 +918,22 @@ function CheckboxWidget(props) {
|
|
|
893
918
|
...semanticProps,
|
|
894
919
|
checked: typeof value === "undefined" ? false : checked,
|
|
895
920
|
error: rawErrors.length > 0,
|
|
896
|
-
onChange:
|
|
897
|
-
onBlur:
|
|
898
|
-
onFocus:
|
|
921
|
+
onChange: handleChange,
|
|
922
|
+
onBlur: handleBlur,
|
|
923
|
+
onFocus: handleFocus,
|
|
899
924
|
required,
|
|
900
|
-
label: (0,
|
|
901
|
-
"aria-describedby": (0,
|
|
925
|
+
label: (0, import_utils16.labelValue)(label, hideLabel, false),
|
|
926
|
+
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id)
|
|
902
927
|
}
|
|
903
928
|
)
|
|
904
929
|
] });
|
|
905
930
|
}
|
|
906
931
|
|
|
907
932
|
// src/RadioWidget/RadioWidget.tsx
|
|
908
|
-
var
|
|
909
|
-
var
|
|
910
|
-
var
|
|
911
|
-
var
|
|
933
|
+
var import_utils17 = require("@rjsf/utils");
|
|
934
|
+
var import_semantic_ui_react17 = require("semantic-ui-react");
|
|
935
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
936
|
+
var import_react3 = require("react");
|
|
912
937
|
function RadioWidget(props) {
|
|
913
938
|
const {
|
|
914
939
|
id,
|
|
@@ -926,48 +951,46 @@ function RadioWidget(props) {
|
|
|
926
951
|
rawErrors = []
|
|
927
952
|
} = props;
|
|
928
953
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
929
|
-
const optionValueFormat = (0,
|
|
954
|
+
const optionValueFormat = (0, import_utils17.getOptionValueFormat)(options);
|
|
930
955
|
const semanticProps = getSemanticProps({
|
|
931
956
|
formContext: registry.formContext,
|
|
932
957
|
options,
|
|
933
958
|
uiSchema
|
|
934
959
|
});
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const _onBlur = () => onBlur(id, value);
|
|
939
|
-
const _onFocus = () => onFocus(id, value);
|
|
960
|
+
const handleChange = (_, { value: eventValue }) => onChange((0, import_utils17.enumOptionValueDecoder)(String(eventValue), enumOptions, optionValueFormat, emptyValue));
|
|
961
|
+
const handleBlur = () => onBlur(id, value);
|
|
962
|
+
const handleFocus = () => onFocus(id, value);
|
|
940
963
|
const inlineOption = options.inline ? { inline: true } : { grouped: true };
|
|
941
|
-
return /* @__PURE__ */ (0,
|
|
942
|
-
const checked = (0,
|
|
943
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
944
|
-
return /* @__PURE__ */ (0,
|
|
945
|
-
|
|
964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_semantic_ui_react17.Form.Group, { ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
965
|
+
const checked = (0, import_utils17.enumOptionsIsSelected)(option.value, value);
|
|
966
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
967
|
+
return /* @__PURE__ */ (0, import_react3.createElement)(
|
|
968
|
+
import_semantic_ui_react17.Form.Field,
|
|
946
969
|
{
|
|
947
970
|
required,
|
|
948
|
-
control:
|
|
949
|
-
id: (0,
|
|
971
|
+
control: import_semantic_ui_react17.Radio,
|
|
972
|
+
id: (0, import_utils17.optionId)(id, index),
|
|
950
973
|
name: htmlName || id,
|
|
951
974
|
...semanticProps,
|
|
952
|
-
onFocus:
|
|
953
|
-
onBlur:
|
|
954
|
-
onChange:
|
|
975
|
+
onFocus: handleFocus,
|
|
976
|
+
onBlur: handleBlur,
|
|
977
|
+
onChange: handleChange,
|
|
955
978
|
label: option.label,
|
|
956
|
-
value: (0,
|
|
979
|
+
value: (0, import_utils17.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
957
980
|
error: rawErrors.length > 0,
|
|
958
|
-
key:
|
|
981
|
+
key: String(option.value),
|
|
959
982
|
checked,
|
|
960
983
|
disabled: disabled || itemDisabled || readonly,
|
|
961
|
-
"aria-describedby": (0,
|
|
984
|
+
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id)
|
|
962
985
|
}
|
|
963
986
|
);
|
|
964
987
|
}) });
|
|
965
988
|
}
|
|
966
989
|
|
|
967
990
|
// src/RangeWidget/RangeWidget.tsx
|
|
968
|
-
var
|
|
969
|
-
var
|
|
970
|
-
var
|
|
991
|
+
var import_utils18 = require("@rjsf/utils");
|
|
992
|
+
var import_semantic_ui_react18 = require("semantic-ui-react");
|
|
993
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
971
994
|
function RangeWidget(props) {
|
|
972
995
|
const {
|
|
973
996
|
id,
|
|
@@ -992,45 +1015,45 @@ function RangeWidget(props) {
|
|
|
992
1015
|
fluid: true
|
|
993
1016
|
}
|
|
994
1017
|
});
|
|
995
|
-
const
|
|
996
|
-
const
|
|
997
|
-
const
|
|
998
|
-
return /* @__PURE__ */ (0,
|
|
999
|
-
/* @__PURE__ */ (0,
|
|
1000
|
-
|
|
1018
|
+
const handleChange = ({ target: { value: value2 } }) => onChange?.(value2 === "" ? options.emptyValue : value2);
|
|
1019
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
1020
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
1021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1023
|
+
import_semantic_ui_react18.Input,
|
|
1001
1024
|
{
|
|
1002
1025
|
id,
|
|
1003
1026
|
name: id,
|
|
1004
1027
|
type: "range",
|
|
1005
1028
|
required,
|
|
1006
1029
|
disabled: disabled || readonly,
|
|
1007
|
-
...(0,
|
|
1030
|
+
...(0, import_utils18.rangeSpec)(schema),
|
|
1008
1031
|
...semanticProps,
|
|
1009
1032
|
value: value || "",
|
|
1010
1033
|
error: rawErrors.length > 0,
|
|
1011
|
-
onChange:
|
|
1012
|
-
onBlur:
|
|
1013
|
-
onFocus:
|
|
1014
|
-
"aria-describedby": (0,
|
|
1034
|
+
onChange: handleChange,
|
|
1035
|
+
onBlur: handleBlur,
|
|
1036
|
+
onFocus: handleFocus,
|
|
1037
|
+
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id)
|
|
1015
1038
|
},
|
|
1016
1039
|
id
|
|
1017
1040
|
),
|
|
1018
|
-
/* @__PURE__ */ (0,
|
|
1041
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: value })
|
|
1019
1042
|
] });
|
|
1020
1043
|
}
|
|
1021
1044
|
|
|
1022
1045
|
// src/SelectWidget/SelectWidget.tsx
|
|
1023
|
-
var
|
|
1046
|
+
var import_utils19 = require("@rjsf/utils");
|
|
1024
1047
|
var import_map = __toESM(require("lodash/map"), 1);
|
|
1025
|
-
var
|
|
1026
|
-
var
|
|
1048
|
+
var import_semantic_ui_react19 = require("semantic-ui-react");
|
|
1049
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1027
1050
|
function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled, showPlaceholderOption, placeholder, format = "indexed") {
|
|
1028
1051
|
const disabledOptions = enumDisabled || [];
|
|
1029
1052
|
const options = (0, import_map.default)(enumOptions, ({ label, value }, index) => ({
|
|
1030
|
-
disabled: disabledOptions.
|
|
1053
|
+
disabled: disabledOptions.includes(value),
|
|
1031
1054
|
key: label,
|
|
1032
1055
|
text: label,
|
|
1033
|
-
value: (0,
|
|
1056
|
+
value: (0, import_utils19.enumOptionValueEncoder)(value, index, format)
|
|
1034
1057
|
}));
|
|
1035
1058
|
if (showPlaceholderOption) {
|
|
1036
1059
|
options.unshift({ value: "", text: placeholder || "" });
|
|
@@ -1073,8 +1096,9 @@ function SelectWidget(props) {
|
|
|
1073
1096
|
});
|
|
1074
1097
|
const { enumDisabled, enumOptions, emptyValue: optEmptyVal } = options;
|
|
1075
1098
|
const emptyValue = multiple ? [] : "";
|
|
1076
|
-
const optionValueFormat = (0,
|
|
1099
|
+
const optionValueFormat = (0, import_utils19.getOptionValueFormat)(options);
|
|
1077
1100
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1101
|
+
(0, import_utils19.logUnsupportedDefaultForEnum)(id, schema, enumOptions, multiple);
|
|
1078
1102
|
const dropdownOptions = createDefaultValueOptionsForDropDown(
|
|
1079
1103
|
enumOptions,
|
|
1080
1104
|
enumDisabled,
|
|
@@ -1082,38 +1106,41 @@ function SelectWidget(props) {
|
|
|
1082
1106
|
placeholder,
|
|
1083
1107
|
optionValueFormat
|
|
1084
1108
|
);
|
|
1085
|
-
const
|
|
1086
|
-
const
|
|
1087
|
-
const
|
|
1088
|
-
return /* @__PURE__ */ (0,
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1109
|
+
const handleChange = (_, { value: enumValue }) => onChange((0, import_utils19.enumOptionValueDecoder)(enumValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
1110
|
+
const handleBlur = (_, { target }) => onBlur(id, (0, import_utils19.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1111
|
+
const handleFocus = (_, { target }) => onFocus(id, (0, import_utils19.enumOptionValueDecoder)(target?.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1114
|
+
import_semantic_ui_react19.Form.Dropdown,
|
|
1115
|
+
{
|
|
1116
|
+
id,
|
|
1117
|
+
name: htmlName || id,
|
|
1118
|
+
label: (0, import_utils19.labelValue)(label || void 0, hideLabel, false),
|
|
1119
|
+
multiple: typeof multiple === "undefined" ? false : multiple,
|
|
1120
|
+
value: (0, import_utils19.enumOptionSelectedValue)(value, enumOptions, !!multiple, optionValueFormat, emptyValue),
|
|
1121
|
+
error: rawErrors.length > 0,
|
|
1122
|
+
disabled,
|
|
1123
|
+
placeholder,
|
|
1124
|
+
...semanticProps,
|
|
1125
|
+
required,
|
|
1126
|
+
autoFocus: autofocus,
|
|
1127
|
+
readOnly: readonly,
|
|
1128
|
+
options: dropdownOptions,
|
|
1129
|
+
onChange: handleChange,
|
|
1130
|
+
onBlur: handleBlur,
|
|
1131
|
+
onFocus: handleFocus,
|
|
1132
|
+
"aria-describedby": (0, import_utils19.ariaDescribedByIds)(id)
|
|
1133
|
+
},
|
|
1134
|
+
id
|
|
1135
|
+
),
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_utils19.SelectedOptionDescription, { ...props })
|
|
1137
|
+
] });
|
|
1111
1138
|
}
|
|
1112
1139
|
|
|
1113
1140
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
1114
|
-
var
|
|
1115
|
-
var
|
|
1116
|
-
var
|
|
1141
|
+
var import_utils20 = require("@rjsf/utils");
|
|
1142
|
+
var import_semantic_ui_react20 = require("semantic-ui-react");
|
|
1143
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1117
1144
|
function TextareaWidget(props) {
|
|
1118
1145
|
const {
|
|
1119
1146
|
id,
|
|
@@ -1138,15 +1165,15 @@ function TextareaWidget(props) {
|
|
|
1138
1165
|
options,
|
|
1139
1166
|
defaultSchemaProps: { inverted: "false" }
|
|
1140
1167
|
});
|
|
1141
|
-
const
|
|
1142
|
-
const
|
|
1143
|
-
const
|
|
1144
|
-
return /* @__PURE__ */ (0,
|
|
1145
|
-
|
|
1168
|
+
const handleChange = ({ target: { value: value2 } }) => onChange?.(value2 === "" ? options.emptyValue : value2);
|
|
1169
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
1170
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
1171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1172
|
+
import_semantic_ui_react20.Form.TextArea,
|
|
1146
1173
|
{
|
|
1147
1174
|
id,
|
|
1148
1175
|
name: htmlName || id,
|
|
1149
|
-
label: (0,
|
|
1176
|
+
label: (0, import_utils20.labelValue)(label || void 0, hideLabel, false),
|
|
1150
1177
|
placeholder,
|
|
1151
1178
|
autoFocus: autofocus,
|
|
1152
1179
|
required,
|
|
@@ -1155,10 +1182,10 @@ function TextareaWidget(props) {
|
|
|
1155
1182
|
value: value || "",
|
|
1156
1183
|
error: rawErrors.length > 0,
|
|
1157
1184
|
rows: options.rows || 5,
|
|
1158
|
-
onChange:
|
|
1159
|
-
onBlur:
|
|
1160
|
-
onFocus:
|
|
1161
|
-
"aria-describedby": (0,
|
|
1185
|
+
onChange: handleChange,
|
|
1186
|
+
onBlur: handleBlur,
|
|
1187
|
+
onFocus: handleFocus,
|
|
1188
|
+
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(id)
|
|
1162
1189
|
},
|
|
1163
1190
|
id
|
|
1164
1191
|
);
|
|
@@ -1182,7 +1209,7 @@ function generateTheme() {
|
|
|
1182
1209
|
return {
|
|
1183
1210
|
templates: generateTemplates(),
|
|
1184
1211
|
widgets: generateWidgets(),
|
|
1185
|
-
_internalFormWrapper:
|
|
1212
|
+
_internalFormWrapper: import_semantic_ui_react21.Form
|
|
1186
1213
|
};
|
|
1187
1214
|
}
|
|
1188
1215
|
var Theme_default = generateTheme();
|