@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.
@@ -1,3 +1,5 @@
1
1
  import React from 'react';
2
- import { ArrayLayoutProps } from '@jsonforms/core';
3
- export declare const MaterialArrayLayout: React.MemoExoticComponent<(props: ArrayLayoutProps) => React.JSX.Element>;
2
+ import { ArrayLayoutProps, ArrayTranslations } from '@jsonforms/core';
3
+ export declare const MaterialArrayLayout: React.MemoExoticComponent<(props: ArrayLayoutProps & {
4
+ translations: ArrayTranslations;
5
+ }) => React.JSX.Element>;
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
- import { ArrayLayoutProps, RankedTester } from '@jsonforms/core';
3
- export declare const MaterialArrayLayoutRenderer: ({ visible, addItem, ...props }: ArrayLayoutProps) => React.JSX.Element;
2
+ import { ArrayLayoutProps, ArrayTranslations, RankedTester } from '@jsonforms/core';
3
+ export declare const MaterialArrayLayoutRenderer: ({ visible, addItem, translations, ...props }: ArrayLayoutProps & {
4
+ translations: ArrayTranslations;
5
+ }) => React.JSX.Element;
4
6
  export declare const materialArrayLayoutTester: RankedTester;
5
7
  declare const _default: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
6
8
  export default _default;
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  export declare const UnwrappedLayouts: {
3
3
  ExpandPanelRenderer: import("react").MemoExoticComponent<(props: import("./ExpandPanelRenderer").ExpandPanelProps) => import("react").JSX.Element>;
4
- MaterialArrayLayout: ({ visible, addItem, ...props }: import("@jsonforms/core").ArrayLayoutProps) => import("react").JSX.Element;
4
+ MaterialArrayLayout: ({ visible, addItem, translations, ...props }: import("@jsonforms/core").ArrayLayoutProps & {
5
+ translations: import("@jsonforms/core").ArrayTranslations;
6
+ }) => import("react").JSX.Element;
5
7
  MaterialCategorizationLayout: (props: import("./MaterialCategorizationLayout").MaterialCategorizationLayoutRendererProps) => import("react").JSX.Element;
6
8
  MaterialGroupLayout: ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label, }: import("@jsonforms/core").LayoutProps) => import("react").JSX.Element;
7
9
  MaterialHorizontalLayout: ({ uischema, renderers, cells, schema, path, enabled, visible, }: import("@jsonforms/core").LayoutProps) => import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/material-renderers",
3
- "version": "3.4.0-alpha.3",
3
+ "version": "3.4.0-beta.0",
4
4
  "description": "Material Renderer Set for JSON Forms",
5
5
  "repository": "https://github.com/eclipsesource/jsonforms",
6
6
  "bugs": "https://github.com/eclipsesource/jsonforms/issues",
@@ -73,10 +73,10 @@
73
73
  "peerDependencies": {
74
74
  "@emotion/react": "^11.4.1",
75
75
  "@emotion/styled": "^11.3.0",
76
- "@jsonforms/core": "3.4.0-alpha.3",
77
- "@jsonforms/react": "3.4.0-alpha.3",
78
- "@mui/icons-material": "^5.11.16",
79
- "@mui/material": "^5.13.0",
76
+ "@jsonforms/core": "3.4.0-beta.0",
77
+ "@jsonforms/react": "3.4.0-beta.0",
78
+ "@mui/icons-material": "^5.11.16 || ^6.0.0",
79
+ "@mui/material": "^5.13.0 || ^6.0.0",
80
80
  "@mui/x-date-pickers": "^6.0.0 || ^7.0.0",
81
81
  "react": "^16.12.0 || ^17.0.0 || ^18.0.0"
82
82
  },
@@ -126,8 +126,8 @@
126
126
  "webpack": "^5.78.0",
127
127
  "webpack-cli": "^5.1.4",
128
128
  "webpack-dev-server": "^4.15.1",
129
- "@jsonforms/core": "3.4.0-alpha.3",
130
- "@jsonforms/react": "3.4.0-alpha.3"
129
+ "@jsonforms/core": "3.4.0-beta.0",
130
+ "@jsonforms/react": "3.4.0-beta.0"
131
131
  },
