@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,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ArrayTranslations } from '@jsonforms/core';
|
|
2
3
|
export interface ArrayLayoutToolbarProps {
|
|
3
4
|
label: string;
|
|
4
5
|
errors: string;
|
|
5
6
|
path: string;
|
|
6
7
|
addItem(path: string, data: any): () => void;
|
|
7
8
|
createDefault(): any;
|
|
9
|
+
translations: ArrayTranslations;
|
|
8
10
|
}
|
|
9
|
-
export declare const ArrayLayoutToolbar: React.
|
|
11
|
+
export declare const ArrayLayoutToolbar: React.NamedExoticComponent<ArrayLayoutToolbarProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ComponentType, Dispatch, ReducerAction } from 'react';
|
|
2
|
-
import { ControlElement, JsonFormsRendererRegistryEntry, JsonSchema, JsonFormsCellRendererRegistryEntry, JsonFormsUISchemaRegistryEntry } from '@jsonforms/core';
|
|
2
|
+
import { ControlElement, JsonFormsRendererRegistryEntry, JsonSchema, JsonFormsCellRendererRegistryEntry, JsonFormsUISchemaRegistryEntry, ArrayTranslations } from '@jsonforms/core';
|
|
3
3
|
interface OwnPropsOfExpandPanel {
|
|
4
4
|
enabled: boolean;
|
|
5
5
|
index: number;
|
|
@@ -16,6 +16,7 @@ interface OwnPropsOfExpandPanel {
|
|
|
16
16
|
config: any;
|
|
17
17
|
childLabelProp?: string;
|
|
18
18
|
handleExpansion(panel: string): (event: any, expanded: boolean) => void;
|
|
19
|
+
translations: ArrayTranslations;
|
|
19
20
|
}
|
|
20
21
|
interface StatePropsOfExpandPanel extends OwnPropsOfExpandPanel {
|
|
21
22
|
childLabel: string;
|
|
@@ -33,6 +34,7 @@ export interface DispatchPropsOfExpandPanel {
|
|
|
33
34
|
}
|
|
34
35
|
export interface ExpandPanelProps extends StatePropsOfExpandPanel, DispatchPropsOfExpandPanel {
|
|
35
36
|
}
|
|
37
|
+
export declare const ExpandPanelRenderer: React.MemoExoticComponent<(props: ExpandPanelProps) => JSX.Element>;
|
|
36
38
|
/**
|
|
37
39
|
* Maps state to dispatch properties of an expand pandel control.
|
|
38
40
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LayoutProps, RankedTester } from '@jsonforms/core';
|
|
3
3
|
export declare const groupTester: RankedTester;
|
|
4
|
-
export declare const MaterializedGroupLayoutRenderer: ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label }: LayoutProps) => JSX.Element;
|
|
4
|
+
export declare const MaterializedGroupLayoutRenderer: ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label, }: LayoutProps) => JSX.Element;
|
|
5
5
|
declare const _default: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
|
|
6
6
|
export default _default;
|
|
7
7
|
export declare const materialGroupTester: RankedTester;
|
|
@@ -5,6 +5,6 @@ import { LayoutProps, RankedTester } from '@jsonforms/core';
|
|
|
5
5
|
* @type {RankedTester}
|
|
6
6
|
*/
|
|
7
7
|
export declare const materialHorizontalLayoutTester: RankedTester;
|
|
8
|
-
export declare const MaterialHorizontalLayoutRenderer: ({ uischema, renderers, cells, schema, path, enabled, visible }: LayoutProps) => JSX.Element;
|
|
8
|
+
export declare const MaterialHorizontalLayoutRenderer: ({ uischema, renderers, cells, schema, path, enabled, visible, }: LayoutProps) => JSX.Element;
|
|
9
9
|
declare const _default: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
|
|
10
10
|
export default _default;
|
|
@@ -5,6 +5,6 @@ import { LayoutProps, RankedTester } from '@jsonforms/core';
|
|
|
5
5
|
* @type {RankedTester}
|
|
6
6
|
*/
|
|
7
7
|
export declare const materialVerticalLayoutTester: RankedTester;
|
|
8
|
-
export declare const MaterialVerticalLayoutRenderer: ({ uischema, schema, path, enabled, visible, renderers, cells }: LayoutProps) => JSX.Element;
|
|
8
|
+
export declare const MaterialVerticalLayoutRenderer: ({ uischema, schema, path, enabled, visible, renderers, cells, }: LayoutProps) => JSX.Element;
|
|
9
9
|
declare const _default: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
|
|
10
10
|
export default _default;
|
package/lib/layouts/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import ExpandPanelRenderer, { ctxDispatchToExpandPanelProps, withContextToExpandPanelProps, withJsonFormsExpandPanelProps } from './ExpandPanelRenderer';
|
|
1
2
|
import MaterialGroupLayout, { materialGroupTester } from './MaterialGroupLayout';
|
|
2
3
|
import MaterialHorizontalLayout, { materialHorizontalLayoutTester } from './MaterialHorizontalLayout';
|
|
3
4
|
import MaterialVerticalLayout, { materialVerticalLayoutTester } from './MaterialVerticalLayout';
|
|
4
5
|
import MaterialCategorizationLayout, { materialCategorizationTester } from './MaterialCategorizationLayout';
|
|
5
6
|
import MaterialArrayLayout, { materialArrayLayoutTester } from './MaterialArrayLayoutRenderer';
|
|
6
|
-
export {
|
|
7
|
+
export { ExpandPanelRenderer, ctxDispatchToExpandPanelProps, withContextToExpandPanelProps, withJsonFormsExpandPanelProps, MaterialArrayLayout, materialArrayLayoutTester, MaterialCategorizationLayout, materialCategorizationTester, MaterialGroupLayout, materialGroupTester, MaterialHorizontalLayout, materialHorizontalLayoutTester, MaterialVerticalLayout, materialVerticalLayoutTester, };
|
|
8
|
+
export * from './ArrayToolbar';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const UnwrappedLayouts: {
|
|
3
|
+
ExpandPanelRenderer: import("react").MemoExoticComponent<(props: import("./ExpandPanelRenderer").ExpandPanelProps) => JSX.Element>;
|
|
4
|
+
MaterialArrayLayout: ({ visible, addItem, ...props }: import("@jsonforms/core").ArrayLayoutProps) => JSX.Element;
|
|
5
|
+
MaterialCategorizationLayout: (props: import("./MaterialCategorizationLayout").MaterialCategorizationLayoutRendererProps) => JSX.Element;
|
|
6
|
+
MaterialGroupLayout: ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label, }: import("@jsonforms/core").LayoutProps) => JSX.Element;
|
|
7
|
+
MaterialHorizontalLayout: ({ uischema, renderers, cells, schema, path, enabled, visible, }: import("@jsonforms/core").LayoutProps) => JSX.Element;
|
|
8
|
+
MaterialVerticalLayout: ({ uischema, schema, path, enabled, visible, renderers, cells, }: import("@jsonforms/core").LayoutProps) => JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export * from './ArrayToolbar';
|
|
@@ -4,5 +4,5 @@ import { InputProps } from '@mui/material';
|
|
|
4
4
|
interface MuiCheckboxInputProps {
|
|
5
5
|
inputProps?: InputProps['inputProps'];
|
|
6
6
|
}
|
|
7
|
-
export declare const MuiCheckbox: React.
|
|
7
|
+
export declare const MuiCheckbox: React.NamedExoticComponent<CellProps & WithClassname & MuiCheckboxInputProps>;
|
|
8
8
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CellProps, WithClassname } from '@jsonforms/core';
|
|
3
|
-
export declare const MuiInputInteger: React.
|
|
3
|
+
export declare const MuiInputInteger: React.NamedExoticComponent<CellProps & WithClassname>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CellProps, WithClassname } from '@jsonforms/core';
|
|
3
|
-
export declare const MuiInputNumber: React.
|
|
3
|
+
export declare const MuiInputNumber: React.NamedExoticComponent<CellProps & WithClassname>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CellProps, Formatted, WithClassname } from '@jsonforms/core';
|
|
3
|
-
export declare const MuiInputNumberFormat: React.
|
|
3
|
+
export declare const MuiInputNumberFormat: React.NamedExoticComponent<CellProps & WithClassname & Formatted<number>>;
|
|
@@ -5,5 +5,5 @@ interface MuiTextInputProps {
|
|
|
5
5
|
muiInputProps?: InputProps['inputProps'];
|
|
6
6
|
inputComponent?: InputProps['inputComponent'];
|
|
7
7
|
}
|
|
8
|
-
export declare const MuiInputText: React.
|
|
8
|
+
export declare const MuiInputText: React.NamedExoticComponent<CellProps & WithClassname & MuiTextInputProps>;
|
|
9
9
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CellProps, WithClassname } from '@jsonforms/core';
|
|
3
|
-
export declare const MuiInputTime: React.
|
|
3
|
+
export declare const MuiInputTime: React.NamedExoticComponent<CellProps & WithClassname>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EnumCellProps, WithClassname } from '@jsonforms/core';
|
|
3
3
|
import { TranslateProps } from '@jsonforms/react';
|
|
4
|
-
export declare const MuiSelect: React.
|
|
4
|
+
export declare const MuiSelect: React.NamedExoticComponent<EnumCellProps & WithClassname & TranslateProps>;
|
|
@@ -4,5 +4,5 @@ import { InputProps } from '@mui/material';
|
|
|
4
4
|
interface MuiToggleInputProps {
|
|
5
5
|
inputProps?: InputProps['inputProps'];
|
|
6
6
|
}
|
|
7
|
-
export declare const MuiToggle: React.
|
|
7
|
+
export declare const MuiToggle: React.NamedExoticComponent<CellProps & WithClassname & MuiToggleInputProps>;
|
|
8
8
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * from './MuiAutocomplete';
|
|
1
2
|
export * from './MuiCheckbox';
|
|
2
|
-
export * from './MuiSelect';
|
|
3
3
|
export * from './MuiInputInteger';
|
|
4
4
|
export * from './MuiInputNumber';
|
|
5
5
|
export * from './MuiInputNumberFormat';
|
|
6
6
|
export * from './MuiInputText';
|
|
7
7
|
export * from './MuiInputTime';
|
|
8
|
+
export * from './MuiSelect';
|
|
9
|
+
export * from './MuiToggle';
|
package/lib/util/layout.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentType } from 'react';
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
3
2
|
import Ajv from 'ajv';
|
|
4
3
|
import type { UISchemaElement } from '@jsonforms/core';
|
|
5
4
|
import { JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonSchema, OwnPropsOfRenderer } from '@jsonforms/core';
|
|
@@ -8,7 +7,7 @@ export interface MaterialLayoutRendererProps extends OwnPropsOfRenderer {
|
|
|
8
7
|
elements: UISchemaElement[];
|
|
9
8
|
direction: 'row' | 'column';
|
|
10
9
|
}
|
|
11
|
-
export declare const MaterialLayoutRenderer: React.MemoExoticComponent<({ visible, elements, schema, path, enabled, direction, renderers, cells }: MaterialLayoutRendererProps) => JSX.Element>;
|
|
10
|
+
export declare const MaterialLayoutRenderer: React.MemoExoticComponent<({ visible, elements, schema, path, enabled, direction, renderers, cells, }: MaterialLayoutRendererProps) => JSX.Element>;
|
|
12
11
|
export interface AjvProps {
|
|
13
12
|
ajv: Ajv;
|
|
14
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/material-renderers",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
3
|
+
"version": "3.1.0-alpha.3",
|
|
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",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"build:examples-app": "rollup -c rollup.example.config.js",
|
|
41
41
|
"dev": "webpack --config webpack/webpack.dev.js && webpack-dev-server --config webpack/webpack.dev.js --env=dev --inline",
|
|
42
42
|
"clean": "rimraf lib coverage dist .nyc_output example/dist 2> /dev/null",
|
|
43
|
-
"lint": "
|
|
43
|
+
"lint": "eslint .",
|
|
44
|
+
"lint:fix": "eslint --fix .",
|
|
44
45
|
"test": "jest --no-cache",
|
|
45
46
|
"test-cov": "jest --no-cache --coverage",
|
|
46
47
|
"report": "nyc report --reporter=html",
|
|
@@ -81,8 +82,8 @@
|
|
|
81
82
|
"peerDependencies": {
|
|
82
83
|
"@emotion/react": "^11.4.1",
|
|
83
84
|
"@emotion/styled": "^11.3.0",
|
|
84
|
-
"@jsonforms/core": "3.1.0-alpha.
|
|
85
|
-
"@jsonforms/react": "3.1.0-alpha.
|
|
85
|
+
"@jsonforms/core": "3.1.0-alpha.3",
|
|
86
|
+
"@jsonforms/react": "3.1.0-alpha.3",
|
|
86
87
|
"@mui/icons-material": "~5.2.2",
|
|
87
88
|
"@mui/material": "~5.2.2",
|
|
88
89
|
"@mui/x-date-pickers": "^5.0.0-beta.5"
|
|
@@ -90,8 +91,8 @@
|
|
|
90
91
|
"devDependencies": {
|
|
91
92
|
"@emotion/react": "^11.5.0",
|
|
92
93
|
"@emotion/styled": "^11.3.0",
|
|
93
|
-
"@jsonforms/core": "^3.1.0-alpha.
|
|
94
|
-
"@jsonforms/react": "^3.1.0-alpha.
|
|
94
|
+
"@jsonforms/core": "^3.1.0-alpha.3",
|
|
95
|
+
"@jsonforms/react": "^3.1.0-alpha.3",
|
|
95
96
|
"@mui/icons-material": "~5.2.0",
|
|
96
97
|
"@mui/material": "~5.2.2",
|
|
97
98
|
"@mui/x-date-pickers": "^5.0.0-beta.5",
|
|
@@ -101,11 +102,19 @@
|
|
|
101
102
|
"@rollup/plugin-replace": "^5.0.1",
|
|
102
103
|
"@types/enzyme": "^3.10.3",
|
|
103
104
|
"@types/react-dom": "^17.0.9",
|
|
105
|
+
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
106
|
+
"@typescript-eslint/parser": "^5.54.1",
|
|
104
107
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
|
|
105
108
|
"copy-webpack-plugin": "^5.0.5",
|
|
106
109
|
"enzyme": "^3.10.0",
|
|
110
|
+
"eslint": "^7.32.0",
|
|
111
|
+
"eslint-config-prettier": "^8.7.0",
|
|
112
|
+
"eslint-plugin-import": "^2.27.5",
|
|
113
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
114
|
+
"eslint-plugin-react": "^7.32.2",
|
|
107
115
|
"jest": "^26.6.3",
|
|
108
116
|
"nyc": "^15.1.0",
|
|
117
|
+
"prettier": "^2.8.4",
|
|
109
118
|
"react-dom": "^17.0.2",
|
|
110
119
|
"rimraf": "^3.0.2",
|
|
111
120
|
"rollup": "^2.78.0",
|
|
@@ -117,13 +126,11 @@
|
|
|
117
126
|
"source-map-loader": "^0.2.4",
|
|
118
127
|
"ts-jest": "^26.4.4",
|
|
119
128
|
"ts-loader": "^6.2.1",
|
|
120
|
-
"tslint": "^5.20.1",
|
|
121
|
-
"tslint-loader": "^3.5.4",
|
|
122
129
|
"typedoc": "^0.19.2",
|
|
123
130
|
"typescript": "4.2.3",
|
|
124
131
|
"webpack": "^4.41.2",
|
|
125
132
|
"webpack-cli": "^3.2.1",
|
|
126
133
|
"webpack-dev-server": "^3.9.0"
|
|
127
134
|
},
|
|
128
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "f8ea38f9f9dd3d46cbfde269ec43e9eb1632e428"
|
|
129
136
|
}
|
|
@@ -25,34 +25,42 @@
|
|
|
25
25
|
import type { StatePropsOfMasterItem } from '@jsonforms/core';
|
|
26
26
|
import { withJsonFormsMasterListItemProps } from '@jsonforms/react';
|
|
27
27
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
Avatar,
|
|
29
|
+
IconButton,
|
|
30
|
+
ListItem,
|
|
31
|
+
ListItemAvatar,
|
|
32
|
+
ListItemSecondaryAction,
|
|
33
|
+
ListItemText,
|
|
34
34
|
} from '@mui/material';
|
|
35
35
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
36
36
|
import React from 'react';
|
|
37
37
|
|
|
38
|
-
const ListWithDetailMasterItem = ({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
export const ListWithDetailMasterItem = ({
|
|
39
|
+
index,
|
|
40
|
+
childLabel,
|
|
41
|
+
selected,
|
|
42
|
+
handleSelect,
|
|
43
|
+
removeItem,
|
|
44
|
+
path,
|
|
45
|
+
translations,
|
|
46
|
+
}: StatePropsOfMasterItem) => {
|
|
47
|
+
return (
|
|
48
|
+
<ListItem button selected={selected} onClick={handleSelect(index)}>
|
|
49
|
+
<ListItemAvatar>
|
|
50
|
+
<Avatar aria-label='Index'>{index + 1}</Avatar>
|
|
51
|
+
</ListItemAvatar>
|
|
52
|
+
<ListItemText primary={childLabel} />
|
|
53
|
+
<ListItemSecondaryAction>
|
|
54
|
+
<IconButton
|
|
55
|
+
aria-label={translations.removeAriaLabel}
|
|
56
|
+
onClick={removeItem(path, index)}
|
|
57
|
+
size='large'
|
|
44
58
|
>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<IconButton aria-label='Delete' onClick={removeItem(path, index)} size='large'>
|
|
51
|
-
<DeleteIcon />
|
|
52
|
-
</IconButton>
|
|
53
|
-
</ListItemSecondaryAction>
|
|
54
|
-
</ListItem>
|
|
55
|
-
);
|
|
59
|
+
<DeleteIcon />
|
|
60
|
+
</IconButton>
|
|
61
|
+
</ListItemSecondaryAction>
|
|
62
|
+
</ListItem>
|
|
63
|
+
);
|
|
56
64
|
};
|
|
57
65
|
|
|
58
66
|
export default withJsonFormsMasterListItemProps(ListWithDetailMasterItem);
|
|
@@ -23,33 +23,26 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import React from 'react';
|
|
26
|
-
import {
|
|
27
|
-
LabelProps,
|
|
28
|
-
RankedTester,
|
|
29
|
-
rankWith,
|
|
30
|
-
uiTypeIs,
|
|
31
|
-
} from '@jsonforms/core';
|
|
26
|
+
import { LabelProps, RankedTester, rankWith, uiTypeIs } from '@jsonforms/core';
|
|
32
27
|
import { withJsonFormsLabelProps } from '@jsonforms/react';
|
|
33
|
-
import {
|
|
34
|
-
Hidden,
|
|
35
|
-
Typography
|
|
36
|
-
} from '@mui/material';
|
|
28
|
+
import { Hidden, Typography } from '@mui/material';
|
|
37
29
|
|
|
38
30
|
/**
|
|
39
31
|
* Default tester for a label.
|
|
40
32
|
* @type {RankedTester}
|
|
41
33
|
*/
|
|
42
|
-
export const materialLabelRendererTester: RankedTester = rankWith(
|
|
34
|
+
export const materialLabelRendererTester: RankedTester = rankWith(
|
|
35
|
+
1,
|
|
36
|
+
uiTypeIs('Label')
|
|
37
|
+
);
|
|
43
38
|
|
|
44
39
|
/**
|
|
45
40
|
* Default renderer for a label.
|
|
46
41
|
*/
|
|
47
|
-
export const MaterialLabelRenderer = ({ text, visible }: LabelProps
|
|
42
|
+
export const MaterialLabelRenderer = ({ text, visible }: LabelProps) => {
|
|
48
43
|
return (
|
|
49
44
|
<Hidden xsUp={!visible}>
|
|
50
|
-
<Typography variant='h6'>
|
|
51
|
-
{text}
|
|
52
|
-
</Typography>
|
|
45
|
+
<Typography variant='h6'>{text}</Typography>
|
|
53
46
|
</Hidden>
|
|
54
47
|
);
|
|
55
48
|
};
|
|
@@ -32,11 +32,11 @@ import {
|
|
|
32
32
|
isObjectArray,
|
|
33
33
|
RankedTester,
|
|
34
34
|
rankWith,
|
|
35
|
-
uiTypeIs
|
|
35
|
+
uiTypeIs,
|
|
36
36
|
} from '@jsonforms/core';
|
|
37
37
|
import {
|
|
38
38
|
JsonFormsDispatch,
|
|
39
|
-
withJsonFormsArrayLayoutProps
|
|
39
|
+
withJsonFormsArrayLayoutProps,
|
|
40
40
|
} from '@jsonforms/react';
|
|
41
41
|
import { Grid, Hidden, List, Typography } from '@mui/material';
|
|
42
42
|
import map from 'lodash/map';
|
|
@@ -61,7 +61,8 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
61
61
|
renderers,
|
|
62
62
|
cells,
|
|
63
63
|
config,
|
|
64
|
-
rootSchema
|
|
64
|
+
rootSchema,
|
|
65
|
+
translations,
|
|
65
66
|
}: ArrayLayoutProps) => {
|
|
66
67
|
const [selectedIndex, setSelectedIndex] = useState(undefined);
|
|
67
68
|
const handleRemoveItem = useCallback(
|
|
@@ -105,6 +106,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
105
106
|
return (
|
|
106
107
|
<Hidden xsUp={!visible}>
|
|
107
108
|
<ArrayLayoutToolbar
|
|
109
|
+
translations={translations}
|
|
108
110
|
label={computeLabel(
|
|
109
111
|
label,
|
|
110
112
|
required,
|
|
@@ -119,7 +121,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
119
121
|
<Grid item xs={3}>
|
|
120
122
|
<List>
|
|
121
123
|
{data > 0 ? (
|
|
122
|
-
map(range(data), index => (
|
|
124
|
+
map(range(data), (index) => (
|
|
123
125
|
<ListWithDetailMasterItem
|
|
124
126
|
index={index}
|
|
125
127
|
path={path}
|
|
@@ -128,6 +130,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
128
130
|
removeItem={handleRemoveItem}
|
|
129
131
|
selected={selectedIndex === index}
|
|
130
132
|
key={index}
|
|
133
|
+
translations={translations}
|
|
131
134
|
/>
|
|
132
135
|
))
|
|
133
136
|
) : (
|
|
@@ -146,7 +149,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
146
149
|
path={composePaths(path, `${selectedIndex}`)}
|
|
147
150
|
/>
|
|
148
151
|
) : (
|
|
149
|
-
<Typography variant='h6'>
|
|
152
|
+
<Typography variant='h6'>{translations.noSelection}</Typography>
|
|
150
153
|
)}
|
|
151
154
|
</Grid>
|
|
152
155
|
</Grid>
|
package/src/additional/index.ts
CHANGED
|
@@ -23,10 +23,18 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import MaterialLabelRenderer, {
|
|
26
|
-
materialLabelRendererTester
|
|
26
|
+
materialLabelRendererTester,
|
|
27
27
|
} from './MaterialLabelRenderer';
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
import MaterialListWithDetailRenderer, {
|
|
30
|
-
materialListWithDetailTester
|
|
30
|
+
materialListWithDetailTester,
|
|
31
31
|
} from './MaterialListWithDetailRenderer';
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
MaterialLabelRenderer,
|
|
35
|
+
materialLabelRendererTester,
|
|
36
|
+
MaterialListWithDetailRenderer,
|
|
37
|
+
materialListWithDetailTester,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export * from './ListWithDetailMasterItem';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import { MaterialLabelRenderer } from './MaterialLabelRenderer';
|
|
26
|
+
|
|
27
|
+
import { MaterialListWithDetailRenderer } from './MaterialListWithDetailRenderer';
|
|
28
|
+
|
|
29
|
+
export const UnwrappedAdditional = {
|
|
30
|
+
MaterialLabelRenderer,
|
|
31
|
+
MaterialListWithDetailRenderer,
|
|
32
|
+
};
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
optionIs,
|
|
31
31
|
RankedTester,
|
|
32
32
|
rankWith,
|
|
33
|
-
WithClassname
|
|
33
|
+
WithClassname,
|
|
34
34
|
} from '@jsonforms/core';
|
|
35
35
|
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
36
36
|
import { MuiToggle } from '../mui-controls/MuiToggle';
|
|
@@ -42,6 +42,6 @@ export const MaterialBooleanToggleCell = (props: CellProps & WithClassname) => {
|
|
|
42
42
|
export const materialBooleanToggleCellTester: RankedTester = rankWith(
|
|
43
43
|
3,
|
|
44
44
|
and(isBooleanControl, optionIs('toggle', true))
|
|
45
|
-
)
|
|
45
|
+
);
|
|
46
46
|
|
|
47
47
|
export default withJsonFormsCellProps(MaterialBooleanToggleCell);
|
|
@@ -28,23 +28,15 @@ import {
|
|
|
28
28
|
isDateControl,
|
|
29
29
|
RankedTester,
|
|
30
30
|
rankWith,
|
|
31
|
-
WithClassname
|
|
31
|
+
WithClassname,
|
|
32
32
|
} from '@jsonforms/core';
|
|
33
33
|
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
34
34
|
import Input from '@mui/material/Input';
|
|
35
35
|
import merge from 'lodash/merge';
|
|
36
36
|
|
|
37
37
|
export const MaterialDateCell = (props: CellProps & WithClassname) => {
|
|
38
|
-
const {
|
|
39
|
-
|
|
40
|
-
className,
|
|
41
|
-
id,
|
|
42
|
-
enabled,
|
|
43
|
-
uischema,
|
|
44
|
-
path,
|
|
45
|
-
handleChange,
|
|
46
|
-
config
|
|
47
|
-
} = props;
|
|
38
|
+
const { data, className, id, enabled, uischema, path, handleChange, config } =
|
|
39
|
+
props;
|
|
48
40
|
|
|
49
41
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
50
42
|
|
|
@@ -52,7 +44,7 @@ export const MaterialDateCell = (props: CellProps & WithClassname) => {
|
|
|
52
44
|
<Input
|
|
53
45
|
type='date'
|
|
54
46
|
value={data || ''}
|
|
55
|
-
onChange={ev => handleChange(path, ev.target.value)}
|
|
47
|
+
onChange={(ev) => handleChange(path, ev.target.value)}
|
|
56
48
|
className={className}
|
|
57
49
|
id={id}
|
|
58
50
|
disabled={!enabled}
|
|
@@ -28,14 +28,18 @@ import {
|
|
|
28
28
|
isEnumControl,
|
|
29
29
|
RankedTester,
|
|
30
30
|
rankWith,
|
|
31
|
-
WithClassname
|
|
31
|
+
WithClassname,
|
|
32
32
|
} from '@jsonforms/core';
|
|
33
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
TranslateProps,
|
|
35
|
+
withJsonFormsEnumCellProps,
|
|
36
|
+
withTranslateProps,
|
|
37
|
+
} from '@jsonforms/react';
|
|
34
38
|
import { MuiSelect } from '../mui-controls/MuiSelect';
|
|
35
39
|
|
|
36
|
-
export const MaterialEnumCell = (
|
|
37
|
-
|
|
38
|
-
)
|
|
40
|
+
export const MaterialEnumCell = (
|
|
41
|
+
props: EnumCellProps & WithClassname & TranslateProps
|
|
42
|
+
) => <MuiSelect {...props} />;
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* Default tester for enum controls.
|
|
@@ -44,4 +48,7 @@ export const MaterialEnumCell = (props: EnumCellProps & WithClassname & Translat
|
|
|
44
48
|
export const materialEnumCellTester: RankedTester = rankWith(2, isEnumControl);
|
|
45
49
|
|
|
46
50
|
// HOC order can be reversed with https://github.com/eclipsesource/jsonforms/issues/1987
|
|
47
|
-
export default withJsonFormsEnumCellProps(
|
|
51
|
+
export default withJsonFormsEnumCellProps(
|
|
52
|
+
withTranslateProps(React.memo(MaterialEnumCell)),
|
|
53
|
+
false
|
|
54
|
+
);
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
isNumberFormatControl,
|
|
30
30
|
RankedTester,
|
|
31
31
|
rankWith,
|
|
32
|
-
WithClassname
|
|
32
|
+
WithClassname,
|
|
33
33
|
} from '@jsonforms/core';
|
|
34
34
|
import { withJsonFormsCellProps } from '@jsonforms/react';
|
|
35
35
|
import { MuiInputNumberFormat } from '../mui-controls/MuiInputNumberFormat';
|
|
@@ -28,19 +28,29 @@ import {
|
|
|
28
28
|
isOneOfEnumControl,
|
|
29
29
|
RankedTester,
|
|
30
30
|
rankWith,
|
|
31
|
-
WithClassname
|
|
31
|
+
WithClassname,
|
|
32
32
|
} from '@jsonforms/core';
|
|
33
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
TranslateProps,
|
|
35
|
+
withJsonFormsOneOfEnumCellProps,
|
|
36
|
+
withTranslateProps,
|
|
37
|
+
} from '@jsonforms/react';
|
|
34
38
|
import { MuiSelect } from '../mui-controls/MuiSelect';
|
|
35
39
|
|
|
36
|
-
export const MaterialOneOfEnumCell = (
|
|
37
|
-
|
|
38
|
-
)
|
|
40
|
+
export const MaterialOneOfEnumCell = (
|
|
41
|
+
props: EnumCellProps & WithClassname & TranslateProps
|
|
42
|
+
) => <MuiSelect {...props} />;
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* Default tester for oneOf enum controls.
|
|
42
46
|
* @type {RankedTester}
|
|
43
47
|
*/
|
|
44
|
-
export const materialOneOfEnumCellTester: RankedTester = rankWith(
|
|
48
|
+
export const materialOneOfEnumCellTester: RankedTester = rankWith(
|
|
49
|
+
2,
|
|
50
|
+
isOneOfEnumControl
|
|
51
|
+
);
|
|
45
52
|
|
|
46
|
-
export default withJsonFormsOneOfEnumCellProps(
|
|
53
|
+
export default withJsonFormsOneOfEnumCellProps(
|
|
54
|
+
withTranslateProps(React.memo(MaterialOneOfEnumCell)),
|
|
55
|
+
false
|
|
56
|
+
);
|