@jsonforms/material-renderers 3.1.0-alpha.1 → 3.1.0-alpha.3
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 +690 -599
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +620 -557
- 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 +1 -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 +1 -1
- package/lib/mui-controls/index.d.ts +3 -1
- package/lib/util/layout.d.ts +2 -3
- package/package.json +16 -9
- package/src/additional/ListWithDetailMasterItem.tsx +31 -23
- package/src/additional/MaterialLabelRenderer.tsx +8 -15
- package/src/additional/MaterialListWithDetailRenderer.tsx +8 -5
- package/src/additional/index.ts +12 -4
- package/src/additional/unwrapped.ts +32 -0
- 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/src/complex/unwrapped.ts +39 -0
- package/src/controls/MaterialAnyOfStringOrEnumControl.tsx +19 -11
- package/src/controls/MaterialBooleanControl.tsx +22 -16
- package/src/controls/MaterialBooleanToggleControl.tsx +22 -16
- 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/src/layouts/unwrapped.ts +41 -0
- package/src/mui-controls/MuiAutocomplete.tsx +51 -35
- package/src/mui-controls/MuiCheckbox.tsx +5 -3
- 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 +5 -3
- 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
|
@@ -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,113 +262,55 @@ 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, inputProps } = 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
312
|
const inputPropsMerged = merge({}, inputProps, {
|
|
325
|
-
autoFocus: !!appliedUiSchemaOptions.focus
|
|
313
|
+
autoFocus: !!appliedUiSchemaOptions.focus,
|
|
326
314
|
});
|
|
327
315
|
const checked = !!data;
|
|
328
316
|
return (React.createElement(Checkbox, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputPropsMerged }));
|
|
@@ -348,10 +336,18 @@ const getData = (data, saveFormat) => {
|
|
|
348
336
|
return dayjsData;
|
|
349
337
|
};
|
|
350
338
|
const ResettableTextField = ({ rawValue, dayjsValueIsValid, valueInInputFormat, focused, inputProps, ...props }) => {
|
|
351
|
-
const value = useRef({
|
|
339
|
+
const value = useRef({
|
|
340
|
+
lastInput: inputProps?.value,
|
|
341
|
+
toShow: inputProps?.value,
|
|
342
|
+
});
|
|
352
343
|
if (!focused) {
|
|
353
344
|
if (!dayjsValueIsValid) {
|
|
354
|
-
value.current.toShow =
|
|
345
|
+
value.current.toShow =
|
|
346
|
+
typeof rawValue === 'string' ||
|
|
347
|
+
rawValue === null ||
|
|
348
|
+
rawValue === undefined
|
|
349
|
+
? rawValue
|
|
350
|
+
: JSON.stringify(rawValue);
|
|
355
351
|
}
|
|
356
352
|
else {
|
|
357
353
|
value.current.toShow = valueInInputFormat;
|
|
@@ -361,14 +357,14 @@ const ResettableTextField = ({ rawValue, dayjsValueIsValid, valueInInputFormat,
|
|
|
361
357
|
value.current.lastInput = inputProps?.value;
|
|
362
358
|
value.current.toShow = inputProps?.value;
|
|
363
359
|
}
|
|
364
|
-
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 || '' } })));
|
|
365
361
|
};
|
|
366
362
|
|
|
367
363
|
const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
|
|
368
364
|
return elements.map((child, index) => (React.createElement(Grid, { item: true, key: `${path}-${index}`, xs: true },
|
|
369
365
|
React.createElement(JsonFormsDispatch, { uischema: child, schema: schema, path: path, enabled: enabled, renderers: renderers, cells: cells }))));
|
|
370
366
|
};
|
|
371
|
-
const MaterialLayoutRendererComponent = ({ visible, elements, schema, path, enabled, direction, renderers, cells }) => {
|
|
367
|
+
const MaterialLayoutRendererComponent = ({ visible, elements, schema, path, enabled, direction, renderers, cells, }) => {
|
|
372
368
|
if (isEmpty(elements)) {
|
|
373
369
|
return null;
|
|
374
370
|
}
|
|
@@ -378,10 +374,10 @@ const MaterialLayoutRendererComponent = ({ visible, elements, schema, path, enab
|
|
|
378
374
|
}
|
|
379
375
|
};
|
|
380
376
|
const MaterialLayoutRenderer = React.memo(MaterialLayoutRendererComponent);
|
|
381
|
-
const withAjvProps = (Component) => (props)
|
|
377
|
+
const withAjvProps = (Component) => function WithAjvProps(props) {
|
|
382
378
|
const ctx = useJsonForms();
|
|
383
379
|
const ajv = getAjv({ jsonforms: { ...ctx } });
|
|
384
|
-
return
|
|
380
|
+
return React.createElement(Component, Object.assign({}, props, { ajv: ajv }));
|
|
385
381
|
};
|
|
386
382
|
|
|
387
383
|
const eventToValue$3 = (ev) => ev.target.value;
|
|
@@ -396,32 +392,20 @@ const useDebouncedChange = (handleChange, defaultValue, data, path, eventToValue
|
|
|
396
392
|
setInput(newValue ?? defaultValue);
|
|
397
393
|
debouncedUpdate(newValue);
|
|
398
394
|
}, [debouncedUpdate, eventToValueFunction]);
|
|
399
|
-
const onClear = useCallback(() => {
|
|
395
|
+
const onClear = useCallback(() => {
|
|
396
|
+
setInput(defaultValue);
|
|
397
|
+
handleChange(path, undefined);
|
|
398
|
+
}, [defaultValue, handleChange, path]);
|
|
400
399
|
return [input, onChange, onClear];
|
|
401
400
|
};
|
|
402
401
|
|
|
403
|
-
const useFocus = () => {
|
|
404
|
-
const [focused, setFocused] = useState(false);
|
|
405
|
-
const onFocus = useCallback(() => setFocused(true), []);
|
|
406
|
-
const onBlur = useCallback(() => setFocused(false), []);
|
|
407
|
-
return [focused, onFocus, onBlur];
|
|
408
|
-
};
|
|
409
|
-
|
|
410
402
|
const i18nDefaults = {
|
|
411
|
-
'enum.none': 'None'
|
|
403
|
+
'enum.none': 'None',
|
|
412
404
|
};
|
|
413
405
|
|
|
414
|
-
const MuiSelect = React.memo((props) => {
|
|
415
|
-
const { data, className, id, enabled, schema, uischema, path, handleChange, options, config, t } = props;
|
|
416
|
-
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
417
|
-
const noneOptionLabel = useMemo(() => t('enum.none', i18nDefaults['enum.none'], { schema, uischema, path }), [t, schema, uischema, path]);
|
|
418
|
-
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' },
|
|
419
|
-
React.createElement("em", null, noneOptionLabel))].concat(options.map(optionValue => (React.createElement(MenuItem, { value: optionValue.value, key: optionValue.value }, optionValue.label))))));
|
|
420
|
-
});
|
|
421
|
-
|
|
422
406
|
const toNumber$1 = (value) => value === '' ? undefined : parseInt(value, 10);
|
|
423
407
|
const eventToValue$2 = (ev) => toNumber$1(ev.target.value);
|
|
424
|
-
const MuiInputInteger = React.memo((props)
|
|
408
|
+
const MuiInputInteger = React.memo(function MuiInputInteger(props) {
|
|
425
409
|
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
426
410
|
const inputProps = { step: '1' };
|
|
427
411
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
@@ -431,7 +415,7 @@ const MuiInputInteger = React.memo((props) => {
|
|
|
431
415
|
|
|
432
416
|
const toNumber = (value) => value === '' ? undefined : parseFloat(value);
|
|
433
417
|
const eventToValue$1 = (ev) => toNumber(ev.target.value);
|
|
434
|
-
const MuiInputNumber = React.memo((props)
|
|
418
|
+
const MuiInputNumber = React.memo(function MuiInputNumber(props) {
|
|
435
419
|
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
436
420
|
const inputProps = { step: '0.1' };
|
|
437
421
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
@@ -439,8 +423,8 @@ const MuiInputNumber = React.memo((props) => {
|
|
|
439
423
|
return (React.createElement(Input, { type: 'number', value: inputValue, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, inputProps: inputProps, fullWidth: true }));
|
|
440
424
|
});
|
|
441
425
|
|
|
442
|
-
const MuiInputNumberFormat = React.memo((props)
|
|
443
|
-
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;
|
|
444
428
|
const maxLength = schema.maxLength;
|
|
445
429
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
446
430
|
let inputProps;
|
|
@@ -457,9 +441,9 @@ const MuiInputNumberFormat = React.memo((props) => {
|
|
|
457
441
|
});
|
|
458
442
|
|
|
459
443
|
const eventToValue = (ev) => ev.target.value === '' ? undefined : ev.target.value;
|
|
460
|
-
const MuiInputText = React.memo((props)
|
|
444
|
+
const MuiInputText = React.memo(function MuiInputText(props) {
|
|
461
445
|
const [showAdornment, setShowAdornment] = useState(false);
|
|
462
|
-
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;
|
|
463
447
|
const maxLength = schema.maxLength;
|
|
464
448
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
465
449
|
let inputProps;
|
|
@@ -478,26 +462,49 @@ const MuiInputText = React.memo((props) => {
|
|
|
478
462
|
const onPointerLeave = () => setShowAdornment(false);
|
|
479
463
|
const theme = useTheme();
|
|
480
464
|
const closeStyle = {
|
|
481
|
-
background: theme.jsonforms?.input?.delete?.background ||
|
|
482
|
-
|
|
465
|
+
background: theme.jsonforms?.input?.delete?.background ||
|
|
466
|
+
theme.palette.background.default,
|
|
467
|
+
borderRadius: '50%',
|
|
483
468
|
};
|
|
484
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: {
|
|
485
|
-
display: !showAdornment || !enabled || data === undefined
|
|
470
|
+
display: !showAdornment || !enabled || data === undefined
|
|
471
|
+
? 'none'
|
|
472
|
+
: 'flex',
|
|
486
473
|
position: 'absolute',
|
|
487
|
-
right: 0
|
|
474
|
+
right: 0,
|
|
488
475
|
} },
|
|
489
476
|
React.createElement(IconButton, { "aria-label": 'Clear input field', onClick: onClear, size: 'large' },
|
|
490
477
|
React.createElement(Close, { style: closeStyle }))), inputComponent: inputComponent }));
|
|
491
478
|
});
|
|
492
479
|
|
|
493
|
-
const MuiInputTime = React.memo((props)
|
|
480
|
+
const MuiInputTime = React.memo(function MuiInputTime(props) {
|
|
494
481
|
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
495
482
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
496
483
|
const [inputValue, onChange] = useDebouncedChange(handleChange, '', data, path);
|
|
497
484
|
return (React.createElement(Input, { type: 'time', value: inputValue, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, fullWidth: true }));
|
|
498
485
|
});
|
|
499
486
|
|
|
500
|
-
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 }) => {
|
|
501
508
|
return (React.createElement(Hidden, { xlUp: !visible },
|
|
502
509
|
React.createElement(FormControl, { component: 'fieldset' },
|
|
503
510
|
React.createElement(FormGroup, { row: true }, options.map((option, index) => {
|
|
@@ -517,14 +524,63 @@ const hasOneOfItems = (schema) => schema.oneOf !== undefined &&
|
|
|
517
524
|
return entry.const !== undefined;
|
|
518
525
|
});
|
|
519
526
|
const hasEnumItems = (schema) => schema.type === 'string' && schema.enum !== undefined;
|
|
520
|
-
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') &&
|
|
521
528
|
!Array.isArray(schema.items) &&
|
|
522
|
-
schema.uniqueItems === true), schemaSubPathMatches('items', schema => {
|
|
529
|
+
schema.uniqueItems === true), schemaSubPathMatches('items', (schema) => {
|
|
523
530
|
return hasOneOfItems(schema) || hasEnumItems(schema);
|
|
524
531
|
}))));
|
|
525
532
|
var MaterialEnumArrayRenderer$1 = withJsonFormsMultiEnumProps(MaterialEnumArrayRenderer);
|
|
526
533
|
|
|
527
|
-
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);
|
|
528
584
|
|
|
529
585
|
const materialLabelRendererTester = rankWith(1, uiTypeIs('Label'));
|
|
530
586
|
const MaterialLabelRenderer = ({ text, visible }) => {
|
|
@@ -533,34 +589,33 @@ const MaterialLabelRenderer = ({ text, visible }) => {
|
|
|
533
589
|
};
|
|
534
590
|
var MaterialLabelRenderer$1 = withJsonFormsLabelProps(MaterialLabelRenderer);
|
|
535
591
|
|
|
536
|
-
const ArrayLayoutToolbar = React.memo(({ label, errors, addItem, path, createDefault })
|
|
592
|
+
const ArrayLayoutToolbar = React.memo(function ArrayLayoutToolbar({ label, errors, addItem, path, createDefault, translations, }) {
|
|
537
593
|
return (React.createElement(Toolbar, { disableGutters: true },
|
|
538
594
|
React.createElement(Grid, { container: true, alignItems: 'center', justifyContent: 'space-between' },
|
|
539
595
|
React.createElement(Grid, { item: true },
|
|
540
596
|
React.createElement(Typography, { variant: 'h6' }, label)),
|
|
541
|
-
errors.length !== 0 &&
|
|
542
|
-
React.createElement(
|
|
543
|
-
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 }))),
|
|
544
599
|
React.createElement(Grid, { item: true },
|
|
545
600
|
React.createElement(Grid, { container: true },
|
|
546
601
|
React.createElement(Grid, { item: true },
|
|
547
|
-
React.createElement(Tooltip, { id: 'tooltip-add', title:
|
|
548
|
-
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' },
|
|
549
604
|
React.createElement(AddIcon, null)))))))));
|
|
550
605
|
});
|
|
551
606
|
|
|
552
|
-
const ListWithDetailMasterItem = ({ index, childLabel, selected, handleSelect, removeItem, path }) => {
|
|
607
|
+
const ListWithDetailMasterItem = ({ index, childLabel, selected, handleSelect, removeItem, path, translations, }) => {
|
|
553
608
|
return (React.createElement(ListItem, { button: true, selected: selected, onClick: handleSelect(index) },
|
|
554
609
|
React.createElement(ListItemAvatar, null,
|
|
555
610
|
React.createElement(Avatar, { "aria-label": 'Index' }, index + 1)),
|
|
556
611
|
React.createElement(ListItemText, { primary: childLabel }),
|
|
557
612
|
React.createElement(ListItemSecondaryAction, null,
|
|
558
|
-
React.createElement(IconButton, { "aria-label":
|
|
613
|
+
React.createElement(IconButton, { "aria-label": translations.removeAriaLabel, onClick: removeItem(path, index), size: 'large' },
|
|
559
614
|
React.createElement(DeleteIcon, null)))));
|
|
560
615
|
};
|
|
561
616
|
var ListWithDetailMasterItem$1 = withJsonFormsMasterListItemProps(ListWithDetailMasterItem);
|
|
562
617
|
|
|
563
|
-
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, }) => {
|
|
564
619
|
const [selectedIndex, setSelectedIndex] = useState(undefined);
|
|
565
620
|
const handleRemoveItem = useCallback((p, value) => () => {
|
|
566
621
|
removeItems(p, [value])();
|
|
@@ -579,72 +634,84 @@ const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, err
|
|
|
579
634
|
setSelectedIndex(undefined);
|
|
580
635
|
}, [schema]);
|
|
581
636
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
582
|
-
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 }),
|
|
583
638
|
React.createElement(Grid, { container: true, direction: 'row', spacing: 2 },
|
|
584
639
|
React.createElement(Grid, { item: true, xs: 3 },
|
|
585
|
-
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")))),
|
|
586
|
-
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))))));
|
|
587
642
|
};
|
|
588
643
|
const materialListWithDetailTester = rankWith(4, and(uiTypeIs('ListWithDetail'), isObjectArray));
|
|
589
644
|
var MaterialListWithDetailRenderer$1 = withJsonFormsArrayLayoutProps(MaterialListWithDetailRenderer);
|
|
590
645
|
|
|
591
|
-
const
|
|
646
|
+
const MaterialInputControl = (props) => {
|
|
647
|
+
const [focused, onFocus, onBlur] = useFocus();
|
|
648
|
+
const { id, description, errors, label, uischema, visible, required, config, input, } = props;
|
|
592
649
|
const isValid = errors.length === 0;
|
|
593
650
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
594
|
-
const showDescription = !isDescriptionHidden(visible, description,
|
|
595
|
-
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
596
|
-
const showTooltip = !showDescription && !isDescriptionHidden(visible, description,
|
|
597
|
-
true,
|
|
598
|
-
true);
|
|
651
|
+
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
599
652
|
const firstFormHelperText = showDescription
|
|
600
653
|
? description
|
|
601
654
|
: !isValid
|
|
602
655
|
? errors
|
|
603
656
|
: null;
|
|
604
657
|
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
605
|
-
const
|
|
606
|
-
const tooltipId = `${id}-tip`;
|
|
607
|
-
const helpId1 = `${id}-help1`;
|
|
608
|
-
const helpId2 = `${id}-help2`;
|
|
609
|
-
if (showTooltip) {
|
|
610
|
-
descriptionIds.push(tooltipId);
|
|
611
|
-
}
|
|
612
|
-
if (firstFormHelperText) {
|
|
613
|
-
descriptionIds.push(helpId1);
|
|
614
|
-
}
|
|
615
|
-
if (secondFormHelperText) {
|
|
616
|
-
descriptionIds.push(helpId2);
|
|
617
|
-
}
|
|
618
|
-
const ariaDescribedBy = descriptionIds.join(' ');
|
|
658
|
+
const InnerComponent = input;
|
|
619
659
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
620
|
-
React.createElement(
|
|
621
|
-
React.createElement(
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
React.createElement(FormHelperText, { id: helpId2, error: !isValid }, secondFormHelperText)));
|
|
660
|
+
React.createElement(FormControl, { fullWidth: !appliedUiSchemaOptions.trim, onFocus: onFocus, onBlur: onBlur, id: id, variant: 'standard' },
|
|
661
|
+
React.createElement(InputLabel, { htmlFor: id + '-input', error: !isValid, required: showAsRequired(required, appliedUiSchemaOptions.hideRequiredAsterisk) }, label),
|
|
662
|
+
React.createElement(InnerComponent, Object.assign({}, props, { id: id + '-input', isValid: isValid, visible: visible })),
|
|
663
|
+
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
664
|
+
React.createElement(FormHelperText, { error: !isValid }, secondFormHelperText))));
|
|
626
665
|
};
|
|
627
|
-
const materialBooleanControlTester = rankWith(2, isBooleanControl);
|
|
628
|
-
var MaterialBooleanControl$1 = withJsonFormsControlProps(MaterialBooleanControl);
|
|
629
|
-
|
|
630
|
-
const MuiToggle = React.memo((props) => {
|
|
631
|
-
const { data, className, id, enabled, uischema, path, handleChange, config, inputProps } = props;
|
|
632
|
-
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
633
|
-
const inputPropsMerged = merge({}, inputProps, {
|
|
634
|
-
autoFocus: !!appliedUiSchemaOptions.focus
|
|
635
|
-
});
|
|
636
|
-
const checked = !!data;
|
|
637
|
-
return (React.createElement(Switch, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputPropsMerged }));
|
|
638
|
-
});
|
|
639
666
|
|
|
640
|
-
const
|
|
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, }) => {
|
|
641
707
|
const isValid = errors.length === 0;
|
|
642
708
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
643
709
|
const showDescription = !isDescriptionHidden(visible, description,
|
|
644
710
|
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
645
|
-
const showTooltip = !showDescription &&
|
|
646
|
-
|
|
647
|
-
|
|
711
|
+
const showTooltip = !showDescription &&
|
|
712
|
+
!isDescriptionHidden(visible, description,
|
|
713
|
+
true,
|
|
714
|
+
true);
|
|
648
715
|
const firstFormHelperText = showDescription
|
|
649
716
|
? description
|
|
650
717
|
: !isValid
|
|
@@ -666,90 +733,59 @@ const MaterialBooleanToggleControl = ({ data, visible, label, id, enabled, uisch
|
|
|
666
733
|
}
|
|
667
734
|
const ariaDescribedBy = descriptionIds.join(' ');
|
|
668
735
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
669
|
-
React.createElement(Tooltip, { id: tooltipId, title:
|
|
670
|
-
React.createElement(FormControlLabel, { label: label, id: id, control: React.createElement(
|
|
671
|
-
'aria-describedby': ariaDescribedBy
|
|
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,
|
|
672
739
|
} }) })),
|
|
673
740
|
React.createElement(FormHelperText, { id: helpId1, error: !isValid && !showDescription }, firstFormHelperText),
|
|
674
741
|
React.createElement(FormHelperText, { id: helpId2, error: !isValid }, secondFormHelperText)));
|
|
675
742
|
};
|
|
676
|
-
const
|
|
677
|
-
var
|
|
743
|
+
const materialBooleanControlTester = rankWith(2, isBooleanControl);
|
|
744
|
+
var MaterialBooleanControl$1 = withJsonFormsControlProps(MaterialBooleanControl);
|
|
678
745
|
|
|
679
|
-
const
|
|
680
|
-
const [focused, onFocus, onBlur] = useFocus();
|
|
681
|
-
const { id, description, errors, label, uischema, visible, required, config, input } = props;
|
|
746
|
+
const MaterialBooleanToggleControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description, }) => {
|
|
682
747
|
const isValid = errors.length === 0;
|
|
683
748
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
684
|
-
const showDescription = !isDescriptionHidden(visible, description,
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
691
|
-
const InnerComponent = input;
|
|
692
|
-
return (React.createElement(Hidden, { xsUp: !visible },
|
|
693
|
-
React.createElement(FormControl, { fullWidth: !appliedUiSchemaOptions.trim, onFocus: onFocus, onBlur: onBlur, id: id, variant: 'standard' },
|
|
694
|
-
React.createElement(InputLabel, { htmlFor: id + '-input', error: !isValid, required: showAsRequired(required, appliedUiSchemaOptions.hideRequiredAsterisk) }, label),
|
|
695
|
-
React.createElement(InnerComponent, Object.assign({}, props, { id: id + '-input', isValid: isValid, visible: visible })),
|
|
696
|
-
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
697
|
-
React.createElement(FormHelperText, { error: !isValid }, secondFormHelperText))));
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
const MuiAutocomplete = (props) => {
|
|
701
|
-
const { description, errors, visible, required, label, data, className, id, enabled, uischema, path, handleChange, options, config, getOptionLabel, renderOption, filterOptions, isValid } = props;
|
|
702
|
-
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
703
|
-
const [inputValue, setInputValue] = React.useState(data ?? '');
|
|
704
|
-
const [focused, onFocus, onBlur] = useFocus();
|
|
705
|
-
const findOption = options.find(o => o.value === data) ?? null;
|
|
706
|
-
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
749
|
+
const showDescription = !isDescriptionHidden(visible, description,
|
|
750
|
+
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
751
|
+
const showTooltip = !showDescription &&
|
|
752
|
+
!isDescriptionHidden(visible, description,
|
|
753
|
+
true,
|
|
754
|
+
true);
|
|
707
755
|
const firstFormHelperText = showDescription
|
|
708
756
|
? description
|
|
709
757
|
: !isValid
|
|
710
758
|
? errors
|
|
711
759
|
: null;
|
|
712
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(' ');
|
|
713
775
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
714
|
-
React.createElement(
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}, renderOption: renderOption, filterOptions: filterOptions }),
|
|
721
|
-
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
722
|
-
React.createElement(FormHelperText, { error: !isValid }, secondFormHelperText)));
|
|
723
|
-
};
|
|
724
|
-
|
|
725
|
-
const MaterialEnumControl = (props) => {
|
|
726
|
-
const { config, uischema, errors } = props;
|
|
727
|
-
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
728
|
-
const isValid = errors.length === 0;
|
|
729
|
-
return (appliedUiSchemaOptions.autocomplete === false ?
|
|
730
|
-
React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiSelect })) :
|
|
731
|
-
React.createElement(MuiAutocomplete, Object.assign({}, props, { isValid: isValid })));
|
|
732
|
-
};
|
|
733
|
-
const materialEnumControlTester = rankWith(2, isEnumControl);
|
|
734
|
-
var MaterialEnumControl$1 = withJsonFormsEnumProps(withTranslateProps(React.memo(MaterialEnumControl)), false);
|
|
735
|
-
|
|
736
|
-
const MaterialNativeControl = (props) => {
|
|
737
|
-
const [focused, onFocus, onBlur] = useFocus();
|
|
738
|
-
const { id, errors, label, schema, description, enabled, visible, required, path, handleChange, data, config } = props;
|
|
739
|
-
const isValid = errors.length === 0;
|
|
740
|
-
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
741
|
-
const [inputValue, onChange] = useDebouncedChange(handleChange, '', data, path);
|
|
742
|
-
const fieldType = appliedUiSchemaOptions.format ?? schema.format;
|
|
743
|
-
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
744
|
-
return (React.createElement(Hidden, { xsUp: !visible },
|
|
745
|
-
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 })));
|
|
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)));
|
|
746
782
|
};
|
|
747
|
-
const
|
|
748
|
-
var
|
|
783
|
+
const materialBooleanToggleControlTester = rankWith(3, and(isBooleanControl, optionIs('toggle', true)));
|
|
784
|
+
var MaterialBooleanToggleControl$1 = withJsonFormsControlProps(MaterialBooleanToggleControl);
|
|
749
785
|
|
|
750
786
|
const MaterialDateControl = (props) => {
|
|
751
787
|
const [focused, onFocus, onBlur] = useFocus();
|
|
752
|
-
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;
|
|
753
789
|
const isValid = errors.length === 0;
|
|
754
790
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
755
791
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
@@ -769,9 +805,9 @@ const MaterialDateControl = (props) => {
|
|
|
769
805
|
React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
770
806
|
React.createElement(DatePicker, { label: label, value: value, onChange: onChange, inputFormat: format, disableMaskedInput: true, views: views, disabled: !enabled, componentsProps: {
|
|
771
807
|
actionBar: {
|
|
772
|
-
actions: (variant) =>
|
|
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: {
|
|
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: {
|
|
775
811
|
...params.inputProps,
|
|
776
812
|
type: 'text',
|
|
777
813
|
}, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))) }),
|
|
@@ -783,13 +819,18 @@ var MaterialDateControl$1 = withJsonFormsControlProps(MaterialDateControl);
|
|
|
783
819
|
|
|
784
820
|
const MaterialDateTimeControl = (props) => {
|
|
785
821
|
const [focused, onFocus, onBlur] = useFocus();
|
|
786
|
-
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;
|
|
787
823
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
788
824
|
const isValid = errors.length === 0;
|
|
789
825
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
790
826
|
const format = appliedUiSchemaOptions.dateTimeFormat ?? 'YYYY-MM-DD HH:mm';
|
|
791
827
|
const saveFormat = appliedUiSchemaOptions.dateTimeSaveFormat ?? undefined;
|
|
792
|
-
const views = appliedUiSchemaOptions.views ?? [
|
|
828
|
+
const views = appliedUiSchemaOptions.views ?? [
|
|
829
|
+
'year',
|
|
830
|
+
'day',
|
|
831
|
+
'hours',
|
|
832
|
+
'minutes',
|
|
833
|
+
];
|
|
793
834
|
const firstFormHelperText = showDescription
|
|
794
835
|
? description
|
|
795
836
|
: !isValid
|
|
@@ -803,9 +844,9 @@ const MaterialDateTimeControl = (props) => {
|
|
|
803
844
|
React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
804
845
|
React.createElement(DateTimePicker, { label: label, value: value, onChange: onChange, inputFormat: format, disableMaskedInput: true, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, componentsProps: {
|
|
805
846
|
actionBar: {
|
|
806
|
-
actions: (variant) =>
|
|
807
|
-
}
|
|
808
|
-
}, 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: {
|
|
809
850
|
...params.inputProps,
|
|
810
851
|
type: 'text',
|
|
811
852
|
}, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))) }),
|
|
@@ -815,59 +856,91 @@ const MaterialDateTimeControl = (props) => {
|
|
|
815
856
|
const materialDateTimeControlTester = rankWith(2, isDateTimeControl);
|
|
816
857
|
var MaterialDateTimeControl$1 = withJsonFormsControlProps(MaterialDateTimeControl);
|
|
817
858
|
|
|
818
|
-
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) => {
|
|
819
873
|
const [focused, onFocus, onBlur] = useFocus();
|
|
820
|
-
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;
|
|
821
892
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
822
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);
|
|
823
904
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
824
|
-
const
|
|
825
|
-
const saveFormat = appliedUiSchemaOptions.timeSaveFormat ?? 'HH:mm:ss';
|
|
826
|
-
const views = appliedUiSchemaOptions.views ?? ['hours', 'minutes'];
|
|
827
|
-
const firstFormHelperText = showDescription
|
|
828
|
-
? description
|
|
829
|
-
: !isValid
|
|
830
|
-
? errors
|
|
831
|
-
: null;
|
|
832
|
-
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
833
|
-
const onChange = useMemo(() => createOnChangeHandler(path, handleChange, saveFormat), [path, handleChange, saveFormat]);
|
|
834
|
-
const value = getData(data, saveFormat);
|
|
835
|
-
const valueInInputFormat = value ? value.format(format) : '';
|
|
905
|
+
const onChange = (_ev, value) => handleChange(path, value);
|
|
836
906
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
837
|
-
React.createElement(
|
|
838
|
-
React.createElement(
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}
|
|
842
|
-
}, 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: {
|
|
843
|
-
...params.inputProps,
|
|
844
|
-
type: 'text'
|
|
845
|
-
}, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))) }),
|
|
846
|
-
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
847
|
-
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))));
|
|
848
911
|
};
|
|
849
|
-
|
|
850
|
-
|
|
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);
|
|
851
924
|
|
|
852
925
|
const MaterialSliderControl = (props) => {
|
|
853
926
|
const [focused, onFocus, onBlur] = useFocus();
|
|
854
|
-
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;
|
|
855
928
|
const isValid = errors.length === 0;
|
|
856
929
|
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
857
930
|
const labelStyle = {
|
|
858
931
|
whiteSpace: 'nowrap',
|
|
859
932
|
overflow: 'hidden',
|
|
860
933
|
textOverflow: 'ellipsis',
|
|
861
|
-
width: '100%'
|
|
934
|
+
width: '100%',
|
|
862
935
|
};
|
|
863
936
|
const rangeContainerStyle = {
|
|
864
|
-
display: 'flex'
|
|
937
|
+
display: 'flex',
|
|
865
938
|
};
|
|
866
939
|
const rangeItemStyle = {
|
|
867
|
-
flexGrow: '1'
|
|
940
|
+
flexGrow: '1',
|
|
868
941
|
};
|
|
869
942
|
const sliderStyle = {
|
|
870
|
-
marginTop: '7px'
|
|
943
|
+
marginTop: '7px',
|
|
871
944
|
};
|
|
872
945
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
873
946
|
const onChange = useCallback((_ev, value) => handleChange(path, Number(value)), [path, handleChange]);
|
|
@@ -884,123 +957,134 @@ const MaterialSliderControl = (props) => {
|
|
|
884
957
|
const materialSliderControlTester = rankWith(4, isRangeControl);
|
|
885
958
|
var MaterialSliderControl$1 = withJsonFormsControlProps(MaterialSliderControl);
|
|
886
959
|
|
|
887
|
-
const MaterialRadioGroup = (props) => {
|
|
888
|
-
const [focused, onFocus, onBlur] = useFocus();
|
|
889
|
-
const { config, id, label, required, description, errors, data, visible, options, handleChange, path, enabled } = props;
|
|
890
|
-
const isValid = errors.length === 0;
|
|
891
|
-
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
892
|
-
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
893
|
-
const onChange = (_ev, value) => handleChange(path, value);
|
|
894
|
-
return (React.createElement(Hidden, { xsUp: !visible },
|
|
895
|
-
React.createElement(FormControl, { component: 'fieldset', fullWidth: !appliedUiSchemaOptions.trim, onFocus: onFocus, onBlur: onBlur },
|
|
896
|
-
React.createElement(FormLabel, { htmlFor: id, error: !isValid, component: 'legend', required: showAsRequired(required, appliedUiSchemaOptions.hideRequiredAsterisk) }, label),
|
|
897
|
-
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 })))),
|
|
898
|
-
React.createElement(FormHelperText, { error: !isValid }, !isValid ? errors : showDescription ? description : null))));
|
|
899
|
-
};
|
|
900
|
-
|
|
901
|
-
const MaterialRadioGroupControl = (props) => {
|
|
902
|
-
return React.createElement(MaterialRadioGroup, Object.assign({}, props));
|
|
903
|
-
};
|
|
904
|
-
const materialRadioGroupControlTester = rankWith(20, and(isEnumControl, optionIs('format', 'radio')));
|
|
905
|
-
var MaterialRadioGroupControl$1 = withJsonFormsEnumProps(MaterialRadioGroupControl);
|
|
906
|
-
|
|
907
|
-
const MaterialIntegerControl = (props) => (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiInputInteger })));
|
|
908
|
-
const materialIntegerControlTester = rankWith(2, isIntegerControl);
|
|
909
|
-
var MaterialIntegerControl$1 = withJsonFormsControlProps(MaterialIntegerControl);
|
|
910
|
-
|
|
911
|
-
const MaterialNumberControl = (props) => (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiInputNumber })));
|
|
912
|
-
const materialNumberControlTester = rankWith(2, isNumberControl);
|
|
913
|
-
var MaterialNumberControl$1 = withJsonFormsControlProps(MaterialNumberControl);
|
|
914
|
-
|
|
915
960
|
const MaterialTextControl = (props) => (React.createElement(MaterialInputControl, Object.assign({}, props, { input: MuiInputText })));
|
|
916
961
|
const materialTextControlTester = rankWith(1, isStringControl);
|
|
917
962
|
var MaterialTextControl$1 = withJsonFormsControlProps(MaterialTextControl);
|
|
918
963
|
|
|
919
|
-
const
|
|
920
|
-
const
|
|
921
|
-
const
|
|
922
|
-
const { data, config, className, id, enabled, uischema, isValid, path, handleChange, schema } = props;
|
|
923
|
-
const enumSchema = findEnumSchema(schema.anyOf);
|
|
924
|
-
const stringSchema = findTextSchema(schema.anyOf);
|
|
925
|
-
const maxLength = stringSchema.maxLength;
|
|
926
|
-
const appliedUiSchemaOptions = useMemo(() => merge({}, config, uischema.options), [config, uischema.options]);
|
|
927
|
-
const inputProps = useMemo(() => {
|
|
928
|
-
let propMemo = {};
|
|
929
|
-
if (appliedUiSchemaOptions.restrict) {
|
|
930
|
-
propMemo = { maxLength: maxLength };
|
|
931
|
-
}
|
|
932
|
-
if (appliedUiSchemaOptions.trim && maxLength !== undefined) {
|
|
933
|
-
propMemo.size = maxLength;
|
|
934
|
-
}
|
|
935
|
-
propMemo.list = props.id + 'datalist';
|
|
936
|
-
return propMemo;
|
|
937
|
-
}, [appliedUiSchemaOptions, props.id]);
|
|
938
|
-
const [inputText, onChange] = useDebouncedChange(handleChange, '', data, path);
|
|
939
|
-
const dataList = (React.createElement("datalist", { id: props.id + 'datalist' }, enumSchema.enum.map(optionValue => (React.createElement("option", { value: optionValue, key: optionValue })))));
|
|
940
|
-
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 }));
|
|
941
|
-
};
|
|
942
|
-
class MaterialAnyOfStringOrEnumControl extends Control {
|
|
943
|
-
render() {
|
|
944
|
-
return (React.createElement(MaterialInputControl, Object.assign({}, this.props, { input: MuiAutocompleteInputText })));
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
const hasEnumAndText = (schemas) => {
|
|
948
|
-
const enumSchema = findEnumSchema(schemas);
|
|
949
|
-
const stringSchema = findTextSchema(schemas);
|
|
950
|
-
const remainingSchemas = schemas.filter(s => s !== enumSchema || s !== stringSchema);
|
|
951
|
-
const wrongType = remainingSchemas.find(s => s.type && s.type !== 'string');
|
|
952
|
-
return enumSchema && stringSchema && !wrongType;
|
|
953
|
-
};
|
|
954
|
-
const simpleAnyOf = and(uiTypeIs('Control'), schemaMatches(schema => schema.hasOwnProperty('anyOf') && hasEnumAndText(schema.anyOf)));
|
|
955
|
-
const materialAnyOfStringOrEnumControlTester = rankWith(5, simpleAnyOf);
|
|
956
|
-
var MaterialAnyOfStringOrEnumControl$1 = withJsonFormsControlProps(MaterialAnyOfStringOrEnumControl);
|
|
957
|
-
|
|
958
|
-
const MaterialOneOfEnumControl = (props) => {
|
|
959
|
-
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;
|
|
960
967
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
961
968
|
const isValid = errors.length === 0;
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
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))));
|
|
965
994
|
};
|
|
966
|
-
const
|
|
967
|
-
var
|
|
995
|
+
const materialTimeControlTester = rankWith(4, isTimeControl);
|
|
996
|
+
var MaterialTimeControl$1 = withJsonFormsControlProps(MaterialTimeControl);
|
|
968
997
|
|
|
969
|
-
const
|
|
970
|
-
|
|
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 }))));
|
|
971
1036
|
};
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
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 })));
|
|
991
1073
|
};
|
|
1074
|
+
const withJsonFormsExpandPanelProps = (Component) => withJsonFormsContext(withContextToExpandPanelProps(Component));
|
|
1075
|
+
var ExpandPanelRenderer$1 = withJsonFormsExpandPanelProps(ExpandPanelRenderer);
|
|
992
1076
|
|
|
993
1077
|
const groupTester = rankWith(1, uiTypeIs('Group'));
|
|
994
1078
|
const style = { marginBottom: '10px' };
|
|
995
|
-
const GroupComponent = React.memo(({ visible, enabled, uischema, label, ...props })
|
|
1079
|
+
const GroupComponent = React.memo(function GroupComponent({ visible, enabled, uischema, label, ...props }) {
|
|
996
1080
|
const groupLayout = uischema;
|
|
997
1081
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
998
1082
|
React.createElement(Card, { style: style },
|
|
999
|
-
!isEmpty(label) &&
|
|
1083
|
+
!isEmpty(label) && React.createElement(CardHeader, { title: label }),
|
|
1000
1084
|
React.createElement(CardContent, null,
|
|
1001
1085
|
React.createElement(MaterialLayoutRenderer, Object.assign({}, props, { visible: visible, enabled: enabled, elements: groupLayout.elements }))))));
|
|
1002
1086
|
});
|
|
1003
|
-
const MaterializedGroupLayoutRenderer = ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label }) => {
|
|
1087
|
+
const MaterializedGroupLayoutRenderer = ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label, }) => {
|
|
1004
1088
|
const groupLayout = uischema;
|
|
1005
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 }));
|
|
1006
1090
|
};
|
|
@@ -1008,7 +1092,7 @@ var MaterialGroupLayout = withJsonFormsLayoutProps(MaterializedGroupLayoutRender
|
|
|
1008
1092
|
const materialGroupTester = withIncreasedRank(1, groupTester);
|
|
1009
1093
|
|
|
1010
1094
|
const materialHorizontalLayoutTester = rankWith(2, uiTypeIs('HorizontalLayout'));
|
|
1011
|
-
const MaterialHorizontalLayoutRenderer = ({ uischema, renderers, cells, schema, path, enabled, visible }) => {
|
|
1095
|
+
const MaterialHorizontalLayoutRenderer = ({ uischema, renderers, cells, schema, path, enabled, visible, }) => {
|
|
1012
1096
|
const layout = uischema;
|
|
1013
1097
|
const childProps = {
|
|
1014
1098
|
elements: layout.elements,
|
|
@@ -1016,14 +1100,14 @@ const MaterialHorizontalLayoutRenderer = ({ uischema, renderers, cells, schema,
|
|
|
1016
1100
|
path,
|
|
1017
1101
|
enabled,
|
|
1018
1102
|
direction: 'row',
|
|
1019
|
-
visible
|
|
1103
|
+
visible,
|
|
1020
1104
|
};
|
|
1021
|
-
return React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { renderers: renderers, cells: cells }));
|
|
1105
|
+
return (React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { renderers: renderers, cells: cells })));
|
|
1022
1106
|
};
|
|
1023
1107
|
var MaterialHorizontalLayout = withJsonFormsLayoutProps(MaterialHorizontalLayoutRenderer);
|
|
1024
1108
|
|
|
1025
1109
|
const materialVerticalLayoutTester = rankWith(1, uiTypeIs('VerticalLayout'));
|
|
1026
|
-
const MaterialVerticalLayoutRenderer = ({ uischema, schema, path, enabled, visible, renderers, cells }) => {
|
|
1110
|
+
const MaterialVerticalLayoutRenderer = ({ uischema, schema, path, enabled, visible, renderers, cells, }) => {
|
|
1027
1111
|
const verticalLayout = uischema;
|
|
1028
1112
|
const childProps = {
|
|
1029
1113
|
elements: verticalLayout.elements,
|
|
@@ -1031,9 +1115,9 @@ const MaterialVerticalLayoutRenderer = ({ uischema, schema, path, enabled, visib
|
|
|
1031
1115
|
path,
|
|
1032
1116
|
enabled,
|
|
1033
1117
|
direction: 'column',
|
|
1034
|
-
visible
|
|
1118
|
+
visible,
|
|
1035
1119
|
};
|
|
1036
|
-
return React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { renderers: renderers, cells: cells }));
|
|
1120
|
+
return (React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { renderers: renderers, cells: cells })));
|
|
1037
1121
|
};
|
|
1038
1122
|
var MaterialVerticalLayout = withJsonFormsLayoutProps(MaterialVerticalLayoutRenderer);
|
|
1039
1123
|
|
|
@@ -1044,23 +1128,29 @@ const isSingleLevelCategorization = and(uiTypeIs('Categorization'), (uischema) =
|
|
|
1044
1128
|
});
|
|
1045
1129
|
const materialCategorizationTester = rankWith(1, isSingleLevelCategorization);
|
|
1046
1130
|
const MaterialCategorizationLayoutRenderer = (props) => {
|
|
1047
|
-
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;
|
|
1048
1132
|
const categorization = uischema;
|
|
1133
|
+
const [previousCategorization, setPreviousCategorization] = useState(uischema);
|
|
1049
1134
|
const [activeCategory, setActiveCategory] = useState(selected ?? 0);
|
|
1050
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;
|
|
1051
1141
|
const childProps = {
|
|
1052
|
-
elements: categories[
|
|
1142
|
+
elements: categories[safeCategory] ? categories[safeCategory].elements : [],
|
|
1053
1143
|
schema,
|
|
1054
1144
|
path,
|
|
1055
1145
|
direction: 'column',
|
|
1056
1146
|
enabled,
|
|
1057
1147
|
visible,
|
|
1058
1148
|
renderers,
|
|
1059
|
-
cells
|
|
1149
|
+
cells,
|
|
1060
1150
|
};
|
|
1061
1151
|
const onTabChange = (_event, value) => {
|
|
1062
1152
|
if (onChange) {
|
|
1063
|
-
onChange(value,
|
|
1153
|
+
onChange(value, safeCategory);
|
|
1064
1154
|
}
|
|
1065
1155
|
setActiveCategory(value);
|
|
1066
1156
|
};
|
|
@@ -1069,90 +1159,12 @@ const MaterialCategorizationLayoutRenderer = (props) => {
|
|
|
1069
1159
|
}, [categories, t]);
|
|
1070
1160
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
1071
1161
|
React.createElement(AppBar, { position: 'static' },
|
|
1072
|
-
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] }))))),
|
|
1073
1163
|
React.createElement("div", { style: { marginTop: '0.5em' } },
|
|
1074
|
-
React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps)))));
|
|
1164
|
+
React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps, { key: safeCategory })))));
|
|
1075
1165
|
};
|
|
1076
1166
|
var MaterialCategorizationLayout = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(MaterialCategorizationLayoutRenderer)));
|
|
1077
1167
|
|
|
1078
|
-
const iconStyle = { float: 'right' };
|
|
1079
|
-
const ExpandPanelRendererComponent = (props) => {
|
|
1080
|
-
const [labelHtmlId] = useState(createId('expand-panel'));
|
|
1081
|
-
useEffect(() => {
|
|
1082
|
-
return () => {
|
|
1083
|
-
removeId(labelHtmlId);
|
|
1084
|
-
};
|
|
1085
|
-
}, [labelHtmlId]);
|
|
1086
|
-
const { enabled, childLabel, childPath, index, expanded, moveDown, moveUp, enableMoveDown, enableMoveUp, handleExpansion, removeItems, path, rootSchema, schema, uischema, uischemas, renderers, cells, config } = props;
|
|
1087
|
-
const foundUISchema = useMemo(() => findUISchema(uischemas, schema, uischema.scope, path, undefined, uischema, rootSchema), [uischemas, schema, uischema.scope, path, uischema, rootSchema]);
|
|
1088
|
-
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
1089
|
-
const showSortButtons = appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayLayoutSortButtons;
|
|
1090
|
-
return (React.createElement(Accordion, { "aria-labelledby": labelHtmlId, expanded: expanded, onChange: handleExpansion(childPath) },
|
|
1091
|
-
React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, null) },
|
|
1092
|
-
React.createElement(Grid, { container: true, alignItems: 'center' },
|
|
1093
|
-
React.createElement(Grid, { item: true, xs: 7, md: 9 },
|
|
1094
|
-
React.createElement(Grid, { container: true, alignItems: 'center' },
|
|
1095
|
-
React.createElement(Grid, { item: true, xs: 2, md: 1 },
|
|
1096
|
-
React.createElement(Avatar, { "aria-label": 'Index' }, index + 1)),
|
|
1097
|
-
React.createElement(Grid, { item: true, xs: 10, md: 11 },
|
|
1098
|
-
React.createElement("span", { id: labelHtmlId }, childLabel)))),
|
|
1099
|
-
React.createElement(Grid, { item: true, xs: 5, md: 3 },
|
|
1100
|
-
React.createElement(Grid, { container: true, justifyContent: 'flex-end' },
|
|
1101
|
-
React.createElement(Grid, { item: true },
|
|
1102
|
-
React.createElement(Grid, { container: true, direction: 'row', justifyContent: 'center', alignItems: 'center' },
|
|
1103
|
-
showSortButtons ? (React.createElement(Fragment, null,
|
|
1104
|
-
React.createElement(Grid, { item: true },
|
|
1105
|
-
React.createElement(IconButton, { onClick: moveUp(path, index), style: iconStyle, disabled: !enableMoveUp, "aria-label": `Move up`, size: 'large' },
|
|
1106
|
-
React.createElement(ArrowUpward, null))),
|
|
1107
|
-
React.createElement(Grid, { item: true },
|
|
1108
|
-
React.createElement(IconButton, { onClick: moveDown(path, index), style: iconStyle, disabled: !enableMoveDown, "aria-label": `Move down`, size: 'large' },
|
|
1109
|
-
React.createElement(ArrowDownward, null))))) : (''),
|
|
1110
|
-
React.createElement(Grid, { item: true },
|
|
1111
|
-
React.createElement(IconButton, { onClick: removeItems(path, [index]), style: iconStyle, "aria-label": `Delete`, size: 'large' },
|
|
1112
|
-
React.createElement(DeleteIcon, null))))))))),
|
|
1113
|
-
React.createElement(AccordionDetails, null,
|
|
1114
|
-
React.createElement(JsonFormsDispatch, { enabled: enabled, schema: schema, uischema: foundUISchema, path: childPath, key: childPath, renderers: renderers, cells: cells }))));
|
|
1115
|
-
};
|
|
1116
|
-
const ExpandPanelRenderer = React.memo(ExpandPanelRendererComponent);
|
|
1117
|
-
const ctxDispatchToExpandPanelProps = dispatch => ({
|
|
1118
|
-
removeItems: useCallback((path, toDelete) => (event) => {
|
|
1119
|
-
event.stopPropagation();
|
|
1120
|
-
dispatch(update(path, array => {
|
|
1121
|
-
toDelete
|
|
1122
|
-
.sort()
|
|
1123
|
-
.reverse()
|
|
1124
|
-
.forEach(s => array.splice(s, 1));
|
|
1125
|
-
return array;
|
|
1126
|
-
}));
|
|
1127
|
-
}, [dispatch]),
|
|
1128
|
-
moveUp: useCallback((path, toMove) => (event) => {
|
|
1129
|
-
event.stopPropagation();
|
|
1130
|
-
dispatch(update(path, array => {
|
|
1131
|
-
moveUp(array, toMove);
|
|
1132
|
-
return array;
|
|
1133
|
-
}));
|
|
1134
|
-
}, [dispatch]),
|
|
1135
|
-
moveDown: useCallback((path, toMove) => (event) => {
|
|
1136
|
-
event.stopPropagation();
|
|
1137
|
-
dispatch(update(path, array => {
|
|
1138
|
-
moveDown(array, toMove);
|
|
1139
|
-
return array;
|
|
1140
|
-
}));
|
|
1141
|
-
}, [dispatch])
|
|
1142
|
-
});
|
|
1143
|
-
const withContextToExpandPanelProps = (Component) => ({ ctx, props }) => {
|
|
1144
|
-
const dispatchProps = ctxDispatchToExpandPanelProps(ctx.dispatch);
|
|
1145
|
-
const { childLabelProp, schema, path, index, uischemas } = props;
|
|
1146
|
-
const childPath = composePaths(path, `${index}`);
|
|
1147
|
-
const childData = Resolve.data(ctx.core.data, childPath);
|
|
1148
|
-
const childLabel = childLabelProp
|
|
1149
|
-
? get(childData, childLabelProp, '')
|
|
1150
|
-
: get(childData, getFirstPrimitiveProp(schema), '');
|
|
1151
|
-
return (React.createElement(Component, Object.assign({}, props, dispatchProps, { childLabel: childLabel, childPath: childPath, uischemas: uischemas })));
|
|
1152
|
-
};
|
|
1153
|
-
const withJsonFormsExpandPanelProps = (Component) => withJsonFormsContext(withContextToExpandPanelProps(Component));
|
|
1154
|
-
var ExpandPanelRenderer$1 = withJsonFormsExpandPanelProps(ExpandPanelRenderer);
|
|
1155
|
-
|
|
1156
1168
|
const MaterialArrayLayoutComponent = (props) => {
|
|
1157
1169
|
const [expanded, setExpanded] = useState(false);
|
|
1158
1170
|
const innerCreateDefaultValue = useCallback(() => createDefaultValue(props.schema), [props.schema]);
|
|
@@ -1160,20 +1172,18 @@ const MaterialArrayLayoutComponent = (props) => {
|
|
|
1160
1172
|
setExpanded(expandedPanel ? panel : false);
|
|
1161
1173
|
}, []);
|
|
1162
1174
|
const isExpanded = (index) => expanded === composePaths(props.path, `${index}`);
|
|
1163
|
-
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;
|
|
1164
1176
|
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
1165
1177
|
return (React.createElement("div", null,
|
|
1166
|
-
React.createElement(ArrayLayoutToolbar, { label: computeLabel(label, required, appliedUiSchemaOptions.hideRequiredAsterisk), errors: errors, path: path, addItem: addItem, createDefault: innerCreateDefaultValue }),
|
|
1167
|
-
React.createElement("div", null, data > 0 ? (map(range(data), index => {
|
|
1168
|
-
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 }));
|
|
1169
1181
|
})) : (React.createElement("p", null, "No data")))));
|
|
1170
1182
|
};
|
|
1171
1183
|
const MaterialArrayLayout$1 = React.memo(MaterialArrayLayoutComponent);
|
|
1172
1184
|
|
|
1173
1185
|
const MaterialArrayLayoutRenderer = ({ visible, addItem, ...props }) => {
|
|
1174
|
-
const addItemCb = useCallback((p, value) => addItem(p, value), [
|
|
1175
|
-
addItem
|
|
1176
|
-
]);
|
|
1186
|
+
const addItemCb = useCallback((p, value) => addItem(p, value), [addItem]);
|
|
1177
1187
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
1178
1188
|
React.createElement(MaterialArrayLayout$1, Object.assign({ visible: visible, addItem: addItemCb }, props))));
|
|
1179
1189
|
};
|
|
@@ -1195,12 +1205,12 @@ var MaterialBooleanToggleCell$1 = withJsonFormsCellProps(MaterialBooleanToggleCe
|
|
|
1195
1205
|
const MaterialDateCell = (props) => {
|
|
1196
1206
|
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
1197
1207
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
1198
|
-
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 }));
|
|
1199
1209
|
};
|
|
1200
1210
|
const materialDateCellTester = rankWith(2, isDateControl);
|
|
1201
1211
|
var MaterialDateCell$1 = withJsonFormsCellProps(MaterialDateCell);
|
|
1202
1212
|
|
|
1203
|
-
const MaterialEnumCell = (props) =>
|
|
1213
|
+
const MaterialEnumCell = (props) => React.createElement(MuiSelect, Object.assign({}, props));
|
|
1204
1214
|
const materialEnumCellTester = rankWith(2, isEnumControl);
|
|
1205
1215
|
var MaterialEnumCell$1 = withJsonFormsEnumCellProps(withTranslateProps(React.memo(MaterialEnumCell)), false);
|
|
1206
1216
|
|
|
@@ -1216,7 +1226,7 @@ const MaterialNumberFormatCell = (props) => React.createElement(MuiInputNumberFo
|
|
|
1216
1226
|
const materialNumberFormatCellTester = rankWith(4, isNumberFormatControl);
|
|
1217
1227
|
var MaterialNumberFormatCell$1 = withJsonFormsCellProps(MaterialNumberFormatCell);
|
|
1218
1228
|
|
|
1219
|
-
const MaterialOneOfEnumCell = (props) =>
|
|
1229
|
+
const MaterialOneOfEnumCell = (props) => React.createElement(MuiSelect, Object.assign({}, props));
|
|
1220
1230
|
const materialOneOfEnumCellTester = rankWith(2, isOneOfEnumControl);
|
|
1221
1231
|
var MaterialOneOfEnumCell$1 = withJsonFormsOneOfEnumCellProps(withTranslateProps(React.memo(MaterialOneOfEnumCell)), false);
|
|
1222
1232
|
|
|
@@ -1247,19 +1257,19 @@ const MaterialCategorizationStepperLayoutRenderer = (props) => {
|
|
|
1247
1257
|
const handleStep = (step) => {
|
|
1248
1258
|
setActiveCategory(step);
|
|
1249
1259
|
};
|
|
1250
|
-
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;
|
|
1251
1261
|
const categorization = uischema;
|
|
1252
1262
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
1253
1263
|
const buttonWrapperStyle = {
|
|
1254
1264
|
textAlign: 'right',
|
|
1255
1265
|
width: '100%',
|
|
1256
|
-
margin: '1em auto'
|
|
1266
|
+
margin: '1em auto',
|
|
1257
1267
|
};
|
|
1258
1268
|
const buttonNextStyle = {
|
|
1259
|
-
float: 'right'
|
|
1269
|
+
float: 'right',
|
|
1260
1270
|
};
|
|
1261
1271
|
const buttonStyle = {
|
|
1262
|
-
marginRight: '1em'
|
|
1272
|
+
marginRight: '1em',
|
|
1263
1273
|
};
|
|
1264
1274
|
const categories = useMemo(() => categorization.elements.filter((category) => isVisible(category, data, undefined, ajv)), [categorization, data, ajv]);
|
|
1265
1275
|
const childProps = {
|
|
@@ -1269,7 +1279,7 @@ const MaterialCategorizationStepperLayoutRenderer = (props) => {
|
|
|
1269
1279
|
direction: 'column',
|
|
1270
1280
|
visible,
|
|
1271
1281
|
renderers,
|
|
1272
|
-
cells
|
|
1282
|
+
cells,
|
|
1273
1283
|
};
|
|
1274
1284
|
const tabLabels = useMemo(() => {
|
|
1275
1285
|
return categories.map((e) => deriveLabelForUISchemaElement(e, t));
|
|
@@ -1279,19 +1289,63 @@ const MaterialCategorizationStepperLayoutRenderer = (props) => {
|
|
|
1279
1289
|
React.createElement(StepButton, { onClick: () => handleStep(idx) }, tabLabels[idx]))))),
|
|
1280
1290
|
React.createElement("div", null,
|
|
1281
1291
|
React.createElement(MaterialLayoutRenderer, Object.assign({}, childProps))),
|
|
1282
|
-
|
|
1283
|
-
React.createElement(Button, { style: buttonNextStyle, variant:
|
|
1284
|
-
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))));
|
|
1285
1295
|
};
|
|
1286
1296
|
var MaterialCategorizationStepperLayout = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(MaterialCategorizationStepperLayoutRenderer)));
|
|
1287
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
|
+
|
|
1288
1339
|
const materialRenderers = [
|
|
1289
1340
|
{
|
|
1290
1341
|
tester: materialArrayControlTester,
|
|
1291
|
-
renderer: MaterialArrayControlRenderer$1
|
|
1342
|
+
renderer: MaterialArrayControlRenderer$1,
|
|
1292
1343
|
},
|
|
1293
1344
|
{ tester: materialBooleanControlTester, renderer: MaterialBooleanControl$1 },
|
|
1294
|
-
{
|
|
1345
|
+
{
|
|
1346
|
+
tester: materialBooleanToggleControlTester,
|
|
1347
|
+
renderer: MaterialBooleanToggleControl$1,
|
|
1348
|
+
},
|
|
1295
1349
|
{ tester: materialNativeControlTester, renderer: MaterialNativeControl$1 },
|
|
1296
1350
|
{ tester: materialEnumControlTester, renderer: MaterialEnumControl$1 },
|
|
1297
1351
|
{ tester: materialIntegerControlTester, renderer: MaterialIntegerControl$1 },
|
|
@@ -1307,41 +1361,44 @@ const materialRenderers = [
|
|
|
1307
1361
|
{ tester: materialOneOfControlTester, renderer: MaterialOneOfRenderer$1 },
|
|
1308
1362
|
{
|
|
1309
1363
|
tester: materialRadioGroupControlTester,
|
|
1310
|
-
renderer: MaterialRadioGroupControl$1
|
|
1364
|
+
renderer: MaterialRadioGroupControl$1,
|
|
1311
1365
|
},
|
|
1312
1366
|
{
|
|
1313
1367
|
tester: materialOneOfRadioGroupControlTester,
|
|
1314
|
-
renderer: MaterialOneOfRadioGroupControl$1
|
|
1368
|
+
renderer: MaterialOneOfRadioGroupControl$1,
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
tester: materialOneOfEnumControlTester,
|
|
1372
|
+
renderer: MaterialOneOfEnumControl$1,
|
|
1315
1373
|
},
|
|
1316
|
-
{ tester: materialOneOfEnumControlTester, renderer: MaterialOneOfEnumControl$1 },
|
|
1317
1374
|
{ tester: materialGroupTester, renderer: MaterialGroupLayout },
|
|
1318
1375
|
{
|
|
1319
1376
|
tester: materialHorizontalLayoutTester,
|
|
1320
|
-
renderer: MaterialHorizontalLayout
|
|
1377
|
+
renderer: MaterialHorizontalLayout,
|
|
1321
1378
|
},
|
|
1322
1379
|
{ tester: materialVerticalLayoutTester, renderer: MaterialVerticalLayout },
|
|
1323
1380
|
{
|
|
1324
1381
|
tester: materialCategorizationTester,
|
|
1325
|
-
renderer: MaterialCategorizationLayout
|
|
1382
|
+
renderer: MaterialCategorizationLayout,
|
|
1326
1383
|
},
|
|
1327
1384
|
{
|
|
1328
1385
|
tester: materialCategorizationStepperTester,
|
|
1329
|
-
renderer: MaterialCategorizationStepperLayout
|
|
1386
|
+
renderer: MaterialCategorizationStepperLayout,
|
|
1330
1387
|
},
|
|
1331
1388
|
{ tester: materialArrayLayoutTester, renderer: MaterialArrayLayout },
|
|
1332
1389
|
{ tester: materialLabelRendererTester, renderer: MaterialLabelRenderer$1 },
|
|
1333
1390
|
{
|
|
1334
1391
|
tester: materialListWithDetailTester,
|
|
1335
|
-
renderer: MaterialListWithDetailRenderer$1
|
|
1392
|
+
renderer: MaterialListWithDetailRenderer$1,
|
|
1336
1393
|
},
|
|
1337
1394
|
{
|
|
1338
1395
|
tester: materialAnyOfStringOrEnumControlTester,
|
|
1339
|
-
renderer: MaterialAnyOfStringOrEnumControl$1
|
|
1396
|
+
renderer: MaterialAnyOfStringOrEnumControl$1,
|
|
1340
1397
|
},
|
|
1341
1398
|
{
|
|
1342
1399
|
tester: materialEnumArrayRendererTester,
|
|
1343
|
-
renderer: MaterialEnumArrayRenderer$1
|
|
1344
|
-
}
|
|
1400
|
+
renderer: MaterialEnumArrayRenderer$1,
|
|
1401
|
+
},
|
|
1345
1402
|
];
|
|
1346
1403
|
const materialCells = [
|
|
1347
1404
|
{ tester: materialBooleanCellTester, cell: MaterialBooleanCell$1 },
|
|
@@ -1353,8 +1410,14 @@ const materialCells = [
|
|
|
1353
1410
|
{ tester: materialNumberFormatCellTester, cell: MaterialNumberFormatCell$1 },
|
|
1354
1411
|
{ tester: materialOneOfEnumCellTester, cell: MaterialOneOfEnumCell$1 },
|
|
1355
1412
|
{ tester: materialTextCellTester, cell: MaterialTextCell$1 },
|
|
1356
|
-
{ tester: materialTimeCellTester, cell: MaterialTimeCell$1 }
|
|
1413
|
+
{ tester: materialTimeCellTester, cell: MaterialTimeCell$1 },
|
|
1357
1414
|
];
|
|
1415
|
+
const Unwrapped = {
|
|
1416
|
+
...UnwrappedAdditional,
|
|
1417
|
+
...UnwrappedComplex,
|
|
1418
|
+
...UnwrappedControls,
|
|
1419
|
+
...UnwrappedLayouts,
|
|
1420
|
+
};
|
|
1358
1421
|
|
|
1359
|
-
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 };
|
|
1360
1423
|
//# sourceMappingURL=jsonforms-react-material.esm.js.map
|