Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(vue) add binding for one enum cell elements #1919

Merged
merged 2 commits into from
May 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/vue/vue/src/jsonFormsCompositions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
JsonFormsCellRendererRegistryEntry,
defaultMapStateToEnumCellProps,
mapStateToDispatchCellProps,
mapStateToOneOfEnumCellProps,
StatePropsOfJsonFormsRenderer,
createId,
removeId
Expand Down Expand Up @@ -395,6 +396,22 @@ export const useJsonFormsEnumCell = (props: ControlProps) => {
return { cell: control, ...other };
};

/**
* Provides bindings for 'oneOf' enum cell elements. Cells are meant to show simple inputs,
* for example without error validation, within a larger structure like tables.
*
* Access bindings via the provided reactive 'cell' object.
* Dispatch changes via the provided `handleChange` method.
*/
export const useJsonFormsOneOfEnumCell = (props: ControlProps) => {
const { control, ...other } = useControl(
props,
mapStateToOneOfEnumCellProps,
mapDispatchToControlProps
);
return { cell: control, ...other };
};

/**
* Provides bindings for a cell dispatcher. Cells are meant to show simple inputs,
* for example without error validation, within a larger structure like tables.
Expand Down