132
132
  "scripts": {
133
133
  "build": "rollup -c rollup.config.js",
@@ -25,6 +25,7 @@
25
25
  import {
26
26
  and,
27
27
  ArrayLayoutProps,
28
+ ArrayTranslations,
28
29
  composePaths,
29
30
  computeLabel,
30
31
  createDefaultValue,
@@ -36,7 +37,9 @@ import {
36
37
  } from '@jsonforms/core';
37
38
  import {
38
39
  JsonFormsDispatch,
40
+ withArrayTranslationProps,
39
41
  withJsonFormsArrayLayoutProps,
42
+ withTranslateProps,
40
43
  } from '@jsonforms/react';
41
44
  import { Grid, List, Typography } from '@mui/material';
42
45
  import map from 'lodash/map';
@@ -63,11 +66,11 @@ export const MaterialListWithDetailRenderer = ({
63
66
  cells,
64
67
  config,
65
68
  rootSchema,
66
- translations,
67
69
  description,
68
70
  disableAdd,
69
71
  disableRemove,
70
- }: ArrayLayoutProps) => {
72
+ translations,
73
+ }: ArrayLayoutProps & { translations: ArrayTranslations }) => {
71
74
  const [selectedIndex, setSelectedIndex] = useState(undefined);
72
75
  const handleRemoveItem = useCallback(
73
76
  (p: string, value: any) => () => {
@@ -101,6 +104,7 @@ export const MaterialListWithDetailRenderer = ({
101
104
  ),
102
105
  [uischemas, schema, uischema.scope, path, uischema, rootSchema]
103
106
  );
107
+
104
108
  const appliedUiSchemaOptions = merge({}, config, uischema.options);
105
109
  const doDisableAdd = disableAdd || appliedUiSchemaOptions.disableAdd;
106
110
  const doDisableRemove = disableRemove || appliedUiSchemaOptions.disableRemove;
@@ -179,4 +183,6 @@ export const materialListWithDetailTester: RankedTester = rankWith(
179
183
  and(uiTypeIs('ListWithDetail'), isObjectArray)
180
184
  );
181
185
 
182
- export default withJsonFormsArrayLayoutProps(MaterialListWithDetailRenderer);
186
+ export default withJsonFormsArrayLayoutProps(
187
+ withTranslateProps(withArrayTranslationProps(MaterialListWithDetailRenderer))
188
+ );
@@ -25,21 +25,28 @@
25
25
  import React, { useCallback, useState } from 'react';
26
26
  import {
27
27
  ArrayLayoutProps,
28
+ ArrayTranslations,
28
29
  RankedTester,
29
30
  isObjectArrayControl,
30
31
  isPrimitiveArrayControl,
31
32
  or,
32
33
  rankWith,
33
34
  } from '@jsonforms/core';
34
- import { withJsonFormsArrayLayoutProps } from '@jsonforms/react';
35
+ import {
36
+ withArrayTranslationProps,
37
+ withJsonFormsArrayLayoutProps,
38
+ withTranslateProps,
39
+ } from '@jsonforms/react';
35
40
  import { MaterialTableControl } from './MaterialTableControl';
36
41
  import { DeleteDialog } from './DeleteDialog';
37
42
 
38
- export const MaterialArrayControlRenderer = (props: ArrayLayoutProps) => {
43
+ export const MaterialArrayControlRenderer = (
44
+ props: ArrayLayoutProps & { translations: ArrayTranslations }
45
+ ) => {
39
46
  const [open, setOpen] = useState(false);
40
47
  const [path, setPath] = useState(undefined);
41
48
  const [rowData, setRowData] = useState(undefined);
42
- const { removeItems, visible } = props;
49
+ const { removeItems, visible, translations } = props;
43
50
 
44
51
  const openDeleteDialog = useCallback(
45
52
  (p: string, rowIndex: number) => {
@@ -63,16 +70,20 @@ export const MaterialArrayControlRenderer = (props: ArrayLayoutProps) => {
63
70
 
64
71
  return (
65
72
  <>
66
- <MaterialTableControl {...props} openDeleteDialog={openDeleteDialog} />
73
+ <MaterialTableControl
74
+ {...props}
75
+ openDeleteDialog={openDeleteDialog}
76
+ translations={translations}
77
+ />
67
78
  <DeleteDialog
68
79
  open={open}
69
80
  onCancel={deleteCancel}
70
81
  onConfirm={deleteConfirm}
71
82
  onClose={deleteClose}
72
- acceptText={props.translations.deleteDialogAccept}
73
- declineText={props.translations.deleteDialogDecline}
74
- title={props.translations.deleteDialogTitle}
75
- message={props.translations.deleteDialogMessage}
83
+ acceptText={translations.deleteDialogAccept}
84
+ declineText={translations.deleteDialogDecline}
85
+ title={translations.deleteDialogTitle}
86
+ message={translations.deleteDialogMessage}
76
87
  />
77
88
  </>
78
89
  );
@@ -83,4 +94,6 @@ export const materialArrayControlTester: RankedTester = rankWith(
83
94
  or(isObjectArrayControl, isPrimitiveArrayControl)
84
95
  );
85
96
 
86
- export default withJsonFormsArrayLayoutProps(MaterialArrayControlRenderer);
97
+ export default withJsonFormsArrayLayoutProps(
98
+ withTranslateProps(withArrayTranslationProps(MaterialArrayControlRenderer))
99
+ );
@@ -22,7 +22,7 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
- import React, { useCallback, useState } from 'react';
25
+ import React, { useCallback, useMemo, useState } from 'react';
26
26
  import isEmpty from 'lodash/isEmpty';
27
27
 
28
28
  import { TabSwitchConfirmDialog } from './TabSwitchConfirmDialog';
@@ -69,13 +69,17 @@ export const MaterialOneOfRenderer = ({
69
69
  const cancel = useCallback(() => {
70
70
  setConfirmDialogOpen(false);
71
71
  }, [setConfirmDialogOpen]);
72
- const oneOfRenderInfos = createCombinatorRenderInfos(
73
- (schema as JsonSchema).oneOf,
74
- rootSchema,
75
- 'oneOf',
76
- uischema,
77
- path,
78
- uischemas
72
+ const oneOfRenderInfos = useMemo(
73
+ () =>
74
+ createCombinatorRenderInfos(
75
+ (schema as JsonSchema).oneOf,
76
+ rootSchema,
77
+ 'oneOf',
78
+ uischema,
79
+ path,
80
+ uischemas
81
+ ),
82
+ [schema, rootSchema, uischema, path, uischemas]
79
83
  );
80
84
 
81
85
  const openNewTab = (newIndex: number) => {
@@ -451,7 +451,8 @@ const TableRows = ({
451
451
  };
452
452
 
453
453
  export class MaterialTableControl extends React.Component<
454
- ArrayLayoutProps & WithDeleteDialogSupport,
454
+ ArrayLayoutProps &
455
+ WithDeleteDialogSupport & { translations: ArrayTranslations },
455
456
  any
456
457
  > {
457
458
  addItem = (path: string, value: any) => this.props.addItem(path, value);
@@ -26,6 +26,7 @@ import range from 'lodash/range';
26
26
  import React, { useState, useCallback } from 'react';
27
27
  import {
28
28
  ArrayLayoutProps,
29
+ ArrayTranslations,
29
30
  composePaths,
30
31
  computeLabel,
31
32
  createDefaultValue,
@@ -35,7 +36,9 @@ import { ArrayLayoutToolbar } from './ArrayToolbar';
35
36
  import ExpandPanelRenderer from './ExpandPanelRenderer';
36
37
  import merge from 'lodash/merge';
37
38
 
38
- const MaterialArrayLayoutComponent = (props: ArrayLayoutProps) => {
39
+ const MaterialArrayLayoutComponent = (
40
+ props: ArrayLayoutProps & { translations: ArrayTranslations }
41
+ ) => {
39
42
  const [expanded, setExpanded] = useState<string | boolean>(false);
40
43
  const innerCreateDefaultValue = useCallback(
41
44
  () => createDefaultValue(props.schema, props.rootSchema),
@@ -65,10 +68,10 @@ const MaterialArrayLayoutComponent = (props: ArrayLayoutProps) => {
65
68
  rootSchema,
66
69
  config,
67
70
  uischemas,
68
- translations,
69
71
  description,
70
72
  disableAdd,
71
73
  disableRemove,
74
+ translations,
72
75
  } = props;
73
76
  const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
74
77
  const doDisableAdd = disableAdd || appliedUiSchemaOptions.disableAdd;
@@ -26,29 +26,39 @@ import React, { useCallback } from 'react';
26
26
 
27
27
  import {
28
28
  ArrayLayoutProps,
29
+ ArrayTranslations,
29
30
  isObjectArrayWithNesting,
30
31
  RankedTester,
31
32
  rankWith,
32
33
  } from '@jsonforms/core';
33
34
  import { MaterialArrayLayout } from './MaterialArrayLayout';
34
- import { withJsonFormsArrayLayoutProps } from '@jsonforms/react';
35
+ import {
36
+ withArrayTranslationProps,
37
+ withJsonFormsArrayLayoutProps,
38
+ withTranslateProps,
39
+ } from '@jsonforms/react';
35
40
 
36
41
  export const MaterialArrayLayoutRenderer = ({
37
42
  visible,
38
43
  addItem,
44
+ translations,
39
45
  ...props
40
- }: ArrayLayoutProps) => {
46
+ }: ArrayLayoutProps & { translations: ArrayTranslations }) => {
41
47
  const addItemCb = useCallback(
42
48
  (p: string, value: any) => addItem(p, value),
43
49
  [addItem]
44
50
  );
45
-
46
51
  if (!visible) {
47
52
  return null;
48
53
  }
49
54
 
50
55
  return (
51
- <MaterialArrayLayout visible={visible} addItem={addItemCb} {...props} />
56
+ <MaterialArrayLayout
57
+ translations={translations}
58
+ visible={visible}
59
+ addItem={addItemCb}
60
+ {...props}
61
+ />
52
62
  );
53
63
  };
54
64
 
@@ -56,4 +66,6 @@ export const materialArrayLayoutTester: RankedTester = rankWith(
56
66
  4,
57
67
  isObjectArrayWithNesting
58
68
  );
59
- export default withJsonFormsArrayLayoutProps(MaterialArrayLayoutRenderer);
69
+ export default withJsonFormsArrayLayoutProps(
70
+ withTranslateProps(withArrayTranslationProps(MaterialArrayLayoutRenderer))
71
+ );