@jsonforms/material-renderers 3.2.0-alpha.2 → 3.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/material-renderers",
3
- "version": "3.2.0-alpha.2",
3
+ "version": "3.2.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",
@@ -85,8 +85,8 @@
85
85
  "peerDependencies": {
86
86
  "@emotion/react": "^11.4.1",
87
87
  "@emotion/styled": "^11.3.0",
88
- "@jsonforms/core": "3.2.0-alpha.2",
89
- "@jsonforms/react": "3.2.0-alpha.2",
88
+ "@jsonforms/core": "3.2.0-alpha.3",
89
+ "@jsonforms/react": "3.2.0-alpha.3",
90
90
  "@mui/icons-material": "^5.11.16",
91
91
  "@mui/material": "~5.13.0",
92
92
  "@mui/x-date-pickers": "^6.0.0",
@@ -95,8 +95,8 @@
95
95
  "devDependencies": {
96
96
  "@emotion/react": "^11.5.0",
97
97
  "@emotion/styled": "^11.3.0",
98
- "@jsonforms/core": "3.2.0-alpha.2",
99
- "@jsonforms/react": "3.2.0-alpha.2",
98
+ "@jsonforms/core": "3.2.0-alpha.3",
99
+ "@jsonforms/react": "3.2.0-alpha.3",
100
100
  "@mui/icons-material": "~5.11.16",
101
101
  "@mui/material": "~5.13.0",
102
102
  "@mui/x-date-pickers": "^6.5.0",
@@ -141,5 +141,5 @@
141
141
  "webpack-cli": "^3.2.1",
142
142
  "webpack-dev-server": "^3.9.0"
143
143
  },
144
- "gitHead": "f922f48cb7548cefd8f1acd939a9afbd14b36f9b"
144
+ "gitHead": "77624c6ab6c0f3db98abe3175547bbd51f7510bb"
145
145
  }
