@rjsf/mui 6.4.2 → 6.5.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/README.md +25 -0
- package/dist/index.cjs +353 -214
- package/dist/index.cjs.map +4 -4
- package/dist/mui.esm.js +354 -185
- package/dist/mui.esm.js.map +4 -4
- package/dist/mui.umd.js +293 -165
- package/lib/AddButton/AddButton.js +12 -2
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +22 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +3 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +20 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +3 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +17 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +9 -4
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +13 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +3 -1
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +17 -2
- package/lib/CheckboxesWidget/CheckboxesWidget.js +12 -7
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +10 -1
- package/lib/DescriptionField/DescriptionField.js +6 -1
- package/lib/DescriptionField/DescriptionField.js.map +1 -1
- package/lib/ErrorList/ErrorList.d.ts +29 -2
- package/lib/ErrorList/ErrorList.js +7 -4
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +16 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +8 -4
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +10 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +6 -2
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +13 -1
- package/lib/FieldTemplate/FieldTemplate.js +3 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/IconButton/IconButton.js +12 -2
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +13 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +6 -2
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +16 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +4 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +3 -3
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +17 -2
- package/lib/RadioWidget/RadioWidget.js +13 -9
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +10 -1
- package/lib/RangeWidget/RangeWidget.js +3 -1
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +14 -3
- package/lib/SelectWidget/SelectWidget.js +26 -19
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +13 -1
- package/lib/SubmitButton/SubmitButton.js +5 -2
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/TitleField/TitleField.d.ts +24 -2
- package/lib/TitleField/TitleField.js +9 -4
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +16 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +7 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.d.ts +9 -0
- package/lib/util.js +24 -0
- package/lib/util.js.map +1 -0
- package/package.json +7 -7
- package/src/AddButton/AddButton.tsx +21 -3
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +39 -9
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +30 -8
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +29 -5
- package/src/CheckboxWidget/CheckboxWidget.tsx +20 -2
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +51 -23
- package/src/DescriptionField/DescriptionField.tsx +25 -3
- package/src/ErrorList/ErrorList.tsx +52 -15
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +34 -8
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +30 -3
- package/src/FieldTemplate/FieldTemplate.tsx +26 -4
- package/src/IconButton/IconButton.tsx +21 -2
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +28 -6
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +25 -5
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -1
- package/src/RadioWidget/RadioWidget.tsx +43 -26
- package/src/RangeWidget/RangeWidget.tsx +16 -1
- package/src/SelectWidget/SelectWidget.tsx +71 -49
- package/src/SubmitButton/SubmitButton.tsx +36 -5
- package/src/TitleField/TitleField.tsx +54 -16
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +39 -5
- package/src/util.ts +30 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { RichHelp } from '@rjsf/core';
|
|
3
|
-
import { helpId } from '@rjsf/utils';
|
|
3
|
+
import { helpId, getUiOptions, } from '@rjsf/utils';
|
|
4
4
|
import FormHelperText from '@mui/material/FormHelperText';
|
|
5
|
+
import { getMuiProps } from '../util.js';
|
|
5
6
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
6
7
|
*
|
|
7
8
|
* @param props - The `FieldHelpProps` to be rendered
|
|
@@ -11,6 +12,9 @@ export default function FieldHelpTemplate(props) {
|
|
|
11
12
|
if (!help) {
|
|
12
13
|
return null;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
16
|
+
const muiProps = getMuiProps(uiOptions);
|
|
17
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
18
|
+
return (_jsx(FormHelperText, { component: 'div', id: helpId(fieldPathId), style: { marginTop: '5px' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.helpFormHelperText, children: _jsx(RichHelp, { help: help, registry: registry, uiSchema: uiSchema }) }));
|
|
15
19
|
}
|
|
16
20
|
//# sourceMappingURL=FieldHelpTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldHelpTemplate.js","sourceRoot":"","sources":["../../src/FieldHelpTemplate/FieldHelpTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"FieldHelpTemplate.js","sourceRoot":"","sources":["../../src/FieldHelpTemplate/FieldHelpTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,MAAM,EAKN,YAAY,GAEb,MAAM,aAAa,CAAC;AACrB,OAAO,cAAuC,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAWtC;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAIvC,KAA8B;IAC9B,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACxD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,WAAW,CAAqC,SAAS,CAAC,CAAC;IAC5E,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IAEjD,OAAO,CACL,KAAC,cAAc,IACb,SAAS,EAAC,KAAK,EACf,EAAE,EAAE,MAAM,CAAC,WAAW,CAAC,EACvB,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KACvB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,kBAAkB,YAEpC,KAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,GACjD,CAClB,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormControlProps } from '@mui/material/FormControl';
|
|
2
|
+
import { TypographyProps } from '@mui/material/Typography';
|
|
3
|
+
import { FieldTemplateProps, FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
4
|
+
/** Properties available for the `rjsfSlotProps` target of the FieldTemplate. */
|
|
5
|
+
export interface FieldTemplateMuiProps extends GenericObjectType {
|
|
6
|
+
/** RJSF-specific slot props for targeting child elements of the FieldTemplate. */
|
|
7
|
+
rjsfSlotProps?: {
|
|
8
|
+
/** Props applied to the MUI `FormControl` wrapping the field. */
|
|
9
|
+
fieldFormControl?: FormControlProps;
|
|
10
|
+
/** Props applied to the MUI `Typography` element used for description. */
|
|
11
|
+
fieldTypography?: TypographyProps;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
2
14
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
3
15
|
* content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.
|
|
4
16
|
*
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import FormControl from '@mui/material/FormControl';
|
|
3
3
|
import Typography from '@mui/material/Typography';
|
|
4
4
|
import { getTemplate, getUiOptions, } from '@rjsf/utils';
|
|
5
|
+
import { getMuiProps } from '../util.js';
|
|
5
6
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
6
7
|
* content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.
|
|
7
8
|
*
|
|
@@ -15,6 +16,7 @@ export default function FieldTemplate(props) {
|
|
|
15
16
|
return _jsx("div", { style: { display: 'none' }, children: children });
|
|
16
17
|
}
|
|
17
18
|
const isCheckbox = uiOptions.widget === 'checkbox';
|
|
18
|
-
|
|
19
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
|
|
20
|
+
return (_jsx(WrapIfAdditionalTemplate, { classNames: classNames, style: style, disabled: disabled, id: id, label: label, displayLabel: displayLabel, rawDescription: rawDescription, onKeyRename: onKeyRename, onKeyRenameBlur: onKeyRenameBlur, onRemoveProperty: onRemoveProperty, readonly: readonly, required: required, schema: schema, uiSchema: uiSchema, registry: registry, children: _jsxs(FormControl, { fullWidth: true, error: rawErrors.length ? true : false, required: required, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldFormControl, sx: otherMuiProps.sx, className: otherMuiProps.className, children: [children, displayLabel && !isCheckbox && rawDescription ? (_jsx(Typography, { variant: 'caption', color: 'textSecondary', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldTypography, children: description })) : null, errors, help] }) }));
|
|
19
21
|
}
|
|
20
22
|
//# sourceMappingURL=FieldTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldTemplate.js","sourceRoot":"","sources":["../../src/FieldTemplate/FieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FieldTemplate.js","sourceRoot":"","sources":["../../src/FieldTemplate/FieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,WAAiC,MAAM,2BAA2B,CAAC;AAC1E,OAAO,UAA+B,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAML,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAatC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAInC,KAAkC;IAClC,MAAM,EACJ,EAAE,EACF,QAAQ,EACR,UAAU,EACV,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,KAAK,EACL,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,MAAM,EACN,IAAI,EACJ,WAAW,EACX,cAAc,EACd,MAAM,EACN,QAAQ,EACR,QAAQ,GACT,GAAG,KAAK,CAAC;IACV,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,wBAAwB,GAAG,WAAW,CAC1C,0BAA0B,EAC1B,QAAQ,EACR,SAAS,CACV,CAAC;IAEF,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,cAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,YAAG,QAAQ,GAAO,CAAC;IAC3D,CAAC;IAED,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,KAAK,UAAU,CAAC;IAEnD,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,GAAG,WAAW,CAAiC,SAAS,CAAC,CAAC;IAEjH,OAAO,CACL,KAAC,wBAAwB,IACvB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,YAElB,MAAC,WAAW,IACV,SAAS,EAAE,IAAI,EACf,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EACtC,QAAQ,EAAE,QAAQ,KACd,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,gBAAgB,EAClC,EAAE,EAAE,aAAa,CAAC,EAAE,EACpB,SAAS,EAAE,aAAa,CAAC,SAAS,aAEjC,QAAQ,EACR,YAAY,IAAI,CAAC,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC,CAC/C,KAAC,UAAU,IAAC,OAAO,EAAC,SAAS,EAAC,KAAK,EAAC,eAAe,KAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,eAAe,YAClF,WAAW,GACD,CACd,CAAC,CAAC,CAAC,IAAI,EACP,MAAM,EACN,IAAI,IACO,GACW,CAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -5,10 +5,20 @@ import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward';
|
|
|
5
5
|
import CopyIcon from '@mui/icons-material/ContentCopy';
|
|
6
6
|
import RemoveIcon from '@mui/icons-material/Remove';
|
|
7
7
|
import ClearIcon from '@mui/icons-material/Clear';
|
|
8
|
-
import { TranslatableString } from '@rjsf/utils';
|
|
8
|
+
import { TranslatableString, getUiOptions, } from '@rjsf/utils';
|
|
9
|
+
import { getMuiProps } from '../util.js';
|
|
9
10
|
export default function MuiIconButton(props) {
|
|
10
11
|
const { icon, color, uiSchema, registry, ...otherProps } = props;
|
|
11
|
-
|
|
12
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
13
|
+
const muiProps = getMuiProps(uiOptions, [
|
|
14
|
+
'color',
|
|
15
|
+
'disableFocusRipple',
|
|
16
|
+
'disableRipple',
|
|
17
|
+
'edge',
|
|
18
|
+
'size',
|
|
19
|
+
'sx',
|
|
20
|
+
]);
|
|
21
|
+
return (_jsx(IconButton, { ...muiProps, ...otherProps, size: 'small', color: color, children: icon }));
|
|
12
22
|
}
|
|
13
23
|
export function CopyButton(props) {
|
|
14
24
|
const { registry: { translateString }, } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../src/IconButton/IconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAqD,MAAM,0BAA0B,CAAC;AAC7F,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAClE,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../src/IconButton/IconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAqD,MAAM,0BAA0B,CAAC;AAC7F,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAClE,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAKL,kBAAkB,EAClB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,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AAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,KACnD,KAAK,EACT,IAAI,EAAE,KAAC,eAAe,IAAC,QAAQ,EAAC,OAAO,GAAG,GAC1C,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,KAA+B;IAE/B,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC1C,MAAM,EACJ,QAAQ,EAAE,EAAE,eAAe,EAAE,GAC9B,GAAG,UAAU,CAAC;IACf,OAAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,KACnD,UAAU,EACd,KAAK,EAAC,OAAO,EACb,IAAI,EAAE,KAAC,UAAU,IAAC,QAAQ,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,GAAI,GAC5E,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,KAA+B;IAE/B,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC1C,MAAM,EACJ,QAAQ,EAAE,EAAE,eAAe,EAAE,GAC9B,GAAG,UAAU,CAAC;IACf,OAAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,WAAW,CAAC,KAClD,UAAU,EACd,IAAI,EAAE,KAAC,SAAS,IAAC,QAAQ,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,GAAI,GAC3E,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BoxProps } from '@mui/material/Box';
|
|
2
|
+
import { FormControlProps } from '@mui/material/FormControl';
|
|
3
|
+
import { FormContextType, GenericObjectType, MultiSchemaFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
4
|
+
/** Properties available for the `rjsfSlotProps` target of the MultiSchemaFieldTemplate. */
|
|
5
|
+
export interface MultiSchemaFieldTemplateMuiProps extends GenericObjectType {
|
|
6
|
+
/** RJSF-specific slot props for targeting child elements of the MultiSchemaFieldTemplate. */
|
|
7
|
+
rjsfSlotProps?: {
|
|
8
|
+
/** Props applied to the wrapper `Box` container. */
|
|
9
|
+
multiBox?: BoxProps;
|
|
10
|
+
/** Props applied to the MUI `FormControl` wrapping the selector. */
|
|
11
|
+
multiFormControl?: FormControlProps;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
2
14
|
export default function MultiSchemaFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: MultiSchemaFieldTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Box from '@mui/material/Box';
|
|
3
3
|
import FormControl from '@mui/material/FormControl';
|
|
4
|
+
import { getUiOptions, } from '@rjsf/utils';
|
|
5
|
+
import { getMuiProps } from '../util.js';
|
|
4
6
|
export default function MultiSchemaFieldTemplate(props) {
|
|
5
|
-
const { optionSchemaField, selector } = props;
|
|
6
|
-
|
|
7
|
+
const { optionSchemaField, selector, uiSchema } = props;
|
|
8
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
9
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
10
|
+
return (_jsxs(Box, { sx: { mb: 2 }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.multiBox, children: [_jsx(FormControl, { fullWidth: true, sx: { mb: 2 }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.multiFormControl, children: selector }), optionSchemaField] }));
|
|
7
11
|
}
|
|
8
12
|
//# sourceMappingURL=MultiSchemaFieldTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSchemaFieldTemplate.js","sourceRoot":"","sources":["../../src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MultiSchemaFieldTemplate.js","sourceRoot":"","sources":["../../src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,GAAiB,MAAM,mBAAmB,CAAC;AAClD,OAAO,WAAiC,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAML,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAatC,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAI9C,KAA6C;IAC7C,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAExD,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,WAAW,CAA4C,SAAS,CAAC,CAAC;IAE1G,OAAO,CACL,MAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,aAC5C,KAAC,WAAW,IAAC,SAAS,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,gBAAgB,YACrE,QAAQ,GACG,EACb,iBAAiB,IACd,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GridProps } from '@mui/material/Grid';
|
|
2
|
+
import { FormContextType, GenericObjectType, ObjectFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
|
+
/** Properties available for the `rjsfSlotProps` target of the ObjectFieldTemplate. */
|
|
4
|
+
export interface ObjectFieldTemplateMuiProps extends GenericObjectType {
|
|
5
|
+
/** RJSF-specific slot props for targeting child elements of the ObjectFieldTemplate. */
|
|
6
|
+
rjsfSlotProps?: {
|
|
7
|
+
/** Props applied to the outermost `Grid` container wrapping all object properties. */
|
|
8
|
+
objectGridContainer?: GridProps;
|
|
9
|
+
/** Props applied to the `Grid` item wrapping each individual object property. */
|
|
10
|
+
objectGridItem?: GridProps;
|
|
11
|
+
/** Props applied to the wrapper `Grid` container next to the Add Button (when expandable). */
|
|
12
|
+
objectAddButtonGridContainer?: GridProps;
|
|
13
|
+
/** Props applied to the `Grid` item containing the Add Button. */
|
|
14
|
+
objectAddButtonGridItem?: GridProps;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
2
17
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
3
18
|
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
4
19
|
* the properties.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import Grid from '@mui/material/Grid';
|
|
3
3
|
import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, buttonId, } from '@rjsf/utils';
|
|
4
|
+
import { getMuiProps } from '../util.js';
|
|
4
5
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
5
6
|
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
6
7
|
* the properties.
|
|
@@ -15,9 +16,10 @@ export default function ObjectFieldTemplate(props) {
|
|
|
15
16
|
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
16
17
|
// Button templates are not overridden in the uiSchema
|
|
17
18
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
18
|
-
|
|
19
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
20
|
+
return (_jsxs(_Fragment, { 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(Grid, { container: true, spacing: 2, style: { marginTop: '10px' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.objectGridContainer, children: [!showOptionalDataControlInTitle ? optionalDataControl : undefined, properties.map((element, index) =>
|
|
19
21
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
20
22
|
// itself would otherwise still take up space.
|
|
21
|
-
element.hidden ? (element.content) : (_jsx(Grid, { size: { xs: 12 }, style: { marginBottom: '10px' }, children: element.content }, index)))] }), canExpand(schema, uiSchema, formData) && (_jsx(Grid, { container: true, justifyContent: 'flex-end', children: _jsx(Grid, { children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-object-property-expand', onClick: onAddProperty, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }))] }));
|
|
23
|
+
element.hidden ? (element.content) : (_jsx(Grid, { size: { xs: 12 }, style: { marginBottom: '10px' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.objectGridItem, children: element.content }, index)))] }), canExpand(schema, uiSchema, formData) && (_jsx(Grid, { container: true, justifyContent: 'flex-end', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.objectAddButtonGridContainer, children: _jsx(Grid, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.objectAddButtonGridItem, children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-object-property-expand', onClick: onAddProperty, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }))] }));
|
|
22
24
|
}
|
|
23
25
|
//# sourceMappingURL=ObjectFieldTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectFieldTemplate.js","sourceRoot":"","sources":["../../src/ObjectFieldTemplate/ObjectFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ObjectFieldTemplate.js","sourceRoot":"","sources":["../../src/ObjectFieldTemplate/ObjectFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAML,SAAS,EACT,aAAa,EACb,WAAW,EACX,YAAY,EACZ,OAAO,EACP,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiBtC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAIzC,KAAwC;IACxC,MAAM,EACJ,WAAW,EACX,KAAK,EACL,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,MAAM,EACN,QAAQ,EACR,mBAAmB,EACnB,aAAa,EACb,QAAQ,GACT,GAAG,KAAK,CAAC;IACV,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,kBAAkB,GAAG,WAAW,CAAgC,oBAAoB,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACjH,MAAM,wBAAwB,GAAG,WAAW,CAC1C,0BAA0B,EAC1B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,8BAA8B,GAAG,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC;IAC9D,sDAAsD;IACtD,MAAM,EACJ,eAAe,EAAE,EAAE,SAAS,EAAE,GAC/B,GAAG,QAAQ,CAAC,SAAS,CAAC;IAEvB,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,WAAW,CAAuC,SAAS,CAAC,CAAC;IAErG,OAAO,CACL,8BACG,KAAK,IAAI,CACR,KAAC,kBAAk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AAZ,YAAY,CAAE,4BAA4B,YACtF,KAAC,IAAI,OAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,uBAAuB,YAC7C,KAAC,SAAS,IACR,EAAE,EAAE,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,EAChC,SAAS,EAAC,6BAA6B,EACvC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,GACG,GACF,CACR,IACA,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -10,12 +10,12 @@ import AddIcon from '@mui/icons-material/Add';
|
|
|
10
10
|
* @param props - The `OptionalDataControlsTemplateProps` for the template
|
|
11
11
|
*/
|
|
12
12
|
export default function OptionalDataControlsTemplate(props) {
|
|
13
|
-
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
13
|
+
const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;
|
|
14
14
|
if (onAddClick) {
|
|
15
|
-
return (_jsx(IconButton, { id: id, registry: registry, className: 'rjsf-add-optional-data', onClick: onAddClick, title: label, icon: _jsx(AddIcon, { fontSize: 'small' }) }));
|
|
15
|
+
return (_jsx(IconButton, { id: id, registry: registry, uiSchema: uiSchema, className: 'rjsf-add-optional-data', onClick: onAddClick, title: label, icon: _jsx(AddIcon, { fontSize: 'small' }) }));
|
|
16
16
|
}
|
|
17
17
|
else if (onRemoveClick) {
|
|
18
|
-
return (_jsx(RemoveButton, { id: id, registry: registry, className: 'rjsf-remove-optional-data', onClick: onRemoveClick, title: label }));
|
|
18
|
+
return (_jsx(RemoveButton, { id: id, registry: registry, uiSchema: uiSchema, className: 'rjsf-remove-optional-data', onClick: onRemoveClick, title: label }));
|
|
19
19
|
}
|
|
20
20
|
return _jsx("em", { id: id, children: label });
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionalDataControlsTemplate.js","sourceRoot":"","sources":["../../src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx"],"names":[],"mappings":";AAEA,OAAO,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAE9C;;;;;;;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;
|
|
1
|
+
{"version":3,"file":"OptionalDataControlsTemplate.js","sourceRoot":"","sources":["../../src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx"],"names":[],"mappings":";AAEA,OAAO,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAIlD,KAAiD;IACjD,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3E,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CACL,KAAC,UAAU,IACT,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAC,wBAAwB,EAClC,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,KAAC,OAAO,IAAC,QAAQ,EAAC,OAAO,GAAG,GAClC,CACH,CAAC;IACJ,CAAC;SAAM,IAAI,aAAa,EAAE,CAAC;QACzB,OAAO,CACL,KAAC,YAAY,IACX,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,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,7 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormControlLabelProps } from '@mui/material/FormControlLabel';
|
|
2
|
+
import { RadioProps } from '@mui/material/Radio';
|
|
3
|
+
import { RadioGroupProps } from '@mui/material/RadioGroup';
|
|
4
|
+
import { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
5
|
+
/** Properties available for the `rjsfSlotProps` target of the RadioWidget. */
|
|
6
|
+
export interface RadioWidgetMuiProps extends GenericObjectType {
|
|
7
|
+
/** RJSF-specific slot props for targeting child elements of the RadioWidget. */
|
|
8
|
+
rjsfSlotProps?: {
|
|
9
|
+
/** Props applied to the `RadioGroup` component. */
|
|
10
|
+
radioGroup?: RadioGroupProps;
|
|
11
|
+
/** Props applied to the individual `Radio` components. */
|
|
12
|
+
radio?: RadioProps;
|
|
13
|
+
/** Props applied to the `FormControlLabel` components wrapping each radio button. */
|
|
14
|
+
formControlLabel?: FormControlLabelProps;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
2
17
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
3
18
|
* It is typically used with a string property constrained with enum options.
|
|
4
19
|
*
|
|
5
20
|
* @param props - The `WidgetProps` for this component
|
|
6
21
|
*/
|
|
7
|
-
export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
22
|
+
export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
3
4
|
import FormLabel from '@mui/material/FormLabel';
|
|
4
5
|
import Radio from '@mui/material/Radio';
|
|
5
6
|
import RadioGroup from '@mui/material/RadioGroup';
|
|
6
|
-
import { ariaDescribedByIds,
|
|
7
|
+
import { ariaDescribedByIds, enumOptionSelectedValue, enumOptionValueDecoder, enumOptionValueEncoder, getOptionValueFormat, labelValue, optionId, } from '@rjsf/utils';
|
|
8
|
+
import { getMuiProps } from '../util.js';
|
|
7
9
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
8
10
|
* It is typically used with a string property constrained with enum options.
|
|
9
11
|
*
|
|
10
12
|
* @param props - The `WidgetProps` for this component
|
|
11
13
|
*/
|
|
12
|
-
export default function RadioWidget(
|
|
13
|
-
|
|
14
|
+
export default function RadioWidget(props) {
|
|
15
|
+
const { id, htmlName, options, value, required, disabled, readonly, label, hideLabel, onChange, onBlur, onFocus } = props;
|
|
14
16
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
17
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
18
|
+
const _onChange = (_, value) => onChange(enumOptionValueDecoder(value, enumOptions, optionValueFormat, emptyValue));
|
|
19
|
+
const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
20
|
+
const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
18
21
|
const row = options ? options.inline : false;
|
|
19
|
-
const
|
|
20
|
-
|
|
22
|
+
const selectValue = enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, '');
|
|
23
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
24
|
+
return (_jsxs(_Fragment, { children: [labelValue(_jsx(FormLabel, { required: required, htmlFor: id, children: label || undefined }), hideLabel), _jsx(RadioGroup, { ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.radioGroup, id: id, name: htmlName || id, value: selectValue, row: row, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id), children: Array.isArray(enumOptions) &&
|
|
21
25
|
enumOptions.map((option, index) => {
|
|
22
26
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
23
|
-
const radio = (
|
|
27
|
+
const radio = (_createElement(FormControlLabel, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formControlLabel, control: _jsx(Radio, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.radio, name: htmlName || id, id: optionId(id, index), color: 'primary' }), label: option.label, value: enumOptionValueEncoder(option.value, index, optionValueFormat), key: index, disabled: disabled || itemDisabled || readonly }));
|
|
24
28
|
return radio;
|
|
25
29
|
}) })] }));
|
|
26
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioWidget.js","sourceRoot":"","sources":["../../src/RadioWidget/RadioWidget.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RadioWidget.js","sourceRoot":"","sources":["../../src/RadioWidget/RadioWidget.tsx"],"names":[],"mappings":";;AACA,OAAO,gBAA2C,MAAM,gCAAgC,CAAC;AACzF,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,KAAqB,MAAM,qBAAqB,CAAC;AACxD,OAAO,UAA+B,MAAM,0BAA0B,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,QAAQ,GAMT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAetC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,KAA2B;IAE3B,MAAM,EAAE,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|
1
|
-
import {
|
|
1
|
+
import { SliderProps } from '@mui/material/Slider';
|
|
2
|
+
import { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
3
|
+
/** Properties available for the `rjsfSlotProps` target of the RangeWidget. */
|
|
4
|
+
export interface RangeWidgetMuiProps extends GenericObjectType {
|
|
5
|
+
/** RJSF-specific slot props for targeting child elements of the RangeWidget. */
|
|
6
|
+
rjsfSlotProps?: {
|
|
7
|
+
/** Props applied to the MUI `Slider` component. */
|
|
8
|
+
slider?: SliderProps;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
2
11
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
3
12
|
* in a div, with the value along side it.
|
|
4
13
|
*
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import FormLabel from '@mui/material/FormLabel';
|
|
3
3
|
import Slider from '@mui/material/Slider';
|
|
4
4
|
import { ariaDescribedByIds, labelValue, rangeSpec, } from '@rjsf/utils';
|
|
5
|
+
import { getMuiProps } from '../util.js';
|
|
5
6
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
6
7
|
* in a div, with the value along side it.
|
|
7
8
|
*
|
|
@@ -15,6 +16,7 @@ export default function RangeWidget(props) {
|
|
|
15
16
|
};
|
|
16
17
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
17
18
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
18
|
-
|
|
19
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
20
|
+
return (_jsxs(_Fragment, { children: [labelValue(_jsx(FormLabel, { required: required, htmlFor: id, children: label || undefined }), hideLabel), _jsx(Slider, { disabled: disabled || readonly, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, valueLabelDisplay: 'auto', ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.slider, ...sliderProps, "aria-describedby": ariaDescribedByIds(id) })] }));
|
|
19
21
|
}
|
|
20
22
|
//# sourceMappingURL=RangeWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeWidget.js","sourceRoot":"","sources":["../../src/RangeWidget/RangeWidget.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"RangeWidget.js","sourceRoot":"","sources":["../../src/RangeWidget/RangeWidget.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,MAAuB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,UAAU,EAMV,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAWtC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,KAA2B;IAE3B,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,GAC7G,KAAK,CAAC;IACR,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,SAAS,CAAI,MAAM,CAAC,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,CAAC,CAAM,EAAE,KAAyB,EAAE,EAAE;QACtD,QAAQ,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,EAAgC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IACjG,MAAM,QAAQ,GAAG,CAAC,EAAE,MAAM,EAAgC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAEnG,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,GAAG,WAAW,CAA+B,OAAO,CAAC,CAAC;IAE7G,OAAO,CACL,8BACG,UAAU,CACT,KAAC,SAAS,IAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,YACvC,KAAK,IAAI,SAAS,GACT,EACZ,SAAS,CACV,EACD,KAAC,MAAM,IACL,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,iBAAiB,EAAC,MAAM,KACpB,aAAa,KACb,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,KACpB,WAAW,sBACG,kBAAkB,CAAC,EAAE,CAAC,GACxC,IACD,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InputLabelProps as MuiInputLabelProps } from '@mui/material/InputLabel';
|
|
2
|
+
import { SelectProps as MuiSelectProps } from '@mui/material/Select';
|
|
3
|
+
import { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
4
|
+
/** Properties available for the `rjsfSlotProps` target of the SelectWidget. */
|
|
5
|
+
export interface SelectWidgetMuiProps extends GenericObjectType {
|
|
6
|
+
/** RJSF-specific slot props for targeting child elements of the SelectWidget. */
|
|
7
|
+
rjsfSlotProps?: {
|
|
8
|
+
/** Props applied to the `InputLabel` element. */
|
|
9
|
+
inputLabel?: MuiInputLabelProps;
|
|
10
|
+
/** Props applied to the `Select` element. */
|
|
11
|
+
select?: MuiSelectProps;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
2
14
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
3
15
|
* It is typically used with string properties constrained with enum options.
|
|
4
16
|
*
|
|
5
17
|
* @param props - The `WidgetProps` for this component
|
|
6
18
|
*/
|
|
7
|
-
export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
8
|
-
htmlName, options, label, hideLabel, required, disabled, placeholder, readonly, value, multiple, autofocus, onChange, onBlur, onFocus, errorSchema, rawErrors, registry, uiSchema, hideError, ...textFieldProps }: WidgetProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import MenuItem from '@mui/material/MenuItem';
|
|
3
3
|
import TextField from '@mui/material/TextField';
|
|
4
|
-
import { ariaDescribedByIds,
|
|
4
|
+
import { ariaDescribedByIds, enumOptionSelectedValue, enumOptionValueDecoder, enumOptionValueEncoder, getOptionValueFormat, labelValue, } from '@rjsf/utils';
|
|
5
|
+
import { getMuiProps } from '../util.js';
|
|
5
6
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
6
7
|
* It is typically used with string properties constrained with enum options.
|
|
7
8
|
*
|
|
8
9
|
* @param props - The `WidgetProps` for this component
|
|
9
10
|
*/
|
|
10
|
-
export default function SelectWidget({
|
|
11
|
-
|
|
11
|
+
export default function SelectWidget(props) {
|
|
12
|
+
const { schema, id, name, // remove this from textFieldProps
|
|
13
|
+
htmlName, options, label, hideLabel, required, disabled, placeholder, readonly, value, multiple, autofocus, onChange, onBlur, onFocus, errorSchema, rawErrors = [], registry, uiSchema, hideError, ...textFieldProps } = props;
|
|
12
14
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
15
|
+
const optionValueFormat = getOptionValueFormat(options);
|
|
16
|
+
const isMultiple = typeof multiple === 'undefined' ? false : !!multiple;
|
|
17
|
+
const emptyValue = isMultiple ? [] : '';
|
|
18
|
+
const isEmpty = typeof value === 'undefined' || (isMultiple && value.length < 1) || (!isMultiple && value === emptyValue);
|
|
19
|
+
const _onChange = ({ target: { value } }) => onChange(enumOptionValueDecoder(value, enumOptions, optionValueFormat, optEmptyVal));
|
|
20
|
+
const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
21
|
+
const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
22
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
20
23
|
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
|
|
21
|
-
const showPlaceholderOption = !
|
|
22
|
-
return (_jsxs(TextField, { id: id, name: htmlName || id, label: labelValue(label || undefined, hideLabel, undefined), value:
|
|
23
|
-
: true,
|
|
24
|
-
...
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const showPlaceholderOption = !isMultiple && schema.default === undefined;
|
|
25
|
+
return (_jsxs(TextField, { id: id, name: htmlName || id, label: labelValue(label || undefined, hideLabel, undefined), value: enumOptionSelectedValue(value, enumOptions, isMultiple, optionValueFormat, emptyValue), required: required, disabled: disabled || readonly, autoFocus: autofocus, autoComplete: autocomplete, placeholder: placeholder, error: rawErrors.length > 0, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, ...{ ...otherMuiProps, ...textFieldRemainingProps }, select // Apply this and the following props after the potential overrides defined in textFieldProps
|
|
26
|
+
: true, slotProps: {
|
|
27
|
+
...muiSlotProps,
|
|
28
|
+
inputLabel: {
|
|
29
|
+
...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel,
|
|
30
|
+
shrink: !isEmpty,
|
|
31
|
+
},
|
|
32
|
+
select: {
|
|
33
|
+
...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.select,
|
|
34
|
+
multiple,
|
|
35
|
+
},
|
|
29
36
|
}, "aria-describedby": ariaDescribedByIds(id), children: [showPlaceholderOption && _jsx(MenuItem, { value: '', children: placeholder }), Array.isArray(enumOptions) &&
|
|
30
37
|
enumOptions.map(({ value, label }, i) => {
|
|
31
38
|
const disabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1;
|
|
32
|
-
return (_jsx(MenuItem, { value:
|
|
39
|
+
return (_jsx(MenuItem, { value: enumOptionValueEncoder(value, i, optionValueFormat), disabled: disabled, children: label }, i));
|
|
33
40
|
})] }));
|
|
34
41
|
}
|
|
35
42
|
//# sourceMappingURL=SelectWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectWidget.js","sourceRoot":"","sources":["../../src/SelectWidget/SelectWidget.tsx"],"names":[],"mappings":";AACA,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,SAA6B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectWidget.js","sourceRoot":"","sources":["../../src/SelectWidget/SelectWidget.tsx"],"names":[],"mappings":";AACA,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,SAA6B,MAAM,yBAAyB,CAAC;AAGpE,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,GAMX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAatC;;;;GAIG;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AM,EAAE,CAAC,OAAO;aACjB;YACD,MAAM,EAAE;gBACN,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM;gBACvB,QAAQ;aACT;SACF,sBACiB,kBAAkB,CAAC,EAAE,CAAC,aAEvC,qBAAqB,IAAI,KAAC,QAAQ,IAAC,KAAK,EAAC,EAAE,YAAE,WAAW,GAAY,EACpE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;gBACzB,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAS,EAAE,EAAE;oBAC9C,MAAM,QAAQ,GAAY,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;oBAC5F,OAAO,CACL,KAAC,QAAQ,IAAS,KAAK,EAAE,sBAAsB,CAAC,KAAK,EAAE,CAAC,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,QAAQ,YAC7F,KAAK,IADO,CAAC,CAEL,CACZ,CAAC;gBACJ,CAAC,CAAC,IACM,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BoxProps } from '@mui/material/Box';
|
|
2
|
+
import { ButtonProps } from '@mui/material/Button';
|
|
3
|
+
import { GenericObjectType, FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
|
|
4
|
+
/** Properties available for the `rjsfSlotProps` target of the SubmitButton. */
|
|
5
|
+
export interface SubmitButtonMuiProps extends GenericObjectType {
|
|
6
|
+
/** RJSF-specific slot props for targeting child elements of the SubmitButton. */
|
|
7
|
+
rjsfSlotProps?: {
|
|
8
|
+
/** Props applied to the `Box` wrapper. */
|
|
9
|
+
submitBox?: BoxProps;
|
|
10
|
+
/** Props applied to the `Button` element. */
|
|
11
|
+
submitButton?: ButtonProps;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
2
14
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
3
15
|
*/
|
|
4
16
|
export default function SubmitButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ uiSchema }: SubmitButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import Box from '@mui/material/Box';
|
|
3
3
|
import Button from '@mui/material/Button';
|
|
4
|
-
import { getSubmitButtonOptions } from '@rjsf/utils';
|
|
4
|
+
import { getSubmitButtonOptions, getUiOptions, } from '@rjsf/utils';
|
|
5
|
+
import { getMuiProps } from '../util.js';
|
|
5
6
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
6
7
|
*/
|
|
7
8
|
export default function SubmitButton({ uiSchema }) {
|
|
@@ -9,6 +10,8 @@ export default function SubmitButton({ uiSchema }) {
|
|
|
9
10
|
if (norender) {
|
|
10
11
|
return null;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
14
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
|
|
15
|
+
return (_jsx(Box, { marginTop: 3, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.submitBox, children: _jsx(Button, { type: 'submit', variant: 'contained', color: 'primary', ...submitButtonProps, ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.submitButton, children: submitText }) }));
|
|
13
16
|
}
|
|
14
17
|
//# sourceMappingURL=SubmitButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitButton.js","sourceRoot":"","sources":["../../src/SubmitButton/SubmitButton.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SubmitButton.js","sourceRoot":"","sources":["../../src/SubmitButton/SubmitButton.tsx"],"names":[],"mappings":";AAAA,OAAO,GAAiB,MAAM,mBAAmB,CAAC;AAClD,OAAO,MAAuB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,sBAAsB,EAMtB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAatC;GACG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAIlC,EAAE,QAAQ,EAA8B;IACxC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,GAAG,EAAE,EAAE,GAAG,sBAAsB,CAAU,QAAQ,CAAC,CAAC;IAC1G,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,GAAG,WAAW,CAAgC,SAAS,CAAC,CAAC;IAEhH,OAAO,CACL,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,YAC5C,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,SAAS,KACX,iBAAiB,KACjB,aAAa,KACb,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,YAAY,YAE7B,UAAU,GACJ,GACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BoxProps } from '@mui/material/Box';
|
|
2
|
+
import { DividerProps } from '@mui/material/Divider';
|
|
3
|
+
import { GridProps } from '@mui/material/Grid';
|
|
4
|
+
import { TypographyProps } from '@mui/material/Typography';
|
|
5
|
+
import { FormContextType, GenericObjectType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
6
|
+
/** Properties available for the `rjsfSlotProps` target of the TitleField. */
|
|
7
|
+
export interface TitleFieldMuiProps extends GenericObjectType {
|
|
8
|
+
/** RJSF-specific slot props for targeting child elements of the TitleField. */
|
|
9
|
+
rjsfSlotProps?: {
|
|
10
|
+
/** Props applied to the `Box` wrapper. */
|
|
11
|
+
titleBox?: BoxProps;
|
|
12
|
+
/** Props applied to the `Divider` element. */
|
|
13
|
+
titleDivider?: DividerProps;
|
|
14
|
+
/** Props applied to the `Typography` element used for the title. */
|
|
15
|
+
titleTypography?: TypographyProps;
|
|
16
|
+
/** Props applied to the `Grid` container used when `optionalDataControl` is present. */
|
|
17
|
+
titleGridContainer?: GridProps;
|
|
18
|
+
/** Props applied to the `Grid` item containing the title. */
|
|
19
|
+
titleGridItem?: GridProps;
|
|
20
|
+
/** Props applied to the `Grid` item containing the `optionalDataControl`. */
|
|
21
|
+
titleOptionalDataGridItem?: GridProps;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
2
24
|
/** The `TitleField` is the template to use to render the title of a field
|
|
3
25
|
*
|
|
4
26
|
* @param props - The `TitleFieldProps` for this component
|
|
5
27
|
*/
|
|
6
|
-
export default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
28
|
+
export default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: TitleFieldProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|