@jsonforms/material-renderers 3.0.0 → 3.1.0-alpha.1
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/lib/controls/MaterialBooleanControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
- package/lib/controls/index.d.ts +2 -2
- package/lib/jsonforms-react-material.cjs.js +84 -17
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +85 -18
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/mui-controls/MuiCheckbox.d.ts +6 -1
- package/lib/mui-controls/MuiToggle.d.ts +6 -1
- package/package.json +23 -12
- package/src/additional/ListWithDetailMasterItem.tsx +1 -1
- package/src/complex/TableToolbar.tsx +3 -3
- package/src/controls/MaterialBooleanControl.tsx +84 -23
- package/src/controls/MaterialBooleanToggleControl.tsx +84 -23
- package/src/layouts/ArrayToolbar.tsx +2 -3
- package/src/mui-controls/MuiCheckbox.tsx +12 -5
- package/src/mui-controls/MuiToggle.tsx +12 -5
- package/docs/assets/css/main.css +0 -1
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -51
- package/docs/assets/js/search.json +0 -1
- package/docs/classes/combinatorproperties.html +0 -957
- package/docs/classes/materialanyofstringorenumcontrol.html +0 -822
- package/docs/classes/materialtablecontrol.html +0 -999
- package/docs/globals.html +0 -4492
- package/docs/index.html +0 -753
- package/docs/interfaces/ajvprops.html +0 -162
- package/docs/interfaces/arraylayouttoolbarprops.html +0 -253
- package/docs/interfaces/categorizationstate.html +0 -154
- package/docs/interfaces/categorizationstepperstate.html +0 -154
- package/docs/interfaces/combinatorpropertiesprops.html +0 -182
- package/docs/interfaces/deletedialogprops.html +0 -225
- package/docs/interfaces/dispatchpropsofexpandpanel.html +0 -296
- package/docs/interfaces/emptytableprops.html +0 -154
- package/docs/interfaces/expandpanelprops.html +0 -594
- package/docs/interfaces/inputref.html +0 -168
- package/docs/interfaces/jsonformstheme.html +0 -352
- package/docs/interfaces/materialcategorizationlayoutrendererprops.html +0 -460
- package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +0 -394
- package/docs/interfaces/materiallabelablelayoutrendererprops.html +0 -328
- package/docs/interfaces/materiallayoutrendererprops.html +0 -317
- package/docs/interfaces/materialtabletoolbarprops.html +0 -302
- package/docs/interfaces/muitextinputprops.html +0 -168
- package/docs/interfaces/nonemptycellcomponentprops.html +0 -266
- package/docs/interfaces/nonemptycellprops.html +0 -277
- package/docs/interfaces/nonemptyrowprops.html +0 -366
- package/docs/interfaces/ownoneofprops.html +0 -308
- package/docs/interfaces/ownpropsofexpandpanel.html +0 -397
- package/docs/interfaces/ownpropsofnonemptycell.html +0 -229
- package/docs/interfaces/statepropsofexpandpanel.html +0 -445
- package/docs/interfaces/tableheadercellprops.html +0 -154
- package/docs/interfaces/tablerowsprop.html +0 -330
- package/docs/interfaces/validationprops.html +0 -168
- package/docs/interfaces/withdeletedialogsupport.html +0 -170
- package/docs/interfaces/withinput.html +0 -154
- package/docs/interfaces/withoptionlabel.html +0 -230
- package/example/index.html +0 -16
- package/example/index.ts +0 -31
- package/rollup.config.js +0 -51
- package/stats.html +0 -3279
- package/test/renderers/MatchMediaMock.ts +0 -36
- package/test/renderers/MaterialAllOfRenderer.test.tsx +0 -114
- package/test/renderers/MaterialAnyOfRenderer.test.tsx +0 -310
- package/test/renderers/MaterialAnyOfStringOrEnumControl.test.tsx +0 -126
- package/test/renderers/MaterialArrayControl.test.tsx +0 -633
- package/test/renderers/MaterialArrayLayout.test.tsx +0 -528
- package/test/renderers/MaterialBooleanCell.test.tsx +0 -374
- package/test/renderers/MaterialBooleanToggleCell.test.tsx +0 -466
- package/test/renderers/MaterialBooleanToggleControl.test.tsx +0 -469
- package/test/renderers/MaterialCategorizationLayout.test.tsx +0 -458
- package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +0 -647
- package/test/renderers/MaterialDateCell.test.tsx +0 -303
- package/test/renderers/MaterialDateControl.test.tsx +0 -411
- package/test/renderers/MaterialDateTimeControl.test.tsx +0 -417
- package/test/renderers/MaterialEnumArrayRenderer.test.tsx +0 -207
- package/test/renderers/MaterialEnumCell.test.tsx +0 -88
- package/test/renderers/MaterialEnumControl.test.tsx +0 -75
- package/test/renderers/MaterialGroupLayout.test.tsx +0 -90
- package/test/renderers/MaterialInputControl.test.tsx +0 -370
- package/test/renderers/MaterialIntegerCell.test.tsx +0 -333
- package/test/renderers/MaterialLabelRenderer.test.tsx +0 -114
- package/test/renderers/MaterialLayouts.test.tsx +0 -542
- package/test/renderers/MaterialListWithDetailRenderer.test.tsx +0 -279
- package/test/renderers/MaterialNativeControl.test.tsx +0 -81
- package/test/renderers/MaterialNumberCell.test.tsx +0 -382
- package/test/renderers/MaterialObjectControl.test.tsx +0 -186
- package/test/renderers/MaterialOneOfEnumCell.test.tsx +0 -94
- package/test/renderers/MaterialOneOfRadioGroupControl.test.tsx +0 -108
- package/test/renderers/MaterialOneOfRenderer.test.tsx +0 -603
- package/test/renderers/MaterialRadioGroupControl.test.tsx +0 -125
- package/test/renderers/MaterialSliderControl.test.tsx +0 -438
- package/test/renderers/MaterialTextCell.test.tsx +0 -541
- package/test/renderers/MaterialTextControl.test.tsx +0 -115
- package/test/renderers/MaterialTimeCell.test.tsx +0 -331
- package/test/renderers/MaterialTimeControl.test.tsx +0 -411
- package/test/renderers/util.ts +0 -50
- package/tsconfig.json +0 -13
- package/tsconfig.test.json +0 -7
- package/webpack/webpack.dev.js +0 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createDefaultValue, Resolve, encode, Paths, formatErrorMessage, errorsAt, rankWith, isObjectControl, findUISchema, Generate, isAllOfControl, findMatchingUISchema, createCombinatorRenderInfos, isAnyOfControl, isOneOfControl, getAjv, and, uiTypeIs, schemaMatches, hasType, schemaSubPathMatches, or, isObjectArrayControl, isPrimitiveArrayControl, isObjectArray, computeLabel, composePaths, isBooleanControl,
|
|
1
|
+
import { createDefaultValue, Resolve, encode, Paths, formatErrorMessage, errorsAt, rankWith, isObjectControl, findUISchema, Generate, isAllOfControl, findMatchingUISchema, createCombinatorRenderInfos, isAnyOfControl, isOneOfControl, getAjv, and, uiTypeIs, schemaMatches, hasType, schemaSubPathMatches, or, isObjectArrayControl, isPrimitiveArrayControl, isObjectArray, computeLabel, composePaths, isBooleanControl, isDescriptionHidden, optionIs, showAsRequired, isEnumControl, isDateControl, isTimeControl, isDateTimeControl, isRangeControl, isIntegerControl, isNumberControl, isStringControl, isOneOfEnumControl, withIncreasedRank, isVisible, deriveLabelForUISchemaElement, createId, removeId, getFirstPrimitiveProp, update, moveUp, moveDown, isObjectArrayWithNesting, isNumberFormatControl, categorizationHasCategory } from '@jsonforms/core';
|
|
2
2
|
import React, { useMemo, Fragment, useState, useCallback, useRef, useEffect } from 'react';
|
|
3
3
|
import { DispatchCell, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsDetailProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsAnyOfProps, withJsonFormsOneOfProps, withJsonFormsMultiEnumProps, withJsonFormsLabelProps, withJsonFormsMasterListItemProps, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, Control, withJsonFormsOneOfEnumProps, withJsonFormsLayoutProps, withJsonFormsContext, withJsonFormsCellProps, withJsonFormsEnumCellProps, withJsonFormsOneOfEnumCellProps } from '@jsonforms/react';
|
|
4
4
|
import isEmpty from 'lodash/isEmpty';
|
|
5
5
|
import union from 'lodash/union';
|
|
6
6
|
import startCase from 'lodash/startCase';
|
|
7
7
|
import range from 'lodash/range';
|
|
8
|
-
import { TableCell, styled as styled$1, Badge, Tooltip, TableRow, Grid, Typography,
|
|
8
|
+
import { TableCell, styled as styled$1, Badge, Tooltip, TableRow, Grid, Typography, IconButton, FormHelperText, Hidden, Table, TableHead, TableBody, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, Tabs, Tab, Checkbox, TextField, Select, MenuItem, Input, useTheme, InputAdornment, FormControl, FormGroup, FormControlLabel, Toolbar, ListItem, ListItemAvatar, Avatar, ListItemText, ListItemSecondaryAction, List, Switch, InputLabel, Autocomplete, FormLabel, Slider, RadioGroup, Radio, Card, CardHeader, CardContent, AppBar, Accordion, AccordionSummary, AccordionDetails, Stepper, Step, StepButton } from '@mui/material';
|
|
9
9
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
10
10
|
import ArrowDownward from '@mui/icons-material/ArrowDownward';
|
|
11
11
|
import ArrowUpward from '@mui/icons-material/ArrowUpward';
|
|
@@ -48,10 +48,9 @@ const TableToolbar = React.memo(({ numColumns, errors, label, path, addItem, sch
|
|
|
48
48
|
React.createElement(Grid, { container: true, justifyContent: 'flex-start', alignItems: 'center', spacing: 2 },
|
|
49
49
|
React.createElement(Grid, { item: true },
|
|
50
50
|
React.createElement(Typography, { variant: 'h6' }, label)),
|
|
51
|
-
React.createElement(Grid, { item: true },
|
|
52
|
-
React.createElement(
|
|
53
|
-
React.createElement(
|
|
54
|
-
React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors })))))),
|
|
51
|
+
React.createElement(Grid, { item: true }, errors.length !== 0 &&
|
|
52
|
+
React.createElement(Grid, { item: true },
|
|
53
|
+
React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors }))))),
|
|
55
54
|
enabled ? (React.createElement(NoBorderTableCell, { align: 'right', style: fixedCellSmall },
|
|
56
55
|
React.createElement(Tooltip, { id: 'tooltip-add', title: `Add to ${label}`, placement: 'bottom' },
|
|
57
56
|
React.createElement(IconButton, { "aria-label": `Add to ${label}`, onClick: addItem(path, createDefaultValue(schema)), size: 'large' },
|
|
@@ -320,11 +319,13 @@ const materialOneOfControlTester = rankWith(3, isOneOfControl);
|
|
|
320
319
|
var MaterialOneOfRenderer$1 = withJsonFormsOneOfProps(MaterialOneOfRenderer);
|
|
321
320
|
|
|
322
321
|
const MuiCheckbox = React.memo((props) => {
|
|
323
|
-
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
322
|
+
const { data, className, id, enabled, uischema, path, handleChange, config, inputProps } = props;
|
|
324
323
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
325
|
-
const
|
|
324
|
+
const inputPropsMerged = merge({}, inputProps, {
|
|
325
|
+
autoFocus: !!appliedUiSchemaOptions.focus
|
|
326
|
+
});
|
|
326
327
|
const checked = !!data;
|
|
327
|
-
return (React.createElement(Checkbox, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps:
|
|
328
|
+
return (React.createElement(Checkbox, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputPropsMerged }));
|
|
328
329
|
});
|
|
329
330
|
|
|
330
331
|
dayjs.extend(customParsing);
|
|
@@ -537,9 +538,9 @@ const ArrayLayoutToolbar = React.memo(({ label, errors, addItem, path, createDef
|
|
|
537
538
|
React.createElement(Grid, { container: true, alignItems: 'center', justifyContent: 'space-between' },
|
|
538
539
|
React.createElement(Grid, { item: true },
|
|
539
540
|
React.createElement(Typography, { variant: 'h6' }, label)),
|
|
540
|
-
|
|
541
|
+
errors.length !== 0 &&
|
|
541
542
|
React.createElement(Grid, { item: true },
|
|
542
|
-
React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors }))
|
|
543
|
+
React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors })),
|
|
543
544
|
React.createElement(Grid, { item: true },
|
|
544
545
|
React.createElement(Grid, { container: true },
|
|
545
546
|
React.createElement(Grid, { item: true },
|
|
@@ -587,24 +588,90 @@ const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, err
|
|
|
587
588
|
const materialListWithDetailTester = rankWith(4, and(uiTypeIs('ListWithDetail'), isObjectArray));
|
|
588
589
|
var MaterialListWithDetailRenderer$1 = withJsonFormsArrayLayoutProps(MaterialListWithDetailRenderer);
|
|
589
590
|
|
|
590
|
-
const MaterialBooleanControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config }) => {
|
|
591
|
+
const MaterialBooleanControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
|
|
592
|
+
const isValid = errors.length === 0;
|
|
593
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
594
|
+
const showDescription = !isDescriptionHidden(visible, description,
|
|
595
|
+
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
596
|
+
const showTooltip = !showDescription && !isDescriptionHidden(visible, description,
|
|
597
|
+
true,
|
|
598
|
+
true);
|
|
599
|
+
const firstFormHelperText = showDescription
|
|
600
|
+
? description
|
|
601
|
+
: !isValid
|
|
602
|
+
? errors
|
|
603
|
+
: null;
|
|
604
|
+
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
605
|
+
const descriptionIds = [];
|
|
606
|
+
const tooltipId = `${id}-tip`;
|
|
607
|
+
const helpId1 = `${id}-help1`;
|
|
608
|
+
const helpId2 = `${id}-help2`;
|
|
609
|
+
if (showTooltip) {
|
|
610
|
+
descriptionIds.push(tooltipId);
|
|
611
|
+
}
|
|
612
|
+
if (firstFormHelperText) {
|
|
613
|
+
descriptionIds.push(helpId1);
|
|
614
|
+
}
|
|
615
|
+
if (secondFormHelperText) {
|
|
616
|
+
descriptionIds.push(helpId2);
|
|
617
|
+
}
|
|
618
|
+
const ariaDescribedBy = descriptionIds.join(' ');
|
|
591
619
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
592
|
-
React.createElement(
|
|
620
|
+
React.createElement(Tooltip, { id: tooltipId, title: (showTooltip) ? description : '' },
|
|
621
|
+
React.createElement(FormControlLabel, { label: label, id: id, control: React.createElement(MuiCheckbox, { id: `${id}-input`, isValid: isEmpty(errors), data: data, enabled: enabled, visible: visible, path: path, uischema: uischema, schema: schema, rootSchema: rootSchema, handleChange: handleChange, errors: errors, config: config, inputProps: {
|
|
622
|
+
'aria-describedby': ariaDescribedBy
|
|
623
|
+
} }) })),
|
|
624
|
+
React.createElement(FormHelperText, { id: helpId1, error: !isValid && !showDescription }, firstFormHelperText),
|
|
625
|
+
React.createElement(FormHelperText, { id: helpId2, error: !isValid }, secondFormHelperText)));
|
|
593
626
|
};
|
|
594
627
|
const materialBooleanControlTester = rankWith(2, isBooleanControl);
|
|
595
628
|
var MaterialBooleanControl$1 = withJsonFormsControlProps(MaterialBooleanControl);
|
|
596
629
|
|
|
597
630
|
const MuiToggle = React.memo((props) => {
|
|
598
|
-
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
631
|
+
const { data, className, id, enabled, uischema, path, handleChange, config, inputProps } = props;
|
|
599
632
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
600
|
-
const
|
|
633
|
+
const inputPropsMerged = merge({}, inputProps, {
|
|
634
|
+
autoFocus: !!appliedUiSchemaOptions.focus
|
|
635
|
+
});
|
|
601
636
|
const checked = !!data;
|
|
602
|
-
return (React.createElement(Switch, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps:
|
|
637
|
+
return (React.createElement(Switch, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputPropsMerged }));
|
|
603
638
|
});
|
|
604
639
|
|
|
605
|
-
const MaterialBooleanToggleControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config }) => {
|
|
640
|
+
const MaterialBooleanToggleControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
|
|
641
|
+
const isValid = errors.length === 0;
|
|
642
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
643
|
+
const showDescription = !isDescriptionHidden(visible, description,
|
|
644
|
+
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
645
|
+
const showTooltip = !showDescription && !isDescriptionHidden(visible, description,
|
|
646
|
+
true,
|
|
647
|
+
true);
|
|
648
|
+
const firstFormHelperText = showDescription
|
|
649
|
+
? description
|
|
650
|
+
: !isValid
|
|
651
|
+
? errors
|
|
652
|
+
: null;
|
|
653
|
+
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
654
|
+
const descriptionIds = [];
|
|
655
|
+
const tooltipId = `${id}-tip`;
|
|
656
|
+
const helpId1 = `${id}-help1`;
|
|
657
|
+
const helpId2 = `${id}-help2`;
|
|
658
|
+
if (showTooltip) {
|
|
659
|
+
descriptionIds.push(tooltipId);
|
|
660
|
+
}
|
|
661
|
+
if (firstFormHelperText) {
|
|
662
|
+
descriptionIds.push(helpId1);
|
|
663
|
+
}
|
|
664
|
+
if (secondFormHelperText) {
|
|
665
|
+
descriptionIds.push(helpId2);
|
|
666
|
+
}
|
|
667
|
+
const ariaDescribedBy = descriptionIds.join(' ');
|
|
606
668
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
607
|
-
React.createElement(
|
|
669
|
+
React.createElement(Tooltip, { id: tooltipId, title: (showTooltip) ? description : '' },
|
|
670
|
+
React.createElement(FormControlLabel, { label: label, id: id, control: React.createElement(MuiToggle, { id: `${id}-input`, isValid: isEmpty(errors), data: data, enabled: enabled, visible: visible, path: path, uischema: uischema, schema: schema, rootSchema: rootSchema, handleChange: handleChange, errors: errors, config: config, inputProps: {
|
|
671
|
+
'aria-describedby': ariaDescribedBy
|
|
672
|
+
} }) })),
|
|
673
|
+
React.createElement(FormHelperText, { id: helpId1, error: !isValid && !showDescription }, firstFormHelperText),
|
|
674
|
+
React.createElement(FormHelperText, { id: helpId2, error: !isValid }, secondFormHelperText)));
|
|
608
675
|
};
|
|
609
676
|
const materialBooleanToggleControlTester = rankWith(3, and(isBooleanControl, optionIs('toggle', true)));
|
|
610
677
|
var MaterialBooleanToggleControl$1 = withJsonFormsControlProps(MaterialBooleanToggleControl);
|