@@ -82,7 +82,7 @@ export const MaterialListWithDetailRenderer = ({
82
82
  [setSelectedIndex]
83
83
  );
84
84
  const handleCreateDefaultValue = useCallback(
85
- () => createDefaultValue(schema),
85
+ () => createDefaultValue(schema, rootSchema),
86
86
  [createDefaultValue]
87
87
  );
88
88
  const foundUISchema = useMemo(
@@ -36,6 +36,7 @@ interface CombinatorPropertiesProps {
36
36
  schema: JsonSchema;
37
37
  combinatorKeyword: 'oneOf' | 'anyOf';
38
38
  path: string;
39
+ rootSchema: JsonSchema;
39
40
  }
40
41
 
41
42
  export class CombinatorProperties extends React.Component<
@@ -45,7 +46,7 @@ export class CombinatorProperties extends React.Component<
45
46
  {}
46
47
  > {
47
48
  render() {
48
- const { schema, combinatorKeyword, path } = this.props;
49
+ const { schema, combinatorKeyword, path, rootSchema } = this.props;
49
50
 
50
51
  const otherProps: JsonSchema = omit(
51
52
  schema,
@@ -53,7 +54,9 @@ export class CombinatorProperties extends React.Component<
53
54
  ) as JsonSchema;
54
55
  const foundUISchema: UISchemaElement = Generate.uiSchema(
55
56
  otherProps,
56
- 'VerticalLayout'
57
+ 'VerticalLayout',
58
+ undefined,
59
+ rootSchema
57
60
  );
58
61
  let isLayoutWithElements = false;
59
62
  if (foundUISchema !== null && isLayout(foundUISchema)) {
@@ -67,7 +67,10 @@ export const MaterialAnyOfRenderer = ({
67
67
  if (
68
68
  isEmpty(data) ||
69
69
  typeof data ===
70
- typeof createDefaultValue(anyOfRenderInfos[newIndex].schema)
70
+ typeof createDefaultValue(
71
+ anyOfRenderInfos[newIndex].schema,
72
+ rootSchema
73
+ )
71
74
  ) {
72
75
  setSelectedAnyOf(newIndex);
73
76
  } else {
@@ -79,7 +82,10 @@ export const MaterialAnyOfRenderer = ({
79
82
  );
80
83
 
81
84
  const openNewTab = (newIndex: number) => {
82
- handleChange(path, createDefaultValue(anyOfRenderInfos[newIndex].schema));
85
+ handleChange(
86
+ path,
87
+ createDefaultValue(anyOfRenderInfos[newIndex].schema, rootSchema)
88
+ );
83
89
  setSelectedAnyOf(newIndex);
84
90
  };
85
91
 
@@ -104,6 +110,7 @@ export const MaterialAnyOfRenderer = ({
104
110
  schema={schema}
105
111
  combinatorKeyword={anyOf}
106
112
  path={path}
113
+ rootSchema={rootSchema}
107
114
  />
108
115
  <Tabs value={selectedAnyOf} onChange={handleTabChange}>
109
116
  {anyOfRenderInfos.map((anyOfRenderInfo) => (
@@ -56,8 +56,11 @@ export const MaterialObjectRenderer = ({
56
56
  path,
57
57
  () =>
58
58
  isEmpty(path)
59
- ? Generate.uiSchema(schema, 'VerticalLayout')
60
- : { ...Generate.uiSchema(schema, 'Group'), label },
59
+ ? Generate.uiSchema(schema, 'VerticalLayout', undefined, rootSchema)
60
+ : {
61
+ ...Generate.uiSchema(schema, 'Group', undefined, rootSchema),
62
+ label,
63
+ },
61
64
  uischema,
62
65
  rootSchema
63
66
  ),
@@ -79,7 +79,10 @@ export const MaterialOneOfRenderer = ({
79
79
  );
80
80
 
81
81
  const openNewTab = (newIndex: number) => {
82
- handleChange(path, createDefaultValue(oneOfRenderInfos[newIndex].schema));
82
+ handleChange(
83
+ path,
84
+ createDefaultValue(oneOfRenderInfos[newIndex].schema, rootSchema)
85
+ );
83
86
  setSelectedIndex(newIndex);
84
87
  };
85
88
 
@@ -106,6 +109,7 @@ export const MaterialOneOfRenderer = ({
106
109
  schema={schema}
107
110
  combinatorKeyword={'oneOf'}
108
111
  path={path}
112
+ rootSchema={rootSchema}
109
113
  />
110
114
  <Tabs value={selectedIndex} onChange={handleTabChange}>
111
115
  {oneOfRenderInfos.map((oneOfRenderInfo) => (
@@ -61,6 +61,7 @@ const TableToolbar = React.memo(function TableToolbar({
61
61
  schema,
62
62
  enabled,
63
63
  translations,
64
+ rootSchema,
64
65
  }: MaterialTableToolbarProps) {
65
66
  return (
66
67
  <TableRow>
@@ -95,7 +96,7 @@ const TableToolbar = React.memo(function TableToolbar({
95
96
  >
96
97
  <IconButton
97
98
  aria-label={translations.addAriaLabel}
98
- onClick={addItem(path, createDefaultValue(schema))}
99
+ onClick={addItem(path, createDefaultValue(schema, rootSchema))}
99
100
  size='large'
100
101
  >
101
102
  <AddIcon />
@@ -65,7 +65,6 @@ export const MaterialRadioGroup = (props: ControlProps & OwnPropsOfEnum) => {
65
65
  focused,
66
66
  appliedUiSchemaOptions.showUnfocusedDescription
67
67
  );
68
- const onChange = (_ev: any, value: any) => handleChange(path, value);
69
68
 
70
69
  return (
71
70
  <Hidden xsUp={!visible}>
@@ -87,12 +86,17 @@ export const MaterialRadioGroup = (props: ControlProps & OwnPropsOfEnum) => {
87
86
  {label}
88
87
  </FormLabel>
89
88
 
90
- <RadioGroup value={props.data ?? ''} onChange={onChange} row={true}>
89
+ <RadioGroup value={props.data ?? ''} row={true}>
91
90
  {options.map((option) => (
92
91
  <FormControlLabel
93
92
  value={option.value}
94
93
  key={option.label}
95
- control={<Radio checked={data === option.value} />}
94
+ control={
95
+ <Radio
96
+ checked={data === option.value}
97
+ onChange={() => handleChange(path, option.value)}
98
+ />
99
+ }
96
100
  label={option.label}
97
101
  disabled={!enabled}
98
102
  />
@@ -38,7 +38,7 @@ import merge from 'lodash/merge';
38
38
  const MaterialArrayLayoutComponent = (props: ArrayLayoutProps) => {
39
39
  const [expanded, setExpanded] = useState<string | boolean>(false);
40
40
  const innerCreateDefaultValue = useCallback(
41
- () => createDefaultValue(props.schema),
41
+ () => createDefaultValue(props.schema, props.rootSchema),
42
42
  [props.schema]
43
43
  );
44
44
  const handleChange = useCallback(
@@ -129,7 +129,7 @@ export const MuiAutocomplete = (
129
129
  autoFocus={appliedUiSchemaOptions.focus}
130
130
  disabled={!enabled}
131
131
  {...params}
132
- id={id + '-input'}
132
+ id={id}
133
133
  required={
134
134
  required && !appliedUiSchemaOptions.hideRequiredAsterisk
135
135
  }