@jsonforms/material-renderers 3.1.0-alpha.0 → 3.1.0-alpha.2
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 +16 -17
- package/lib/additional/ListWithDetailMasterItem.d.ts +2 -0
- package/lib/additional/MaterialListWithDetailRenderer.d.ts +1 -1
- package/lib/additional/index.d.ts +2 -2
- package/lib/additional/unwrapped.d.ts +5 -0
- package/lib/cells/index.d.ts +1 -1
- package/lib/complex/CombinatorProperties.d.ts +1 -2
- package/lib/complex/DeleteDialog.d.ts +5 -1
- package/lib/complex/MaterialAllOfRenderer.d.ts +1 -1
- package/lib/complex/MaterialAnyOfRenderer.d.ts +1 -1
- package/lib/complex/MaterialArrayControlRenderer.d.ts +2 -1
- package/lib/complex/MaterialEnumArrayRenderer.d.ts +1 -1
- package/lib/complex/MaterialObjectRenderer.d.ts +1 -1
- package/lib/complex/MaterialOneOfRenderer.d.ts +1 -1
- package/lib/complex/MaterialTableControl.d.ts +4 -2
- package/lib/complex/NoBorderTableCell.d.ts +2 -2
- package/lib/complex/TableToolbar.d.ts +3 -2
- package/lib/complex/index.d.ts +11 -16
- package/lib/complex/unwrapped.d.ts +9 -0
- package/lib/controls/MaterialBooleanControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
- package/lib/controls/index.d.ts +8 -26
- package/lib/controls/unwrapped.d.ts +19 -0
- package/lib/index.d.ts +34 -1
- package/lib/jsonforms-react-material.cjs.js +731 -572
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +648 -517
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/layouts/ArrayToolbar.d.ts +3 -1
- package/lib/layouts/ExpandPanelRenderer.d.ts +3 -1
- package/lib/layouts/MaterialGroupLayout.d.ts +1 -1
- package/lib/layouts/MaterialHorizontalLayout.d.ts +1 -1
- package/lib/layouts/MaterialVerticalLayout.d.ts +1 -1
- package/lib/layouts/index.d.ts +3 -1
- package/lib/layouts/unwrapped.d.ts +10 -0
- package/lib/mui-controls/MuiCheckbox.d.ts +6 -1
- package/lib/mui-controls/MuiInputInteger.d.ts +1 -1
- package/lib/mui-controls/MuiInputNumber.d.ts +1 -1
- package/lib/mui-controls/MuiInputNumberFormat.d.ts +1 -1
- package/lib/mui-controls/MuiInputText.d.ts +1 -1
- package/lib/mui-controls/MuiInputTime.d.ts +1 -1
- package/lib/mui-controls/MuiSelect.d.ts +1 -1
- package/lib/mui-controls/MuiToggle.d.ts +6 -1
- package/lib/mui-controls/index.d.ts +3 -1
- package/lib/util/layout.d.ts +2 -3
- package/package.json +33 -15
- package/src/additional/ListWithDetailMasterItem.tsx +32 -24
- package/src/additional/MaterialLabelRenderer.tsx +8 -15
- package/src/additional/MaterialListWithDetailRenderer.tsx +8 -5
- package/src/additional/index.ts +12 -4
- package/{example/index.ts → src/additional/unwrapped.ts} +7 -6
- package/src/cells/MaterialBooleanCell.tsx +1 -1
- package/src/cells/MaterialBooleanToggleCell.tsx +2 -2
- package/src/cells/MaterialDateCell.tsx +4 -12
- package/src/cells/MaterialEnumCell.tsx +13 -6
- package/src/cells/MaterialIntegerCell.tsx +1 -1
- package/src/cells/MaterialNumberCell.tsx +1 -1
- package/src/cells/MaterialNumberFormatCell.tsx +1 -1
- package/src/cells/MaterialOneOfEnumCell.tsx +17 -7
- package/src/cells/MaterialTextCell.tsx +1 -1
- package/src/cells/MaterialTimeCell.tsx +1 -1
- package/src/cells/index.ts +7 -7
- package/src/complex/CombinatorProperties.tsx +20 -9
- package/src/complex/DeleteDialog.tsx +48 -37
- package/src/complex/MaterialAllOfRenderer.tsx +2 -2
- package/src/complex/MaterialAnyOfRenderer.tsx +3 -3
- package/src/complex/MaterialArrayControlRenderer.tsx +27 -11
- package/src/complex/MaterialEnumArrayRenderer.tsx +6 -8
- package/src/complex/MaterialObjectRenderer.tsx +6 -3
- package/src/complex/MaterialOneOfRenderer.tsx +105 -88
- package/src/complex/MaterialTableControl.tsx +145 -97
- package/src/complex/NoBorderTableCell.tsx +3 -5
- package/src/complex/TableToolbar.tsx +24 -25
- package/src/complex/ValidationIcon.tsx +10 -18
- package/src/complex/index.ts +35 -32
- package/{test/renderers/MatchMediaMock.ts → src/complex/unwrapped.ts} +19 -16
- package/src/controls/MaterialAnyOfStringOrEnumControl.tsx +19 -11
- package/src/controls/MaterialBooleanControl.tsx +90 -23
- package/src/controls/MaterialBooleanToggleControl.tsx +90 -23
- package/src/controls/MaterialDateControl.tsx +16 -19
- package/src/controls/MaterialDateTimeControl.tsx +24 -23
- package/src/controls/MaterialEnumControl.tsx +21 -15
- package/src/controls/MaterialInputControl.tsx +7 -8
- package/src/controls/MaterialIntegerControl.tsx +1 -1
- package/src/controls/MaterialNativeControl.tsx +12 -9
- package/src/controls/MaterialNumberControl.tsx +1 -1
- package/src/controls/MaterialOneOfEnumControl.tsx +21 -15
- package/src/controls/MaterialOneOfRadioGroupControl.tsx +5 -3
- package/src/controls/MaterialRadioGroup.tsx +11 -17
- package/src/controls/MaterialRadioGroupControl.tsx +8 -3
- package/src/controls/MaterialSliderControl.tsx +17 -16
- package/src/controls/MaterialTextControl.tsx +1 -1
- package/src/controls/MaterialTimeControl.tsx +19 -22
- package/src/controls/index.ts +36 -72
- package/src/controls/unwrapped.ts +57 -0
- package/src/index.ts +41 -22
- package/src/layouts/ArrayToolbar.tsx +38 -42
- package/src/layouts/ExpandPanelRenderer.tsx +96 -67
- package/src/layouts/MaterialArrayLayout.tsx +21 -16
- package/src/layouts/MaterialArrayLayoutRenderer.tsx +6 -9
- package/src/layouts/MaterialCategorizationLayout.tsx +52 -21
- package/src/layouts/MaterialCategorizationStepperLayout.tsx +60 -44
- package/src/layouts/MaterialGroupLayout.tsx +25 -6
- package/src/layouts/MaterialHorizontalLayout.tsx +18 -4
- package/src/layouts/MaterialVerticalLayout.tsx +18 -4
- package/src/layouts/index.ts +18 -7
- package/{test/renderers/util.ts → src/layouts/unwrapped.ts} +19 -28
- package/src/mui-controls/MuiAutocomplete.tsx +51 -35
- package/src/mui-controls/MuiCheckbox.tsx +14 -5
- package/src/mui-controls/MuiInputInteger.tsx +31 -32
- package/src/mui-controls/MuiInputNumber.tsx +16 -16
- package/src/mui-controls/MuiInputNumberFormat.tsx +51 -42
- package/src/mui-controls/MuiInputText.tsx +30 -19
- package/src/mui-controls/MuiInputTime.tsx +11 -12
- package/src/mui-controls/MuiSelect.tsx +15 -6
- package/src/mui-controls/MuiToggle.tsx +14 -5
- package/src/mui-controls/index.ts +3 -1
- package/src/util/datejs.tsx +41 -20
- package/src/util/debounce.ts +26 -11
- package/src/util/focus.ts +7 -7
- package/src/util/i18nDefaults.ts +2 -2
- package/src/util/layout.tsx +47 -42
- package/src/util/theme.ts +2 -2
- 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/rollup.config.js +0 -51
- package/stats.html +0 -3279
- 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/tsconfig.json +0 -13
- package/tsconfig.test.json +0 -7
- package/webpack/webpack.dev.js +0 -11
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import React, { useState, useCallback, useMemo, Fragment, useRef, useEffect } from 'react';
|
|
2
|
+
import { Hidden, Tabs, Tab, TableCell, styled as styled$1, Badge, Tooltip, TableRow, Grid, Typography, IconButton, FormHelperText, Table, TableHead, TableBody, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, Autocomplete, TextField, Checkbox, Input, useTheme, InputAdornment, Select, MenuItem, Switch, FormControl, FormGroup, FormControlLabel, Toolbar, ListItem, ListItemAvatar, Avatar, ListItemText, ListItemSecondaryAction, List, InputLabel, FormLabel, RadioGroup, Radio, Slider, Accordion, AccordionSummary, AccordionDetails, Card, CardHeader, CardContent, AppBar, Stepper, Step, StepButton } from '@mui/material';
|
|
3
|
+
import { rankWith, isAllOfControl, findMatchingUISchema, createCombinatorRenderInfos, Generate, isLayout, isAnyOfControl, createDefaultValue, Resolve, encode, Paths, formatErrorMessage, errorsAt, or, isObjectArrayControl, isPrimitiveArrayControl, isDescriptionHidden, getAjv, and, uiTypeIs, schemaMatches, hasType, schemaSubPathMatches, isObjectControl, findUISchema, isOneOfControl, isObjectArray, computeLabel, composePaths, showAsRequired, isBooleanControl, optionIs, isDateControl, isDateTimeControl, isEnumControl, isIntegerControl, isTimeControl, isNumberControl, isOneOfEnumControl, isRangeControl, isStringControl, createId, removeId, update, moveUp, moveDown, getFirstPrimitiveProp, withIncreasedRank, isVisible, deriveLabelForUISchemaElement, isObjectArrayWithNesting, isNumberFormatControl, categorizationHasCategory } from '@jsonforms/core';
|
|
4
|
+
import { withJsonFormsAllOfProps, JsonFormsDispatch, withJsonFormsAnyOfProps, DispatchCell, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsMultiEnumProps, withJsonFormsDetailProps, withJsonFormsOneOfProps, withJsonFormsLabelProps, withJsonFormsMasterListItemProps, withJsonFormsControlProps, Control, withJsonFormsEnumProps, withTranslateProps, withJsonFormsOneOfEnumProps, withJsonFormsContext, withJsonFormsLayoutProps, withJsonFormsCellProps, withJsonFormsEnumCellProps, withJsonFormsOneOfEnumCellProps } from '@jsonforms/react';
|
|
5
|
+
import omit from 'lodash/omit';
|
|
4
6
|
import isEmpty from 'lodash/isEmpty';
|
|
5
7
|
import union from 'lodash/union';
|
|
6
8
|
import startCase from 'lodash/startCase';
|
|
7
9
|
import range from 'lodash/range';
|
|
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
10
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
10
11
|
import ArrowDownward from '@mui/icons-material/ArrowDownward';
|
|
11
12
|
import ArrowUpward from '@mui/icons-material/ArrowUpward';
|
|
@@ -13,7 +14,6 @@ import { styled } from '@mui/material/styles';
|
|
|
13
14
|
import AddIcon from '@mui/icons-material/Add';
|
|
14
15
|
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
15
16
|
import merge from 'lodash/merge';
|
|
16
|
-
import omit from 'lodash/omit';
|
|
17
17
|
import dayjs from 'dayjs';
|
|
18
18
|
import customParsing from 'dayjs/plugin/customParseFormat';
|
|
19
19
|
import debounce from 'lodash/debounce';
|
|
@@ -25,13 +25,54 @@ import get from 'lodash/get';
|
|
|
25
25
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
26
26
|
import Input$1 from '@mui/material/Input';
|
|
27
27
|
|
|
28
|
+
const MaterialAllOfRenderer = ({ schema, rootSchema, visible, renderers, cells, path, uischemas, uischema, }) => {
|
|
29
|
+
const delegateUISchema = findMatchingUISchema(uischemas)(schema, uischema.scope, path);
|
|
30
|
+
if (delegateUISchema) {
|
|
31
|
+
return (React.createElement(Hidden, { xsUp: !visible },
|
|
32
|
+
React.createElement(JsonFormsDispatch, { schema: schema, uischema: delegateUISchema, path: path, renderers: renderers, cells: cells })));
|
|
33
|
+
}
|
|
34
|
+
const allOfRenderInfos = createCombinatorRenderInfos(schema.allOf, rootSchema, 'allOf', uischema, path, uischemas);
|
|
35
|
+
return (React.createElement(Hidden, { xsUp: !visible }, allOfRenderInfos.map((allOfRenderInfo, allOfIndex) => (React.createElement(JsonFormsDispatch, { key: allOfIndex, schema: allOfRenderInfo.schema, uischema: allOfRenderInfo.uischema, path: path, renderers: renderers, cells: cells })))));
|
|
36
|
+
};
|
|
37
|
+
const materialAllOfControlTester = rankWith(3, isAllOfControl);
|
|
38
|
+
var MaterialAllOfRenderer$1 = withJsonFormsAllOfProps(MaterialAllOfRenderer);
|
|
39
|
+
|
|
40
|
+
class CombinatorProperties extends React.Component {
|
|
41
|
+
render() {
|
|
42
|
+
const { schema, combinatorKeyword, path } = this.props;
|
|
43
|
+
const otherProps = omit(schema, combinatorKeyword);
|
|
44
|
+
const foundUISchema = Generate.uiSchema(otherProps, 'VerticalLayout');
|
|
45
|
+
let isLayoutWithElements = false;
|
|
46
|
+
if (foundUISchema !== null && isLayout(foundUISchema)) {
|
|
47
|
+
isLayoutWithElements = foundUISchema.elements.length > 0;
|
|
48
|
+
}
|
|
49
|
+
if (isLayoutWithElements) {
|
|
50
|
+
return (React.createElement(JsonFormsDispatch, { schema: otherProps, path: path, uischema: foundUISchema }));
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const MaterialAnyOfRenderer = ({ schema, rootSchema, indexOfFittingSchema, visible, path, renderers, cells, uischema, uischemas, }) => {
|
|
57
|
+
const [selectedAnyOf, setSelectedAnyOf] = useState(indexOfFittingSchema || 0);
|
|
58
|
+
const handleChange = useCallback((_ev, value) => setSelectedAnyOf(value), [setSelectedAnyOf]);
|
|
59
|
+
const anyOf = 'anyOf';
|
|
60
|
+
const anyOfRenderInfos = createCombinatorRenderInfos(schema.anyOf, rootSchema, anyOf, uischema, path, uischemas);
|
|
61
|
+
return (React.createElement(Hidden, { xsUp: !visible },
|
|
62
|
+
React.createElement(CombinatorProperties, { schema: schema, combinatorKeyword: anyOf, path: path }),
|
|
63
|
+
React.createElement(Tabs, { value: selectedAnyOf, onChange: handleChange }, anyOfRenderInfos.map((anyOfRenderInfo) => (React.createElement(Tab, { key: anyOfRenderInfo.label, label: anyOfRenderInfo.label })))),
|
|
64
|
+
anyOfRenderInfos.map((anyOfRenderInfo, anyOfIndex) => selectedAnyOf === anyOfIndex && (React.createElement(JsonFormsDispatch, { key: anyOfIndex, schema: anyOfRenderInfo.schema, uischema: anyOfRenderInfo.uischema, path: path, renderers: renderers, cells: cells })))));
|
|
65
|
+
};
|
|
66
|
+
const materialAnyOfControlTester = rankWith(3, isAnyOfControl);
|
|
67
|
+
var MaterialAnyOfRenderer$1 = withJsonFormsAnyOfProps(MaterialAnyOfRenderer);
|
|
68
|
+
|
|
28
69
|
const StyledTableCell = styled(TableCell)({
|
|
29
|
-
borderBottom: 'none'
|
|
70
|
+
borderBottom: 'none',
|
|
30
71
|
});
|
|
31
72
|
const NoBorderTableCell = ({ children, ...otherProps }) => (React.createElement(StyledTableCell, Object.assign({}, otherProps), children));
|
|
32
73
|
|
|
33
74
|
const StyledBadge = styled$1(Badge)(({ theme }) => ({
|
|
34
|
-
color: theme.palette.error.main
|
|
75
|
+
color: theme.palette.error.main,
|
|
35
76
|
}));
|
|
36
77
|
const ValidationIcon = ({ errorMessages, id }) => {
|
|
37
78
|
return (React.createElement(Tooltip, { id: id, title: errorMessages },
|
|
@@ -43,18 +84,19 @@ const fixedCellSmall = {
|
|
|
43
84
|
paddingLeft: 0,
|
|
44
85
|
paddingRight: 0,
|
|
45
86
|
};
|
|
46
|
-
const TableToolbar = React.memo(({ numColumns, errors, label, path, addItem, schema, enabled })
|
|
47
|
-
React.createElement(
|
|
48
|
-
React.createElement(
|
|
49
|
-
React.createElement(Grid, {
|
|
50
|
-
React.createElement(Typography, { variant: 'h6' }, label)),
|
|
51
|
-
React.createElement(Grid, { item: true }, errors.length !== 0 &&
|
|
87
|
+
const TableToolbar = React.memo(function TableToolbar({ numColumns, errors, label, path, addItem, schema, enabled, translations, }) {
|
|
88
|
+
return (React.createElement(TableRow, null,
|
|
89
|
+
React.createElement(NoBorderTableCell, { colSpan: numColumns },
|
|
90
|
+
React.createElement(Grid, { container: true, justifyContent: 'flex-start', alignItems: 'center', spacing: 2 },
|
|
52
91
|
React.createElement(Grid, { item: true },
|
|
53
|
-
React.createElement(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
92
|
+
React.createElement(Typography, { variant: 'h6' }, label)),
|
|
93
|
+
React.createElement(Grid, { item: true }, errors.length !== 0 && (React.createElement(Grid, { item: true },
|
|
94
|
+
React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors })))))),
|
|
95
|
+
enabled ? (React.createElement(NoBorderTableCell, { align: 'right', style: fixedCellSmall },
|
|
96
|
+
React.createElement(Tooltip, { id: 'tooltip-add', title: translations.addTooltip, placement: 'bottom' },
|
|
97
|
+
React.createElement(IconButton, { "aria-label": translations.addAriaLabel, onClick: addItem(path, createDefaultValue(schema)), size: 'large' },
|
|
98
|
+
React.createElement(AddIcon, null))))) : null));
|
|
99
|
+
});
|
|
58
100
|
|
|
59
101
|
const styles = {
|
|
60
102
|
fixedCell: {
|
|
@@ -62,19 +104,19 @@ const styles = {
|
|
|
62
104
|
height: '50px',
|
|
63
105
|
paddingLeft: 0,
|
|
64
106
|
paddingRight: 0,
|
|
65
|
-
textAlign: 'center'
|
|
107
|
+
textAlign: 'center',
|
|
66
108
|
},
|
|
67
109
|
fixedCellSmall: {
|
|
68
110
|
width: '50px',
|
|
69
111
|
height: '50px',
|
|
70
112
|
paddingLeft: 0,
|
|
71
113
|
paddingRight: 0,
|
|
72
|
-
textAlign: 'center'
|
|
73
|
-
}
|
|
114
|
+
textAlign: 'center',
|
|
115
|
+
},
|
|
74
116
|
};
|
|
75
117
|
const generateCells = (Cell, schema, rowPath, enabled, cells) => {
|
|
76
118
|
if (schema.type === 'object') {
|
|
77
|
-
return getValidColumnProps(schema).map(prop => {
|
|
119
|
+
return getValidColumnProps(schema).map((prop) => {
|
|
78
120
|
const cellPath = Paths.compose(rowPath, prop);
|
|
79
121
|
const props = {
|
|
80
122
|
propName: prop,
|
|
@@ -83,7 +125,7 @@ const generateCells = (Cell, schema, rowPath, enabled, cells) => {
|
|
|
83
125
|
rowPath,
|
|
84
126
|
cellPath,
|
|
85
127
|
enabled,
|
|
86
|
-
cells
|
|
128
|
+
cells,
|
|
87
129
|
};
|
|
88
130
|
return React.createElement(Cell, Object.assign({ key: cellPath }, props));
|
|
89
131
|
});
|
|
@@ -93,25 +135,28 @@ const generateCells = (Cell, schema, rowPath, enabled, cells) => {
|
|
|
93
135
|
schema,
|
|
94
136
|
rowPath,
|
|
95
137
|
cellPath: rowPath,
|
|
96
|
-
enabled
|
|
138
|
+
enabled,
|
|
97
139
|
};
|
|
98
140
|
return React.createElement(Cell, Object.assign({ key: rowPath }, props));
|
|
99
141
|
}
|
|
100
142
|
};
|
|
101
143
|
const getValidColumnProps = (scopedSchema) => {
|
|
102
|
-
if (scopedSchema.type === 'object' &&
|
|
103
|
-
|
|
144
|
+
if (scopedSchema.type === 'object' &&
|
|
145
|
+
typeof scopedSchema.properties === 'object') {
|
|
146
|
+
return Object.keys(scopedSchema.properties).filter((prop) => scopedSchema.properties[prop].type !== 'array');
|
|
104
147
|
}
|
|
105
148
|
return [''];
|
|
106
149
|
};
|
|
107
|
-
const EmptyTable = ({ numColumns }) => (React.createElement(TableRow, null,
|
|
150
|
+
const EmptyTable = ({ numColumns, translations }) => (React.createElement(TableRow, null,
|
|
108
151
|
React.createElement(NoBorderTableCell, { colSpan: numColumns },
|
|
109
|
-
React.createElement(Typography, { align: 'center' },
|
|
110
|
-
const TableHeaderCell = React.memo(({ title })
|
|
152
|
+
React.createElement(Typography, { align: 'center' }, translations.noDataMessage))));
|
|
153
|
+
const TableHeaderCell = React.memo(function TableHeaderCell({ title, }) {
|
|
154
|
+
return React.createElement(TableCell, null, title);
|
|
155
|
+
});
|
|
111
156
|
const ctxToNonEmptyCellProps = (ctx, ownProps) => {
|
|
112
157
|
const path = ownProps.rowPath +
|
|
113
158
|
(ownProps.schema.type === 'object' ? '.' + ownProps.propName : '');
|
|
114
|
-
const errors = formatErrorMessage(union(errorsAt(path, ownProps.schema, p => p === path)(ctx.core.errors).map((error) => error.message)));
|
|
159
|
+
const errors = formatErrorMessage(union(errorsAt(path, ownProps.schema, (p) => p === path)(ctx.core.errors).map((error) => error.message)));
|
|
115
160
|
return {
|
|
116
161
|
rowPath: ownProps.rowPath,
|
|
117
162
|
propName: ownProps.propName,
|
|
@@ -121,15 +166,15 @@ const ctxToNonEmptyCellProps = (ctx, ownProps) => {
|
|
|
121
166
|
path,
|
|
122
167
|
enabled: ownProps.enabled,
|
|
123
168
|
cells: ownProps.cells || ctx.cells,
|
|
124
|
-
renderers: ownProps.renderers || ctx.renderers
|
|
169
|
+
renderers: ownProps.renderers || ctx.renderers,
|
|
125
170
|
};
|
|
126
171
|
};
|
|
127
172
|
const controlWithoutLabel = (scope) => ({
|
|
128
173
|
type: 'Control',
|
|
129
174
|
scope: scope,
|
|
130
|
-
label: false
|
|
175
|
+
label: false,
|
|
131
176
|
});
|
|
132
|
-
const NonEmptyCellComponent = React.memo(({ path, propName, schema, rootSchema, errors, enabled, renderers, cells, isValid })
|
|
177
|
+
const NonEmptyCellComponent = React.memo(function NonEmptyCellComponent({ path, propName, schema, rootSchema, errors, enabled, renderers, cells, isValid, }) {
|
|
133
178
|
return (React.createElement(NoBorderTableCell, null,
|
|
134
179
|
schema.properties ? (React.createElement(DispatchCell, { schema: Resolve.schema(schema, `#/properties/${encode(propName)}`, rootSchema), uischema: controlWithoutLabel(`#/properties/${encode(propName)}`), path: path, enabled: enabled, renderers: renderers, cells: cells })) : (React.createElement(DispatchCell, { schema: schema, uischema: controlWithoutLabel('#'), path: path, enabled: enabled, renderers: renderers, cells: cells })),
|
|
135
180
|
React.createElement(FormHelperText, { error: !isValid }, !isValid && errors)));
|
|
@@ -140,7 +185,7 @@ const NonEmptyCell = (ownProps) => {
|
|
|
140
185
|
const isValid = isEmpty(emptyCellProps.errors);
|
|
141
186
|
return React.createElement(NonEmptyCellComponent, Object.assign({}, emptyCellProps, { isValid: isValid }));
|
|
142
187
|
};
|
|
143
|
-
const NonEmptyRowComponent = ({ childPath, schema, rowIndex, openDeleteDialog, moveUpCreator, moveDownCreator, enableUp, enableDown, showSortButtons, enabled, cells, path }) => {
|
|
188
|
+
const NonEmptyRowComponent = ({ childPath, schema, rowIndex, openDeleteDialog, moveUpCreator, moveDownCreator, enableUp, enableDown, showSortButtons, enabled, cells, path, translations, }) => {
|
|
144
189
|
const moveUp = useMemo(() => moveUpCreator(path, rowIndex), [moveUpCreator, path, rowIndex]);
|
|
145
190
|
const moveDown = useMemo(() => moveDownCreator(path, rowIndex), [moveDownCreator, path, rowIndex]);
|
|
146
191
|
return (React.createElement(TableRow, { key: childPath, hover: true },
|
|
@@ -149,25 +194,26 @@ const NonEmptyRowComponent = ({ childPath, schema, rowIndex, openDeleteDialog, m
|
|
|
149
194
|
React.createElement(Grid, { container: true, direction: 'row', justifyContent: 'flex-end', alignItems: 'center' },
|
|
150
195
|
showSortButtons ? (React.createElement(Fragment, null,
|
|
151
196
|
React.createElement(Grid, { item: true },
|
|
152
|
-
React.createElement(IconButton, { "aria-label":
|
|
197
|
+
React.createElement(IconButton, { "aria-label": translations.upAriaLabel, onClick: moveUp, disabled: !enableUp, size: 'large' },
|
|
153
198
|
React.createElement(ArrowUpward, null))),
|
|
154
199
|
React.createElement(Grid, { item: true },
|
|
155
|
-
React.createElement(IconButton, { "aria-label":
|
|
200
|
+
React.createElement(IconButton, { "aria-label": translations.downAriaLabel, onClick: moveDown, disabled: !enableDown, size: 'large' },
|
|
156
201
|
React.createElement(ArrowDownward, null))))) : null,
|
|
157
202
|
React.createElement(Grid, { item: true },
|
|
158
|
-
React.createElement(IconButton, { "aria-label":
|
|
203
|
+
React.createElement(IconButton, { "aria-label": translations.removeAriaLabel, onClick: () => openDeleteDialog(childPath, rowIndex), size: 'large' },
|
|
159
204
|
React.createElement(DeleteIcon, null)))))) : null));
|
|
160
205
|
};
|
|
161
206
|
const NonEmptyRow = React.memo(NonEmptyRowComponent);
|
|
162
|
-
const TableRows = ({ data, path, schema, openDeleteDialog, moveUp, moveDown, uischema, config, enabled, cells }) => {
|
|
207
|
+
const TableRows = ({ data, path, schema, openDeleteDialog, moveUp, moveDown, uischema, config, enabled, cells, translations, }) => {
|
|
163
208
|
const isEmptyTable = data === 0;
|
|
164
209
|
if (isEmptyTable) {
|
|
165
|
-
return React.createElement(EmptyTable, { numColumns: getValidColumnProps(schema).length + 1 });
|
|
210
|
+
return (React.createElement(EmptyTable, { numColumns: getValidColumnProps(schema).length + 1, translations: translations }));
|
|
166
211
|
}
|
|
167
212
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
168
213
|
return (React.createElement(React.Fragment, null, range(data).map((index) => {
|
|
169
214
|
const childPath = Paths.compose(path, `${index}`);
|
|
170
|
-
return (React.createElement(NonEmptyRow, { key: childPath, childPath: childPath, rowIndex: index, schema: schema, openDeleteDialog: openDeleteDialog, moveUpCreator: moveUp, moveDownCreator: moveDown, enableUp: index !== 0, enableDown: index !== data - 1, showSortButtons: appliedUiSchemaOptions.showSortButtons ||
|
|
215
|
+
return (React.createElement(NonEmptyRow, { key: childPath, childPath: childPath, rowIndex: index, schema: schema, openDeleteDialog: openDeleteDialog, moveUpCreator: moveUp, moveDownCreator: moveDown, enableUp: index !== 0, enableDown: index !== data - 1, showSortButtons: appliedUiSchemaOptions.showSortButtons ||
|
|
216
|
+
appliedUiSchemaOptions.showArrayTableSortButtons, enabled: enabled, cells: cells, path: path, translations: translations }));
|
|
171
217
|
})));
|
|
172
218
|
};
|
|
173
219
|
class MaterialTableControl extends React.Component {
|
|
@@ -176,7 +222,7 @@ class MaterialTableControl extends React.Component {
|
|
|
176
222
|
this.addItem = (path, value) => this.props.addItem(path, value);
|
|
177
223
|
}
|
|
178
224
|
render() {
|
|
179
|
-
const { label, path, schema, rootSchema, uischema, errors, openDeleteDialog, visible, enabled, cells } = this.props;
|
|
225
|
+
const { label, path, schema, rootSchema, uischema, errors, openDeleteDialog, visible, enabled, cells, translations, } = this.props;
|
|
180
226
|
const controlElement = uischema;
|
|
181
227
|
const isObjectSchema = schema.type === 'object';
|
|
182
228
|
const headerCells = isObjectSchema
|
|
@@ -185,23 +231,23 @@ class MaterialTableControl extends React.Component {
|
|
|
185
231
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
186
232
|
React.createElement(Table, null,
|
|
187
233
|
React.createElement(TableHead, null,
|
|
188
|
-
React.createElement(TableToolbar, { errors: errors, label: label, addItem: this.addItem, numColumns: isObjectSchema ? headerCells.length : 1, path: path, uischema: controlElement, schema: schema, rootSchema: rootSchema, enabled: enabled }),
|
|
234
|
+
React.createElement(TableToolbar, { errors: errors, label: label, addItem: this.addItem, numColumns: isObjectSchema ? headerCells.length : 1, path: path, uischema: controlElement, schema: schema, rootSchema: rootSchema, enabled: enabled, translations: translations }),
|
|
189
235
|
isObjectSchema && (React.createElement(TableRow, null,
|
|
190
236
|
headerCells,
|
|
191
237
|
enabled ? React.createElement(TableCell, null) : null))),
|
|
192
238
|
React.createElement(TableBody, null,
|
|
193
|
-
React.createElement(TableRows, Object.assign({ openDeleteDialog: openDeleteDialog }, this.props))))));
|
|
239
|
+
React.createElement(TableRows, Object.assign({ openDeleteDialog: openDeleteDialog, translations: translations }, this.props))))));
|
|
194
240
|
}
|
|
195
241
|
}
|
|
196
242
|
|
|
197
|
-
const DeleteDialog = React.memo(({ open, onClose, onConfirm, onCancel })
|
|
243
|
+
const DeleteDialog = React.memo(function DeleteDialog({ open, onClose, onConfirm, onCancel, title, message, acceptText, declineText, }) {
|
|
198
244
|
return (React.createElement(Dialog, { open: open, keepMounted: true, onClose: onClose, "aria-labelledby": 'alert-dialog-confirmdelete-title', "aria-describedby": 'alert-dialog-confirmdelete-description' },
|
|
199
|
-
React.createElement(DialogTitle, { id: 'alert-dialog-confirmdelete-title' },
|
|
245
|
+
React.createElement(DialogTitle, { id: 'alert-dialog-confirmdelete-title' }, title),
|
|
200
246
|
React.createElement(DialogContent, null,
|
|
201
|
-
React.createElement(DialogContentText, { id: 'alert-dialog-confirmdelete-description' },
|
|
247
|
+
React.createElement(DialogContentText, { id: 'alert-dialog-confirmdelete-description' }, message)),
|
|
202
248
|
React.createElement(DialogActions, null,
|
|
203
|
-
React.createElement(Button, { onClick: onCancel, color: 'primary' },
|
|
204
|
-
React.createElement(Button, { onClick: onConfirm, color: 'primary' },
|
|
249
|
+
React.createElement(Button, { onClick: onCancel, color: 'primary' }, declineText),
|
|
250
|
+
React.createElement(Button, { onClick: onConfirm, color: 'primary' }, acceptText))));
|
|
205
251
|
});
|
|
206
252
|
|
|
207
253
|
const MaterialArrayControlRenderer = (props) => {
|
|
@@ -216,114 +262,58 @@ const MaterialArrayControlRenderer = (props) => {
|
|
|
216
262
|
}, [setOpen, setPath, setRowData]);
|
|
217
263
|
const deleteCancel = useCallback(() => setOpen(false), [setOpen]);
|
|
218
264
|
const deleteConfirm = useCallback(() => {
|
|
219
|
-
const p = path.substring(0, path.lastIndexOf(
|
|
265
|
+
const p = path.substring(0, path.lastIndexOf('.'));
|
|
220
266
|
removeItems(p, [rowData])();
|
|
221
267
|
setOpen(false);
|
|
222
268
|
}, [setOpen, path, rowData]);
|
|
223
269
|
const deleteClose = useCallback(() => setOpen(false), [setOpen]);
|
|
224
270
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
225
271
|
React.createElement(MaterialTableControl, Object.assign({}, props, { openDeleteDialog: openDeleteDialog })),
|
|
226
|
-
React.createElement(DeleteDialog, { open: open, onCancel: deleteCancel, onConfirm: deleteConfirm, onClose: deleteClose })));
|
|
272
|
+
React.createElement(DeleteDialog, { open: open, onCancel: deleteCancel, onConfirm: deleteConfirm, onClose: deleteClose, acceptText: props.translations.deleteDialogAccept, declineText: props.translations.deleteDialogDecline, title: props.translations.deleteDialogTitle, message: props.translations.deleteDialogMessage })));
|
|
227
273
|
};
|
|
274
|
+
const materialArrayControlTester = rankWith(3, or(isObjectArrayControl, isPrimitiveArrayControl));
|
|
228
275
|
var MaterialArrayControlRenderer$1 = withJsonFormsArrayLayoutProps(MaterialArrayControlRenderer);
|
|
229
276
|
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const materialObjectControlTester = rankWith(2, isObjectControl);
|
|
236
|
-
var MaterialObjectRenderer$1 = withJsonFormsDetailProps(MaterialObjectRenderer);
|
|
237
|
-
|
|
238
|
-
const MaterialAllOfRenderer = ({ schema, rootSchema, visible, renderers, cells, path, uischemas, uischema }) => {
|
|
239
|
-
const delegateUISchema = findMatchingUISchema(uischemas)(schema, uischema.scope, path);
|
|
240
|
-
if (delegateUISchema) {
|
|
241
|
-
return (React.createElement(Hidden, { xsUp: !visible },
|
|
242
|
-
React.createElement(JsonFormsDispatch, { schema: schema, uischema: delegateUISchema, path: path, renderers: renderers, cells: cells })));
|
|
243
|
-
}
|
|
244
|
-
const allOfRenderInfos = createCombinatorRenderInfos(schema.allOf, rootSchema, 'allOf', uischema, path, uischemas);
|
|
245
|
-
return (React.createElement(Hidden, { xsUp: !visible }, allOfRenderInfos.map((allOfRenderInfo, allOfIndex) => (React.createElement(JsonFormsDispatch, { key: allOfIndex, schema: allOfRenderInfo.schema, uischema: allOfRenderInfo.uischema, path: path, renderers: renderers, cells: cells })))));
|
|
246
|
-
};
|
|
247
|
-
const materialAllOfControlTester = rankWith(3, isAllOfControl);
|
|
248
|
-
var MaterialAllOfRenderer$1 = withJsonFormsAllOfProps(MaterialAllOfRenderer);
|
|
249
|
-
|
|
250
|
-
const isLayout = (uischema) => uischema.hasOwnProperty('elements');
|
|
251
|
-
class CombinatorProperties extends React.Component {
|
|
252
|
-
render() {
|
|
253
|
-
const { schema, combinatorKeyword, path } = this.props;
|
|
254
|
-
const otherProps = omit(schema, combinatorKeyword);
|
|
255
|
-
const foundUISchema = Generate.uiSchema(otherProps, 'VerticalLayout');
|
|
256
|
-
let isLayoutWithElements = false;
|
|
257
|
-
if (foundUISchema !== null && isLayout(foundUISchema)) {
|
|
258
|
-
isLayoutWithElements = foundUISchema.elements.length > 0;
|
|
259
|
-
}
|
|
260
|
-
if (isLayoutWithElements) {
|
|
261
|
-
return (React.createElement(JsonFormsDispatch, { schema: otherProps, path: path, uischema: foundUISchema }));
|
|
262
|
-
}
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
const MaterialAnyOfRenderer = ({ schema, rootSchema, indexOfFittingSchema, visible, path, renderers, cells, uischema, uischemas }) => {
|
|
268
|
-
const [selectedAnyOf, setSelectedAnyOf] = useState(indexOfFittingSchema || 0);
|
|
269
|
-
const handleChange = useCallback((_ev, value) => setSelectedAnyOf(value), [setSelectedAnyOf]);
|
|
270
|
-
const anyOf = 'anyOf';
|
|
271
|
-
const anyOfRenderInfos = createCombinatorRenderInfos(schema.anyOf, rootSchema, anyOf, uischema, path, uischemas);
|
|
272
|
-
return (React.createElement(Hidden, { xsUp: !visible },
|
|
273
|
-
React.createElement(CombinatorProperties, { schema: schema, combinatorKeyword: anyOf, path: path }),
|
|
274
|
-
React.createElement(Tabs, { value: selectedAnyOf, onChange: handleChange }, anyOfRenderInfos.map(anyOfRenderInfo => (React.createElement(Tab, { key: anyOfRenderInfo.label, label: anyOfRenderInfo.label })))),
|
|
275
|
-
anyOfRenderInfos.map((anyOfRenderInfo, anyOfIndex) => selectedAnyOf === anyOfIndex && (React.createElement(JsonFormsDispatch, { key: anyOfIndex, schema: anyOfRenderInfo.schema, uischema: anyOfRenderInfo.uischema, path: path, renderers: renderers, cells: cells })))));
|
|
277
|
+
const useFocus = () => {
|
|
278
|
+
const [focused, setFocused] = useState(false);
|
|
279
|
+
const onFocus = useCallback(() => setFocused(true), []);
|
|
280
|
+
const onBlur = useCallback(() => setFocused(false), []);
|
|
281
|
+
return [focused, onFocus, onBlur];
|
|
276
282
|
};
|
|
277
|
-
const materialAnyOfControlTester = rankWith(3, isAnyOfControl);
|
|
278
|
-
var MaterialAnyOfRenderer$1 = withJsonFormsAnyOfProps(MaterialAnyOfRenderer);
|
|
279
283
|
|
|
280
|
-
const
|
|
281
|
-
const
|
|
282
|
-
const
|
|
283
|
-
const [
|
|
284
|
-
const
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const confirm = useCallback(() => {
|
|
294
|
-
openNewTab(newSelectedIndex);
|
|
295
|
-
setOpen(false);
|
|
296
|
-
}, [handleChange, createDefaultValue, newSelectedIndex]);
|
|
297
|
-
const handleTabChange = useCallback((_event, newOneOfIndex) => {
|
|
298
|
-
setNewSelectedIndex(newOneOfIndex);
|
|
299
|
-
if (isEmpty(data)) {
|
|
300
|
-
openNewTab(newOneOfIndex);
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
setOpen(true);
|
|
304
|
-
}
|
|
305
|
-
}, [setOpen, setSelectedIndex, data]);
|
|
284
|
+
const MuiAutocomplete = (props) => {
|
|
285
|
+
const { description, errors, visible, required, label, data, className, id, enabled, uischema, path, handleChange, options, config, getOptionLabel, renderOption, filterOptions, isValid, } = props;
|
|
286
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
287
|
+
const [inputValue, setInputValue] = React.useState(data ?? '');
|
|
288
|
+
const [focused, onFocus, onBlur] = useFocus();
|
|
289
|
+
const findOption = options.find((o) => o.value === data) ?? null;
|
|
290
|
+
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
291
|
+
const firstFormHelperText = showDescription
|
|
292
|
+
? description
|
|
293
|
+
: !isValid
|
|
294
|
+
? errors
|
|
295
|
+
: null;
|
|
296
|
+
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
306
297
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
307
|
-
React.createElement(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
React.createElement(Button, { onClick: confirm, color: 'primary', autoFocus: true, id: `oneOf-${id}-confirm-yes` }, "Yes")))));
|
|
298
|
+
React.createElement(Autocomplete, { className: className, id: id, disabled: !enabled, value: findOption, onChange: (_event, newValue) => {
|
|
299
|
+
handleChange(path, newValue?.value);
|
|
300
|
+
}, inputValue: inputValue, onInputChange: (_event, newInputValue) => {
|
|
301
|
+
setInputValue(newInputValue);
|
|
302
|
+
}, autoHighlight: true, autoSelect: true, autoComplete: true, fullWidth: true, options: options, getOptionLabel: getOptionLabel || ((option) => option?.label), freeSolo: false, renderInput: (params) => {
|
|
303
|
+
return (React.createElement(TextField, Object.assign({ label: label, variant: 'standard', type: 'text', inputProps: params.inputProps, inputRef: params.InputProps.ref, autoFocus: appliedUiSchemaOptions.focus, disabled: !enabled }, params, { id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, focused: focused })));
|
|
304
|
+
}, renderOption: renderOption, filterOptions: filterOptions }),
|
|
305
|
+
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
306
|
+
React.createElement(FormHelperText, { error: !isValid }, secondFormHelperText)));
|
|
317
307
|
};
|
|
318
|
-
const materialOneOfControlTester = rankWith(3, isOneOfControl);
|
|
319
|
-
var MaterialOneOfRenderer$1 = withJsonFormsOneOfProps(MaterialOneOfRenderer);
|
|
320
308
|
|
|
321
|
-
const MuiCheckbox = React.memo((props)
|
|
322
|
-
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
309
|
+
const MuiCheckbox = React.memo(function MuiCheckbox(props) {
|
|
310
|
+
const { data, className, id, enabled, uischema, path, handleChange, config, inputProps, } = props;
|
|
323
311
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
324
|
-
const
|
|
312
|
+
const inputPropsMerged = merge({}, inputProps, {
|
|
313
|
+
autoFocus: !!appliedUiSchemaOptions.focus,
|
|
314
|
+
});
|
|
325
315
|
const checked = !!data;
|
|
326
|
-
return (React.createElement(Checkbox, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps:
|
|
316
|
+
return (React.createElement(Checkbox, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputPropsMerged }));
|
|
327
317
|
});
|
|
328
318
|
|
|
329
319
|
dayjs.extend(customParsing);
|
|
@@ -346,10 +336,18 @@ const getData = (data, saveFormat) => {
|
|
|
346
336
|
return dayjsData;
|
|
347
337
|
};
|
|
348
338
|
const ResettableTextField = ({ rawValue, dayjsValueIsValid, valueInInputFormat, focused, inputProps, ...props }) => {
|
|
349
|
-
const value = useRef({
|
|
339
|
+
const value = useRef({
|
|
340
|
+
lastInput: inputProps?.value,
|
|
341
|
+
toShow: inputProps?.value,
|
|
342
|
+
});
|
|
350
343
|
if (!focused) {
|
|
351
344
|
if (!dayjsValueIsValid) {
|
|
352
|
-
value.current.toShow =
|
|
345
|
+
value.current.toShow =
|
|
346
|
+
typeof rawValue === 'string' ||
|
|
347
|
+
rawValue === null ||
|
|
348
|
+
rawValue === undefined
|
|
349
|
+
? rawValue
|
|
350
|
+
: JSON.stringify(rawValue);
|
|
353
351
|
}
|
|
354
352
|
else {
|
|
355
353
|
value.current.toShow = valueInInputFormat;
|
|
@@ -359,14 +357,14 @@ const ResettableTextField = ({ rawValue, dayjsValueIsValid, valueInInputFormat,
|
|
|
359
357
|
value.current.lastInput = inputProps?.value;
|
|
360
358
|
value.current.toShow = inputProps?.value;
|
|
361
359
|
}
|
|
362
|
-
return React.createElement(TextField, Object.assign({}, props, { inputProps: { ...inputProps, value: value.current.toShow || '' } }));
|
|
360
|
+
return (React.createElement(TextField, Object.assign({}, props, { inputProps: { ...inputProps, value: value.current.toShow || '' } })));
|
|
363
361
|
};
|
|
364
362
|
|
|
365
363
|
const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
|
|
366
364
|
return elements.map((child, index) => (React.createElement(Grid, { item: true, key: `${path}-${index}`, xs: true },
|
|
367
365
|
React.createElement(JsonFormsDispatch, { uischema: child, schema: schema, path: path, enabled: enabled, renderers: renderers, cells: cells }))));
|
|
368
366
|
};
|
|
369
|
-
const MaterialLayoutRendererComponent = ({ visible, elements, schema, path, enabled, direction, renderers, cells }) => {
|
|
367
|
+
const MaterialLayoutRendererComponent = ({ visible, elements, schema, path, enabled, direction, renderers, cells, }) => {
|
|
370
368
|
if (isEmpty(elements)) {
|
|
371
369
|
return null;
|
|
372
370
|
}
|
|
@@ -376,10 +374,10 @@ const MaterialLayoutRendererComponent = ({ visible, elements, schema, path, enab
|
|
|
376
374
|
}
|
|
377
375
|
};
|
|
378
376
|
const MaterialLayoutRenderer = React.memo(MaterialLayoutRendererComponent);
|
|
379
|
-
const withAjvProps = (Component) => (props)
|
|
377
|
+
const withAjvProps = (Component) => function WithAjvProps(props) {
|
|
380
378
|
const ctx = useJsonForms();
|
|
381
379
|
const ajv = getAjv({ jsonforms: { ...ctx } });
|
|
382
|
-
return
|
|
380
|
+
return React.createElement(Component, Object.assign({}, props, { ajv: ajv }));
|
|
383
381
|
};
|
|
384
382
|
|
|
385
383
|
const eventToValue$3 = (ev) => ev.target.value;
|
|
@@ -394,32 +392,20 @@ const useDebouncedChange = (handleChange, defaultValue, data, path, eventToValue
|
|
|
394
392
|
setInput(newValue ?? defaultValue);
|
|
395
393
|
debouncedUpdate(newValue);
|
|
396
394
|
}, [debouncedUpdate, eventToValueFunction]);
|
|
397
|
-
const onClear = useCallback(() => {
|
|
395
|
+
const onClear = useCallback(() => {
|
|
396
|
+
setInput(defaultValue);
|
|
397
|
+
handleChange(path, undefined);
|
|
398
|
+
}, [defaultValue, handleChange, path]);
|
|
398
399
|
return [input, onChange, onClear];
|
|
399
400
|
};
|
|
400
401
|
|
|
401
|
-
const useFocus = () => {
|
|
402
|
-
const [focused, setFocused] = useState(false);
|
|
403
|
-
const onFocus = useCallback(() => setFocused(true), []);
|
|
404
|
-
const onBlur = useCallback(() => setFocused(false), []);
|
|
405
|
-
return [focused, onFocus, onBlur];
|
|
406
|
-
};
|
|
407
|
-
|
|
408
402
|
const i18nDefaults = {
|
|
409
|
-
'enum.none': 'None'
|
|
403
|
+
'enum.none': 'None',
|
|
410
404
|
};
|
|
411
405
|
|
|
412
|
-
const MuiSelect = React.memo((props) => {
|
|
413
|
-
const { data, className, id, enabled, schema, uischema, path, handleChange, options, config, t } = props;
|
|
414
|
-
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
415
|
-
const noneOptionLabel = useMemo(() => t('enum.none', i18nDefaults['enum.none'], { schema, uischema, path }), [t, schema, uischema, path]);
|
|
416
|
-
return (React.createElement(Select, { className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, value: data !== undefined ? data : '', onChange: ev => handleChange(path, ev.target.value || undefined), fullWidth: true, variant: 'standard' }, [React.createElement(MenuItem, { value: '', key: 'jsonforms.enum.none' },
|
|
417
|
-
React.createElement("em", null, noneOptionLabel))].concat(options.map(optionValue => (React.createElement(MenuItem, { value: optionValue.value, key: optionValue.value }, optionValue.label))))));
|
|
418
|
-
});
|
|
419
|
-
|
|
420
406
|
const toNumber$1 = (value) => value === '' ? undefined : parseInt(value, 10);
|
|
421
407
|
const eventToValue$2 = (ev) => toNumber$1(ev.target.value);
|
|
422
|
-
const MuiInputInteger = React.memo((props)
|
|
408
|
+
const MuiInputInteger = React.memo(function MuiInputInteger(props) {
|
|
423
409
|
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
424
410
|
const inputProps = { step: '1' };
|
|
425
411
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
@@ -429,7 +415,7 @@ const MuiInputInteger = React.memo((props) => {
|
|
|
429
415
|
|
|
430
416
|
const toNumber = (value) => value === '' ? undefined : parseFloat(value);
|
|
431
417
|
const eventToValue$1 = (ev) => toNumber(ev.target.value);
|
|
432
|
-
const MuiInputNumber = React.memo((props)
|
|
418
|
+
const MuiInputNumber = React.memo(function MuiInputNumber(props) {
|
|
433
419
|
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
434
420
|
const inputProps = { step: '0.1' };
|
|
435
421
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
@@ -437,8 +423,8 @@ const MuiInputNumber = React.memo((props) => {
|
|
|
437
423
|
return (React.createElement(Input, { type: 'number', value: inputValue, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, inputProps: inputProps, fullWidth: true }));
|
|
438
424
|
});
|
|
439
425
|
|
|
440
|
-
const MuiInputNumberFormat = React.memo((props)
|
|
441
|
-
const { className, id, enabled, uischema, isValid, path, handleChange, schema, config } = props;
|
|
426
|
+
const MuiInputNumberFormat = React.memo(function MuiInputNumberFormat(props) {
|
|
427
|
+
const { className, id, enabled, uischema, isValid, path, handleChange, schema, config, } = props;
|
|
442
428
|
const maxLength = schema.maxLength;
|
|
443
429
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
444
430
|
let inputProps;
|
|
@@ -455,9 +441,9 @@ const MuiInputNumberFormat = React.memo((props) => {
|
|
|
455
441
|
});
|
|
456
442
|
|
|
457
443
|
const eventToValue = (ev) => ev.target.value === '' ? undefined : ev.target.value;
|
|
458
|
-
const MuiInputText = React.memo((props)
|
|
444
|
+
const MuiInputText = React.memo(function MuiInputText(props) {
|
|
459
445
|
const [showAdornment, setShowAdornment] = useState(false);
|
|
460
|
-
const { data, config, className, id, enabled, uischema, isValid, path, handleChange, schema, muiInputProps, inputComponent } = props;
|
|
446
|
+
const { data, config, className, id, enabled, uischema, isValid, path, handleChange, schema, muiInputProps, inputComponent, } = props;
|
|
461
447
|
const maxLength = schema.maxLength;
|
|
462
448
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
463
449
|
let inputProps;
|
|
@@ -476,26 +462,49 @@ const MuiInputText = React.memo((props) => {
|
|
|
476
462
|
const onPointerLeave = () => setShowAdornment(false);
|
|
477
463
|
const theme = useTheme();
|
|
478
464
|
const closeStyle = {
|
|
479
|
-
background: theme.jsonforms?.input?.delete?.background ||
|
|
480
|
-
|
|
465
|
+
background: theme.jsonforms?.input?.delete?.background ||
|
|
466
|
+
theme.palette.background.default,
|
|
467
|
+
borderRadius: '50%',
|
|
481
468
|
};
|
|
482
469
|
return (React.createElement(Input, { type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text', value: inputText, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, multiline: appliedUiSchemaOptions.multi, fullWidth: !appliedUiSchemaOptions.trim || maxLength === undefined, inputProps: inputProps, error: !isValid, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, endAdornment: React.createElement(InputAdornment, { position: 'end', style: {
|
|
483
|
-
display: !showAdornment || !enabled || data === undefined
|
|
470
|
+
display: !showAdornment || !enabled || data === undefined
|
|
471
|
+
? 'none'
|
|
472
|
+
: 'flex',
|
|
484
473
|
position: 'absolute',
|
|
485
|
-
right: 0
|
|
474
|
+
right: 0,
|
|
486
475
|
} },
|
|
487
476
|
React.createElement(IconButton, { "aria-label": 'Clear input field', onClick: onClear, size: 'large' },
|
|
488
477
|
React.createElement(Close, { style: closeStyle }))), inputComponent: inputComponent }));
|
|
489
478
|
});
|
|
490
479
|
|
|
491
|
-
const MuiInputTime = React.memo((props)
|
|
480
|
+
const MuiInputTime = React.memo(function MuiInputTime(props) {
|
|
492
481
|
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
493
482
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
494
483
|
const [inputValue, onChange] = useDebouncedChange(handleChange, '', data, path);
|
|
495
484
|
return (React.createElement(Input, { type: 'time', value: inputValue, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, fullWidth: true }));
|
|
496
485
|
});
|
|
497
486
|
|
|
498
|
-
const
|
|
487
|
+
const MuiSelect = React.memo(function MuiSelect(props) {
|
|
488
|
+
const { data, className, id, enabled, schema, uischema, path, handleChange, options, config, t, } = props;
|
|
489
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
490
|
+
const noneOptionLabel = useMemo(() => t('enum.none', i18nDefaults['enum.none'], { schema, uischema, path }), [t, schema, uischema, path]);
|
|
491
|
+
return (React.createElement(Select, { className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, value: data !== undefined ? data : '', onChange: (ev) => handleChange(path, ev.target.value || undefined), fullWidth: true, variant: 'standard' }, [
|
|
492
|
+
React.createElement(MenuItem, { value: '', key: 'jsonforms.enum.none' },
|
|
493
|
+
React.createElement("em", null, noneOptionLabel)),
|
|
494
|
+
].concat(options.map((optionValue) => (React.createElement(MenuItem, { value: optionValue.value, key: optionValue.value }, optionValue.label))))));
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
const MuiToggle = React.memo(function MuiToggle(props) {
|
|
498
|
+
const { data, className, id, enabled, uischema, path, handleChange, config, inputProps, } = props;
|
|
499
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
500
|
+
const inputPropsMerged = merge({}, inputProps, {
|
|
501
|
+
autoFocus: !!appliedUiSchemaOptions.focus,
|
|
502
|
+
});
|
|
503
|
+
const checked = !!data;
|
|
504
|
+
return (React.createElement(Switch, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputPropsMerged }));
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
const MaterialEnumArrayRenderer = ({ schema, visible, errors, path, options, data, addItem, removeItem, handleChange: _handleChange, ...otherProps }) => {
|
|
499
508
|
return (React.createElement(Hidden, { xlUp: !visible },
|
|
500
509
|
React.createElement(FormControl, { component: 'fieldset' },
|
|
501
510
|
React.createElement(FormGroup, { row: true }, options.map((option, index) => {
|
|
@@ -515,14 +524,63 @@ const hasOneOfItems = (schema) => schema.oneOf !== undefined &&
|
|
|
515
524
|
return entry.const !== undefined;
|
|
516
525
|
});
|
|
517
526
|
const hasEnumItems = (schema) => schema.type === 'string' && schema.enum !== undefined;
|
|
518
|
-
const materialEnumArrayRendererTester = rankWith(5, and(uiTypeIs('Control'), and(schemaMatches(schema => hasType(schema, 'array') &&
|
|
527
|
+
const materialEnumArrayRendererTester = rankWith(5, and(uiTypeIs('Control'), and(schemaMatches((schema) => hasType(schema, 'array') &&
|
|
519
528
|
!Array.isArray(schema.items) &&
|
|
520
|
-
schema.uniqueItems === true), schemaSubPathMatches('items', schema => {
|
|
529
|
+
schema.uniqueItems === true), schemaSubPathMatches('items', (schema) => {
|
|
521
530
|
return hasOneOfItems(schema) || hasEnumItems(schema);
|
|
522
531
|
}))));
|
|
523
532
|
var MaterialEnumArrayRenderer$1 = withJsonFormsMultiEnumProps(MaterialEnumArrayRenderer);
|
|
524
533
|
|
|
525
|
-
const
|
|
534
|
+
const MaterialObjectRenderer = ({ renderers, cells, uischemas, schema, label, path, visible, enabled, uischema, rootSchema, }) => {
|
|
535
|
+
const detailUiSchema = useMemo(() => findUISchema(uischemas, schema, uischema.scope, path, () => isEmpty(path)
|
|
536
|
+
? Generate.uiSchema(schema, 'VerticalLayout')
|
|
537
|
+
: { ...Generate.uiSchema(schema, 'Group'), label }, uischema, rootSchema), [uischemas, schema, uischema.scope, path, label, uischema, rootSchema]);
|
|
538
|
+
return (React.createElement(Hidden, { xsUp: !visible },
|
|
539
|
+
React.createElement(JsonFormsDispatch, { visible: visible, enabled: enabled, schema: schema, uischema: detailUiSchema, path: path, renderers: renderers, cells: cells })));
|
|
540
|
+
};
|
|
541
|
+
const materialObjectControlTester = rankWith(2, isObjectControl);
|
|
542
|
+
var MaterialObjectRenderer$1 = withJsonFormsDetailProps(MaterialObjectRenderer);
|
|
543
|
+
|
|
544
|
+
const MaterialOneOfRenderer = ({ handleChange, schema, path, renderers, cells, rootSchema, id, visible, indexOfFittingSchema, uischema, uischemas, data, }) => {
|
|
545
|
+
const [open, setOpen] = useState(false);
|
|
546
|
+
const [selectedIndex, setSelectedIndex] = useState(indexOfFittingSchema || 0);
|
|
547
|
+
const [newSelectedIndex, setNewSelectedIndex] = useState(0);
|
|
548
|
+
const handleClose = useCallback(() => setOpen(false), [setOpen]);
|
|
549
|
+
const cancel = useCallback(() => {
|
|
550
|
+
setOpen(false);
|
|
551
|
+
}, [setOpen]);
|
|
552
|
+
const oneOfRenderInfos = createCombinatorRenderInfos(schema.oneOf, rootSchema, 'oneOf', uischema, path, uischemas);
|
|
553
|
+
const openNewTab = (newIndex) => {
|
|
554
|
+
handleChange(path, createDefaultValue(oneOfRenderInfos[newIndex].schema));
|
|
555
|
+
setSelectedIndex(newIndex);
|
|
556
|
+
};
|
|
557
|
+
const confirm = useCallback(() => {
|
|
558
|
+
openNewTab(newSelectedIndex);
|
|
559
|
+
setOpen(false);
|
|
560
|
+
}, [handleChange, createDefaultValue, newSelectedIndex]);
|
|
561
|
+
const handleTabChange = useCallback((_event, newOneOfIndex) => {
|
|
562
|
+
setNewSelectedIndex(newOneOfIndex);
|
|
563
|
+
if (isEmpty(data)) {
|
|
564
|
+
openNewTab(newOneOfIndex);
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
setOpen(true);
|
|
568
|
+
}
|
|
569
|
+
}, [setOpen, setSelectedIndex, data]);
|
|
570
|
+
return (React.createElement(Hidden, { xsUp: !visible },
|
|
571
|
+
React.createElement(CombinatorProperties, { schema: schema, combinatorKeyword: 'oneOf', path: path }),
|
|
572
|
+
React.createElement(Tabs, { value: selectedIndex, onChange: handleTabChange }, oneOfRenderInfos.map((oneOfRenderInfo) => (React.createElement(Tab, { key: oneOfRenderInfo.label, label: oneOfRenderInfo.label })))),
|
|
573
|
+
oneOfRenderInfos.map((oneOfRenderInfo, oneOfIndex) => selectedIndex === oneOfIndex && (React.createElement(JsonFormsDispatch, { key: oneOfIndex, schema: oneOfRenderInfo.schema, uischema: oneOfRenderInfo.uischema, path: path, renderers: renderers, cells: cells }))),
|
|
574
|
+
React.createElement(Dialog, { open: open, onClose: handleClose, "aria-labelledby": 'alert-dialog-title', "aria-describedby": 'alert-dialog-description' },
|
|
575
|
+
React.createElement(DialogTitle, { id: 'alert-dialog-title' }, 'Clear form?'),
|
|
576
|
+
React.createElement(DialogContent, null,
|
|
577
|
+
React.createElement(DialogContentText, { id: 'alert-dialog-description' }, "Your data will be cleared if you navigate away from this tab. Do you want to proceed?")),
|
|
578
|
+
React.createElement(DialogActions, null,
|
|
579
|
+
React.createElement(Button, { onClick: cancel, color: 'primary' }, "No"),
|
|
580
|
+
React.createElement(Button, { onClick: confirm, color: 'primary', autoFocus: true, id: `oneOf-${id}-confirm-yes` }, "Yes")))));
|
|
581
|
+
};
|
|
582
|
+
const materialOneOfControlTester = rankWith(3, isOneOfControl);
|
|
583
|
+
var MaterialOneOfRenderer$1 = withJsonFormsOneOfProps(MaterialOneOfRenderer);
|
|
526
584
|
|
|
527
585
|
const materialLabelRendererTester = rankWith(1, uiTypeIs('Label'));
|
|
528
586
|
const MaterialLabelRenderer = ({ text, visible }) => {
|
|
@@ -531,34 +589,33 @@ const MaterialLabelRenderer = ({ text, visible }) => {
|
|
|
531
589
|
};
|
|
532
590
|
var MaterialLabelRenderer$1 = withJsonFormsLabelProps(MaterialLabelRenderer);
|
|
533
591
|
|
|
534
|
-
const ArrayLayoutToolbar = React.memo(({ label, errors, addItem, path, createDefault })
|
|
592
|
+
const ArrayLayoutToolbar = React.memo(function ArrayLayoutToolbar({ label, errors, addItem, path, createDefault, translations, }) {
|
|
535
593
|
return (React.createElement(Toolbar, { disableGutters: true },
|
|
536
594
|
React.createElement(Grid, { container: true, alignItems: 'center', justifyContent: 'space-between' },
|
|
537
595
|
React.createElement(Grid, { item: true },
|
|
538
596
|
React.createElement(Typography, { variant: 'h6' }, label)),
|
|
539
|
-
errors.length !== 0 &&
|
|
540
|
-
React.createElement(
|
|
541
|
-
React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors })),
|
|
597
|
+
errors.length !== 0 && (React.createElement(Grid, { item: true },
|
|
598
|
+
React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors }))),
|
|
542
599
|
React.createElement(Grid, { item: true },
|
|
543
600
|
React.createElement(Grid, { container: true },
|
|
544
601
|
React.createElement(Grid, { item: true },
|
|
545
|
-
React.createElement(Tooltip, { id: 'tooltip-add', title:
|
|
546
|
-
React.createElement(IconButton, { "aria-label":
|
|
602
|
+
React.createElement(Tooltip, { id: 'tooltip-add', title: translations.addTooltip, placement: 'bottom' },
|
|
603
|
+
React.createElement(IconButton, { "aria-label": translations.addAriaLabel, onClick: addItem(path, createDefault()), size: 'large' },
|
|
547
604
|
React.createElement(AddIcon, null)))))))));
|
|
548
605
|
});
|
|
549
606
|
|
|
550
|
-
const ListWithDetailMasterItem = ({ index, childLabel, selected, handleSelect, removeItem, path }) => {
|
|
607
|
+
const ListWithDetailMasterItem = ({ index, childLabel, selected, handleSelect, removeItem, path, translations, }) => {
|
|
551
608
|
return (React.createElement(ListItem, { button: true, selected: selected, onClick: handleSelect(index) },
|
|
552
609
|
React.createElement(ListItemAvatar, null,
|
|
553
610
|
React.createElement(Avatar, { "aria-label": 'Index' }, index + 1)),
|
|
554
611
|
React.createElement(ListItemText, { primary: childLabel }),
|
|
555
612
|
React.createElement(ListItemSecondaryAction, null,
|
|
556
|
-
React.createElement(IconButton, { "aria-label":
|
|
613
|
+
React.createElement(IconButton, { "aria-label": translations.removeAriaLabel, onClick: removeItem(path, index), size: 'large' },
|
|
557
614
|
React.createElement(DeleteIcon, null)))));
|
|
558
615
|
};
|
|
559
616
|
var ListWithDetailMasterItem$1 = withJsonFormsMasterListItemProps(ListWithDetailMasterItem);
|
|
560
617
|
|
|
561
|
-
const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, errors, visible, label, required, removeItems, addItem, data, renderers, cells, config, rootSchema }) => {
|
|
618
|
+
const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, errors, visible, label, required, removeItems, addItem, data, renderers, cells, config, rootSchema, translations, }) => {
|
|
562
619
|
const [selectedIndex, setSelectedIndex] = useState(undefined);
|
|
563
620
|
const handleRemoveItem = useCallback((p, value) => () => {
|
|
564
621
|
removeItems(p, [value])();
|
|
@@ -577,40 +634,18 @@ const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, err
|
|
|
577
634
|
setSelectedIndex(undefined);
|
|
578
635
|
}, [schema]);
|
|
579
636
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
580
|
-
React.createElement(ArrayLayoutToolbar, { label: computeLabel(label, required, appliedUiSchemaOptions.hideRequiredAsterisk), errors: errors, path: path, addItem: addItem, createDefault: handleCreateDefaultValue }),
|
|
637
|
+
React.createElement(ArrayLayoutToolbar, { translations: translations, label: computeLabel(label, required, appliedUiSchemaOptions.hideRequiredAsterisk), errors: errors, path: path, addItem: addItem, createDefault: handleCreateDefaultValue }),
|
|
581
638
|
React.createElement(Grid, { container: true, direction: 'row', spacing: 2 },
|
|
582
639
|
React.createElement(Grid, { item: true, xs: 3 },
|
|
583
|
-
React.createElement(List, null, data > 0 ? (map(range(data), index => (React.createElement(ListWithDetailMasterItem$1, { index: index, path: path, schema: schema, handleSelect: handleListItemClick, removeItem: handleRemoveItem, selected: selectedIndex === index, key: index })))) : (React.createElement("p", null, "No data")))),
|
|
584
|
-
React.createElement(Grid, { item: true, xs: true }, selectedIndex !== undefined ? (React.createElement(JsonFormsDispatch, { renderers: renderers, cells: cells, visible: visible, schema: schema, uischema: foundUISchema, path: composePaths(path, `${selectedIndex}`) })) : (React.createElement(Typography, { variant: 'h6' },
|
|
640
|
+
React.createElement(List, null, data > 0 ? (map(range(data), (index) => (React.createElement(ListWithDetailMasterItem$1, { index: index, path: path, schema: schema, handleSelect: handleListItemClick, removeItem: handleRemoveItem, selected: selectedIndex === index, key: index, translations: translations })))) : (React.createElement("p", null, "No data")))),
|
|
641
|
+
React.createElement(Grid, { item: true, xs: true }, selectedIndex !== undefined ? (React.createElement(JsonFormsDispatch, { renderers: renderers, cells: cells, visible: visible, schema: schema, uischema: foundUISchema, path: composePaths(path, `${selectedIndex}`) })) : (React.createElement(Typography, { variant: 'h6' }, translations.noSelection))))));
|
|
585
642
|
};
|
|
586
643
|
const materialListWithDetailTester = rankWith(4, and(uiTypeIs('ListWithDetail'), isObjectArray));
|
|
587
644
|
var MaterialListWithDetailRenderer$1 = withJsonFormsArrayLayoutProps(MaterialListWithDetailRenderer);
|
|
588
645
|
|
|
589
|
-
const MaterialBooleanControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config }) => {
|
|
590
|
-
return (React.createElement(Hidden, { xsUp: !visible },
|
|
591
|
-
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 }) })));
|
|
592
|
-
};
|
|
593
|
-
const materialBooleanControlTester = rankWith(2, isBooleanControl);
|
|
594
|
-
var MaterialBooleanControl$1 = withJsonFormsControlProps(MaterialBooleanControl);
|
|
595
|
-
|
|
596
|
-
const MuiToggle = React.memo((props) => {
|
|
597
|
-
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
598
|
-
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
599
|
-
const inputProps = { autoFocus: !!appliedUiSchemaOptions.focus };
|
|
600
|
-
const checked = !!data;
|
|
601
|
-
return (React.createElement(Switch, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputProps }));
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
const MaterialBooleanToggleControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config }) => {
|
|
605
|
-
return (React.createElement(Hidden, { xsUp: !visible },
|
|
606
|
-
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 }) })));
|
|
607
|
-
};
|
|
608
|
-
const materialBooleanToggleControlTester = rankWith(3, and(isBooleanControl, optionIs('toggle', true)));
|
|
609
|
-
var MaterialBooleanToggleControl$1 = withJsonFormsControlProps(MaterialBooleanToggleControl);
|
|
610
|
-
|
|
611
646
|
const MaterialInputControl = (props) => {
|
|
612
647
|
const [focused, onFocus, onBlur] = useFocus();
|
|
613
|
-
const { id, description, errors, label, uischema, visible, required, config, input } = props;
|
|
648
|
+
const { id, description, errors, label, uischema, visible, required, config, input, } = props;
|
|
614
649
|
const isValid = errors.length === 0;
|
|
615
650
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
616
651
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
@@ -629,59 +664,128 @@ const MaterialInputControl = (props) => {
|
|
|
629
664
|
React.createElement(FormHelperText, { error: !isValid }, secondFormHelperText))));
|
|
630
665
|
};
|
|
631
666
|
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
const
|
|
637
|
-
const
|
|
638
|
-
const
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
:
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
667
|
+
const findEnumSchema = (schemas) => schemas.find((s) => s.enum !== undefined && (s.type === 'string' || s.type === undefined));
|
|
668
|
+
const findTextSchema = (schemas) => schemas.find((s) => s.type === 'string' && s.enum === undefined);
|
|
669
|
+
const MuiAutocompleteInputText = (props) => {
|
|
670
|
+
const { data, config, className, id, enabled, uischema, isValid, path, handleChange, schema, } = props;
|
|
671
|
+
const enumSchema = findEnumSchema(schema.anyOf);
|
|
672
|
+
const stringSchema = findTextSchema(schema.anyOf);
|
|
673
|
+
const maxLength = stringSchema.maxLength;
|
|
674
|
+
const appliedUiSchemaOptions = useMemo(() => merge({}, config, uischema.options), [config, uischema.options]);
|
|
675
|
+
const inputProps = useMemo(() => {
|
|
676
|
+
let propMemo = {};
|
|
677
|
+
if (appliedUiSchemaOptions.restrict) {
|
|
678
|
+
propMemo = { maxLength: maxLength };
|
|
679
|
+
}
|
|
680
|
+
if (appliedUiSchemaOptions.trim && maxLength !== undefined) {
|
|
681
|
+
propMemo.size = maxLength;
|
|
682
|
+
}
|
|
683
|
+
propMemo.list = props.id + 'datalist';
|
|
684
|
+
return propMemo;
|
|
685
|
+
}, [appliedUiSchemaOptions, props.id]);
|
|
686
|
+
const [inputText, onChange] = useDebouncedChange(handleChange, '', data, path);
|
|
687
|
+
const dataList = (React.createElement("datalist", { id: props.id + 'datalist' }, enumSchema.enum.map((optionValue) => (React.createElement("option", { value: optionValue, key: optionValue })))));
|
|
688
|
+
return (React.createElement(Input, { type: 'text', value: inputText, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, fullWidth: !appliedUiSchemaOptions.trim || maxLength === undefined, inputProps: inputProps, error: !isValid, endAdornment: dataList }));
|
|
689
|
+
};
|
|
690
|
+
class MaterialAnyOfStringOrEnumControl extends Control {
|
|
691
|
+
render() {
|
|
692
|
+
return (React.createElement(MaterialInputControl, Object.assign({}, this.props, { input: MuiAutocompleteInputText })));
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
const hasEnumAndText = (schemas) => {
|
|
696
|
+
const enumSchema = findEnumSchema(schemas);
|
|
697
|
+
const stringSchema = findTextSchema(schemas);
|
|
698
|
+
const remainingSchemas = schemas.filter((s) => s !== enumSchema || s !== stringSchema);
|
|
699
|
+
const wrongType = remainingSchemas.find((s) => s.type && s.type !== 'string');
|
|
700
|
+
return enumSchema && stringSchema && !wrongType;
|
|
701
|
+
};
|
|
702
|
+
const simpleAnyOf = and(uiTypeIs('Control'), schemaMatches((schema) => schema.hasOwnProperty('anyOf') && hasEnumAndText(schema.anyOf)));
|
|
703
|
+
const materialAnyOfStringOrEnumControlTester = rankWith(5, simpleAnyOf);
|
|
704
|
+
var MaterialAnyOfStringOrEnumControl$1 = withJsonFormsControlProps(MaterialAnyOfStringOrEnumControl);
|
|
705
|
+
|
|
706
|
+
const MaterialBooleanControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description, }) => {
|
|
660
707
|
const isValid = errors.length === 0;
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
708
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
709
|
+
const showDescription = !isDescriptionHidden(visible, description,
|
|
710
|
+
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
711
|
+
const showTooltip = !showDescription &&
|
|
712
|
+
!isDescriptionHidden(visible, description,
|
|
713
|
+
true,
|
|
714
|
+
true);
|
|
715
|
+
const firstFormHelperText = showDescription
|
|
716
|
+
? description
|
|
717
|
+
: !isValid
|
|
718
|
+
? errors
|
|
719
|
+
: null;
|
|
720
|
+
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
721
|
+
const descriptionIds = [];
|
|
722
|
+
const tooltipId = `${id}-tip`;
|
|
723
|
+
const helpId1 = `${id}-help1`;
|
|
724
|
+
const helpId2 = `${id}-help2`;
|
|
725
|
+
if (showTooltip) {
|
|
726
|
+
descriptionIds.push(tooltipId);
|
|
727
|
+
}
|
|
728
|
+
if (firstFormHelperText) {
|
|
729
|
+
descriptionIds.push(helpId1);
|
|
730
|
+
}
|
|
731
|
+
if (secondFormHelperText) {
|
|
732
|
+
descriptionIds.push(helpId2);
|
|
733
|
+
}
|
|
734
|
+
const ariaDescribedBy = descriptionIds.join(' ');
|
|
735
|
+
return (React.createElement(Hidden, { xsUp: !visible },
|
|
736
|
+
React.createElement(Tooltip, { id: tooltipId, title: showTooltip ? description : '' },
|
|
737
|
+
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: {
|
|
738
|
+
'aria-describedby': ariaDescribedBy,
|
|
739
|
+
} }) })),
|
|
740
|
+
React.createElement(FormHelperText, { id: helpId1, error: !isValid && !showDescription }, firstFormHelperText),
|
|
741
|
+
React.createElement(FormHelperText, { id: helpId2, error: !isValid }, secondFormHelperText)));
|
|
664
742
|
};
|
|
665
|
-
const
|
|
666
|
-
var
|
|
743
|
+
const materialBooleanControlTester = rankWith(2, isBooleanControl);
|
|
744
|
+
var MaterialBooleanControl$1 = withJsonFormsControlProps(MaterialBooleanControl);
|
|
667
745
|
|
|
668
|
-
const
|
|
669
|
-
const [focused, onFocus, onBlur] = useFocus();
|
|
670
|
-
const { id, errors, label, schema, description, enabled, visible, required, path, handleChange, data, config } = props;
|
|
746
|
+
const MaterialBooleanToggleControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description, }) => {
|
|
671
747
|
const isValid = errors.length === 0;
|
|
672
|
-
const appliedUiSchemaOptions = merge({}, config,
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
const
|
|
748
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
749
|
+
const showDescription = !isDescriptionHidden(visible, description,
|
|
750
|
+
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
751
|
+
const showTooltip = !showDescription &&
|
|
752
|
+
!isDescriptionHidden(visible, description,
|
|
753
|
+
true,
|
|
754
|
+
true);
|
|
755
|
+
const firstFormHelperText = showDescription
|
|
756
|
+
? description
|
|
757
|
+
: !isValid
|
|
758
|
+
? errors
|
|
759
|
+
: null;
|
|
760
|
+
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
761
|
+
const descriptionIds = [];
|
|
762
|
+
const tooltipId = `${id}-tip`;
|
|
763
|
+
const helpId1 = `${id}-help1`;
|
|
764
|
+
const helpId2 = `${id}-help2`;
|
|
765
|
+
if (showTooltip) {
|
|
766
|
+
descriptionIds.push(tooltipId);
|
|
767
|
+
}
|
|
768
|
+
if (firstFormHelperText) {
|
|
769
|
+
descriptionIds.push(helpId1);
|
|
770
|
+
}
|
|
771
|
+
if (secondFormHelperText) {
|
|
772
|
+
descriptionIds.push(helpId2);
|
|
773
|
+
}
|
|
774
|
+
const ariaDescribedBy = descriptionIds.join(' ');
|
|
676
775
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
677
|
-
React.createElement(
|
|
776
|
+
React.createElement(Tooltip, { id: tooltipId, title: showTooltip ? description : '' },
|
|
777
|
+
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: {
|
|
778
|
+
'aria-describedby': ariaDescribedBy,
|
|
779
|
+
} }) })),
|
|
780
|
+
React.createElement(FormHelperText, { id: helpId1, error: !isValid && !showDescription }, firstFormHelperText),
|
|
781
|
+
React.createElement(FormHelperText, { id: helpId2, error: !isValid }, secondFormHelperText)));
|
|
678
782
|
};
|
|
679
|
-
const
|
|
680
|
-
var
|
|
783
|
+
const materialBooleanToggleControlTester = rankWith(3, and(isBooleanControl, optionIs('toggle', true)));
|
|
784
|
+
var MaterialBooleanToggleControl$1 = withJsonFormsControlProps(MaterialBooleanToggleControl);
|
|
681
785
|
|
|
682
786
|
const MaterialDateControl = (props) => {
|
|
683
787
|
const [focused, onFocus, onBlur] = useFocus();
|
|
684
|
-
const { description, id, errors, label, uischema, visible, enabled, required, path, handleChange, data, config } = props;
|
|
788
|
+
const { description, id, errors, label, uischema, visible, enabled, required, path, handleChange, data, config, } = props;
|
|
685
789
|
const isValid = errors.length === 0;
|
|
686
790
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
687
791
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
@@ -701,9 +805,9 @@ const MaterialDateControl = (props) => {
|
|
|
701
805
|
React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
702
806
|
React.createElement(DatePicker, { label: label, value: value, onChange: onChange, inputFormat: format, disableMaskedInput: true, views: views, disabled: !enabled, componentsProps: {
|
|
703
807
|
actionBar: {
|
|
704
|
-
actions: (variant) =>
|
|
705
|
-
}
|
|
706
|
-
}, renderInput: params => (React.createElement(ResettableTextField, Object.assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: {
|
|
808
|
+
actions: (variant) => variant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
|
|
809
|
+
},
|
|
810
|
+
}, renderInput: (params) => (React.createElement(ResettableTextField, Object.assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: {
|
|
707
811
|
...params.inputProps,
|
|
708
812
|
type: 'text',
|
|
709
813
|
}, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))) }),
|
|
@@ -715,13 +819,18 @@ var MaterialDateControl$1 = withJsonFormsControlProps(MaterialDateControl);
|
|
|
715
819
|
|
|
716
820
|
const MaterialDateTimeControl = (props) => {
|
|
717
821
|
const [focused, onFocus, onBlur] = useFocus();
|
|
718
|
-
const { id, description, errors, label, uischema, visible, enabled, required, path, handleChange, data, config } = props;
|
|
822
|
+
const { id, description, errors, label, uischema, visible, enabled, required, path, handleChange, data, config, } = props;
|
|
719
823
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
720
824
|
const isValid = errors.length === 0;
|
|
721
825
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
722
826
|
const format = appliedUiSchemaOptions.dateTimeFormat ?? 'YYYY-MM-DD HH:mm';
|
|
723
827
|
const saveFormat = appliedUiSchemaOptions.dateTimeSaveFormat ?? undefined;
|
|
724
|
-
const views = appliedUiSchemaOptions.views ?? [
|
|
828
|
+
const views = appliedUiSchemaOptions.views ?? [
|
|
829
|
+
'year',
|
|
830
|
+
'day',
|
|
831
|
+
'hours',
|
|
832
|
+
'minutes',
|
|
833
|
+
];
|
|
725
834
|
const firstFormHelperText = showDescription
|
|
726
835
|
? description
|
|
727
836
|
: !isValid
|
|
@@ -735,9 +844,9 @@ const MaterialDateTimeControl = (props) => {
|
|
|
735
844
|
React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
736
845
|
React.createElement(DateTimePicker, { label: label, value: value, onChange: onChange, inputFormat: format, disableMaskedInput: true, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, componentsProps: {
|
|
737
846
|
actionBar: {
|
|
738
|
-
actions: (variant) =>
|
|
739
|
-
}
|
|
740
|
-
}, renderInput: params => (React.createElement(ResettableTextField, Object.assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: {
|
|
847
|
+
actions: (variant) => variant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
|
|
848
|
+
},
|
|
849
|
+
}, renderInput: (params) => (React.createElement(ResettableTextField, Object.assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: {
|
|
741
850
|
...params.inputProps,
|
|
742
851
|
type: 'text',
|
|
743
852
|
}, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))) }),
|
|
@@ -747,59 +856,91 @@ const MaterialDateTimeControl = (props) => {
|
|
|
747
856
|
const materialDateTimeControlTester = rankWith(2, isDateTimeControl);
|
|
748
857
|
var MaterialDateTimeControl$1 = withJsonFormsControlProps(MaterialDateTimeControl);
|
|
749
858
|
|
|
750
|
-
const
|
|
859
|
+
const MaterialEnumControl = (props) => {
|
|
860
|
+
const { config, uischema, errors } = props;
|
|
861
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
862
|
+
const isValid = errors.length === 0;
|
|
863
|
+
return appliedUiSchemaOptions.autocomplete === false ? (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiSelect }))) : (React.createElement(MuiAutocomplete, Object.assign({}, props, { isValid: isValid })));
|
|
864
|
+
};
|
|
865
|
+
const materialEnumControlTester = rankWith(2, isEnumControl);
|
|
866
|
+
var MaterialEnumControl$1 = withJsonFormsEnumProps(withTranslateProps(React.memo(MaterialEnumControl)), false);
|
|
867
|
+
|
|
868
|
+
const MaterialIntegerControl = (props) => (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiInputInteger })));
|
|
869
|
+
const materialIntegerControlTester = rankWith(2, isIntegerControl);
|
|
870
|
+
var MaterialIntegerControl$1 = withJsonFormsControlProps(MaterialIntegerControl);
|
|
871
|
+
|
|
872
|
+
const MaterialNativeControl = (props) => {
|
|
751
873
|
const [focused, onFocus, onBlur] = useFocus();
|
|
752
|
-
const { id,
|
|
874
|
+
const { id, errors, label, schema, description, enabled, visible, required, path, handleChange, data, config, } = props;
|
|
875
|
+
const isValid = errors.length === 0;
|
|
876
|
+
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
877
|
+
const [inputValue, onChange] = useDebouncedChange(handleChange, '', data, path);
|
|
878
|
+
const fieldType = appliedUiSchemaOptions.format ?? schema.format;
|
|
879
|
+
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
880
|
+
return (React.createElement(Hidden, { xsUp: !visible },
|
|
881
|
+
React.createElement(TextField, { required: showAsRequired(required, appliedUiSchemaOptions.hideRequiredAsterisk), id: id + '-input', label: label, type: fieldType, error: !isValid, disabled: !enabled, fullWidth: !appliedUiSchemaOptions.trim, onFocus: onFocus, onBlur: onBlur, helperText: !isValid ? errors : showDescription ? description : null, InputLabelProps: { shrink: true }, value: inputValue, onChange: onChange })));
|
|
882
|
+
};
|
|
883
|
+
const materialNativeControlTester = rankWith(2, or(isDateControl, isTimeControl));
|
|
884
|
+
var MaterialNativeControl$1 = withJsonFormsControlProps(MaterialNativeControl);
|
|
885
|
+
|
|
886
|
+
const MaterialNumberControl = (props) => (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiInputNumber })));
|
|
887
|
+
const materialNumberControlTester = rankWith(2, isNumberControl);
|
|
888
|
+
var MaterialNumberControl$1 = withJsonFormsControlProps(MaterialNumberControl);
|
|
889
|
+
|
|
890
|
+
const MaterialOneOfEnumControl = (props) => {
|
|
891
|
+
const { config, uischema, errors } = props;
|
|
753
892
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
754
893
|
const isValid = errors.length === 0;
|
|
894
|
+
return appliedUiSchemaOptions.autocomplete === false ? (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiSelect }))) : (React.createElement(MuiAutocomplete, Object.assign({}, props, { isValid: isValid })));
|
|
895
|
+
};
|
|
896
|
+
const materialOneOfEnumControlTester = rankWith(5, isOneOfEnumControl);
|
|
897
|
+
var MaterialOneOfEnumControl$1 = withJsonFormsOneOfEnumProps(withTranslateProps(React.memo(MaterialOneOfEnumControl)), false);
|
|
898
|
+
|
|
899
|
+
const MaterialRadioGroup = (props) => {
|
|
900
|
+
const [focused, onFocus, onBlur] = useFocus();
|
|
901
|
+
const { config, id, label, required, description, errors, data, visible, options, handleChange, path, enabled, } = props;
|
|
902
|
+
const isValid = errors.length === 0;
|
|
903
|
+
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
755
904
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
756
|
-
const
|
|
757
|
-
const saveFormat = appliedUiSchemaOptions.timeSaveFormat ?? 'HH:mm:ss';
|
|
758
|
-
const views = appliedUiSchemaOptions.views ?? ['hours', 'minutes'];
|
|
759
|
-
const firstFormHelperText = showDescription
|
|
760
|
-
? description
|
|
761
|
-
: !isValid
|
|
762
|
-
? errors
|
|
763
|
-
: null;
|
|
764
|
-
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
765
|
-
const onChange = useMemo(() => createOnChangeHandler(path, handleChange, saveFormat), [path, handleChange, saveFormat]);
|
|
766
|
-
const value = getData(data, saveFormat);
|
|
767
|
-
const valueInInputFormat = value ? value.format(format) : '';
|
|
905
|
+
const onChange = (_ev, value) => handleChange(path, value);
|
|
768
906
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
769
|
-
React.createElement(
|
|
770
|
-
React.createElement(
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
}, renderInput: params => (React.createElement(ResettableTextField, Object.assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: {
|
|
775
|
-
...params.inputProps,
|
|
776
|
-
type: 'text'
|
|
777
|
-
}, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))) }),
|
|
778
|
-
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
779
|
-
React.createElement(FormHelperText, { error: !isValid }, secondFormHelperText))));
|
|
907
|
+
React.createElement(FormControl, { component: 'fieldset', fullWidth: !appliedUiSchemaOptions.trim, onFocus: onFocus, onBlur: onBlur },
|
|
908
|
+
React.createElement(FormLabel, { htmlFor: id, error: !isValid, component: 'legend', required: showAsRequired(required, appliedUiSchemaOptions.hideRequiredAsterisk) }, label),
|
|
909
|
+
React.createElement(RadioGroup, { value: props.data ?? '', onChange: onChange, row: true }, options.map((option) => (React.createElement(FormControlLabel, { value: option.value, key: option.label, control: React.createElement(Radio, { checked: data === option.value }), label: option.label, disabled: !enabled })))),
|
|
910
|
+
React.createElement(FormHelperText, { error: !isValid }, !isValid ? errors : showDescription ? description : null))));
|
|
780
911
|
};
|
|
781
|
-
|
|
782
|
-
|
|
912
|
+
|
|
913
|
+
const MaterialOneOfRadioGroupControl = (props) => {
|
|
914
|
+
return React.createElement(MaterialRadioGroup, Object.assign({}, props));
|
|
915
|
+
};
|
|
916
|
+
const materialOneOfRadioGroupControlTester = rankWith(20, and(isOneOfEnumControl, optionIs('format', 'radio')));
|
|
917
|
+
var MaterialOneOfRadioGroupControl$1 = withJsonFormsOneOfEnumProps(MaterialOneOfRadioGroupControl);
|
|
918
|
+
|
|
919
|
+
const MaterialRadioGroupControl = (props) => {
|
|
920
|
+
return React.createElement(MaterialRadioGroup, Object.assign({}, props));
|
|
921
|
+
};
|
|
922
|
+
const materialRadioGroupControlTester = rankWith(20, and(isEnumControl, optionIs('format', 'radio')));
|
|
923
|
+
var MaterialRadioGroupControl$1 = withJsonFormsEnumProps(MaterialRadioGroupControl);
|
|
783
924
|
|
|
784
925
|
const MaterialSliderControl = (props) => {
|
|
785
926
|
const [focused, onFocus, onBlur] = useFocus();
|
|
786
|
-
const { id, data, description, enabled, errors, label, schema, handleChange, visible, path, required, config } = props;
|
|
927
|
+
const { id, data, description, enabled, errors, label, schema, handleChange, visible, path, required, config, } = props;
|
|
787
928
|
const isValid = errors.length === 0;
|
|
788
929
|
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
789
930
|
const labelStyle = {
|
|
790
931
|
whiteSpace: 'nowrap',
|
|
791
932
|
overflow: 'hidden',
|
|
792
933
|
textOverflow: 'ellipsis',
|
|
793
|
-
width: '100%'
|
|
934
|
+
width: '100%',
|
|
794
935
|
};
|
|
795
936
|
const rangeContainerStyle = {
|
|
796
|
-
display: 'flex'
|
|
937
|
+
display: 'flex',
|
|
797
938
|
};
|
|
798
939
|
const rangeItemStyle = {
|
|
799
|
-
flexGrow: '1'
|
|
940
|
+
flexGrow: '1',
|
|
800
941
|
};
|
|
801
942
|
const sliderStyle = {
|
|
802
|
-
marginTop: '7px'
|
|
943
|
+
marginTop: '7px',
|
|
803
944
|
};
|
|
804
945
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
805
946
|
const onChange = useCallback((_ev, value) => handleChange(path, Number(value)), [path, handleChange]);
|
|
@@ -816,123 +957,134 @@ const MaterialSliderControl = (props) => {
|
|
|
816
957
|
const materialSliderControlTester = rankWith(4, isRangeControl);
|
|
817
958
|
var MaterialSliderControl$1 = withJsonFormsControlProps(MaterialSliderControl);
|
|
818
959
|
|
|
819
|
-
const MaterialRadioGroup = (props) => {
|
|
820
|
-
const [focused, onFocus, onBlur] = useFocus();
|
|
821
|
-
const { config, id, label, required, description, errors, data, visible, options, handleChange, path, enabled } = props;
|
|
822
|
-
const isValid = errors.length === 0;
|
|
823
|
-
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
824
|
-
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
825
|
-
const onChange = (_ev, value) => handleChange(path, value);
|
|
826
|
-
return (React.createElement(Hidden, { xsUp: !visible },
|
|
827
|
-
React.createElement(FormControl, { component: 'fieldset', fullWidth: !appliedUiSchemaOptions.trim, onFocus: onFocus, onBlur: onBlur },
|
|
828
|
-
React.createElement(FormLabel, { htmlFor: id, error: !isValid, component: 'legend', required: showAsRequired(required, appliedUiSchemaOptions.hideRequiredAsterisk) }, label),
|
|
829
|
-
React.createElement(RadioGroup, { value: props.data ?? '', onChange: onChange, row: true }, options.map(option => (React.createElement(FormControlLabel, { value: option.value, key: option.label, control: React.createElement(Radio, { checked: data === option.value }), label: option.label, disabled: !enabled })))),
|
|
830
|
-
React.createElement(FormHelperText, { error: !isValid }, !isValid ? errors : showDescription ? description : null))));
|
|
831
|
-
};
|
|
832
|
-
|
|
833
|
-
const MaterialRadioGroupControl = (props) => {
|
|
834
|
-
return React.createElement(MaterialRadioGroup, Object.assign({}, props));
|
|
835
|
-
};
|
|
836
|
-
const materialRadioGroupControlTester = rankWith(20, and(isEnumControl, optionIs('format', 'radio')));
|
|
837
|
-
var MaterialRadioGroupControl$1 = withJsonFormsEnumProps(MaterialRadioGroupControl);
|
|
838
|
-
|
|
839
|
-
const MaterialIntegerControl = (props) => (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiInputInteger })));
|
|
840
|
-
const materialIntegerControlTester = rankWith(2, isIntegerControl);
|
|
841
|
-
var MaterialIntegerControl$1 = withJsonFormsControlProps(MaterialIntegerControl);
|
|
842
|
-
|
|
843
|
-
const MaterialNumberControl = (props) => (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiInputNumber })));
|
|
844
|
-
const materialNumberControlTester = rankWith(2, isNumberControl);
|
|
845
|
-
var MaterialNumberControl$1 = withJsonFormsControlProps(MaterialNumberControl);
|
|
846
|
-
|
|
847
960
|
const MaterialTextControl = (props) => (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiInputText })));
|
|
848
961
|
const materialTextControlTester = rankWith(1, isStringControl);
|
|
849
962
|
var MaterialTextControl$1 = withJsonFormsControlProps(MaterialTextControl);
|
|
850
963
|
|
|
851
|
-
const
|
|
852
|
-
const
|
|
853
|
-
const
|
|
854
|
-
const { data, config, className, id, enabled, uischema, isValid, path, handleChange, schema } = props;
|
|
855
|
-
const enumSchema = findEnumSchema(schema.anyOf);
|
|
856
|
-
const stringSchema = findTextSchema(schema.anyOf);
|
|
857
|
-
const maxLength = stringSchema.maxLength;
|
|
858
|
-
const appliedUiSchemaOptions = useMemo(() => merge({}, config, uischema.options), [config, uischema.options]);
|
|
859
|
-
const inputProps = useMemo(() => {
|
|
860
|
-
let propMemo = {};
|
|
861
|
-
if (appliedUiSchemaOptions.restrict) {
|
|
862
|
-
propMemo = { maxLength: maxLength };
|
|
863
|
-
}
|
|
864
|
-
if (appliedUiSchemaOptions.trim && maxLength !== undefined) {
|
|
865
|
-
propMemo.size = maxLength;
|
|
866
|
-
}
|
|
867
|
-
propMemo.list = props.id + 'datalist';
|
|
868
|
-
return propMemo;
|
|
869
|
-
}, [appliedUiSchemaOptions, props.id]);
|
|
870
|
-
const [inputText, onChange] = useDebouncedChange(handleChange, '', data, path);
|
|
871
|
-
const dataList = (React.createElement("datalist", { id: props.id + 'datalist' }, enumSchema.enum.map(optionValue => (React.createElement("option", { value: optionValue, key: optionValue })))));
|
|
872
|
-
return (React.createElement(Input, { type: 'text', value: inputText, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, fullWidth: !appliedUiSchemaOptions.trim || maxLength === undefined, inputProps: inputProps, error: !isValid, endAdornment: dataList }));
|
|
873
|
-
};
|
|
874
|
-
class MaterialAnyOfStringOrEnumControl extends Control {
|
|
875
|
-
render() {
|
|
876
|
-
return (React.createElement(MaterialInputControl, Object.assign({}, this.props, { input: MuiAutocompleteInputText })));
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
const hasEnumAndText = (schemas) => {
|
|
880
|
-
const enumSchema = findEnumSchema(schemas);
|
|
881
|
-
const stringSchema = findTextSchema(schemas);
|
|
882
|
-
const remainingSchemas = schemas.filter(s => s !== enumSchema || s !== stringSchema);
|
|
883
|
-
const wrongType = remainingSchemas.find(s => s.type && s.type !== 'string');
|
|
884
|
-
return enumSchema && stringSchema && !wrongType;
|
|
885
|
-
};
|
|
886
|
-
const simpleAnyOf = and(uiTypeIs('Control'), schemaMatches(schema => schema.hasOwnProperty('anyOf') && hasEnumAndText(schema.anyOf)));
|
|
887
|
-
const materialAnyOfStringOrEnumControlTester = rankWith(5, simpleAnyOf);
|
|
888
|
-
var MaterialAnyOfStringOrEnumControl$1 = withJsonFormsControlProps(MaterialAnyOfStringOrEnumControl);
|
|
889
|
-
|
|
890
|
-
const MaterialOneOfEnumControl = (props) => {
|
|
891
|
-
const { config, uischema, errors } = props;
|
|
964
|
+
const MaterialTimeControl = (props) => {
|
|
965
|
+
const [focused, onFocus, onBlur] = useFocus();
|
|
966
|
+
const { id, description, errors, label, uischema, visible, enabled, required, path, handleChange, data, config, } = props;
|
|
892
967
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
893
968
|
const isValid = errors.length === 0;
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
969
|
+
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
970
|
+
const format = appliedUiSchemaOptions.timeFormat ?? 'HH:mm';
|
|
971
|
+
const saveFormat = appliedUiSchemaOptions.timeSaveFormat ?? 'HH:mm:ss';
|
|
972
|
+
const views = appliedUiSchemaOptions.views ?? ['hours', 'minutes'];
|
|
973
|
+
const firstFormHelperText = showDescription
|
|
974
|
+
? description
|
|
975
|
+
: !isValid
|
|
976
|
+
? errors
|
|
977
|
+
: null;
|
|
978
|
+
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
979
|
+
const onChange = useMemo(() => createOnChangeHandler(path, handleChange, saveFormat), [path, handleChange, saveFormat]);
|
|
980
|
+
const value = getData(data, saveFormat);
|
|
981
|
+
const valueInInputFormat = value ? value.format(format) : '';
|
|
982
|
+
return (React.createElement(Hidden, { xsUp: !visible },
|
|
983
|
+
React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
984
|
+
React.createElement(TimePicker, { label: label, value: value, onChange: onChange, inputFormat: format, disableMaskedInput: true, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, componentsProps: {
|
|
985
|
+
actionBar: {
|
|
986
|
+
actions: (variant) => variant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
|
|
987
|
+
},
|
|
988
|
+
}, renderInput: (params) => (React.createElement(ResettableTextField, Object.assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: {
|
|
989
|
+
...params.inputProps,
|
|
990
|
+
type: 'text',
|
|
991
|
+
}, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))) }),
|
|
992
|
+
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
993
|
+
React.createElement(FormHelperText, { error: !isValid }, secondFormHelperText))));
|
|
897
994
|
};
|
|
898
|
-
const
|
|
899
|
-
var
|
|
995
|
+
const materialTimeControlTester = rankWith(4, isTimeControl);
|
|
996
|
+
var MaterialTimeControl$1 = withJsonFormsControlProps(MaterialTimeControl);
|
|
900
997
|
|
|
901
|
-
const
|
|
902
|
-
|
|
998
|
+
const iconStyle = { float: 'right' };
|
|
999
|
+
const ExpandPanelRendererComponent = (props) => {
|
|
1000
|
+
const [labelHtmlId] = useState(createId('expand-panel'));
|
|
1001
|
+
useEffect(() => {
|
|
1002
|
+
return () => {
|
|
1003
|
+
removeId(labelHtmlId);
|
|
1004
|
+
};
|
|
1005
|
+
}, [labelHtmlId]);
|
|
1006
|
+
const { enabled, childLabel, childPath, index, expanded, moveDown, moveUp, enableMoveDown, enableMoveUp, handleExpansion, removeItems, path, rootSchema, schema, uischema, uischemas, renderers, cells, config, translations, } = props;
|
|
1007
|
+
const foundUISchema = useMemo(() => findUISchema(uischemas, schema, uischema.scope, path, undefined, uischema, rootSchema), [uischemas, schema, uischema.scope, path, uischema, rootSchema]);
|
|
1008
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
1009
|
+
const showSortButtons = appliedUiSchemaOptions.showSortButtons ||
|
|
1010
|
+
appliedUiSchemaOptions.showArrayLayoutSortButtons;
|
|
1011
|
+
return (React.createElement(Accordion, { "aria-labelledby": labelHtmlId, expanded: expanded, onChange: handleExpansion(childPath) },
|
|
1012
|
+
React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, null) },
|
|
1013
|
+
React.createElement(Grid, { container: true, alignItems: 'center' },
|
|
1014
|
+
React.createElement(Grid, { item: true, xs: 7, md: 9 },
|
|
1015
|
+
React.createElement(Grid, { container: true, alignItems: 'center' },
|
|
1016
|
+
React.createElement(Grid, { item: true, xs: 2, md: 1 },
|
|
1017
|
+
React.createElement(Avatar, { "aria-label": 'Index' }, index + 1)),
|
|
1018
|
+
React.createElement(Grid, { item: true, xs: 10, md: 11 },
|
|
1019
|
+
React.createElement("span", { id: labelHtmlId }, childLabel)))),
|
|
1020
|
+
React.createElement(Grid, { item: true, xs: 5, md: 3 },
|
|
1021
|
+
React.createElement(Grid, { container: true, justifyContent: 'flex-end' },
|
|
1022
|
+
React.createElement(Grid, { item: true },
|
|
1023
|
+
React.createElement(Grid, { container: true, direction: 'row', justifyContent: 'center', alignItems: 'center' },
|
|
1024
|
+
showSortButtons ? (React.createElement(Fragment, null,
|
|
1025
|
+
React.createElement(Grid, { item: true },
|
|
1026
|
+
React.createElement(IconButton, { onClick: moveUp(path, index), style: iconStyle, disabled: !enableMoveUp, "aria-label": translations.upAriaLabel, size: 'large' },
|
|
1027
|
+
React.createElement(ArrowUpward, null))),
|
|
1028
|
+
React.createElement(Grid, { item: true },
|
|
1029
|
+
React.createElement(IconButton, { onClick: moveDown(path, index), style: iconStyle, disabled: !enableMoveDown, "aria-label": translations.downAriaLabel, size: 'large' },
|
|
1030
|
+
React.createElement(ArrowDownward, null))))) : (''),
|
|
1031
|
+
React.createElement(Grid, { item: true },
|
|
1032
|
+
React.createElement(IconButton, { onClick: removeItems(path, [index]), style: iconStyle, "aria-label": translations.removeAriaLabel, size: 'large' },
|
|
1033
|
+
React.createElement(DeleteIcon, null))))))))),
|
|
1034
|
+
React.createElement(AccordionDetails, null,
|
|
1035
|
+
React.createElement(JsonFormsDispatch, { enabled: enabled, schema: schema, uischema: foundUISchema, path: childPath, key: childPath, renderers: renderers, cells: cells }))));
|
|
903
1036
|
};
|
|
904
|
-
const
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1037
|
+
const ExpandPanelRenderer = React.memo(ExpandPanelRendererComponent);
|
|
1038
|
+
const ctxDispatchToExpandPanelProps = (dispatch) => ({
|
|
1039
|
+
removeItems: useCallback((path, toDelete) => (event) => {
|
|
1040
|
+
event.stopPropagation();
|
|
1041
|
+
dispatch(update(path, (array) => {
|
|
1042
|
+
toDelete
|
|
1043
|
+
.sort()
|
|
1044
|
+
.reverse()
|
|
1045
|
+
.forEach((s) => array.splice(s, 1));
|
|
1046
|
+
return array;
|
|
1047
|
+
}));
|
|
1048
|
+
}, [dispatch]),
|
|
1049
|
+
moveUp: useCallback((path, toMove) => (event) => {
|
|
1050
|
+
event.stopPropagation();
|
|
1051
|
+
dispatch(update(path, (array) => {
|
|
1052
|
+
moveUp(array, toMove);
|
|
1053
|
+
return array;
|
|
1054
|
+
}));
|
|
1055
|
+
}, [dispatch]),
|
|
1056
|
+
moveDown: useCallback((path, toMove) => (event) => {
|
|
1057
|
+
event.stopPropagation();
|
|
1058
|
+
dispatch(update(path, (array) => {
|
|
1059
|
+
moveDown(array, toMove);
|
|
1060
|
+
return array;
|
|
1061
|
+
}));
|
|
1062
|
+
}, [dispatch]),
|
|
1063
|
+
});
|
|
1064
|
+
const withContextToExpandPanelProps = (Component) => function WithContextToExpandPanelProps({ ctx, props, }) {
|
|
1065
|
+
const dispatchProps = ctxDispatchToExpandPanelProps(ctx.dispatch);
|
|
1066
|
+
const { childLabelProp, schema, path, index, uischemas } = props;
|
|
1067
|
+
const childPath = composePaths(path, `${index}`);
|
|
1068
|
+
const childData = Resolve.data(ctx.core.data, childPath);
|
|
1069
|
+
const childLabel = childLabelProp
|
|
1070
|
+
? get(childData, childLabelProp, '')
|
|
1071
|
+
: get(childData, getFirstPrimitiveProp(schema), '');
|
|
1072
|
+
return (React.createElement(Component, Object.assign({}, props, dispatchProps, { childLabel: childLabel, childPath: childPath, uischemas: uischemas })));
|
|
923
1073
|
};
|
|
1074
|
+
const withJsonFormsExpandPanelProps = (Component) => withJsonFormsContext(withContextToExpandPanelProps(Component));
|
|
1075
|
+
var ExpandPanelRenderer$1 = withJsonFormsExpandPanelProps(ExpandPanelRenderer);
|
|
924
1076
|
|
|
925
1077
|
const groupTester = rankWith(1, uiTypeIs('Group'));
|
|
926
1078
|
const style = { marginBottom: '10px' };
|
|
927
|
-
const GroupComponent = React.memo(({ visible, enabled, uischema, label, ...props })
|
|
1079
|
+
const GroupComponent = React.memo(function GroupComponent({ visible, enabled, uischema, label, ...props }) {
|
|
928
1080
|
const groupLayout = uischema;
|
|
929
1081
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
930
1082
|
React.createElement(Card, { style: style },
|
|
931
|
-
!isEmpty(label) &&
|
|
1083
|
+
!isEmpty(label) && React.createElement(CardHeader, { title: label }),
|
|
932
1084
|
React.createElement(CardContent, null,
|
|
933
1085
|
React.createElement(MaterialLayoutRenderer, Object.assign({}, props, { visible: visible, enabled: enabled, elements: groupLayout.elements }))))));
|
|
934
1086
|
});
|
|
935
|
-
const MaterializedGroupLayoutRenderer = ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label }) => {
|
|
1087
|
+
const MaterializedGroupLayoutRenderer = ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label, }) => {
|
|
936
1088
|
const groupLayout = uischema;
|
|
937
1089
|
return (React.createElement(GroupComponent, { elements: groupLayout.elements, schema: schema, path: path, direction: direction, visible: visible, enabled: enabled, uischema: uischema, renderers: renderers, cells: cells, label: label }));
|
|
938
1090
|
};
|
|
@@ -940,7 +1092,7 @@ var MaterialGroupLayout = withJsonFormsLayoutProps(MaterializedGroupLayoutRender
|
|
|
940
1092
|
const materialGroupTester = withIncreasedRank(1, groupTester);
|
|
941
1093
|
|
|
942
1094
|
const materialHorizontalLayoutTester = rankWith(2, uiTypeIs('HorizontalLayout'));
|
|
943
|
-
const MaterialHorizontalLayoutRenderer = ({ uischema, renderers, cells, schema, path, enabled, visible }) => {
|
|
1095
|
+
const MaterialHorizontalLayoutRenderer = ({ uischema, renderers, cells, schema, path, enabled, visible, }) => {
|
|
944
1096
|
const layout = uischema;
|
|
945
1097
|
const childProps = {
|
|
946
1098
|
elements: layout.elements,
|
|
@@ -948,14 +1100,14 @@ const MaterialHorizontalLayoutRenderer = ({ uischema, renderers, cells, schema,
|
|
|
948
1100
|
path,
|
|
949
1101
|
enabled,
|
|
950
1102
|
direction: 'row',
|
|
951
|
-
visible
|
|
1103
|
+
visible,
|
|
952
1104
|
};
|
|
953
|
-
return React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { renderers: renderers, cells: cells }));
|
|
1105
|
+
return (React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { renderers: renderers, cells: cells })));
|
|
954
1106
|
};
|
|
955
1107
|
var MaterialHorizontalLayout = withJsonFormsLayoutProps(MaterialHorizontalLayoutRenderer);
|
|
956
1108
|
|
|
957
1109
|
const materialVerticalLayoutTester = rankWith(1, uiTypeIs('VerticalLayout'));
|
|
958
|
-
const MaterialVerticalLayoutRenderer = ({ uischema, schema, path, enabled, visible, renderers, cells }) => {
|
|
1110
|
+
const MaterialVerticalLayoutRenderer = ({ uischema, schema, path, enabled, visible, renderers, cells, }) => {
|
|
959
1111
|
const verticalLayout = uischema;
|
|
960
1112
|
const childProps = {
|
|
961
1113
|
elements: verticalLayout.elements,
|
|
@@ -963,9 +1115,9 @@ const MaterialVerticalLayoutRenderer = ({ uischema, schema, path, enabled, visib
|
|
|
963
1115
|
path,
|
|
964
1116
|
enabled,
|
|
965
1117
|
direction: 'column',
|
|
966
|
-
visible
|
|
1118
|
+
visible,
|
|
967
1119
|
};
|
|
968
|
-
return React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { renderers: renderers, cells: cells }));
|
|
1120
|
+
return (React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { renderers: renderers, cells: cells })));
|
|
969
1121
|
};
|
|
970
1122
|
var MaterialVerticalLayout = withJsonFormsLayoutProps(MaterialVerticalLayoutRenderer);
|
|
971
1123
|
|
|
@@ -976,23 +1128,29 @@ const isSingleLevelCategorization = and(uiTypeIs('Categorization'), (uischema) =
|
|
|
976
1128
|
});
|
|
977
1129
|
const materialCategorizationTester = rankWith(1, isSingleLevelCategorization);
|
|
978
1130
|
const MaterialCategorizationLayoutRenderer = (props) => {
|
|
979
|
-
const { data, path, renderers, cells, schema, uischema, visible, enabled, selected, onChange, ajv, t } = props;
|
|
1131
|
+
const { data, path, renderers, cells, schema, uischema, visible, enabled, selected, onChange, ajv, t, } = props;
|
|
980
1132
|
const categorization = uischema;
|
|
1133
|
+
const [previousCategorization, setPreviousCategorization] = useState(uischema);
|
|
981
1134
|
const [activeCategory, setActiveCategory] = useState(selected ?? 0);
|
|
982
1135
|
const categories = useMemo(() => categorization.elements.filter((category) => isVisible(category, data, undefined, ajv)), [categorization, data, ajv]);
|
|
1136
|
+
if (categorization !== previousCategorization) {
|
|
1137
|
+
setActiveCategory(0);
|
|
1138
|
+
setPreviousCategorization(categorization);
|
|
1139
|
+
}
|
|
1140
|
+
const safeCategory = activeCategory >= categorization.elements.length ? 0 : activeCategory;
|
|
983
1141
|
const childProps = {
|
|
984
|
-
elements: categories[
|
|
1142
|
+
elements: categories[safeCategory] ? categories[safeCategory].elements : [],
|
|
985
1143
|
schema,
|
|
986
1144
|
path,
|
|
987
1145
|
direction: 'column',
|
|
988
1146
|
enabled,
|
|
989
1147
|
visible,
|
|
990
1148
|
renderers,
|
|
991
|
-
cells
|
|
1149
|
+
cells,
|
|
992
1150
|
};
|
|
993
1151
|
const onTabChange = (_event, value) => {
|
|
994
1152
|
if (onChange) {
|
|
995
|
-
onChange(value,
|
|
1153
|
+
onChange(value, safeCategory);
|
|
996
1154
|
}
|
|
997
1155
|
setActiveCategory(value);
|
|
998
1156
|
};
|
|
@@ -1001,90 +1159,12 @@ const MaterialCategorizationLayoutRenderer = (props) => {
|
|
|
1001
1159
|
}, [categories, t]);
|
|
1002
1160
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
1003
1161
|
React.createElement(AppBar, { position: 'static' },
|
|
1004
|
-
React.createElement(Tabs, { value:
|
|
1162
|
+
React.createElement(Tabs, { value: safeCategory, onChange: onTabChange, textColor: 'inherit', indicatorColor: 'secondary', variant: 'scrollable' }, categories.map((_, idx) => (React.createElement(Tab, { key: idx, label: tabLabels[idx] }))))),
|
|
1005
1163
|
React.createElement("div", { style: { marginTop: '0.5em' } },
|
|
1006
|
-
React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps)))));
|
|
1164
|
+
React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { key: safeCategory })))));
|
|
1007
1165
|
};
|
|
1008
1166
|
var MaterialCategorizationLayout = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(MaterialCategorizationLayoutRenderer)));
|
|
1009
1167
|
|
|
1010
|
-
const iconStyle = { float: 'right' };
|
|
1011
|
-
const ExpandPanelRendererComponent = (props) => {
|
|
1012
|
-
const [labelHtmlId] = useState(createId('expand-panel'));
|
|
1013
|
-
useEffect(() => {
|
|
1014
|
-
return () => {
|
|
1015
|
-
removeId(labelHtmlId);
|
|
1016
|
-
};
|
|
1017
|
-
}, [labelHtmlId]);
|
|
1018
|
-
const { enabled, childLabel, childPath, index, expanded, moveDown, moveUp, enableMoveDown, enableMoveUp, handleExpansion, removeItems, path, rootSchema, schema, uischema, uischemas, renderers, cells, config } = props;
|
|
1019
|
-
const foundUISchema = useMemo(() => findUISchema(uischemas, schema, uischema.scope, path, undefined, uischema, rootSchema), [uischemas, schema, uischema.scope, path, uischema, rootSchema]);
|
|
1020
|
-
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
1021
|
-
const showSortButtons = appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayLayoutSortButtons;
|
|
1022
|
-
return (React.createElement(Accordion, { "aria-labelledby": labelHtmlId, expanded: expanded, onChange: handleExpansion(childPath) },
|
|
1023
|
-
React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, null) },
|
|
1024
|
-
React.createElement(Grid, { container: true, alignItems: 'center' },
|
|
1025
|
-
React.createElement(Grid, { item: true, xs: 7, md: 9 },
|
|
1026
|
-
React.createElement(Grid, { container: true, alignItems: 'center' },
|
|
1027
|
-
React.createElement(Grid, { item: true, xs: 2, md: 1 },
|
|
1028
|
-
React.createElement(Avatar, { "aria-label": 'Index' }, index + 1)),
|
|
1029
|
-
React.createElement(Grid, { item: true, xs: 10, md: 11 },
|
|
1030
|
-
React.createElement("span", { id: labelHtmlId }, childLabel)))),
|
|
1031
|
-
React.createElement(Grid, { item: true, xs: 5, md: 3 },
|
|
1032
|
-
React.createElement(Grid, { container: true, justifyContent: 'flex-end' },
|
|
1033
|
-
React.createElement(Grid, { item: true },
|
|
1034
|
-
React.createElement(Grid, { container: true, direction: 'row', justifyContent: 'center', alignItems: 'center' },
|
|
1035
|
-
showSortButtons ? (React.createElement(Fragment, null,
|
|
1036
|
-
React.createElement(Grid, { item: true },
|
|
1037
|
-
React.createElement(IconButton, { onClick: moveUp(path, index), style: iconStyle, disabled: !enableMoveUp, "aria-label": `Move up`, size: 'large' },
|
|
1038
|
-
React.createElement(ArrowUpward, null))),
|
|
1039
|
-
React.createElement(Grid, { item: true },
|
|
1040
|
-
React.createElement(IconButton, { onClick: moveDown(path, index), style: iconStyle, disabled: !enableMoveDown, "aria-label": `Move down`, size: 'large' },
|
|
1041
|
-
React.createElement(ArrowDownward, null))))) : (''),
|
|
1042
|
-
React.createElement(Grid, { item: true },
|
|
1043
|
-
React.createElement(IconButton, { onClick: removeItems(path, [index]), style: iconStyle, "aria-label": `Delete`, size: 'large' },
|
|
1044
|
-
React.createElement(DeleteIcon, null))))))))),
|
|
1045
|
-
React.createElement(AccordionDetails, null,
|
|
1046
|
-
React.createElement(JsonFormsDispatch, { enabled: enabled, schema: schema, uischema: foundUISchema, path: childPath, key: childPath, renderers: renderers, cells: cells }))));
|
|
1047
|
-
};
|
|
1048
|
-
const ExpandPanelRenderer = React.memo(ExpandPanelRendererComponent);
|
|
1049
|
-
const ctxDispatchToExpandPanelProps = dispatch => ({
|
|
1050
|
-
removeItems: useCallback((path, toDelete) => (event) => {
|
|
1051
|
-
event.stopPropagation();
|
|
1052
|
-
dispatch(update(path, array => {
|
|
1053
|
-
toDelete
|
|
1054
|
-
.sort()
|
|
1055
|
-
.reverse()
|
|
1056
|
-
.forEach(s => array.splice(s, 1));
|
|
1057
|
-
return array;
|
|
1058
|
-
}));
|
|
1059
|
-
}, [dispatch]),
|
|
1060
|
-
moveUp: useCallback((path, toMove) => (event) => {
|
|
1061
|
-
event.stopPropagation();
|
|
1062
|
-
dispatch(update(path, array => {
|
|
1063
|
-
moveUp(array, toMove);
|
|
1064
|
-
return array;
|
|
1065
|
-
}));
|
|
1066
|
-
}, [dispatch]),
|
|
1067
|
-
moveDown: useCallback((path, toMove) => (event) => {
|
|
1068
|
-
event.stopPropagation();
|
|
1069
|
-
dispatch(update(path, array => {
|
|
1070
|
-
moveDown(array, toMove);
|
|
1071
|
-
return array;
|
|
1072
|
-
}));
|
|
1073
|
-
}, [dispatch])
|
|
1074
|
-
});
|
|
1075
|
-
const withContextToExpandPanelProps = (Component) => ({ ctx, props }) => {
|
|
1076
|
-
const dispatchProps = ctxDispatchToExpandPanelProps(ctx.dispatch);
|
|
1077
|
-
const { childLabelProp, schema, path, index, uischemas } = props;
|
|
1078
|
-
const childPath = composePaths(path, `${index}`);
|
|
1079
|
-
const childData = Resolve.data(ctx.core.data, childPath);
|
|
1080
|
-
const childLabel = childLabelProp
|
|
1081
|
-
? get(childData, childLabelProp, '')
|
|
1082
|
-
: get(childData, getFirstPrimitiveProp(schema), '');
|
|
1083
|
-
return (React.createElement(Component, Object.assign({}, props, dispatchProps, { childLabel: childLabel, childPath: childPath, uischemas: uischemas })));
|
|
1084
|
-
};
|
|
1085
|
-
const withJsonFormsExpandPanelProps = (Component) => withJsonFormsContext(withContextToExpandPanelProps(Component));
|
|
1086
|
-
var ExpandPanelRenderer$1 = withJsonFormsExpandPanelProps(ExpandPanelRenderer);
|
|
1087
|
-
|
|
1088
1168
|
const MaterialArrayLayoutComponent = (props) => {
|
|
1089
1169
|
const [expanded, setExpanded] = useState(false);
|
|
1090
1170
|
const innerCreateDefaultValue = useCallback(() => createDefaultValue(props.schema), [props.schema]);
|
|
@@ -1092,20 +1172,18 @@ const MaterialArrayLayoutComponent = (props) => {
|
|
|
1092
1172
|
setExpanded(expandedPanel ? panel : false);
|
|
1093
1173
|
}, []);
|
|
1094
1174
|
const isExpanded = (index) => expanded === composePaths(props.path, `${index}`);
|
|
1095
|
-
const { enabled, data, path, schema, uischema, errors, addItem, renderers, cells, label, required, rootSchema, config, uischemas } = props;
|
|
1175
|
+
const { enabled, data, path, schema, uischema, errors, addItem, renderers, cells, label, required, rootSchema, config, uischemas, translations, } = props;
|
|
1096
1176
|
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
1097
1177
|
return (React.createElement("div", null,
|
|
1098
|
-
React.createElement(ArrayLayoutToolbar, { label: computeLabel(label, required, appliedUiSchemaOptions.hideRequiredAsterisk), errors: errors, path: path, addItem: addItem, createDefault: innerCreateDefaultValue }),
|
|
1099
|
-
React.createElement("div", null, data > 0 ? (map(range(data), index => {
|
|
1100
|
-
return (React.createElement(ExpandPanelRenderer$1, { enabled: enabled, index: index, expanded: isExpanded(index), schema: schema, path: path, handleExpansion: handleChange, uischema: uischema, renderers: renderers, cells: cells, key: index, rootSchema: rootSchema, enableMoveUp: index != 0, enableMoveDown: index < data - 1, config: config, childLabelProp: appliedUiSchemaOptions.elementLabelProp, uischemas: uischemas }));
|
|
1178
|
+
React.createElement(ArrayLayoutToolbar, { translations: translations, label: computeLabel(label, required, appliedUiSchemaOptions.hideRequiredAsterisk), errors: errors, path: path, addItem: addItem, createDefault: innerCreateDefaultValue }),
|
|
1179
|
+
React.createElement("div", null, data > 0 ? (map(range(data), (index) => {
|
|
1180
|
+
return (React.createElement(ExpandPanelRenderer$1, { enabled: enabled, index: index, expanded: isExpanded(index), schema: schema, path: path, handleExpansion: handleChange, uischema: uischema, renderers: renderers, cells: cells, key: index, rootSchema: rootSchema, enableMoveUp: index != 0, enableMoveDown: index < data - 1, config: config, childLabelProp: appliedUiSchemaOptions.elementLabelProp, uischemas: uischemas, translations: translations }));
|
|
1101
1181
|
})) : (React.createElement("p", null, "No data")))));
|
|
1102
1182
|
};
|
|
1103
1183
|
const MaterialArrayLayout$1 = React.memo(MaterialArrayLayoutComponent);
|
|
1104
1184
|
|
|
1105
1185
|
const MaterialArrayLayoutRenderer = ({ visible, addItem, ...props }) => {
|
|
1106
|
-
const addItemCb = useCallback((p, value) => addItem(p, value), [
|
|
1107
|
-
addItem
|
|
1108
|
-
]);
|
|
1186
|
+
const addItemCb = useCallback((p, value) => addItem(p, value), [addItem]);
|
|
1109
1187
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
1110
1188
|
React.createElement(MaterialArrayLayout$1, Object.assign({ visible: visible, addItem: addItemCb }, props))));
|
|
1111
1189
|
};
|
|
@@ -1127,12 +1205,12 @@ var MaterialBooleanToggleCell$1 = withJsonFormsCellProps(MaterialBooleanToggleCe
|
|
|
1127
1205
|
const MaterialDateCell = (props) => {
|
|
1128
1206
|
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
1129
1207
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
1130
|
-
return (React.createElement(Input$1, { type: 'date', value: data || '', onChange: ev => handleChange(path, ev.target.value), className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, fullWidth: true }));
|
|
1208
|
+
return (React.createElement(Input$1, { type: 'date', value: data || '', onChange: (ev) => handleChange(path, ev.target.value), className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, fullWidth: true }));
|
|
1131
1209
|
};
|
|
1132
1210
|
const materialDateCellTester = rankWith(2, isDateControl);
|
|
1133
1211
|
var MaterialDateCell$1 = withJsonFormsCellProps(MaterialDateCell);
|
|
1134
1212
|
|
|
1135
|
-
const MaterialEnumCell = (props) =>
|
|
1213
|
+
const MaterialEnumCell = (props) => React.createElement(MuiSelect, Object.assign({}, props));
|
|
1136
1214
|
const materialEnumCellTester = rankWith(2, isEnumControl);
|
|
1137
1215
|
var MaterialEnumCell$1 = withJsonFormsEnumCellProps(withTranslateProps(React.memo(MaterialEnumCell)), false);
|
|
1138
1216
|
|
|
@@ -1148,7 +1226,7 @@ const MaterialNumberFormatCell = (props) => React.createElement(MuiInputNumberFo
|
|
|
1148
1226
|
const materialNumberFormatCellTester = rankWith(4, isNumberFormatControl);
|
|
1149
1227
|
var MaterialNumberFormatCell$1 = withJsonFormsCellProps(MaterialNumberFormatCell);
|
|
1150
1228
|
|
|
1151
|
-
const MaterialOneOfEnumCell = (props) =>
|
|
1229
|
+
const MaterialOneOfEnumCell = (props) => React.createElement(MuiSelect, Object.assign({}, props));
|
|
1152
1230
|
const materialOneOfEnumCellTester = rankWith(2, isOneOfEnumControl);
|
|
1153
1231
|
var MaterialOneOfEnumCell$1 = withJsonFormsOneOfEnumCellProps(withTranslateProps(React.memo(MaterialOneOfEnumCell)), false);
|
|
1154
1232
|
|
|
@@ -1179,19 +1257,19 @@ const MaterialCategorizationStepperLayoutRenderer = (props) => {
|
|
|
1179
1257
|
const handleStep = (step) => {
|
|
1180
1258
|
setActiveCategory(step);
|
|
1181
1259
|
};
|
|
1182
|
-
const { data, path, renderers, schema, uischema, visible, cells, config, ajv, t } = props;
|
|
1260
|
+
const { data, path, renderers, schema, uischema, visible, cells, config, ajv, t, } = props;
|
|
1183
1261
|
const categorization = uischema;
|
|
1184
1262
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
1185
1263
|
const buttonWrapperStyle = {
|
|
1186
1264
|
textAlign: 'right',
|
|
1187
1265
|
width: '100%',
|
|
1188
|
-
margin: '1em auto'
|
|
1266
|
+
margin: '1em auto',
|
|
1189
1267
|
};
|
|
1190
1268
|
const buttonNextStyle = {
|
|
1191
|
-
float: 'right'
|
|
1269
|
+
float: 'right',
|
|
1192
1270
|
};
|
|
1193
1271
|
const buttonStyle = {
|
|
1194
|
-
marginRight: '1em'
|
|
1272
|
+
marginRight: '1em',
|
|
1195
1273
|
};
|
|
1196
1274
|
const categories = useMemo(() => categorization.elements.filter((category) => isVisible(category, data, undefined, ajv)), [categorization, data, ajv]);
|
|
1197
1275
|
const childProps = {
|
|
@@ -1201,7 +1279,7 @@ const MaterialCategorizationStepperLayoutRenderer = (props) => {
|
|
|
1201
1279
|
direction: 'column',
|
|
1202
1280
|
visible,
|
|
1203
1281
|
renderers,
|
|
1204
|
-
cells
|
|
1282
|
+
cells,
|
|
1205
1283
|
};
|
|
1206
1284
|
const tabLabels = useMemo(() => {
|
|
1207
1285
|
return categories.map((e) => deriveLabelForUISchemaElement(e, t));
|
|
@@ -1211,19 +1289,63 @@ const MaterialCategorizationStepperLayoutRenderer = (props) => {
|
|
|
1211
1289
|
React.createElement(StepButton, { onClick: () => handleStep(idx) }, tabLabels[idx]))))),
|
|
1212
1290
|
React.createElement("div", null,
|
|
1213
1291
|
React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps))),
|
|
1214
|
-
|
|
1215
|
-
React.createElement(Button, { style: buttonNextStyle, variant:
|
|
1216
|
-
React.createElement(Button, { style: buttonStyle, color:
|
|
1292
|
+
appliedUiSchemaOptions.showNavButtons ? (React.createElement("div", { style: buttonWrapperStyle },
|
|
1293
|
+
React.createElement(Button, { style: buttonNextStyle, variant: 'contained', color: 'primary', disabled: activeCategory >= categories.length - 1, onClick: () => handleStep(activeCategory + 1) }, "Next"),
|
|
1294
|
+
React.createElement(Button, { style: buttonStyle, color: 'secondary', variant: 'contained', disabled: activeCategory <= 0, onClick: () => handleStep(activeCategory - 1) }, "Previous"))) : (React.createElement(React.Fragment, null))));
|
|
1217
1295
|
};
|
|
1218
1296
|
var MaterialCategorizationStepperLayout = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(MaterialCategorizationStepperLayoutRenderer)));
|
|
1219
1297
|
|
|
1298
|
+
const UnwrappedAdditional = {
|
|
1299
|
+
MaterialLabelRenderer,
|
|
1300
|
+
MaterialListWithDetailRenderer,
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
const UnwrappedComplex = {
|
|
1304
|
+
MaterialAllOfRenderer,
|
|
1305
|
+
MaterialAnyOfRenderer,
|
|
1306
|
+
MaterialArrayControlRenderer,
|
|
1307
|
+
MaterialEnumArrayRenderer,
|
|
1308
|
+
MaterialObjectRenderer,
|
|
1309
|
+
MaterialOneOfRenderer,
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
const UnwrappedControls = {
|
|
1313
|
+
MaterialAnyOfStringOrEnumControl,
|
|
1314
|
+
MaterialBooleanControl,
|
|
1315
|
+
MaterialBooleanToggleControl,
|
|
1316
|
+
MaterialDateControl,
|
|
1317
|
+
MaterialDateTimeControl,
|
|
1318
|
+
MaterialEnumControl,
|
|
1319
|
+
MaterialIntegerControl,
|
|
1320
|
+
MaterialNativeControl,
|
|
1321
|
+
MaterialNumberControl,
|
|
1322
|
+
MaterialOneOfEnumControl,
|
|
1323
|
+
MaterialOneOfRadioGroupControl,
|
|
1324
|
+
MaterialSliderControl,
|
|
1325
|
+
MaterialRadioGroupControl,
|
|
1326
|
+
MaterialTextControl,
|
|
1327
|
+
MaterialTimeControl,
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
const UnwrappedLayouts = {
|
|
1331
|
+
ExpandPanelRenderer: ExpandPanelRenderer,
|
|
1332
|
+
MaterialArrayLayout: MaterialArrayLayoutRenderer,
|
|
1333
|
+
MaterialCategorizationLayout: MaterialCategorizationLayoutRenderer,
|
|
1334
|
+
MaterialGroupLayout: MaterializedGroupLayoutRenderer,
|
|
1335
|
+
MaterialHorizontalLayout: MaterialHorizontalLayoutRenderer,
|
|
1336
|
+
MaterialVerticalLayout: MaterialVerticalLayoutRenderer,
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1220
1339
|
const materialRenderers = [
|
|
1221
1340
|
{
|
|
1222
1341
|
tester: materialArrayControlTester,
|
|
1223
|
-
renderer: MaterialArrayControlRenderer$1
|
|
1342
|
+
renderer: MaterialArrayControlRenderer$1,
|
|
1224
1343
|
},
|
|
1225
1344
|
{ tester: materialBooleanControlTester, renderer: MaterialBooleanControl$1 },
|
|
1226
|
-
{
|
|
1345
|
+
{
|
|
1346
|
+
tester: materialBooleanToggleControlTester,
|
|
1347
|
+
renderer: MaterialBooleanToggleControl$1,
|
|
1348
|
+
},
|
|
1227
1349
|
{ tester: materialNativeControlTester, renderer: MaterialNativeControl$1 },
|
|
1228
1350
|
{ tester: materialEnumControlTester, renderer: MaterialEnumControl$1 },
|
|
1229
1351
|
{ tester: materialIntegerControlTester, renderer: MaterialIntegerControl$1 },
|
|
@@ -1239,41 +1361,44 @@ const materialRenderers = [
|
|
|
1239
1361
|
{ tester: materialOneOfControlTester, renderer: MaterialOneOfRenderer$1 },
|
|
1240
1362
|
{
|
|
1241
1363
|
tester: materialRadioGroupControlTester,
|
|
1242
|
-
renderer: MaterialRadioGroupControl$1
|
|
1364
|
+
renderer: MaterialRadioGroupControl$1,
|
|
1243
1365
|
},
|
|
1244
1366
|
{
|
|
1245
1367
|
tester: materialOneOfRadioGroupControlTester,
|
|
1246
|
-
renderer: MaterialOneOfRadioGroupControl$1
|
|
1368
|
+
renderer: MaterialOneOfRadioGroupControl$1,
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
tester: materialOneOfEnumControlTester,
|
|
1372
|
+
renderer: MaterialOneOfEnumControl$1,
|
|
1247
1373
|
},
|
|
1248
|
-
{ tester: materialOneOfEnumControlTester, renderer: MaterialOneOfEnumControl$1 },
|
|
1249
1374
|
{ tester: materialGroupTester, renderer: MaterialGroupLayout },
|
|
1250
1375
|
{
|
|
1251
1376
|
tester: materialHorizontalLayoutTester,
|
|
1252
|
-
renderer: MaterialHorizontalLayout
|
|
1377
|
+
renderer: MaterialHorizontalLayout,
|
|
1253
1378
|
},
|
|
1254
1379
|
{ tester: materialVerticalLayoutTester, renderer: MaterialVerticalLayout },
|
|
1255
1380
|
{
|
|
1256
1381
|
tester: materialCategorizationTester,
|
|
1257
|
-
renderer: MaterialCategorizationLayout
|
|
1382
|
+
renderer: MaterialCategorizationLayout,
|
|
1258
1383
|
},
|
|
1259
1384
|
{
|
|
1260
1385
|
tester: materialCategorizationStepperTester,
|
|
1261
|
-
renderer: MaterialCategorizationStepperLayout
|
|
1386
|
+
renderer: MaterialCategorizationStepperLayout,
|
|
1262
1387
|
},
|
|
1263
1388
|
{ tester: materialArrayLayoutTester, renderer: MaterialArrayLayout },
|
|
1264
1389
|
{ tester: materialLabelRendererTester, renderer: MaterialLabelRenderer$1 },
|
|
1265
1390
|
{
|
|
1266
1391
|
tester: materialListWithDetailTester,
|
|
1267
|
-
renderer: MaterialListWithDetailRenderer$1
|
|
1392
|
+
renderer: MaterialListWithDetailRenderer$1,
|
|
1268
1393
|
},
|
|
1269
1394
|
{
|
|
1270
1395
|
tester: materialAnyOfStringOrEnumControlTester,
|
|
1271
|
-
renderer: MaterialAnyOfStringOrEnumControl$1
|
|
1396
|
+
renderer: MaterialAnyOfStringOrEnumControl$1,
|
|
1272
1397
|
},
|
|
1273
1398
|
{
|
|
1274
1399
|
tester: materialEnumArrayRendererTester,
|
|
1275
|
-
renderer: MaterialEnumArrayRenderer$1
|
|
1276
|
-
}
|
|
1400
|
+
renderer: MaterialEnumArrayRenderer$1,
|
|
1401
|
+
},
|
|
1277
1402
|
];
|
|
1278
1403
|
const materialCells = [
|
|
1279
1404
|
{ tester: materialBooleanCellTester, cell: MaterialBooleanCell$1 },
|
|
@@ -1285,8 +1410,14 @@ const materialCells = [
|
|
|
1285
1410
|
{ tester: materialNumberFormatCellTester, cell: MaterialNumberFormatCell$1 },
|
|
1286
1411
|
{ tester: materialOneOfEnumCellTester, cell: MaterialOneOfEnumCell$1 },
|
|
1287
1412
|
{ tester: materialTextCellTester, cell: MaterialTextCell$1 },
|
|
1288
|
-
{ tester: materialTimeCellTester, cell: MaterialTimeCell$1 }
|
|
1413
|
+
{ tester: materialTimeCellTester, cell: MaterialTimeCell$1 },
|
|
1289
1414
|
];
|
|
1415
|
+
const Unwrapped = {
|
|
1416
|
+
...UnwrappedAdditional,
|
|
1417
|
+
...UnwrappedComplex,
|
|
1418
|
+
...UnwrappedControls,
|
|
1419
|
+
...UnwrappedLayouts,
|
|
1420
|
+
};
|
|
1290
1421
|
|
|
1291
|
-
export { CustomizableCells as Customizable, MaterialAllOfRenderer$1 as MaterialAllOfRenderer, MaterialAnyOfRenderer$1 as MaterialAnyOfRenderer, MaterialAnyOfStringOrEnumControl$1 as MaterialAnyOfStringOrEnumControl, MaterialArrayControlRenderer$1 as MaterialArrayControlRenderer, MaterialArrayLayout, MaterialBooleanCell$1 as MaterialBooleanCell, MaterialBooleanControl$1 as MaterialBooleanControl, MaterialBooleanToggleCell$1 as MaterialBooleanToggleCell, MaterialBooleanToggleControl$1 as MaterialBooleanToggleControl, MaterialCategorizationLayout, MaterialDateCell$1 as MaterialDateCell, MaterialDateControl$1 as MaterialDateControl, MaterialDateTimeControl$1 as MaterialDateTimeControl, MaterialEnumArrayRenderer$1 as MaterialEnumArrayRenderer, MaterialEnumCell$1 as MaterialEnumCell, MaterialEnumControl$1 as MaterialEnumControl, MaterialGroupLayout, MaterialHorizontalLayout, MaterialInputControl, MaterialIntegerCell$1 as MaterialIntegerCell, MaterialIntegerControl$1 as MaterialIntegerControl, MaterialLayoutRenderer, MaterialNativeControl$1 as MaterialNativeControl, MaterialNumberCell$1 as MaterialNumberCell, MaterialNumberControl$1 as MaterialNumberControl, MaterialNumberFormatCell$1 as MaterialNumberFormatCell, MaterialObjectRenderer$1 as MaterialObjectRenderer, MaterialOneOfEnumCell$1 as MaterialOneOfEnumCell, MaterialOneOfEnumControl$1 as MaterialOneOfEnumControl, MaterialOneOfRadioGroupControl$1 as MaterialOneOfRadioGroupControl, MaterialOneOfRenderer$1 as MaterialOneOfRenderer, MaterialRadioGroupControl$1 as MaterialRadioGroupControl, MaterialSliderControl$1 as MaterialSliderControl, MaterialTextCell$1 as MaterialTextCell, MaterialTextControl$1 as MaterialTextControl, MaterialTimeCell$1 as MaterialTimeCell, MaterialTimeControl$1 as MaterialTimeControl, MaterialVerticalLayout, MuiCheckbox, MuiInputInteger, MuiInputNumber, MuiInputNumberFormat, MuiInputText, MuiInputTime, MuiSelect, ResettableTextField, Unwrapped, createOnChangeHandler, getData, i18nDefaults, materialAllOfControlTester, materialAnyOfControlTester, materialAnyOfStringOrEnumControlTester, materialArrayControlTester, materialArrayLayoutTester, materialBooleanCellTester, materialBooleanControlTester, materialBooleanToggleCellTester, materialBooleanToggleControlTester, materialCategorizationTester, materialCells, materialDateCellTester, materialDateControlTester, materialDateTimeControlTester, materialEnumArrayRendererTester, materialEnumCellTester, materialEnumControlTester, materialGroupTester, materialHorizontalLayoutTester, materialIntegerCellTester, materialIntegerControlTester, materialNativeControlTester, materialNumberCellTester, materialNumberControlTester, materialNumberFormatCellTester, materialObjectControlTester, materialOneOfControlTester, materialOneOfEnumCellTester, materialOneOfEnumControlTester, materialOneOfRadioGroupControlTester, materialRadioGroupControlTester, materialRenderers, materialSliderControlTester, materialTextCellTester, materialTextControlTester, materialTimeCellTester, materialTimeControlTester, materialVerticalLayoutTester, renderLayoutElements, useDebouncedChange, useFocus, withAjvProps };
|
|
1422
|
+
export { ArrayLayoutToolbar, CombinatorProperties, CustomizableCells as Customizable, DeleteDialog, ExpandPanelRenderer$1 as ExpandPanelRenderer, ListWithDetailMasterItem, MaterialAllOfRenderer$1 as MaterialAllOfRenderer, MaterialAnyOfRenderer$1 as MaterialAnyOfRenderer, MaterialAnyOfStringOrEnumControl$1 as MaterialAnyOfStringOrEnumControl, MaterialArrayControlRenderer$1 as MaterialArrayControlRenderer, MaterialArrayLayout, MaterialBooleanCell$1 as MaterialBooleanCell, MaterialBooleanControl$1 as MaterialBooleanControl, MaterialBooleanToggleCell$1 as MaterialBooleanToggleCell, MaterialBooleanToggleControl$1 as MaterialBooleanToggleControl, MaterialCategorizationLayout, MaterialDateCell$1 as MaterialDateCell, MaterialDateControl$1 as MaterialDateControl, MaterialDateTimeControl$1 as MaterialDateTimeControl, MaterialEnumArrayRenderer$1 as MaterialEnumArrayRenderer, MaterialEnumCell$1 as MaterialEnumCell, MaterialEnumControl$1 as MaterialEnumControl, MaterialGroupLayout, MaterialHorizontalLayout, MaterialInputControl, MaterialIntegerCell$1 as MaterialIntegerCell, MaterialIntegerControl$1 as MaterialIntegerControl, MaterialLabelRenderer$1 as MaterialLabelRenderer, MaterialLayoutRenderer, MaterialListWithDetailRenderer$1 as MaterialListWithDetailRenderer, MaterialNativeControl$1 as MaterialNativeControl, MaterialNumberCell$1 as MaterialNumberCell, MaterialNumberControl$1 as MaterialNumberControl, MaterialNumberFormatCell$1 as MaterialNumberFormatCell, MaterialObjectRenderer$1 as MaterialObjectRenderer, MaterialOneOfEnumCell$1 as MaterialOneOfEnumCell, MaterialOneOfEnumControl$1 as MaterialOneOfEnumControl, MaterialOneOfRadioGroupControl$1 as MaterialOneOfRadioGroupControl, MaterialOneOfRenderer$1 as MaterialOneOfRenderer, MaterialRadioGroupControl$1 as MaterialRadioGroupControl, MaterialSliderControl$1 as MaterialSliderControl, MaterialTableControl, MaterialTextCell$1 as MaterialTextCell, MaterialTextControl$1 as MaterialTextControl, MaterialTimeCell$1 as MaterialTimeCell, MaterialTimeControl$1 as MaterialTimeControl, MaterialVerticalLayout, MuiAutocomplete, MuiCheckbox, MuiInputInteger, MuiInputNumber, MuiInputNumberFormat, MuiInputText, MuiInputTime, MuiSelect, MuiToggle, NoBorderTableCell, NonEmptyRow, ResettableTextField, Unwrapped, createOnChangeHandler, ctxDispatchToExpandPanelProps, getData, i18nDefaults, materialAllOfControlTester, materialAnyOfControlTester, materialAnyOfStringOrEnumControlTester, materialArrayControlTester, materialArrayLayoutTester, materialBooleanCellTester, materialBooleanControlTester, materialBooleanToggleCellTester, materialBooleanToggleControlTester, materialCategorizationTester, materialCells, materialDateCellTester, materialDateControlTester, materialDateTimeControlTester, materialEnumArrayRendererTester, materialEnumCellTester, materialEnumControlTester, materialGroupTester, materialHorizontalLayoutTester, materialIntegerCellTester, materialIntegerControlTester, materialLabelRendererTester, materialListWithDetailTester, materialNativeControlTester, materialNumberCellTester, materialNumberControlTester, materialNumberFormatCellTester, materialObjectControlTester, materialOneOfControlTester, materialOneOfEnumCellTester, materialOneOfEnumControlTester, materialOneOfRadioGroupControlTester, materialRadioGroupControlTester, materialRenderers, materialSliderControlTester, materialTextCellTester, materialTextControlTester, materialTimeCellTester, materialTimeControlTester, materialVerticalLayoutTester, renderLayoutElements, useDebouncedChange, useFocus, withAjvProps, withContextToExpandPanelProps, withJsonFormsExpandPanelProps };
|
|
1292
1423
|
//# sourceMappingURL=jsonforms-react-material.esm.js.map
|