Skip to content

Commit

Permalink
Properly determine UI Schemas
Browse files Browse the repository at this point in the history
Always hand over as many parameters as applicable to the "findUISchema" utility. This
makes sure that all available options are considered in all cases. For example this fixes
an issue in the Vue bindings in which "options.detail" UI Schemas were ignored.
  • Loading branch information
sdirix committed May 24, 2022
1 parent 8dc8751 commit 44070b3
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ export class ArrayLayoutRenderer
this.uischema.scope,
this.propsPath,
undefined,
this.uischema
this.uischema,
this.rootSchema
);
if (this.isEnabled()) {
unsetReadonly(uischema);
Expand Down
3 changes: 2 additions & 1 deletion packages/angular-material/src/other/master-detail/master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ export class MasterListComponent extends JsonFormsArrayControl {
`${controlElement.scope}/items`,
props.path,
'VerticalLayout',
controlElement
controlElement,
props.rootSchema
);

const masterItems = (data || []).map((d: any, index: number) => {
Expand Down
6 changes: 4 additions & 2 deletions packages/angular-material/src/other/object.renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ export class ObjectControlRenderer extends JsonFormsControlWithDetail {
this.detailUiSchema = findUISchema(
props.uischemas,
props.schema,
undefined,
props.uischema.scope,
props.path,
'Group'
'Group',
props.uischema,
props.rootSchema
);
if (isEmpty(props.path)) {
this.detailUiSchema.type = 'VerticalLayout';
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/util/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,10 @@ export const mapStateToJsonFormsRendererProps = (
state.jsonforms.uischemas,
ownProps.schema,
undefined,
ownProps.path
ownProps.path,
undefined,
undefined,
state.jsonforms.core.schema
);
} else {
uischema = getUiSchema(state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export const MaterialListWithDetailRenderer = ({
data,
renderers,
cells,
config
config,
rootSchema
}: ArrayLayoutProps) => {
const [selectedIndex, setSelectedIndex] = useState(undefined);
const handleRemoveItem = useCallback(
Expand Down Expand Up @@ -90,9 +91,10 @@ export const MaterialListWithDetailRenderer = ({
uischema.scope,
path,
undefined,
uischema
uischema,
rootSchema
),
[uischemas, schema, uischema.scope, path, uischema]
[uischemas, schema, uischema.scope, path, uischema, rootSchema]
);
const appliedUiSchemaOptions = merge({}, config, uischema.options);

Expand Down
7 changes: 4 additions & 3 deletions packages/vanilla/src/complex/array/ArrayControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ export const ArrayControl = ({
addItem,
uischema,
uischemas,
renderers
renderers,
rootSchema
}: ArrayControlProps & VanillaRendererProps) => {
const childUiSchema = useMemo(
() => findUISchema(uischemas, schema, uischema.scope, path),
[uischemas, schema, uischema.scope, path]
() => findUISchema(uischemas, schema, uischema.scope, path, undefined, uischema, rootSchema),
[uischemas, schema, uischema.scope, path, uischema, rootSchema]
);
return (
<div className={classNames.wrapper}>
Expand Down
5 changes: 4 additions & 1 deletion packages/vue/vue-vanilla/src/util/composition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export const useVanillaArrayControl = <I extends { control: any }>(
input.control.value.uischemas,
input.control.value.schema,
input.control.value.uischema.scope,
input.control.value.path
input.control.value.path,
undefined,
input.control.value.uischema,
input.control.value.rootSchema
)
);

Expand Down

0 comments on commit 44070b3

Please sign in to comment.