@rjsf/mantine 6.0.0-beta.20 → 6.0.0-beta.21
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 +117 -65
- package/dist/index.cjs.map +4 -4
- package/dist/mantine.esm.js +119 -67
- package/dist/mantine.esm.js.map +4 -4
- package/dist/mantine.umd.js +56 -7
- package/lib/templates/ArrayFieldTemplate.js +4 -4
- package/lib/templates/ArrayFieldTemplate.js.map +1 -1
- package/lib/templates/ObjectFieldTemplate.js +5 -4
- package/lib/templates/ObjectFieldTemplate.js.map +1 -1
- package/lib/templates/OptionalDataControlsTemplate.d.ts +10 -0
- package/lib/templates/OptionalDataControlsTemplate.js +22 -0
- package/lib/templates/OptionalDataControlsTemplate.js.map +1 -0
- package/lib/templates/TitleField.js +8 -4
- package/lib/templates/TitleField.js.map +1 -1
- package/lib/templates/index.js +2 -0
- package/lib/templates/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/templates/ArrayFieldTemplate.tsx +7 -6
- package/src/templates/ObjectFieldTemplate.tsx +4 -1
- package/src/templates/OptionalDataControlsTemplate.tsx +44 -0
- package/src/templates/TitleField.tsx +12 -3
- package/src/templates/index.ts +2 -0
package/dist/mantine.umd.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
disabled,
|
|
26
26
|
fieldPathId,
|
|
27
27
|
items,
|
|
28
|
+
optionalDataControl,
|
|
28
29
|
onAddClick,
|
|
29
30
|
readonly,
|
|
30
31
|
required,
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
registry,
|
|
50
51
|
uiOptions
|
|
51
52
|
);
|
|
53
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
52
54
|
const {
|
|
53
55
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
54
56
|
} = registry.templates;
|
|
@@ -60,7 +62,8 @@
|
|
|
60
62
|
title: uiOptions.title || title,
|
|
61
63
|
schema,
|
|
62
64
|
uiSchema,
|
|
63
|
-
registry
|
|
65
|
+
registry,
|
|
66
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
64
67
|
}
|
|
65
68
|
);
|
|
66
69
|
return /* @__PURE__ */ jsxRuntime.jsxs(core.Fieldset, { legend, className, id: fieldPathId.$id, children: [
|
|
@@ -74,7 +77,10 @@
|
|
|
74
77
|
registry
|
|
75
78
|
}
|
|
76
79
|
),
|
|
77
|
-
/* @__PURE__ */ jsxRuntime.
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className: "row rjsf-array-item-list", children: [
|
|
81
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
82
|
+
items.map(({ key, ...itemProps }) => /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemTemplate2, { ...itemProps }, key))
|
|
83
|
+
] }),
|
|
78
84
|
canAdd && /* @__PURE__ */ jsxRuntime.jsx(core.Group, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
79
85
|
AddButton2,
|
|
80
86
|
{
|
|
@@ -556,6 +562,7 @@
|
|
|
556
562
|
description,
|
|
557
563
|
disabled,
|
|
558
564
|
properties,
|
|
565
|
+
optionalDataControl,
|
|
559
566
|
onAddClick,
|
|
560
567
|
readonly,
|
|
561
568
|
required,
|
|
@@ -572,6 +579,7 @@
|
|
|
572
579
|
registry,
|
|
573
580
|
uiOptions
|
|
574
581
|
);
|
|
582
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
575
583
|
const {
|
|
576
584
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
577
585
|
} = registry.templates;
|
|
@@ -587,7 +595,8 @@
|
|
|
587
595
|
required,
|
|
588
596
|
schema,
|
|
589
597
|
uiSchema,
|
|
590
|
-
registry
|
|
598
|
+
registry,
|
|
599
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
591
600
|
}
|
|
592
601
|
),
|
|
593
602
|
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -600,14 +609,17 @@
|
|
|
600
609
|
registry
|
|
601
610
|
}
|
|
602
611
|
),
|
|
603
|
-
/* @__PURE__ */ jsxRuntime.
|
|
612
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
604
613
|
core.SimpleGrid,
|
|
605
614
|
{
|
|
606
615
|
cols: gridCols,
|
|
607
616
|
spacing: gridSpacing,
|
|
608
617
|
verticalSpacing: gridVerticalSpacing,
|
|
609
618
|
mb: "sm",
|
|
610
|
-
children:
|
|
619
|
+
children: [
|
|
620
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
621
|
+
properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ jsxRuntime.jsx(core.Box, { children: element.content }, element.name))
|
|
622
|
+
]
|
|
611
623
|
}
|
|
612
624
|
),
|
|
613
625
|
utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(core.Group, { mt: "xs", justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -623,9 +635,45 @@
|
|
|
623
635
|
) })
|
|
624
636
|
] });
|
|
625
637
|
}
|
|
638
|
+
function OptionalDataControlsTemplate(props) {
|
|
639
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
640
|
+
if (onAddClick) {
|
|
641
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
642
|
+
AddButton,
|
|
643
|
+
{
|
|
644
|
+
id,
|
|
645
|
+
registry,
|
|
646
|
+
icon: "plus",
|
|
647
|
+
className: "rjsf-add-optional-data",
|
|
648
|
+
onClick: onAddClick,
|
|
649
|
+
title: label
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
} else if (onRemoveClick) {
|
|
653
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
654
|
+
RemoveButton,
|
|
655
|
+
{
|
|
656
|
+
id,
|
|
657
|
+
registry,
|
|
658
|
+
icon: "remove",
|
|
659
|
+
className: "rjsf-remove-optional-data",
|
|
660
|
+
onClick: onRemoveClick,
|
|
661
|
+
title: label
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
return /* @__PURE__ */ jsxRuntime.jsx("em", { id, children: label });
|
|
666
|
+
}
|
|
626
667
|
function TitleField(props) {
|
|
627
|
-
const { id, title } = props;
|
|
628
|
-
|
|
668
|
+
const { id, title, optionalDataControl } = props;
|
|
669
|
+
let heading = title ? /* @__PURE__ */ jsxRuntime.jsx(core.Title, { id, order: 3, fw: "normal", children: title }) : null;
|
|
670
|
+
if (optionalDataControl) {
|
|
671
|
+
heading = /* @__PURE__ */ jsxRuntime.jsxs(core.Grid, { children: [
|
|
672
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: "auto", children: heading }),
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: "content", children: optionalDataControl })
|
|
674
|
+
] });
|
|
675
|
+
}
|
|
676
|
+
return heading;
|
|
629
677
|
}
|
|
630
678
|
function WrapIfAdditionalTemplate(props) {
|
|
631
679
|
const {
|
|
@@ -712,6 +760,7 @@
|
|
|
712
760
|
FieldHelpTemplate,
|
|
713
761
|
GridTemplate,
|
|
714
762
|
ObjectFieldTemplate,
|
|
763
|
+
OptionalDataControlsTemplate,
|
|
715
764
|
TitleFieldTemplate: TitleField,
|
|
716
765
|
WrapIfAdditionalTemplate,
|
|
717
766
|
MultiSchemaFieldTemplate
|
|
@@ -6,15 +6,15 @@ import { Fieldset, Box, Group } from '@mantine/core';
|
|
|
6
6
|
* @param props - The `ArrayFieldItemTemplateType` props for the component
|
|
7
7
|
*/
|
|
8
8
|
export default function ArrayFieldTemplate(props) {
|
|
9
|
-
const { canAdd, className, disabled, fieldPathId, items, onAddClick, readonly, required, schema, uiSchema, title, registry, } = props;
|
|
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
12
|
const ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
13
13
|
const ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
14
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
14
15
|
// Button templates are not overridden in the uiSchema
|
|
15
16
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
16
|
-
const legend = (uiOptions.title || title) && (_jsx(ArrayFieldTitleTemplate, { fieldPathId: fieldPathId, required: required, title: uiOptions.title || title, schema: schema, uiSchema: uiSchema, registry: registry }));
|
|
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 })),
|
|
18
|
-
items.map(({ key, ...itemProps }) => (_jsx(ArrayFieldItemTemplate, { ...itemProps }, key))) }), 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' }) }))] }));
|
|
17
|
+
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.map(({ key, ...itemProps }) => (_jsx(ArrayFieldItemTemplate, { ...itemProps }, key)))] }), 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
19
|
}
|
|
20
20
|
//# 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,EAGZ,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,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,sBAAsB,GAAG,WAAW,CACxC,wBAAwB,EACxB,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,uBAAuB,GAAG,WAAW,CACzC,yBAAyB,EACzB,QAAQ,EACR,SAAS,CACV,CAAC;IACF,sDAAsD;IACtD,MAAM,EACJ,eAAe,EAAE,EAAE,SAAS,EAAE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AE,QAAQ,IAAI,QAAQ,EAC9B,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAC,IAAI,GACb,GACI,CACT,IACQ,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -8,17 +8,18 @@ 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, onAddClick, readonly, required, schema, uiSchema, fieldPathId, formData, registry, } = props;
|
|
11
|
+
const { title, description, disabled, properties, optionalDataControl, onAddClick, 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);
|
|
15
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
15
16
|
// Button templates are not overridden in the uiSchema
|
|
16
17
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
17
18
|
const gridCols = (typeof (uiOptions === null || uiOptions === void 0 ? void 0 : uiOptions.gridCols) === 'number' && (uiOptions === null || uiOptions === void 0 ? void 0 : uiOptions.gridCols)) || undefined;
|
|
18
19
|
const gridSpacing = uiOptions === null || uiOptions === void 0 ? void 0 : uiOptions.gridSpacing;
|
|
19
20
|
const gridVerticalSpacing = uiOptions === null || uiOptions === void 0 ? void 0 : uiOptions.gridVerticalSpacing;
|
|
20
|
-
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 })), description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(fieldPathId), description: description, schema: schema, uiSchema: uiSchema, registry: registry })),
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
.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: onAddClick(schema), className: 'rjsf-object-property-expand', uiSchema: uiSchema, registry: registry }) }))] }));
|
|
23
24
|
}
|
|
24
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,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
+
/** The OptionalDataControlsTemplate renders one of three different states. If
|
|
3
|
+
* there is an `onAddClick()` function, it renders the "Add" button. If there is
|
|
4
|
+
* an `onRemoveClick()` function, it renders the "Remove" button. Otherwise it
|
|
5
|
+
* renders the "No data found" section. All of them use the `label` as either
|
|
6
|
+
* the `title` of buttons or simply outputting it.
|
|
7
|
+
*
|
|
8
|
+
* @param props - The `OptionalDataControlsTemplateProps` for the template
|
|
9
|
+
*/
|
|
10
|
+
export default function OptionalDataControlsTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: OptionalDataControlsTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import AddButton from './ButtonTemplates/AddButton';
|
|
3
|
+
import { RemoveButton } from './ButtonTemplates/IconButton';
|
|
4
|
+
/** The OptionalDataControlsTemplate renders one of three different states. If
|
|
5
|
+
* there is an `onAddClick()` function, it renders the "Add" button. If there is
|
|
6
|
+
* an `onRemoveClick()` function, it renders the "Remove" button. Otherwise it
|
|
7
|
+
* renders the "No data found" section. All of them use the `label` as either
|
|
8
|
+
* the `title` of buttons or simply outputting it.
|
|
9
|
+
*
|
|
10
|
+
* @param props - The `OptionalDataControlsTemplateProps` for the template
|
|
11
|
+
*/
|
|
12
|
+
export default function OptionalDataControlsTemplate(props) {
|
|
13
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
14
|
+
if (onAddClick) {
|
|
15
|
+
return (_jsx(AddButton, { id: id, registry: registry, icon: 'plus', className: 'rjsf-add-optional-data', onClick: onAddClick, title: label }));
|
|
16
|
+
}
|
|
17
|
+
else if (onRemoveClick) {
|
|
18
|
+
return (_jsx(RemoveButton, { id: id, registry: registry, icon: 'remove', className: 'rjsf-remove-optional-data', onClick: onRemoveClick, title: label }));
|
|
19
|
+
}
|
|
20
|
+
return _jsx("em", { id: id, children: label });
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=OptionalDataControlsTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionalDataControlsTemplate.js","sourceRoot":"","sources":["../../src/templates/OptionalDataControlsTemplate.tsx"],"names":[],"mappings":";AAEA,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAIlD,KAAiD;IACjD,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACjE,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CACL,KAAC,SAAS,IACR,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,wBAAwB,EAClC,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;IACJ,CAAC;SAAM,IAAI,aAAa,EAAE,CAAC;QACzB,OAAO,CACL,KAAC,YAAY,IACX,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,2BAA2B,EACrC,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;IACJ,CAAC;IACD,OAAO,aAAI,EAAE,EAAE,EAAE,YAAG,KAAK,GAAM,CAAC;AAClC,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Title } from '@mantine/core';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Grid, Title } from '@mantine/core';
|
|
3
3
|
/** The `TitleField` is the template to use to render the title of a field
|
|
4
4
|
*
|
|
5
5
|
* @param props - The `TitleFieldProps` for this component
|
|
6
6
|
*/
|
|
7
7
|
export default function TitleField(props) {
|
|
8
|
-
const { id, title } = props;
|
|
9
|
-
|
|
8
|
+
const { id, title, optionalDataControl } = props;
|
|
9
|
+
let heading = title ? (_jsx(Title, { id: id, order: 3, fw: 'normal', children: title })) : null;
|
|
10
|
+
if (optionalDataControl) {
|
|
11
|
+
heading = (_jsxs(Grid, { children: [_jsx(Grid.Col, { span: 'auto', children: heading }), _jsx(Grid.Col, { span: 'content', children: optionalDataControl })] }));
|
|
12
|
+
}
|
|
13
|
+
return heading;
|
|
10
14
|
}
|
|
11
15
|
//# sourceMappingURL=TitleField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TitleField.js","sourceRoot":"","sources":["../../src/templates/TitleField.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"TitleField.js","sourceRoot":"","sources":["../../src/templates/TitleField.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,KAA+B;IAE/B,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IACjD,IAAI,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CACpB,KAAC,KAAK,IAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAC,QAAQ,YACjC,KAAK,GACA,CACT,CAAC,CAAC,CAAC,IAAI,CAAC;IACT,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,GAAG,CACR,MAAC,IAAI,eACH,KAAC,IAAI,CAAC,GAAG,IAAC,IAAI,EAAC,MAAM,YAAE,OAAO,GAAY,EAC1C,KAAC,IAAI,CAAC,GAAG,IAAC,IAAI,EAAC,SAAS,YAAE,mBAAmB,GAAY,IACpD,CACR,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/lib/templates/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import FieldTemplate from './FieldTemplate';
|
|
|
10
10
|
import FieldHelpTemplate from './FieldHelpTemplate';
|
|
11
11
|
import GridTemplate from './GridTemplate';
|
|
12
12
|
import ObjectFieldTemplate from './ObjectFieldTemplate';
|
|
13
|
+
import OptionalDataControlsTemplate from './OptionalDataControlsTemplate';
|
|
13
14
|
import TitleField from './TitleField';
|
|
14
15
|
import WrapIfAdditionalTemplate from './WrapIfAdditionalTemplate';
|
|
15
16
|
import MultiSchemaFieldTemplate from './MultiSchemaFieldTemplate';
|
|
@@ -27,6 +28,7 @@ export function generateTemplates() {
|
|
|
27
28
|
FieldHelpTemplate,
|
|
28
29
|
GridTemplate,
|
|
29
30
|
ObjectFieldTemplate,
|
|
31
|
+
OptionalDataControlsTemplate,
|
|
30
32
|
TitleFieldTemplate: TitleField,
|
|
31
33
|
WrapIfAdditionalTemplate,
|
|
32
34
|
MultiSchemaFieldTemplate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD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