@jsonforms/material-renderers 3.0.0-rc.1 → 3.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import isEmpty from 'lodash/isEmpty';
5
5
  import union from 'lodash/union';
6
6
  import startCase from 'lodash/startCase';
7
7
  import range from 'lodash/range';
8
- import { TableCell, styled as styled$1, Badge, Tooltip, TableRow, Grid, Typography, Hidden, IconButton, FormHelperText, 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';
8
+ import { TableCell, styled as styled$1, Badge, Tooltip, TableRow, Grid, Typography, IconButton, FormHelperText, Hidden, Table, TableHead, TableBody, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, Tabs, Tab, Checkbox, TextField, Select, MenuItem, Input, useTheme, InputAdornment, FormControl, FormGroup, FormControlLabel, Toolbar, ListItem, ListItemAvatar, Avatar, ListItemText, ListItemSecondaryAction, List, Switch, InputLabel, Autocomplete, FormLabel, Slider, RadioGroup, Radio, Card, CardHeader, CardContent, AppBar, Accordion, AccordionSummary, AccordionDetails, Stepper, Step, StepButton } from '@mui/material';
9
9
  import DeleteIcon from '@mui/icons-material/Delete';
10
10
  import ArrowDownward from '@mui/icons-material/ArrowDownward';
11
11
  import ArrowUpward from '@mui/icons-material/ArrowUpward';
@@ -48,10 +48,9 @@ const TableToolbar = React.memo(({ numColumns, errors, label, path, addItem, sch
48
48
  React.createElement(Grid, { container: true, justifyContent: 'flex-start', alignItems: 'center', spacing: 2 },
49
49
  React.createElement(Grid, { item: true },
50
50
  React.createElement(Typography, { variant: 'h6' }, label)),
51
- React.createElement(Grid, { item: true },
52
- React.createElement(Hidden, { smUp: errors.length === 0 },
53
- React.createElement(Grid, { item: true },
54
- React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors })))))),
51
+ React.createElement(Grid, { item: true }, errors.length !== 0 &&
52
+ React.createElement(Grid, { item: true },
53
+ React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors }))))),
55
54
  enabled ? (React.createElement(NoBorderTableCell, { align: 'right', style: fixedCellSmall },
56
55
  React.createElement(Tooltip, { id: 'tooltip-add', title: `Add to ${label}`, placement: 'bottom' },
57
56
  React.createElement(IconButton, { "aria-label": `Add to ${label}`, onClick: addItem(path, createDefaultValue(schema)), size: 'large' },
@@ -537,9 +536,9 @@ const ArrayLayoutToolbar = React.memo(({ label, errors, addItem, path, createDef
537
536
  React.createElement(Grid, { container: true, alignItems: 'center', justifyContent: 'space-between' },
538
537
  React.createElement(Grid, { item: true },
539
538
  React.createElement(Typography, { variant: 'h6' }, label)),
540
- React.createElement(Hidden, { smUp: errors.length === 0 },
539
+ errors.length !== 0 &&
541
540
  React.createElement(Grid, { item: true },
542
- React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors }))),
541
+ React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors })),
543
542
  React.createElement(Grid, { item: true },
544
543
  React.createElement(Grid, { container: true },
545
544
  React.createElement(Grid, { item: true },
@@ -1016,7 +1015,7 @@ const ExpandPanelRendererComponent = (props) => {
1016
1015
  removeId(labelHtmlId);
1017
1016
  };
1018
1017
  }, [labelHtmlId]);
1019
- const { childLabel, childPath, index, expanded, moveDown, moveUp, enableMoveDown, enableMoveUp, handleExpansion, removeItems, path, rootSchema, schema, uischema, uischemas, renderers, cells, config } = props;
1018
+ const { enabled, childLabel, childPath, index, expanded, moveDown, moveUp, enableMoveDown, enableMoveUp, handleExpansion, removeItems, path, rootSchema, schema, uischema, uischemas, renderers, cells, config } = props;
1020
1019
  const foundUISchema = useMemo(() => findUISchema(uischemas, schema, uischema.scope, path, undefined, uischema, rootSchema), [uischemas, schema, uischema.scope, path, uischema, rootSchema]);
1021
1020
  const appliedUiSchemaOptions = merge({}, config, uischema.options);
1022
1021
  const showSortButtons = appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayLayoutSortButtons;
@@ -1044,7 +1043,7 @@ const ExpandPanelRendererComponent = (props) => {
1044
1043
  React.createElement(IconButton, { onClick: removeItems(path, [index]), style: iconStyle, "aria-label": `Delete`, size: 'large' },
1045
1044
  React.createElement(DeleteIcon, null))))))))),
1046
1045
  React.createElement(AccordionDetails, null,
1047
- React.createElement(JsonFormsDispatch, { schema: schema, uischema: foundUISchema, path: childPath, key: childPath, renderers: renderers, cells: cells }))));
1046
+ React.createElement(JsonFormsDispatch, { enabled: enabled, schema: schema, uischema: foundUISchema, path: childPath, key: childPath, renderers: renderers, cells: cells }))));
1048
1047
  };
1049
1048
  const ExpandPanelRenderer = React.memo(ExpandPanelRendererComponent);
1050
1049
  const ctxDispatchToExpandPanelProps = dispatch => ({
@@ -1093,12 +1092,12 @@ const MaterialArrayLayoutComponent = (props) => {
1093
1092
  setExpanded(expandedPanel ? panel : false);
1094
1093
  }, []);
1095
1094
  const isExpanded = (index) => expanded === composePaths(props.path, `${index}`);
1096
- const { data, path, schema, uischema, errors, addItem, renderers, cells, label, required, rootSchema, config, uischemas } = props;
1095
+ const { enabled, data, path, schema, uischema, errors, addItem, renderers, cells, label, required, rootSchema, config, uischemas } = props;
1097
1096
  const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
1098
1097
  return (React.createElement("div", null,
1099
1098
  React.createElement(ArrayLayoutToolbar, { label: computeLabel(label, required, appliedUiSchemaOptions.hideRequiredAsterisk), errors: errors, path: path, addItem: addItem, createDefault: innerCreateDefaultValue }),
1100
1099
  React.createElement("div", null, data > 0 ? (map(range(data), index => {
1101
- return (React.createElement(ExpandPanelRenderer$1, { 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 }));
1100
+ return (React.createElement(ExpandPanelRenderer$1, { enabled: enabled, index: index, expanded: isExpanded(index), schema: schema, path: path, handleExpansion: handleChange, uischema: uischema, renderers: renderers, cells: cells, key: index, rootSchema: rootSchema, enableMoveUp: index != 0, enableMoveDown: index < data - 1, config: config, childLabelProp: appliedUiSchemaOptions.elementLabelProp, uischemas: uischemas }));
1102
1101
  })) : (React.createElement("p", null, "No data")))));
1103
1102
  };
1104
1103
  const MaterialArrayLayout$1 = React.memo(MaterialArrayLayoutComponent);