@rjsf/mantine 6.0.0-beta.21 → 6.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +71 -75
- package/dist/index.cjs.map +3 -3
- package/dist/mantine.esm.js +68 -72
- package/dist/mantine.esm.js.map +3 -3
- package/dist/mantine.umd.js +20 -23
- package/lib/templates/ArrayFieldItemTemplate.d.ts +3 -3
- package/lib/templates/ArrayFieldItemTemplate.js +1 -1
- package/lib/templates/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate.d.ts +1 -1
- package/lib/templates/ArrayFieldTemplate.js +2 -3
- package/lib/templates/ArrayFieldTemplate.js.map +1 -1
- package/lib/templates/BaseInputTemplate.js +2 -2
- package/lib/templates/BaseInputTemplate.js.map +1 -1
- package/lib/templates/ObjectFieldTemplate.js +2 -2
- package/lib/templates/ObjectFieldTemplate.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate.js +2 -4
- package/lib/templates/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/CheckboxWidget.js +2 -2
- package/lib/widgets/CheckboxWidget.js.map +1 -1
- package/lib/widgets/CheckboxesWidget.js +2 -2
- package/lib/widgets/CheckboxesWidget.js.map +1 -1
- package/lib/widgets/RadioWidget.js +2 -2
- package/lib/widgets/RadioWidget.js.map +1 -1
- package/lib/widgets/SelectWidget.js +2 -2
- package/lib/widgets/SelectWidget.js.map +1 -1
- package/lib/widgets/TextareaWidget.js +2 -2
- package/lib/widgets/TextareaWidget.js.map +1 -1
- package/package.json +7 -7
- package/src/templates/ArrayFieldItemTemplate.tsx +3 -3
- package/src/templates/ArrayFieldTemplate.tsx +2 -10
- package/src/templates/BaseInputTemplate.tsx +3 -2
- package/src/templates/ObjectFieldTemplate.tsx +2 -2
- package/src/templates/WrapIfAdditionalTemplate.tsx +4 -10
- package/src/widgets/CheckboxWidget.tsx +2 -1
- package/src/widgets/CheckboxesWidget.tsx +2 -1
- package/src/widgets/RadioWidget.tsx +2 -1
- package/src/widgets/SelectWidget.tsx +2 -1
- package/src/widgets/TextareaWidget.tsx +2 -1
package/dist/mantine.umd.js
CHANGED
|
@@ -40,11 +40,6 @@
|
|
|
40
40
|
registry,
|
|
41
41
|
uiOptions
|
|
42
42
|
);
|
|
43
|
-
const ArrayFieldItemTemplate2 = utils.getTemplate(
|
|
44
|
-
"ArrayFieldItemTemplate",
|
|
45
|
-
registry,
|
|
46
|
-
uiOptions
|
|
47
|
-
);
|
|
48
43
|
const ArrayFieldTitleTemplate2 = utils.getTemplate(
|
|
49
44
|
"ArrayFieldTitleTemplate",
|
|
50
45
|
registry,
|
|
@@ -79,7 +74,7 @@
|
|
|
79
74
|
),
|
|
80
75
|
/* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className: "row rjsf-array-item-list", children: [
|
|
81
76
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
82
|
-
items
|
|
77
|
+
items
|
|
83
78
|
] }),
|
|
84
79
|
canAdd && /* @__PURE__ */ jsxRuntime.jsx(core.Group, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
85
80
|
AddButton2,
|
|
@@ -143,6 +138,7 @@
|
|
|
143
138
|
function BaseInputTemplate(props) {
|
|
144
139
|
const {
|
|
145
140
|
id,
|
|
141
|
+
htmlName,
|
|
146
142
|
type,
|
|
147
143
|
schema,
|
|
148
144
|
value,
|
|
@@ -188,7 +184,7 @@
|
|
|
188
184
|
core.NumberInput,
|
|
189
185
|
{
|
|
190
186
|
id,
|
|
191
|
-
name: id,
|
|
187
|
+
name: htmlName || id,
|
|
192
188
|
label: utils.labelValue(label || void 0, hideLabel, false),
|
|
193
189
|
required,
|
|
194
190
|
autoFocus: autofocus,
|
|
@@ -210,7 +206,7 @@
|
|
|
210
206
|
core.TextInput,
|
|
211
207
|
{
|
|
212
208
|
id,
|
|
213
|
-
name: id,
|
|
209
|
+
name: htmlName || id,
|
|
214
210
|
label: utils.labelValue(label || void 0, hideLabel, false),
|
|
215
211
|
required,
|
|
216
212
|
autoFocus: autofocus,
|
|
@@ -563,7 +559,7 @@
|
|
|
563
559
|
disabled,
|
|
564
560
|
properties,
|
|
565
561
|
optionalDataControl,
|
|
566
|
-
|
|
562
|
+
onAddProperty,
|
|
567
563
|
readonly,
|
|
568
564
|
required,
|
|
569
565
|
schema,
|
|
@@ -627,7 +623,7 @@
|
|
|
627
623
|
{
|
|
628
624
|
id: utils.buttonId(fieldPathId, "add"),
|
|
629
625
|
disabled: disabled || readonly,
|
|
630
|
-
onClick:
|
|
626
|
+
onClick: onAddProperty,
|
|
631
627
|
className: "rjsf-object-property-expand",
|
|
632
628
|
uiSchema,
|
|
633
629
|
registry
|
|
@@ -686,8 +682,8 @@
|
|
|
686
682
|
disabled,
|
|
687
683
|
schema,
|
|
688
684
|
uiSchema,
|
|
689
|
-
|
|
690
|
-
|
|
685
|
+
onKeyRenameBlur,
|
|
686
|
+
onRemoveProperty,
|
|
691
687
|
registry,
|
|
692
688
|
children
|
|
693
689
|
} = props;
|
|
@@ -695,10 +691,6 @@
|
|
|
695
691
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
696
692
|
const keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
697
693
|
const additional = utils.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
698
|
-
const handleBlur = react.useCallback(
|
|
699
|
-
({ target }) => onKeyChange(target && target.value),
|
|
700
|
-
[onKeyChange]
|
|
701
|
-
);
|
|
702
694
|
if (!additional) {
|
|
703
695
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children });
|
|
704
696
|
}
|
|
@@ -719,7 +711,7 @@
|
|
|
719
711
|
disabled: disabled || readonly,
|
|
720
712
|
id: `${id}-key`,
|
|
721
713
|
name: `${id}-key`,
|
|
722
|
-
onBlur: !readonly ?
|
|
714
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0
|
|
723
715
|
}
|
|
724
716
|
) }) }),
|
|
725
717
|
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: 6, className: "form-additional", children })
|
|
@@ -731,7 +723,7 @@
|
|
|
731
723
|
iconType: "sm",
|
|
732
724
|
className: "rjsf-array-item-remove",
|
|
733
725
|
disabled: disabled || readonly,
|
|
734
|
-
onClick:
|
|
726
|
+
onClick: onRemoveProperty,
|
|
735
727
|
uiSchema: buttonUiOptions,
|
|
736
728
|
registry
|
|
737
729
|
}
|
|
@@ -1023,6 +1015,7 @@
|
|
|
1023
1015
|
function CheckboxesWidget(props) {
|
|
1024
1016
|
const {
|
|
1025
1017
|
id,
|
|
1018
|
+
htmlName,
|
|
1026
1019
|
value,
|
|
1027
1020
|
required,
|
|
1028
1021
|
disabled,
|
|
@@ -1080,7 +1073,7 @@
|
|
|
1080
1073
|
core.Checkbox,
|
|
1081
1074
|
{
|
|
1082
1075
|
id: utils.optionId(id, i),
|
|
1083
|
-
name: id,
|
|
1076
|
+
name: htmlName || id,
|
|
1084
1077
|
value: String(i),
|
|
1085
1078
|
label: option.label,
|
|
1086
1079
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
@@ -1098,6 +1091,7 @@
|
|
|
1098
1091
|
const {
|
|
1099
1092
|
id,
|
|
1100
1093
|
name,
|
|
1094
|
+
htmlName,
|
|
1101
1095
|
value = false,
|
|
1102
1096
|
required,
|
|
1103
1097
|
disabled,
|
|
@@ -1160,7 +1154,7 @@
|
|
|
1160
1154
|
core.Checkbox,
|
|
1161
1155
|
{
|
|
1162
1156
|
id,
|
|
1163
|
-
name,
|
|
1157
|
+
name: htmlName || name,
|
|
1164
1158
|
label: utils.labelValue(label || void 0, hideLabel, false),
|
|
1165
1159
|
disabled: disabled || readonly,
|
|
1166
1160
|
required,
|
|
@@ -1434,6 +1428,7 @@
|
|
|
1434
1428
|
function RadioWidget(props) {
|
|
1435
1429
|
const {
|
|
1436
1430
|
id,
|
|
1431
|
+
htmlName,
|
|
1437
1432
|
value,
|
|
1438
1433
|
required,
|
|
1439
1434
|
disabled,
|
|
@@ -1478,7 +1473,7 @@
|
|
|
1478
1473
|
core.Radio.Group,
|
|
1479
1474
|
{
|
|
1480
1475
|
id,
|
|
1481
|
-
name: id,
|
|
1476
|
+
name: htmlName || id,
|
|
1482
1477
|
value: selected,
|
|
1483
1478
|
label: !hideLabel ? label : void 0,
|
|
1484
1479
|
onChange: handleChange,
|
|
@@ -1568,6 +1563,7 @@
|
|
|
1568
1563
|
function SelectWidget(props) {
|
|
1569
1564
|
const {
|
|
1570
1565
|
id,
|
|
1566
|
+
htmlName,
|
|
1571
1567
|
value,
|
|
1572
1568
|
placeholder,
|
|
1573
1569
|
required,
|
|
@@ -1626,7 +1622,7 @@
|
|
|
1626
1622
|
Component,
|
|
1627
1623
|
{
|
|
1628
1624
|
id,
|
|
1629
|
-
name: id,
|
|
1625
|
+
name: htmlName || id,
|
|
1630
1626
|
label: utils.labelValue(label || void 0, hideLabel, false),
|
|
1631
1627
|
data: selectOptions,
|
|
1632
1628
|
value: multiple ? selectedIndexes : selectedIndexes,
|
|
@@ -1649,6 +1645,7 @@
|
|
|
1649
1645
|
const {
|
|
1650
1646
|
id,
|
|
1651
1647
|
name,
|
|
1648
|
+
htmlName,
|
|
1652
1649
|
value,
|
|
1653
1650
|
placeholder,
|
|
1654
1651
|
required,
|
|
@@ -1691,7 +1688,7 @@
|
|
|
1691
1688
|
core.Textarea,
|
|
1692
1689
|
{
|
|
1693
1690
|
id,
|
|
1694
|
-
name,
|
|
1691
|
+
name: htmlName || name,
|
|
1695
1692
|
value: value || "",
|
|
1696
1693
|
placeholder: placeholder || void 0,
|
|
1697
1694
|
required,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
3
3
|
*
|
|
4
|
-
* @param props - The `
|
|
4
|
+
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
5
5
|
*/
|
|
6
|
-
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props:
|
|
6
|
+
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { getTemplate, getUiOptions, } from '@rjsf/utils';
|
|
|
3
3
|
import { Box, Flex, Group } from '@mantine/core';
|
|
4
4
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
5
5
|
*
|
|
6
|
-
* @param props - The `
|
|
6
|
+
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
7
7
|
*/
|
|
8
8
|
export default function ArrayFieldItemTemplate(props) {
|
|
9
9
|
const { buttonsProps, className, hasToolbar, index, uiSchema, registry, children } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/templates/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EACX,YAAY,GAGb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,
|
|
1
|
+
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/templates/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EACX,YAAY,GAGb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,KAA2C;IAC3C,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3F,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IAEF,OAAO,CACL,KAAC,GAAG,IAA6B,SAAS,EAAE,SAAS,IAAI,iBAAiB,EAAE,EAAE,EAAC,IAAI,YACjF,MAAC,IAAI,IAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAC,KAAK,EAAC,OAAO,EAAC,QAAQ,aACzC,KAAC,GAAG,IAAC,CAAC,EAAC,MAAM,YAAE,QAAQ,GAAO,EAC7B,UAAU,IAAI,CACb,KAAC,KAAK,IAAC,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,YAChC,KAAC,6BAA6B,OAAK,YAAY,GAAI,GAC7C,CACT,IACI,IARC,cAAc,KAAK,EAAE,CASzB,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
3
3
|
*
|
|
4
|
-
* @param props - The `
|
|
4
|
+
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
5
5
|
*/
|
|
6
6
|
export default function ArrayFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,18 +3,17 @@ import { getTemplate, getUiOptions, buttonId, } from '@rjsf/utils';
|
|
|
3
3
|
import { Fieldset, Box, Group } from '@mantine/core';
|
|
4
4
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
5
5
|
*
|
|
6
|
-
* @param props - The `
|
|
6
|
+
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
7
7
|
*/
|
|
8
8
|
export default function ArrayFieldTemplate(props) {
|
|
9
9
|
const { canAdd, className, disabled, fieldPathId, items, optionalDataControl, onAddClick, readonly, required, schema, uiSchema, title, registry, } = props;
|
|
10
10
|
const uiOptions = getUiOptions(uiSchema);
|
|
11
11
|
const ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
12
|
-
const ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
13
12
|
const ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
14
13
|
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
15
14
|
// Button templates are not overridden in the uiSchema
|
|
16
15
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
17
16
|
const legend = (uiOptions.title || title) && (_jsx(ArrayFieldTitleTemplate, { fieldPathId: fieldPathId, required: required, title: uiOptions.title || title, schema: schema, uiSchema: uiSchema, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined }));
|
|
18
|
-
return (_jsxs(Fieldset, { legend: legend, className: className, id: fieldPathId.$id, children: [(uiOptions.description || schema.description) && (_jsx(ArrayFieldDescriptionTemplate, { description: uiOptions.description || schema.description, fieldPathId: fieldPathId, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs(Box, { className: 'row rjsf-array-item-list', children: [!showOptionalDataControlInTitle ? optionalDataControl : undefined, items
|
|
17
|
+
return (_jsxs(Fieldset, { legend: legend, className: className, id: fieldPathId.$id, children: [(uiOptions.description || schema.description) && (_jsx(ArrayFieldDescriptionTemplate, { description: uiOptions.description || schema.description, fieldPathId: fieldPathId, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs(Box, { className: 'row rjsf-array-item-list', children: [!showOptionalDataControlInTitle ? optionalDataControl : undefined, items] }), canAdd && (_jsx(Group, { justify: 'flex-end', children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-array-item-add', disabled: disabled || readonly, onClick: onAddClick, uiSchema: uiSchema, registry: registry, iconType: 'md' }) }))] }));
|
|
19
18
|
}
|
|
20
19
|
//# sourceMappingURL=ArrayFieldTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/templates/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EACX,YAAY,
|
|
1
|
+
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/templates/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EACX,YAAY,EAEZ,QAAQ,GAIT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAIxC,KAAuC;IACvC,MAAM,EACJ,MAAM,EACN,SAAS,EACT,QAAQ,EACR,WAAW,EACX,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,EACL,QAAQ,GACT,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,uBAAuB,GAAG,WAAW,CACzC,yBAAyB,EACzB,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,8BAA8B,GAAG,CAAC,QAAQ,IA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EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAC,IAAI,GACb,GACI,CACT,IACQ,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { cleanupOptions } from '../utils';
|
|
|
10
10
|
* @param props - The `WidgetProps` for this template
|
|
11
11
|
*/
|
|
12
12
|
export default function BaseInputTemplate(props) {
|
|
13
|
-
const { id, type, schema, value, placeholder, required, disabled, readonly, autofocus, label, hideLabel, onChange, onChangeOverride, onBlur, onFocus, options, rawErrors, children, } = props;
|
|
13
|
+
const { id, htmlName, type, schema, value, placeholder, required, disabled, readonly, autofocus, label, hideLabel, onChange, onChangeOverride, onBlur, onFocus, options, rawErrors, children, } = props;
|
|
14
14
|
const inputProps = getInputProps(schema, type, options, false);
|
|
15
15
|
const themeProps = cleanupOptions(options);
|
|
16
16
|
const handleNumberChange = useCallback((value) => onChange(value), [onChange]);
|
|
@@ -26,7 +26,7 @@ export default function BaseInputTemplate(props) {
|
|
|
26
26
|
const handleFocus = useCallback((e) => {
|
|
27
27
|
onFocus(id, e.target && e.target.value);
|
|
28
28
|
}, [onFocus, id]);
|
|
29
|
-
const input = inputProps.type === 'number' || inputProps.type === 'integer' ? (_jsx(NumberInput, { id: id, name: id, label: labelValue(label || undefined, hideLabel, false), required: required, autoFocus: autofocus, disabled: disabled || readonly, onBlur: !readonly ? handleBlur : undefined, onChange: !readonly ? handleNumberChange : undefined, onFocus: !readonly ? handleFocus : undefined, placeholder: placeholder, error: rawErrors && rawErrors.length > 0 ? rawErrors.join('\n') : undefined, list: schema.examples ? examplesId(id) : undefined, ...inputProps, ...themeProps, step: typeof inputProps.step === 'number' ? inputProps.step : 1, type: 'text', value: value, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) })) : (_jsx(TextInput, { id: id, name: id, label: labelValue(label || undefined, hideLabel, false), required: required, autoFocus: autofocus, disabled: disabled || readonly, onBlur: !readonly ? handleBlur : undefined, onChange: !readonly ? handleChange : undefined, onFocus: !readonly ? handleFocus : undefined, placeholder: placeholder, error: rawErrors && rawErrors.length > 0 ? rawErrors.join('\n') : undefined, list: schema.examples ? examplesId(id) : undefined, ...inputProps, ...themeProps, value: value, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }));
|
|
29
|
+
const input = inputProps.type === 'number' || inputProps.type === 'integer' ? (_jsx(NumberInput, { id: id, name: htmlName || id, label: labelValue(label || undefined, hideLabel, false), required: required, autoFocus: autofocus, disabled: disabled || readonly, onBlur: !readonly ? handleBlur : undefined, onChange: !readonly ? handleNumberChange : undefined, onFocus: !readonly ? handleFocus : undefined, placeholder: placeholder, error: rawErrors && rawErrors.length > 0 ? rawErrors.join('\n') : undefined, list: schema.examples ? examplesId(id) : undefined, ...inputProps, ...themeProps, step: typeof inputProps.step === 'number' ? inputProps.step : 1, type: 'text', value: value, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) })) : (_jsx(TextInput, { id: id, name: htmlName || id, label: labelValue(label || undefined, hideLabel, false), required: required, autoFocus: autofocus, disabled: disabled || readonly, onBlur: !readonly ? handleBlur : undefined, onChange: !readonly ? handleChange : undefined, onFocus: !readonly ? handleFocus : undefined, placeholder: placeholder, error: rawErrors && rawErrors.length > 0 ? rawErrors.join('\n') : undefined, list: schema.examples ? examplesId(id) : undefined, ...inputProps, ...themeProps, value: value, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }));
|
|
30
30
|
return (_jsxs(_Fragment, { children: [input, children, Array.isArray(schema.examples) && (_jsx("datalist", { id: examplesId(id), children: schema.examples
|
|
31
31
|
.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : [])
|
|
32
32
|
.map((example) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputTemplate.js","sourceRoot":"","sources":["../../src/templates/BaseInputTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA2B,WAAW,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAElB,UA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gBAClD,CAAC,CAAC,GACK,CACZ,IACA,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { buttonId, canExpand, descriptionId, getTemplate, getUiOptions, titleId,
|
|
|
8
8
|
* @param props - The `ObjectFieldTemplateProps` for this component
|
|
9
9
|
*/
|
|
10
10
|
export default function ObjectFieldTemplate(props) {
|
|
11
|
-
const { title, description, disabled, properties, optionalDataControl,
|
|
11
|
+
const { title, description, disabled, properties, optionalDataControl, onAddProperty, readonly, required, schema, uiSchema, fieldPathId, formData, registry, } = props;
|
|
12
12
|
const uiOptions = getUiOptions(uiSchema);
|
|
13
13
|
const TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
14
14
|
const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
@@ -20,6 +20,6 @@ export default function ObjectFieldTemplate(props) {
|
|
|
20
20
|
const gridVerticalSpacing = uiOptions === null || uiOptions === void 0 ? void 0 : uiOptions.gridVerticalSpacing;
|
|
21
21
|
return (_jsxs(Container, { id: fieldPathId.$id, p: 0, children: [title && (_jsx(TitleFieldTemplate, { id: titleId(fieldPathId), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined })), description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(fieldPathId), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs(SimpleGrid, { cols: gridCols, spacing: gridSpacing, verticalSpacing: gridVerticalSpacing, mb: 'sm', children: [!showOptionalDataControlInTitle ? optionalDataControl : undefined, properties
|
|
22
22
|
.filter((e) => !e.hidden)
|
|
23
|
-
.map((element) => (_jsx(Box, { children: element.content }, element.name)))] }), canExpand(schema, uiSchema, formData) && (_jsx(Group, { mt: 'xs', justify: 'flex-end', children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), disabled: disabled || readonly, onClick:
|
|
23
|
+
.map((element) => (_jsx(Box, { children: element.content }, element.name)))] }), canExpand(schema, uiSchema, formData) && (_jsx(Group, { mt: 'xs', justify: 'flex-end', children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), disabled: disabled || readonly, onClick: onAddProperty, className: 'rjsf-object-property-expand', uiSchema: uiSchema, registry: registry }) }))] }));
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=ObjectFieldTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectFieldTemplate.js","sourceRoot":"","sources":["../../src/templates/ObjectFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACL,QAAQ,EACR,SAAS,EACT,aAAa,EAEb,WAAW,EACX,YAAY,EAKZ,OAAO,GACR,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAIzC,KAAwC;IACxC,MAAM,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"ObjectFieldTemplate.js","sourceRoot":"","sources":["../../src/templates/ObjectFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACL,QAAQ,EACR,SAAS,EACT,aAAa,EAEb,WAAW,EACX,YAAY,EAKZ,OAAO,GACR,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAIzC,KAAwC;IACxC,MAAM,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,GACT,GAAG,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,EACxB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,EACD,MAAC,UAAU,IACT,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,WAAyC,EAClD,eAAe,EAAE,mBAAiD,EAClE,EAAE,EAAC,IAAI,aAEN,CAAC,8BAA8B,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,EACjE,UAAU;yBACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;yBACxB,GAAG,CAAC,CAAC,OAAwC,EAAE,EAAE,CAAC,CACjD,KAAC,GAAG,cAAqB,OAAO,CAAC,OAAO,IAA9B,OAAO,CAAC,IAAI,CAAyB,CAChD,CAAC,IACO,EACZ,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CACxC,KAAC,KAAK,IAAC,EAAE,EAAC,IAAI,EAAC,OAAO,EAAC,UAAU,YAC/B,KAAC,SAAS,IACR,EAAE,EAAE,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,EAChC,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,OAAO,EAAE,aAAa,EACtB,SAAS,EAAC,6BAA6B,EACvC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,GACI,CACT,IACS,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
2
|
import { ADDITIONAL_PROPERTY_FLAG, UI_OPTIONS_KEY, buttonId, TranslatableString, } from '@rjsf/utils';
|
|
4
3
|
import { Flex, Grid, TextInput } from '@mantine/core';
|
|
5
4
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -8,13 +7,12 @@ import { Flex, Grid, TextInput } from '@mantine/core';
|
|
|
8
7
|
* @param props - The `WrapIfAdditionalProps` for this component
|
|
9
8
|
*/
|
|
10
9
|
export default function WrapIfAdditionalTemplate(props) {
|
|
11
|
-
const { id, classNames, style, label, required, readonly, disabled, schema, uiSchema,
|
|
10
|
+
const { id, classNames, style, label, required, readonly, disabled, schema, uiSchema, onKeyRenameBlur, onRemoveProperty, registry, children, } = props;
|
|
12
11
|
const { templates, translateString } = registry;
|
|
13
12
|
// Button templates are not overridden in the uiSchema
|
|
14
13
|
const { RemoveButton } = templates.ButtonTemplates;
|
|
15
14
|
const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
16
15
|
const additional = ADDITIONAL_PROPERTY_FLAG in schema;
|
|
17
|
-
const handleBlur = useCallback(({ target }) => onKeyChange(target && target.value), [onKeyChange]);
|
|
18
16
|
if (!additional) {
|
|
19
17
|
return (_jsx("div", { className: classNames, style: style, children: children }));
|
|
20
18
|
}
|
|
@@ -24,6 +22,6 @@ export default function WrapIfAdditionalTemplate(props) {
|
|
|
24
22
|
...uiSchema,
|
|
25
23
|
[UI_OPTIONS_KEY]: { ...uiOptions, block: true },
|
|
26
24
|
};
|
|
27
|
-
return (_jsx("div", { className: classNames, style: style, children: _jsxs(Flex, { gap: 'xs', align: 'end', justify: 'center', children: [_jsxs(Grid, { w: '100%', align: 'center', children: [_jsx(Grid.Col, { span: 6, className: 'form-additional', children: _jsx("div", { className: 'form-group', children: _jsx(TextInput, { className: 'form-group', label: keyLabel, defaultValue: label, required: required, disabled: disabled || readonly, id: `${id}-key`, name: `${id}-key`, onBlur: !readonly ?
|
|
25
|
+
return (_jsx("div", { className: classNames, style: style, children: _jsxs(Flex, { gap: 'xs', align: 'end', justify: 'center', children: [_jsxs(Grid, { w: '100%', align: 'center', children: [_jsx(Grid.Col, { span: 6, className: 'form-additional', children: _jsx("div", { className: 'form-group', children: _jsx(TextInput, { className: 'form-group', label: keyLabel, defaultValue: label, required: required, disabled: disabled || readonly, id: `${id}-key`, name: `${id}-key`, onBlur: !readonly ? onKeyRenameBlur : undefined }) }) }), _jsx(Grid.Col, { span: 6, className: 'form-additional', children: children })] }), _jsx(RemoveButton, { id: buttonId(id, 'remove'), iconType: 'sm', className: 'rjsf-array-item-remove', disabled: disabled || readonly, onClick: onRemoveProperty, uiSchema: buttonUiOptions, registry: registry })] }) }));
|
|
28
26
|
}
|
|
29
27
|
//# sourceMappingURL=WrapIfAdditionalTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WrapIfAdditionalTemplate.js","sourceRoot":"","sources":["../../src/templates/WrapIfAdditionalTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"WrapIfAdditionalTemplate.js","sourceRoot":"","sources":["../../src/templates/WrapIfAdditionalTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,QAAQ,EAIR,kBAAkB,GAEnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAI9C,KAA6C;IAC7C,MAAM,EACJ,EAAE,EACF,UAAU,EACV,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,GACT,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IAChD,sDAAsD;IACtD,MAAM,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC,eAAe,CAAC;IACnD,MAAM,QAAQ,GAAG,eAAe,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,wBAAwB,IAAI,MAAM,CAAC;I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