Repository navigation
feat(vue-vuetify): add MultiEnumSelectRenderer for multi-select dropdowns #2637
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
Merged
lucas-koehler
merged 30 commits into
eclipsesource:master
from
darius-lesch:feat/multi-enum-select-renderer
Oct 9, 2026
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
9099496
feat(vue-vuetify): add MultiEnumSelectRenderer for multiselect rendering
darius-lesch b305067
Merge pull request #4 from darius-lesch/feature/multienum-select-rend…
darius-lesch 2f82463
feat: add multi-select example to the dev playground
darius-lesch 42b1b16
Resolved linting and harmonized imports
darius-lesch 7cecfd9
Merge pull request #5 from darius-lesch/feat-add-multi-select-example…
darius-lesch b36f863
Merge branch 'eclipsesource:master' into feat/multi-enum-select-renderer
darius-lesch f457e12
fix: resolved namespace error
darius-lesch 7ef53a0
feat(core, vue-vuetify): support atomic array updates for multi-enum …
darius-lesch c9ae9d2
refactor(vue-vuetify): extract shared predicate for multi-enum testers
darius-lesch 5ff28df
Merge pull request #11 from darius-lesch/refactor-extract-multi-enum-…
darius-lesch 0c76e8a
chore(examples): consolidate multi-select into enum-multi and clean s…
darius-lesch 5727bb4
Merge pull request #12 from darius-lesch/jules-113073129629200865-d6d…
darius-lesch e7a0171
fix: prettier formatting fix applied
darius-lesch 515e556
Merge pull request #10 from darius-lesch/feat-atomic-array-updates-mu…
darius-lesch ce95497
fix: removed leftover blank line
darius-lesch 3631b4f
refactor(vue-vuetify): utilize `adaptValue` in `MultiEnumSelectRenderer`
darius-lesch 1bf9f57
refactor(vue-vuetify): standardize `isMultiEnumControl` API
darius-lesch 3b13513
chore(core): DRY up mapDispatchToMultiEnumProps handleChange implemen…
darius-lesch 06c2b40
Merge pull request #14 from darius-lesch/standardize-is-multi-enum-co…
darius-lesch 77042c4
Merge pull request #13 from darius-lesch/refactor/vue-vuetify-multi-e…
darius-lesch 2fefc81
test(vue-vuetify): cover partial deselect for multiselect component
darius-lesch 84bd290
Merge pull request #15 from darius-lesch/fix-core-mapper-dry-up-94112…
darius-lesch 0b19ce7
Merge pull request #16 from darius-lesch/fix/vuetify-multi-select-des…
darius-lesch e3e1d5c
test(vue-vuetify): add interaction tests for oneOf schema in MultiEnu…
darius-lesch 26bf3ff
Merge pull request #18 from darius-lesch/test/vue-vuetify-multi-enum-…
darius-lesch 544047d
Merge pull request #17 from darius-lesch/fix/pr-2637-comments-v2
darius-lesch 7b26505
fix(vue-vuetify): update isMultiEnumControl tester to strictly requir…
darius-lesch b3f9f6d
fix: prettier fixes
darius-lesch 410cd79
Merge pull request #19 from darius-lesch/fix-multi-enum-tester-const-…
darius-lesch 5c9466b
remove unnecessary any cast
lucas-koehler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 3 additions & 37 deletions
40
packages/vue-vuetify/src/complex/EnumArrayRenderer.entry.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,8 @@ | ||
| import { | ||
| and, | ||
| hasType, | ||
| rankWith, | ||
| schemaMatches, | ||
| schemaSubPathMatches, | ||
| uiTypeIs, | ||
| type JsonFormsRendererRegistryEntry, | ||
| type JsonSchema, | ||
| } from '@jsonforms/core'; | ||
| import { rankWith, type JsonFormsRendererRegistryEntry } from '@jsonforms/core'; | ||
| import controlRenderer from './EnumArrayRenderer.vue'; | ||
| import { isMultiEnumControl } from '../util/tester'; | ||
|
|
||
| export const entry: JsonFormsRendererRegistryEntry = { | ||
| renderer: controlRenderer, | ||
| tester: rankWith( | ||
| 5, | ||
| and( | ||
| uiTypeIs('Control'), | ||
| and( | ||
| schemaMatches( | ||
| (schema) => | ||
| hasType(schema, 'array') && | ||
| !Array.isArray(schema.items) && | ||
| schema.uniqueItems === true, | ||
| ), | ||
| schemaSubPathMatches('items', (schema) => { | ||
| return hasOneOfItems(schema) || hasEnumItems(schema); | ||
| }), | ||
| ), | ||
| ), | ||
| ), | ||
| tester: rankWith(5, isMultiEnumControl), | ||
| }; | ||
|
|
||
| const hasOneOfItems = (schema: JsonSchema): boolean => | ||
| schema.oneOf !== undefined && | ||
| schema.oneOf.length > 0 && | ||
| (schema.oneOf as JsonSchema[]).every((entry: JsonSchema) => { | ||
| return entry.const !== undefined; | ||
| }); | ||
|
|
||
| const hasEnumItems = (schema: JsonSchema): boolean => | ||
| schema.type === 'string' && schema.enum !== undefined; |
16 changes: 16 additions & 0 deletions
16
packages/vue-vuetify/src/complex/MultiEnumSelectRenderer.entry.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { | ||
| and, | ||
| optionIs, | ||
| rankWith, | ||
| type JsonFormsRendererRegistryEntry, | ||
| } from '@jsonforms/core'; | ||
| import controlRenderer from './MultiEnumSelectRenderer.vue'; | ||
| import { isMultiEnumControl } from '../util/tester'; | ||
|
|
||
| export const entry: JsonFormsRendererRegistryEntry = { | ||
| renderer: controlRenderer, | ||
| tester: rankWith( | ||
| 10, | ||
| and(optionIs('format', 'multiselect'), isMultiEnumControl), | ||
| ), | ||
| }; |
78 changes: 78 additions & 0 deletions
78
packages/vue-vuetify/src/complex/MultiEnumSelectRenderer.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| <template> | ||
| <control-wrapper | ||
| v-bind="controlWrapper" | ||
| :styles="styles" | ||
| :isFocused="isFocused" | ||
| :appliedOptions="appliedOptions" | ||
| > | ||
| <v-select | ||
| v-disabled-icon-focus | ||
| :id="control.id + '-input'" | ||
| :class="styles.control.input" | ||
| :disabled="!control.enabled" | ||
| :readonly="control.readonly" | ||
| :autofocus="appliedOptions.focus" | ||
| :placeholder="appliedOptions.placeholder" | ||
| :label="computedLabel" | ||
| :hint="control.description" | ||
| :persistent-hint="persistentHint()" | ||
| :required="control.required" | ||
| :error-messages="control.errors" | ||
| :clearable="clearable" | ||
| :model-value="control.data" | ||
| :items="control.options" | ||
| item-title="label" | ||
| item-value="value" | ||
| multiple | ||
| chips | ||
| closable-chips | ||
| v-bind="vuetifyProps('v-select')" | ||
| @update:model-value="onChange" | ||
| @focus="handleFocus" | ||
| @blur="handleBlur" | ||
| > | ||
| <template v-slot:prepend v-if="$slots.prepend"> | ||
| <slot name="prepend" /> | ||
| </template> | ||
| <template v-slot:append v-if="$slots.append"> | ||
| <slot name="append" /> | ||
| </template> | ||
| </v-select> | ||
| </control-wrapper> | ||
| </template> | ||
|
|
||
| <script lang="ts"> | ||
| import { type ControlElement } from '@jsonforms/core'; | ||
| import { | ||
| rendererProps, | ||
| useJsonFormsMultiEnumControl, | ||
| type RendererProps, | ||
| } from '@jsonforms/vue'; | ||
| import { defineComponent } from 'vue'; | ||
| import { VSelect } from 'vuetify/components'; | ||
| import { determineClearValue, useVuetifyControl } from '../util'; | ||
| import { default as ControlWrapper } from '../controls/ControlWrapper.vue'; | ||
| import { DisabledIconFocus } from '../controls/directives'; | ||
|
|
||
| const controlRenderer = defineComponent({ | ||
| name: 'multi-enum-select-renderer', | ||
| components: { | ||
| ControlWrapper, | ||
| VSelect, | ||
| }, | ||
| directives: { | ||
| DisabledIconFocus, | ||
| }, | ||
| props: { | ||
| ...rendererProps<ControlElement>(), | ||
| }, | ||
| setup(props: RendererProps<ControlElement>) { | ||
| const clearValue = determineClearValue([]); | ||
| return useVuetifyControl(useJsonFormsMultiEnumControl(props), (value) => | ||
| value === null || value.length === 0 ? clearValue : value, | ||
| ); | ||
| }, | ||
| }); | ||
|
|
||
| export default controlRenderer; | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { | ||
| and, | ||
| hasType, | ||
| isOneOfEnumSchema, | ||
| schemaMatches, | ||
| schemaSubPathMatches, | ||
| uiTypeIs, | ||
| type JsonSchema, | ||
| } from '@jsonforms/core'; | ||
|
|
||
| export const isMultiEnumControl = and( | ||
| uiTypeIs('Control'), | ||
| schemaMatches( | ||
| (schema) => | ||
| hasType(schema, 'array') && | ||
| !Array.isArray(schema.items) && | ||
| schema.uniqueItems === true, | ||
| ), | ||
| schemaSubPathMatches('items', (schema) => { | ||
| return ( | ||
| (isOneOfEnumSchema(schema) && | ||
| schema.oneOf !== undefined && | ||
| (schema.oneOf as JsonSchema[]).length > 0) || | ||
| (schema.type === 'string' && schema.enum !== undefined) | ||
| ); | ||
| }), | ||
| ); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.