@protonemedia/form-components-pro-vue3-core
Advanced tools
Comparing version 2.0.12-beta1.0 to 2.0.13-beta1.0
@@ -1,2 +0,2 @@ | ||
import { get, set, isObject, first, map, find, forEach, isString } from 'lodash-es'; | ||
import { get, set, isObject, first, map, isArray, find, forEach, isString } from 'lodash-es'; | ||
import { resolveComponent, openBlock, createElementBlock, Fragment, renderList, createBlock, normalizeProps, mergeProps, toDisplayString } from 'vue'; | ||
@@ -523,2 +523,14 @@ | ||
computed: { | ||
hasSelection() { | ||
if (this.multiple) { | ||
return isArray(this.model) ? this.model.length > 0 : false; | ||
} | ||
if (this.model === null || this.model === "") { | ||
return false; | ||
} | ||
return true; | ||
}, | ||
optionsContainPlaceholder() { | ||
@@ -616,2 +628,4 @@ return find(this.arrayOptions, (option) => { | ||
this.choicesInstance.setChoiceByValue(updatedValue); | ||
this.updateHasSelectionAttribute(); | ||
} | ||
@@ -671,2 +685,9 @@ }, | ||
updateHasSelectionAttribute() { | ||
this.choicesInstance.containerInner.element.setAttribute( | ||
"data-has-selection", | ||
this.hasSelection | ||
); | ||
}, | ||
initChoices(selectElement) { | ||
@@ -687,2 +708,4 @@ const vm = this; | ||
vm.updateHasSelectionAttribute(); | ||
selectElement.addEventListener("change", function () { | ||
@@ -689,0 +712,0 @@ if (vm.multiple) { |
{ | ||
"name": "@protonemedia/form-components-pro-vue3-core", | ||
"version": "2.0.12-beta1.0", | ||
"version": "2.0.13-beta1.0", | ||
"author": "Pascal Baljet <pascal@protone.media>", | ||
@@ -52,3 +52,3 @@ "homepage": "https://formcomponents.pro", | ||
}, | ||
"gitHead": "b1bad8af33a0078b419dc4bb8db266c5c7fccdcb" | ||
"gitHead": "aaacffafd3f8517cdbd2ef9346adfcdf99f8ce41" | ||
} |
Sorry, the diff of this file is not supported yet
38878
1500