@jsonforms/material-renderers 3.4.0-alpha.3 → 3.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/additional/MaterialListWithDetailRenderer.d.ts +4 -2
- package/lib/additional/unwrapped.d.ts +3 -1
- package/lib/complex/MaterialArrayControlRenderer.d.ts +4 -2
- package/lib/complex/MaterialTableControl.d.ts +3 -1
- package/lib/complex/unwrapped.d.ts +3 -1
- package/lib/index.d.ts +9 -3
- package/lib/jsonforms-react-material.cjs.js +13 -11
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +12 -12
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/layouts/MaterialArrayLayout.d.ts +4 -2
- package/lib/layouts/MaterialArrayLayoutRenderer.d.ts +4 -2
- package/lib/layouts/unwrapped.d.ts +3 -1
- package/package.json +7 -7
- package/src/additional/MaterialListWithDetailRenderer.tsx +9 -3
- package/src/complex/MaterialArrayControlRenderer.tsx +22 -9
- package/src/complex/MaterialOneOfRenderer.tsx +12 -8
- package/src/complex/MaterialTableControl.tsx +2 -1
- package/src/layouts/MaterialArrayLayout.tsx +5 -2
- package/src/layouts/MaterialArrayLayoutRenderer.tsx +17 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useCallback, useMemo, Fragment, useEffect } from 'react';
|
|
2
2
|
import { rankWith, isAllOfControl, findMatchingUISchema, createCombinatorRenderInfos, Generate, isLayout, isAnyOfControl, createDefaultValue, Resolve, encode, Paths, formatErrorMessage, errorsAt, or, isObjectArrayControl, isPrimitiveArrayControl, isDescriptionHidden, getAjv, and, uiTypeIs, schemaMatches, hasType, schemaSubPathMatches, resolveSchema, showAsRequired, isObjectControl, findUISchema, isOneOfControl, isObjectArray, computeLabel, composePaths, isBooleanControl, optionIs, isDateControl, defaultDateFormat, isDateTimeControl, defaultDateTimeFormat, isEnumControl, isIntegerControl, isTimeControl, isNumberControl, isOneOfEnumControl, isRangeControl, isStringControl, defaultTimeFormat, createId, removeId, update, moveUp, moveDown, computeChildLabel, withIncreasedRank, isVisible, deriveLabelForUISchemaElement, isObjectArrayWithNesting, isNumberFormatControl, categorizationHasCategory } from '@jsonforms/core';
|
|
3
|
-
import { withJsonFormsAllOfProps, JsonFormsDispatch, withJsonFormsAnyOfProps, DispatchCell, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsMultiEnumProps, withJsonFormsDetailProps, withJsonFormsOneOfProps, withJsonFormsLabelProps, withJsonFormsMasterListItemProps, withJsonFormsControlProps, Control, withJsonFormsEnumProps,
|
|
3
|
+
import { withJsonFormsAllOfProps, JsonFormsDispatch, withJsonFormsAnyOfProps, DispatchCell, useJsonForms, withJsonFormsArrayLayoutProps, withTranslateProps, withArrayTranslationProps, withJsonFormsMultiEnumProps, withJsonFormsDetailProps, withJsonFormsOneOfProps, withJsonFormsLabelProps, withJsonFormsMasterListItemProps, withJsonFormsControlProps, Control, withJsonFormsEnumProps, withJsonFormsOneOfEnumProps, withJsonFormsContext, withJsonFormsLayoutProps, withJsonFormsCellProps, withJsonFormsEnumCellProps, withJsonFormsOneOfEnumCellProps } from '@jsonforms/react';
|
|
4
4
|
import { Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button, Tabs, Tab, TableCell, styled as styled$1, Badge, Tooltip, TableRow, Stack, Grid, Typography, FormHelperText, IconButton, Table, TableHead, TableBody, Autocomplete, TextField, Checkbox, useThemeProps, Input, FilledInput, OutlinedInput, useTheme, InputAdornment, Select, MenuItem, Switch, FormControl, FormLabel, FormGroup, FormControlLabel, Toolbar, ListItem, ListItemAvatar, Avatar, ListItemText, ListItemSecondaryAction, List, InputLabel, RadioGroup, Radio, Slider, Accordion, AccordionSummary, AccordionDetails, Card, CardHeader, CardContent, AppBar, Stepper, Step, StepButton } from '@mui/material';
|
|
5
5
|
import omit from 'lodash/omit';
|
|
6
6
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -299,7 +299,7 @@ const MaterialArrayControlRenderer = (props) => {
|
|
|
299
299
|
const [open, setOpen] = useState(false);
|
|
300
300
|
const [path, setPath] = useState(undefined);
|
|
301
301
|
const [rowData, setRowData] = useState(undefined);
|
|
302
|
-
const { removeItems, visible } = props;
|
|
302
|
+
const { removeItems, visible, translations } = props;
|
|
303
303
|
const openDeleteDialog = useCallback((p, rowIndex) => {
|
|
304
304
|
setOpen(true);
|
|
305
305
|
setPath(p);
|
|
@@ -316,11 +316,11 @@ const MaterialArrayControlRenderer = (props) => {
|
|
|
316
316
|
return null;
|
|
317
317
|
}
|
|
318
318
|
return (React.createElement(React.Fragment, null,
|
|
319
|
-
React.createElement(MaterialTableControl, { ...props, openDeleteDialog: openDeleteDialog }),
|
|
320
|
-
React.createElement(DeleteDialog, { open: open, onCancel: deleteCancel, onConfirm: deleteConfirm, onClose: deleteClose, acceptText:
|
|
319
|
+
React.createElement(MaterialTableControl, { ...props, openDeleteDialog: openDeleteDialog, translations: translations }),
|
|
320
|
+
React.createElement(DeleteDialog, { open: open, onCancel: deleteCancel, onConfirm: deleteConfirm, onClose: deleteClose, acceptText: translations.deleteDialogAccept, declineText: translations.deleteDialogDecline, title: translations.deleteDialogTitle, message: translations.deleteDialogMessage })));
|
|
321
321
|
};
|
|
322
322
|
const materialArrayControlTester = rankWith(3, or(isObjectArrayControl, isPrimitiveArrayControl));
|
|
323
|
-
var MaterialArrayControlRenderer$1 = withJsonFormsArrayLayoutProps(MaterialArrayControlRenderer);
|
|
323
|
+
var MaterialArrayControlRenderer$1 = withJsonFormsArrayLayoutProps(withTranslateProps(withArrayTranslationProps(MaterialArrayControlRenderer)));
|
|
324
324
|
|
|
325
325
|
const useFocus = () => {
|
|
326
326
|
const [focused, setFocused] = useState(false);
|
|
@@ -644,7 +644,7 @@ const MaterialOneOfRenderer = ({ handleChange, schema, path, renderers, cells, r
|
|
|
644
644
|
const cancel = useCallback(() => {
|
|
645
645
|
setConfirmDialogOpen(false);
|
|
646
646
|
}, [setConfirmDialogOpen]);
|
|
647
|
-
const oneOfRenderInfos = createCombinatorRenderInfos(schema.oneOf, rootSchema, 'oneOf', uischema, path, uischemas);
|
|
647
|
+
const oneOfRenderInfos = useMemo(() => createCombinatorRenderInfos(schema.oneOf, rootSchema, 'oneOf', uischema, path, uischemas), [schema, rootSchema, uischema, path, uischemas]);
|
|
648
648
|
const openNewTab = (newIndex) => {
|
|
649
649
|
handleChange(path, createDefaultValue(oneOfRenderInfos[newIndex].schema, rootSchema));
|
|
650
650
|
setSelectedIndex(newIndex);
|
|
@@ -714,7 +714,7 @@ const ListWithDetailMasterItem = ({ index, childLabel, selected, enabled, handle
|
|
|
714
714
|
};
|
|
715
715
|
var ListWithDetailMasterItem$1 = withJsonFormsMasterListItemProps(ListWithDetailMasterItem);
|
|
716
716
|
|
|
717
|
-
const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, enabled, errors, visible, label, required, removeItems, addItem, data, renderers, cells, config, rootSchema,
|
|
717
|
+
const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, enabled, errors, visible, label, required, removeItems, addItem, data, renderers, cells, config, rootSchema, description, disableAdd, disableRemove, translations, }) => {
|
|
718
718
|
const [selectedIndex, setSelectedIndex] = useState(undefined);
|
|
719
719
|
const handleRemoveItem = useCallback((p, value) => () => {
|
|
720
720
|
removeItems(p, [value])();
|
|
@@ -745,7 +745,7 @@ const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, ena
|
|
|
745
745
|
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))))));
|
|
746
746
|
};
|
|
747
747
|
const materialListWithDetailTester = rankWith(4, and(uiTypeIs('ListWithDetail'), isObjectArray));
|
|
748
|
-
var MaterialListWithDetailRenderer$1 = withJsonFormsArrayLayoutProps(MaterialListWithDetailRenderer);
|
|
748
|
+
var MaterialListWithDetailRenderer$1 = withJsonFormsArrayLayoutProps(withTranslateProps(withArrayTranslationProps(MaterialListWithDetailRenderer)));
|
|
749
749
|
|
|
750
750
|
const MaterialInputControl = (props) => {
|
|
751
751
|
const [focused, onFocus, onBlur] = useFocus();
|
|
@@ -1367,7 +1367,7 @@ const MaterialArrayLayoutComponent = (props) => {
|
|
|
1367
1367
|
setExpanded(expandedPanel ? panel : false);
|
|
1368
1368
|
}, []);
|
|
1369
1369
|
const isExpanded = (index) => expanded === composePaths(props.path, `${index}`);
|
|
1370
|
-
const { enabled, data, path, schema, uischema, errors, addItem, renderers, cells, label, required, rootSchema, config, uischemas,
|
|
1370
|
+
const { enabled, data, path, schema, uischema, errors, addItem, renderers, cells, label, required, rootSchema, config, uischemas, description, disableAdd, disableRemove, translations, } = props;
|
|
1371
1371
|
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
1372
1372
|
const doDisableAdd = disableAdd || appliedUiSchemaOptions.disableAdd;
|
|
1373
1373
|
const doDisableRemove = disableRemove || appliedUiSchemaOptions.disableRemove;
|
|
@@ -1379,15 +1379,15 @@ const MaterialArrayLayoutComponent = (props) => {
|
|
|
1379
1379
|
};
|
|
1380
1380
|
const MaterialArrayLayout$1 = React.memo(MaterialArrayLayoutComponent);
|
|
1381
1381
|
|
|
1382
|
-
const MaterialArrayLayoutRenderer = ({ visible, addItem, ...props }) => {
|
|
1382
|
+
const MaterialArrayLayoutRenderer = ({ visible, addItem, translations, ...props }) => {
|
|
1383
1383
|
const addItemCb = useCallback((p, value) => addItem(p, value), [addItem]);
|
|
1384
1384
|
if (!visible) {
|
|
1385
1385
|
return null;
|
|
1386
1386
|
}
|
|
1387
|
-
return (React.createElement(MaterialArrayLayout$1, { visible: visible, addItem: addItemCb, ...props }));
|
|
1387
|
+
return (React.createElement(MaterialArrayLayout$1, { translations: translations, visible: visible, addItem: addItemCb, ...props }));
|
|
1388
1388
|
};
|
|
1389
1389
|
const materialArrayLayoutTester = rankWith(4, isObjectArrayWithNesting);
|
|
1390
|
-
var MaterialArrayLayout = withJsonFormsArrayLayoutProps(MaterialArrayLayoutRenderer);
|
|
1390
|
+
var MaterialArrayLayout = withJsonFormsArrayLayoutProps(withTranslateProps(withArrayTranslationProps(MaterialArrayLayoutRenderer)));
|
|
1391
1391
|
|
|
1392
1392
|
const MaterialBooleanCell = (props) => {
|
|
1393
1393
|
return React.createElement(MuiCheckbox, { ...props });
|