Repository navigation
feat(vue-vuetify): add MultiEnumSelectRenderer for multi-select dropdowns - #2637
lucas-koehler merged 30 commits into
Conversation
Currently, arrays of enums are strictly bound to EnumArrayRenderer which forces a checkbox list view.
For large data sets, a dropdown selection box is more manageable.
This adds a native MultiEnumSelectRenderer using `<v-select multiple>` to provide dropdown multi-select.
It is opted-in via setting `options: { format: 'multiselect' }` within the UI Schema.
Added tests covering layout rendering, bindings, snapshots, and event firing.
…erer-7959558924810637854 feat(vue-vuetify): add MultiEnumSelectRenderer for multiselect array control
Added a new dedicated example `multi-select` in the `@jsonforms/examples` package to showcase the `MultiEnumSelectRenderer` functionality. Registered the example and successfully verified its appearance in the playground.
…-14240345949356981889 Add multi-select dropdown example
✅ Deploy Preview for jsonforms-examples ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
lucas-koehler
left a comment
There was a problem hiding this comment.
Hi @darius-lesch , thanks for the contribution ❤️
Adding this renderer makes sense to me 👍
I have some comments inline, please have a look.
Extracted the array/uniqueItems logic currently duplicated in both MultiEnumSelectRenderer.entry.ts and EnumArrayRenderer.entry.ts into a shared `isMultiEnumControl` predicate in `util/tester.ts`. This refactor also replaces the local `hasOneOfItems` and `hasEnumItems` implementations with `@jsonforms/core`'s native `isOneOfEnumSchema` and `isEnumSchema` utilities while retaining the core conditions.
…predicate-4994370107824699869 refactor(vue-vuetify): extract shared predicate for multi-enum testers
…77ee4 Consolidate multi-select examples and clean spec comments
…lti-enum-3946876482457681454 feat: support atomic array updates for multi-enum controls
lucas-koehler
left a comment
There was a problem hiding this comment.
Hi @darius-lesch , thanks for the updates! I have some more comments inline. Please have a look :)
Replaces the manual `onChange` event wrapper in `MultiEnumSelectRenderer.vue` by leveraging the native `adaptValue` argument of `useVuetifyControl`. Restores `determineClearValue([])` to safely evaluate and assign clear values when the selected array is null or empty, ensuring dynamic property states remain consistent.
Encapsulated the `uiTypeIs('Control')` check natively inside the `isMultiEnumControl` tester utility to match the public API consistency of other core core testers. Removed redundant wrapper checks and orphaned imports from consuming entry files.
…tation Refactors `mapDispatchToMultiEnumProps` to use object spread with `mapDispatchToControlProps` in order to reuse the standard `handleChange` dispatcher, removing duplicated code. Also adds an appropriate unit test to ensure `handleChange` mutations apply correctly for multi-enum core setups.
…ntrol-11666017978019933440 refactor(vue-vuetify): standardize isMultiEnumControl API
…num-clear-logic-2745426208810466107 refactor(vue-vuetify): utilize adaptValue in MultiEnumSelectRenderer
Updated the "emits change when an item is deselected" test for the MultiEnumSelectRenderer to simulate removing a single item from a populated array (emitting `['a']` instead of `[]`) rather than a full clear. Added a new test specifically targeting the full clear scenario via empty array (`[]`), where `undefined` is appropriately expected as the emitted control data. Also, ran tests with `--update` to refresh snapshot ids that changed due to the added test block, and ran prettier.
…37511975146579 chore(core): DRY up mapDispatchToMultiEnumProps handleChange implementation
…election-test-12266432720069315409 test(vue-vuetify): cover partial deselect for multiselect component
…mSelectRenderer Added interaction tests for `oneOf` schema blocks within `MultiEnumSelectRenderer.spec.ts` to improve test coverage. This includes verifying state mutations for selection, partial deselection, and both array and null clear emissions, replicating the tests already present for the `enum` schema variant. Snapshots updated to reflect internal ID shifts.
…one-of-interaction-coverage-14122450674640127001 test(vue-vuetify): add interaction tests for oneOf schema in MultiEnumSelectRenderer
fix: PR2637 comments v2
…e enum - Replaced `isEnumSchema(schema)` with `schema.enum !== undefined` to prevent the predicate from matching `const`-only string arrays, which caused multi-select controls to render as empty options. - Added a `vitest` unit test to explicitly verify `const`-only array schemas return rank -1. - Cleaned up unused `isEnumSchema` import from `@jsonforms/core` in `tester.ts`.
…only-5318206538835551857 fix(vue-vuetify): prevent isMultiEnumControl from matching const-only schemas
lucas-koehler
left a comment
There was a problem hiding this comment.
@darius-lesch Thanks for the updates and the contribution ❤️ LGTM now 🚀
Just so you are not surprised, I took the liberty to remove an unnecessary as any cast and pushed it directly to the branch to avoid an additional review cycle just for this ;)
|
@lucas-koehler, thanks for your thorough reviews and patience. It is really helpful to deeper understand |
Description:
Resolves #2635.
What does this PR do?
This PR introduces a
MultiEnumSelectRendererto the@jsonforms/vue-vuetifypackage, allowing developers to render array-based enumerations as a<v-select multiple>dropdown instead of the default checkbox group.For large datasets, checkbox groups consume excessive vertical space. This opt-in renderer leverages Vuetify's native multiselect capabilities (including
chipsandclosable-chips) for a much cleaner UX.Implementation Details
10and only triggers when the UI Schema includesoptions: { format: 'multiselect' }. Existing schemas relying on theEnumArrayRenderer(checkboxes) are unaffected.useJsonFormsControlrather thanuseJsonFormsMultiEnumControlto natively handle the full array replacement emitted by<v-select multiple>, avoiding the need for manual array diffing.MultiEnumSelectRenderer.spec.tscovering bothenumandoneOfschema definitions, as well as selection, deselection, and clear events.multi-selectexample to the@jsonforms/examplespackage so this feature can be easily evaluated in the dev playground.How to Test
pnpm install && pnpm run build.cd packages/vue-vuetify && pnpm run dev --force.