@volverjs/ui-vue 0.0.5-beta.1 → 0.0.5-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VvAction/VvAction.es.js +10 -0
- package/dist/components/VvBadge/VvBadge.es.js +10 -0
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +10 -0
- package/dist/components/VvButton/VvButton.es.js +10 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +10 -0
- package/dist/components/VvCheckbox/VvCheckbox.es.js +10 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +17 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +174 -64
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +16 -11
- package/dist/components/VvCombobox/index.d.ts +6 -1
- package/dist/components/VvDialog/VvDialog.es.js +10 -0
- package/dist/components/VvDropdown/VvDropdown.es.js +14 -2
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +27 -11
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +6 -0
- package/dist/components/VvDropdown/index.d.ts +6 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +10 -0
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +237 -0
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +10 -0
- package/dist/components/VvInputText/VvInputText.es.js +14 -4
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
- package/dist/components/VvInputText/index.d.ts +2 -2
- package/dist/components/VvProgress/VvProgress.es.js +10 -0
- package/dist/components/VvRadio/VvRadio.es.js +10 -0
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +17 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +52 -10
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +4 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +14 -4
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
- package/dist/components/VvTextarea/index.d.ts +2 -2
- package/dist/components/VvTooltip/VvTooltip.es.js +10 -0
- package/dist/components/index.es.js +250 -140
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/useOptions.d.ts +1 -0
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/index.es.js +51 -2
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.d.ts +3 -0
- package/dist/directives/v-contextmenu.es.js +42 -0
- package/dist/directives/v-contextmenu.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +10 -0
- package/dist/icons.d.ts +3 -1
- package/dist/icons.es.js +6 -4
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +11 -3
- package/dist/resolvers/unplugin.es.js +2 -1
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
- package/dist/stories/argTypes.d.ts +12 -0
- package/package.json +58 -42
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +85 -28
- package/src/components/VvDropdown/VvDropdown.vue +3 -2
- package/src/components/VvDropdown/VvDropdownOptgroup.vue +18 -0
- package/src/components/VvInputText/VvInputText.vue +2 -2
- package/src/components/VvSelect/VvSelect.vue +38 -10
- package/src/components/VvTextarea/VvTextarea.vue +2 -2
- package/src/composables/useOptions.ts +6 -0
- package/src/directives/index.ts +2 -0
- package/src/directives/v-contextmenu.ts +40 -0
- package/src/icons.ts +1 -1
- package/src/props/index.ts +12 -2
- package/src/resolvers/unplugin.ts +2 -1
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
- package/src/stories/argTypes.ts +10 -0
- package/src/types/generic.d.ts +2 -1
|
@@ -122,6 +122,16 @@ const LabelProps = {
|
|
|
122
122
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
|
+
/**
|
|
126
|
+
* Dropdown strategy
|
|
127
|
+
*/
|
|
128
|
+
strategy: {
|
|
129
|
+
type: String,
|
|
130
|
+
default: "absolute",
|
|
131
|
+
validator: (value) => {
|
|
132
|
+
return ["fixed", "absolute"].includes(value);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
125
135
|
/**
|
|
126
136
|
* Dropdown show / hide transition name
|
|
127
137
|
*/
|
|
@@ -118,6 +118,16 @@ const ModifiersProps = {
|
|
|
118
118
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
+
/**
|
|
122
|
+
* Dropdown strategy
|
|
123
|
+
*/
|
|
124
|
+
strategy: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: "absolute",
|
|
127
|
+
validator: (value) => {
|
|
128
|
+
return ["fixed", "absolute"].includes(value);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
121
131
|
/**
|
|
122
132
|
* Dropdown show / hide transition name
|
|
123
133
|
*/
|
|
@@ -141,6 +141,16 @@ const ModifiersProps = {
|
|
|
141
141
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
|
+
/**
|
|
145
|
+
* Dropdown strategy
|
|
146
|
+
*/
|
|
147
|
+
strategy: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: "absolute",
|
|
150
|
+
validator: (value) => {
|
|
151
|
+
return ["fixed", "absolute"].includes(value);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
144
154
|
/**
|
|
145
155
|
* Dropdown show / hide transition name
|
|
146
156
|
*/
|
|
@@ -367,6 +367,16 @@ const IdProps = {
|
|
|
367
367
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
368
368
|
}
|
|
369
369
|
},
|
|
370
|
+
/**
|
|
371
|
+
* Dropdown strategy
|
|
372
|
+
*/
|
|
373
|
+
strategy: {
|
|
374
|
+
type: String,
|
|
375
|
+
default: "absolute",
|
|
376
|
+
validator: (value) => {
|
|
377
|
+
return ["fixed", "absolute"].includes(value);
|
|
378
|
+
}
|
|
379
|
+
},
|
|
370
380
|
/**
|
|
371
381
|
* Dropdown show / hide transition name
|
|
372
382
|
*/
|
|
@@ -125,6 +125,16 @@ const UnselectableProps = {
|
|
|
125
125
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
|
+
/**
|
|
129
|
+
* Dropdown strategy
|
|
130
|
+
*/
|
|
131
|
+
strategy: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: "absolute",
|
|
134
|
+
validator: (value) => {
|
|
135
|
+
return ["fixed", "absolute"].includes(value);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
128
138
|
/**
|
|
129
139
|
* Dropdown show / hide transition name
|
|
130
140
|
*/
|
|
@@ -164,6 +164,16 @@ const IdProps = {
|
|
|
164
164
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
|
+
/**
|
|
168
|
+
* Dropdown strategy
|
|
169
|
+
*/
|
|
170
|
+
strategy: {
|
|
171
|
+
type: String,
|
|
172
|
+
default: "absolute",
|
|
173
|
+
validator: (value) => {
|
|
174
|
+
return ["fixed", "absolute"].includes(value);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
167
177
|
/**
|
|
168
178
|
* Dropdown show / hide transition name
|
|
169
179
|
*/
|
|
@@ -377,6 +377,16 @@ const IdProps = {
|
|
|
377
377
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
378
378
|
}
|
|
379
379
|
},
|
|
380
|
+
/**
|
|
381
|
+
* Dropdown strategy
|
|
382
|
+
*/
|
|
383
|
+
strategy: {
|
|
384
|
+
type: String,
|
|
385
|
+
default: "absolute",
|
|
386
|
+
validator: (value) => {
|
|
387
|
+
return ["fixed", "absolute"].includes(value);
|
|
388
|
+
}
|
|
389
|
+
},
|
|
380
390
|
/**
|
|
381
391
|
* Dropdown show / hide transition name
|
|
382
392
|
*/
|
|
@@ -803,11 +813,17 @@ function useOptions(props) {
|
|
|
803
813
|
return false;
|
|
804
814
|
return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
|
|
805
815
|
};
|
|
816
|
+
const getOptionGrouped = (option) => {
|
|
817
|
+
if (typeof option !== "object" && option !== null)
|
|
818
|
+
return [];
|
|
819
|
+
return option.options;
|
|
820
|
+
};
|
|
806
821
|
return {
|
|
807
822
|
options,
|
|
808
823
|
getOptionLabel,
|
|
809
824
|
getOptionValue,
|
|
810
|
-
getOptionDisabled
|
|
825
|
+
getOptionDisabled,
|
|
826
|
+
getOptionGrouped
|
|
811
827
|
};
|
|
812
828
|
}
|
|
813
829
|
const _hoisted_1 = ["textContent"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=l(e.vue,e.core,e.nanoid)}(this,(function(e,l,n){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),o=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(o||{});const u=Symbol.for("checkGroup");function i(e,l,n){return n?d(e,n)===d(l,n):r(e,l)}function r(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const n=Array.isArray(e),t=Array.isArray(l);let a,o,u;if(n&&t){if(o=e.length,o!=l.length)return!1;for(a=o;0!=a--;)if(!r(e[a],l[a]))return!1;return!0}if(n!=t)return!1;const i=e instanceof Date,d=l instanceof Date;if(i!=d)return!1;if(i&&d)return e.getTime()==l.getTime();const v=e instanceof RegExp,s=l instanceof RegExp;if(v!=s)return!1;if(v&&s)return e.toString()==l.toString();const c=Object.keys(e);if(o=c.length,o!==Object.keys(l).length)return!1;for(a=o;0!=a--;)if(!Object.prototype.hasOwnProperty.call(l,c[a]))return!1;for(a=o;0!=a--;)if(u=c[a],!r(e[u],l[u]))return!1;return!0}return e!=e&&l!=l}function d(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const n=l.split(".");let t=e;for(let l=0,a=n.length;l<a;++l){if(null==e)return null;t=t[n[l]]}return t}}return null}function v(l){return null==(n=e.unref(l))||""===n||Array.isArray(n)&&0===n.length||!(n instanceof Date)&&"object"==typeof n&&0===Object.keys(n).length;var n}function s(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function c(n,t){const{invalid:a,valid:o,hint:u,loading:i}=t,{hintLabel:r,modelValue:c,valid:f,validLabel:p,invalid:m,invalidLabel:b,...y}=e.toRefs(n),g=d(y,"loading"),h=d(y,"loadingLabel"),k=e.computed((()=>!!m.value&&(!(!m.value||!a)||(!!((null==b?void 0:b.value)&&Array.isArray(b.value)&&b.value.length>0)||!(!(null==b?void 0:b.value)||v(b)))))),S=e.computed((()=>!!(r&&r.value||u))),V=e.computed((()=>!!(p&&p.value||o))),B=e.computed((()=>!!((null==g?void 0:g.value)&&i||(null==g?void 0:g.value)&&(null==h?void 0:h.value)))),A=e.computed((()=>S.value||V.value||k.value||B.value));return{hasInvalid:k,hasHint:S,hasValid:V,hasLoading:B,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(n){const t=e.computed((()=>{const e=l.toReactive({hintLabel:r,modelValue:c,valid:f,validLabel:p,invalid:m,invalidLabel:b,loading:g,loadingLabel:h,...n.params});return(null==m?void 0:m.value)?(null==a?void 0:a(e))||s(null==b?void 0:b.value)||(null==r?void 0:r.value):(null==f?void 0:f.value)?(null==o?void 0:o(e))||s(null==p?void 0:p.value)||(null==r?void 0:r.value):(null==g?void 0:g.value)?(null==i?void 0:i(e))||s(null==h?void 0:h.value)||(null==r?void 0:r.value):(null==u?void 0:u(e))||s(null==r?void 0:r.value)||(null==r?void 0:r.value)}));return{isVisible:A,hasInvalid:k,hasValid:V,hintContent:t}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}const f={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},m={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},g={modifiers:[String,Array]},h={hintLabel:{type:String,default:""}},k={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};a.before;const S={tabindex:{type:[String,Number],default:0}},V={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const B={...{...V,name:{type:String,required:!0}},...S,...f,...p,...h,...m,...y,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},A={...f,...p,...k,...h,...m,...y,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};o.button;const x={...B,...g,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function O(l,n){const{group:t,isInGroup:a,getGroupOrLocalRef:o}=function(l){const n=e.inject(l,void 0),t=e.computed((()=>!v(n)));return{group:n,isInGroup:t,getGroupOrLocalRef:function(l,t,a){if(null==n?void 0:n.value){const t=e.unref(n.value)[l];return e.computed({get:()=>null==t?void 0:t.value,set(e){t.value=e}})}const o=e.toRef(t,l);return e.computed({get:()=>o.value,set(e){a&&a(`update:${l}`,e)}})}}}(u),{id:i,switch:r,indeterminate:d}=e.toRefs(l),s=o("modelValue",l,n),c=o("valid",l),f=o("invalid",l),p=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==t?void 0:t.value)?void 0:e.disabled.value))})),m=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==t?void 0:t.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:t,isInGroup:a,modelValue:s,valid:c,invalid:f,readonly:p,disabled:m}}function j(l,n,t){return e.computed((()=>{const a={[l]:!0},o="string"==typeof(null==n?void 0:n.value)?n.value.split(" "):null==n?void 0:n.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(a[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((n=>{a[`${l}--${n}`]=e.unref(t.value[n])})),a}))}const L=["for"],C=["id","name","disabled","value","tabindex","aria-invalid"],w=e.defineComponent({name:"VvCheckbox",props:x,emits:["click","update:modelValue","change","blur"],setup(l,{emit:t}){const a=l,o=e.useSlots(),{id:u,disabled:r,readonly:d,valid:v,invalid:s,propsSwitch:f,modelValue:p,indeterminate:m,isInGroup:b}=O(a,t),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||n.nanoid()))))(u),g=e.computed((()=>S.value?-1:a.tabindex)),h=e.ref(),k=e.computed((()=>void 0!==a.uncheckedValue&&!b.value)),S=e.computed((()=>r.value||d.value)),V=e.computed((()=>!0===s.value||!0!==v.value&&void 0)),B=e.computed((()=>k.value?p.value===a.value:Array.isArray(p.value)?function(e,l){if(null!=e&&l&&l.length)for(const n of l)if(i(e,n))return!0;return!1}(a.value,p.value):i(a.value,p.value))),A=e.computed((()=>!!m.value||!(B.value||!k.value||a.uncheckedValue===p.value))),x=e.computed((()=>{if(!k.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),w=e.computed({get:()=>B.value,set(e){if(k.value)p.value=e?a.value:a.uncheckedValue;else if(Array.isArray(p.value)||b.value){const l=new Set(Array.isArray(p.value)?p.value:void 0!==p.value?[p.value]:[]);e?l.add(a.value):l.delete(a.value),p.value=[...l]}else p.value=e?a.value:void 0;t("change",e)}}),{modifiers:N}=e.toRefs(a),R=j("vv-checkbox",N,e.computed((()=>({switch:f.value,valid:v.value,invalid:s.value,disabled:r.value,readonly:d.value,indeterminate:m.value}))));e.watchEffect((()=>{k.value&&Array.isArray(p.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>A.value),(e=>{h.value.indeterminate=!!e})),e.onMounted((()=>{A.value&&(h.value.indeterminate=!0)}));const{HintSlot:E}=c(a,o);return(l,n)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(R)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:h,"onUpdate:modelValue":n[0]||(n[0]=l=>e.isRef(w)?w.value=l:null),type:"checkbox",class:"vv-checkbox__input",name:l.name,disabled:e.unref(S),value:e.unref(x),tabindex:e.unref(g),"aria-invalid":e.unref(V)},null,8,C),[[e.vModelCheckbox,e.unref(w)]]),e.renderSlot(l.$slots,"default",{value:e.unref(p)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(E),{class:"vv-checkbox__hint",params:{value:e.unref(p)}},null,8,["params"])],10,L))}}),N=A;const R=["textContent"],E={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:N,emits:["update:modelValue","change"],setup(n,{emit:t}){const a=n,o=e.useSlots(),i=l.useVModel(a,"modelValue",t),{disabled:r,readonly:d,vertical:v,valid:s,invalid:f,modifiers:p}=e.toRefs(a);!function(l){if(Object.keys(l).some((n=>"key"!==n&&!e.isRef(l[n]))))throw Error("One or more groupState props aren't ref.");e.provide(l.key,e.computed((()=>l)))}({key:u,modelValue:i,disabled:r,readonly:d,valid:s,invalid:f});const{getOptionLabel:m,getOptionValue:b}=function(l){const{options:n,labelKey:t,valueKey:a,disabledKey:o}=e.toRefs(l);return{options:n,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:"function"==typeof t.value?t.value(e):e[t.value],getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof a.value?a.value(e):e[a.value],getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof o.value?o.value(e):e[o.value])}}(a),y=j("vv-checkbox-group",p,e.computed((()=>({disabled:r.value,readonly:d.value,horizontal:!v.value,valid:s.value,invalid:f.value})))),{HintSlot:g}=c(a,o);return(l,n)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[l.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(l.label)},null,8,R)):e.createCommentVNode("",!0),e.createElementVNode("div",E,[l.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.options,((l,n)=>(e.openBlock(),e.createBlock(w,e.mergeProps({key:n},((e,l)=>({id:`${a.name}_opt${l}`,name:a.name,label:m(e),value:b(e)}))(l,n)),null,16)))),128)):e.renderSlot(l.$slots,"default",{key:1})]),e.createVNode(e.unref(g),{class:"vv-checkbox-group__hint"})],2))}})}));
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=l(e.vue,e.core,e.nanoid)}(this,(function(e,l,n){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),o=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(o||{});const u=Symbol.for("checkGroup");function i(e,l,n){return n?d(e,n)===d(l,n):r(e,l)}function r(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const n=Array.isArray(e),t=Array.isArray(l);let a,o,u;if(n&&t){if(o=e.length,o!=l.length)return!1;for(a=o;0!=a--;)if(!r(e[a],l[a]))return!1;return!0}if(n!=t)return!1;const i=e instanceof Date,d=l instanceof Date;if(i!=d)return!1;if(i&&d)return e.getTime()==l.getTime();const v=e instanceof RegExp,s=l instanceof RegExp;if(v!=s)return!1;if(v&&s)return e.toString()==l.toString();const c=Object.keys(e);if(o=c.length,o!==Object.keys(l).length)return!1;for(a=o;0!=a--;)if(!Object.prototype.hasOwnProperty.call(l,c[a]))return!1;for(a=o;0!=a--;)if(u=c[a],!r(e[u],l[u]))return!1;return!0}return e!=e&&l!=l}function d(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const n=l.split(".");let t=e;for(let l=0,a=n.length;l<a;++l){if(null==e)return null;t=t[n[l]]}return t}}return null}function v(l){return null==(n=e.unref(l))||""===n||Array.isArray(n)&&0===n.length||!(n instanceof Date)&&"object"==typeof n&&0===Object.keys(n).length;var n}function s(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function c(n,t){const{invalid:a,valid:o,hint:u,loading:i}=t,{hintLabel:r,modelValue:c,valid:f,validLabel:p,invalid:m,invalidLabel:b,...y}=e.toRefs(n),g=d(y,"loading"),h=d(y,"loadingLabel"),k=e.computed((()=>!!m.value&&(!(!m.value||!a)||(!!((null==b?void 0:b.value)&&Array.isArray(b.value)&&b.value.length>0)||!(!(null==b?void 0:b.value)||v(b)))))),S=e.computed((()=>!!(r&&r.value||u))),V=e.computed((()=>!!(p&&p.value||o))),B=e.computed((()=>!!((null==g?void 0:g.value)&&i||(null==g?void 0:g.value)&&(null==h?void 0:h.value)))),A=e.computed((()=>S.value||V.value||k.value||B.value));return{hasInvalid:k,hasHint:S,hasValid:V,hasLoading:B,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(n){const t=e.computed((()=>{const e=l.toReactive({hintLabel:r,modelValue:c,valid:f,validLabel:p,invalid:m,invalidLabel:b,loading:g,loadingLabel:h,...n.params});return(null==m?void 0:m.value)?(null==a?void 0:a(e))||s(null==b?void 0:b.value)||(null==r?void 0:r.value):(null==f?void 0:f.value)?(null==o?void 0:o(e))||s(null==p?void 0:p.value)||(null==r?void 0:r.value):(null==g?void 0:g.value)?(null==i?void 0:i(e))||s(null==h?void 0:h.value)||(null==r?void 0:r.value):(null==u?void 0:u(e))||s(null==r?void 0:r.value)||(null==r?void 0:r.value)}));return{isVisible:A,hasInvalid:k,hasValid:V,hintContent:t}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}const f={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},m={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},g={modifiers:[String,Array]},h={hintLabel:{type:String,default:""}},k={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};a.before;const S={tabindex:{type:[String,Number],default:0}},V={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const B={...{...V,name:{type:String,required:!0}},...S,...f,...p,...h,...m,...y,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},A={...f,...p,...k,...h,...m,...y,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};o.button;const x={...B,...g,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function O(l,n){const{group:t,isInGroup:a,getGroupOrLocalRef:o}=function(l){const n=e.inject(l,void 0),t=e.computed((()=>!v(n)));return{group:n,isInGroup:t,getGroupOrLocalRef:function(l,t,a){if(null==n?void 0:n.value){const t=e.unref(n.value)[l];return e.computed({get:()=>null==t?void 0:t.value,set(e){t.value=e}})}const o=e.toRef(t,l);return e.computed({get:()=>o.value,set(e){a&&a(`update:${l}`,e)}})}}}(u),{id:i,switch:r,indeterminate:d}=e.toRefs(l),s=o("modelValue",l,n),c=o("valid",l),f=o("invalid",l),p=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==t?void 0:t.value)?void 0:e.disabled.value))})),m=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==t?void 0:t.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:t,isInGroup:a,modelValue:s,valid:c,invalid:f,readonly:p,disabled:m}}function j(l,n,t){return e.computed((()=>{const a={[l]:!0},o="string"==typeof(null==n?void 0:n.value)?n.value.split(" "):null==n?void 0:n.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(a[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((n=>{a[`${l}--${n}`]=e.unref(t.value[n])})),a}))}const L=["for"],C=["id","name","disabled","value","tabindex","aria-invalid"],w=e.defineComponent({name:"VvCheckbox",props:x,emits:["click","update:modelValue","change","blur"],setup(l,{emit:t}){const a=l,o=e.useSlots(),{id:u,disabled:r,readonly:d,valid:v,invalid:s,propsSwitch:f,modelValue:p,indeterminate:m,isInGroup:b}=O(a,t),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||n.nanoid()))))(u),g=e.computed((()=>S.value?-1:a.tabindex)),h=e.ref(),k=e.computed((()=>void 0!==a.uncheckedValue&&!b.value)),S=e.computed((()=>r.value||d.value)),V=e.computed((()=>!0===s.value||!0!==v.value&&void 0)),B=e.computed((()=>k.value?p.value===a.value:Array.isArray(p.value)?function(e,l){if(null!=e&&l&&l.length)for(const n of l)if(i(e,n))return!0;return!1}(a.value,p.value):i(a.value,p.value))),A=e.computed((()=>!!m.value||!(B.value||!k.value||a.uncheckedValue===p.value))),x=e.computed((()=>{if(!k.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),w=e.computed({get:()=>B.value,set(e){if(k.value)p.value=e?a.value:a.uncheckedValue;else if(Array.isArray(p.value)||b.value){const l=new Set(Array.isArray(p.value)?p.value:void 0!==p.value?[p.value]:[]);e?l.add(a.value):l.delete(a.value),p.value=[...l]}else p.value=e?a.value:void 0;t("change",e)}}),{modifiers:N}=e.toRefs(a),R=j("vv-checkbox",N,e.computed((()=>({switch:f.value,valid:v.value,invalid:s.value,disabled:r.value,readonly:d.value,indeterminate:m.value}))));e.watchEffect((()=>{k.value&&Array.isArray(p.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>A.value),(e=>{h.value.indeterminate=!!e})),e.onMounted((()=>{A.value&&(h.value.indeterminate=!0)}));const{HintSlot:E}=c(a,o);return(l,n)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(R)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:h,"onUpdate:modelValue":n[0]||(n[0]=l=>e.isRef(w)?w.value=l:null),type:"checkbox",class:"vv-checkbox__input",name:l.name,disabled:e.unref(S),value:e.unref(x),tabindex:e.unref(g),"aria-invalid":e.unref(V)},null,8,C),[[e.vModelCheckbox,e.unref(w)]]),e.renderSlot(l.$slots,"default",{value:e.unref(p)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(E),{class:"vv-checkbox__hint",params:{value:e.unref(p)}},null,8,["params"])],10,L))}}),N=A;const R=["textContent"],E={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:N,emits:["update:modelValue","change"],setup(n,{emit:t}){const a=n,o=e.useSlots(),i=l.useVModel(a,"modelValue",t),{disabled:r,readonly:d,vertical:v,valid:s,invalid:f,modifiers:p}=e.toRefs(a);!function(l){if(Object.keys(l).some((n=>"key"!==n&&!e.isRef(l[n]))))throw Error("One or more groupState props aren't ref.");e.provide(l.key,e.computed((()=>l)))}({key:u,modelValue:i,disabled:r,readonly:d,valid:s,invalid:f});const{getOptionLabel:m,getOptionValue:b}=function(l){const{options:n,labelKey:t,valueKey:a,disabledKey:o}=e.toRefs(l);return{options:n,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:"function"==typeof t.value?t.value(e):e[t.value],getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof a.value?a.value(e):e[a.value],getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof o.value?o.value(e):e[o.value]),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options}}(a),y=j("vv-checkbox-group",p,e.computed((()=>({disabled:r.value,readonly:d.value,horizontal:!v.value,valid:s.value,invalid:f.value})))),{HintSlot:g}=c(a,o);return(l,n)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[l.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(l.label)},null,8,R)):e.createCommentVNode("",!0),e.createElementVNode("div",E,[l.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.options,((l,n)=>(e.openBlock(),e.createBlock(w,e.mergeProps({key:n},((e,l)=>({id:`${a.name}_opt${l}`,name:a.name,label:m(e),value:b(e)}))(l,n)),null,16)))),128)):e.renderSlot(l.$slots,"default",{key:1})]),e.createVNode(e.unref(g),{class:"vv-checkbox-group__hint"})],2))}})}));
|
|
@@ -238,6 +238,16 @@ const DropdownProps = {
|
|
|
238
238
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
239
239
|
}
|
|
240
240
|
},
|
|
241
|
+
/**
|
|
242
|
+
* Dropdown strategy
|
|
243
|
+
*/
|
|
244
|
+
strategy: {
|
|
245
|
+
type: String,
|
|
246
|
+
default: "absolute",
|
|
247
|
+
validator: (value) => {
|
|
248
|
+
return ["fixed", "absolute"].includes(value);
|
|
249
|
+
}
|
|
250
|
+
},
|
|
241
251
|
/**
|
|
242
252
|
* Dropdown show / hide transition name
|
|
243
253
|
*/
|
|
@@ -595,11 +605,11 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
595
605
|
return toReturn;
|
|
596
606
|
});
|
|
597
607
|
}
|
|
598
|
-
const __default__$
|
|
608
|
+
const __default__$7 = {
|
|
599
609
|
name: "VvIcon"
|
|
600
610
|
};
|
|
601
|
-
const _sfc_main$
|
|
602
|
-
...__default__$
|
|
611
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
612
|
+
...__default__$7,
|
|
603
613
|
props: VvIconProps,
|
|
604
614
|
setup(__props) {
|
|
605
615
|
const props = __props;
|
|
@@ -767,16 +777,16 @@ function useProvideDropdownAction({
|
|
|
767
777
|
expanded
|
|
768
778
|
});
|
|
769
779
|
}
|
|
770
|
-
const _hoisted_1$
|
|
771
|
-
const __default__$
|
|
780
|
+
const _hoisted_1$4 = ["id", "tabindex", "role", "aria-labelledby"];
|
|
781
|
+
const __default__$6 = {
|
|
772
782
|
name: "VvDropdown",
|
|
773
783
|
inheritAttrs: false
|
|
774
784
|
};
|
|
775
|
-
const _sfc_main$
|
|
776
|
-
...__default__$
|
|
785
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
786
|
+
...__default__$6,
|
|
777
787
|
props: VvDropdownProps,
|
|
778
788
|
emits: ["update:modelValue"],
|
|
779
|
-
setup(__props, { emit }) {
|
|
789
|
+
setup(__props, { expose, emit }) {
|
|
780
790
|
const props = __props;
|
|
781
791
|
const { id } = toRefs(props);
|
|
782
792
|
const hasId = useUniqueId(id);
|
|
@@ -862,7 +872,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
862
872
|
floatingEl,
|
|
863
873
|
{
|
|
864
874
|
whileElementsMounted: autoUpdate,
|
|
865
|
-
placement: props.placement,
|
|
875
|
+
placement: computed(() => props.placement),
|
|
876
|
+
strategy: computed(() => props.strategy),
|
|
866
877
|
middleware
|
|
867
878
|
}
|
|
868
879
|
);
|
|
@@ -920,6 +931,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
920
931
|
const init = (el) => {
|
|
921
932
|
referenceEl.value = el;
|
|
922
933
|
};
|
|
934
|
+
expose({ toggle, show, hide, init });
|
|
923
935
|
watch(expanded, (newValue) => {
|
|
924
936
|
if (newValue && props.autofocusFirst) {
|
|
925
937
|
nextTick(() => {
|
|
@@ -1080,7 +1092,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1080
1092
|
renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
|
|
1081
1093
|
role: unref(itemRole)
|
|
1082
1094
|
})))
|
|
1083
|
-
], 16, _hoisted_1$
|
|
1095
|
+
], 16, _hoisted_1$4),
|
|
1084
1096
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
|
|
1085
1097
|
], 6), [
|
|
1086
1098
|
[vShow, unref(expanded)]
|
|
@@ -1095,11 +1107,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1095
1107
|
function useInjectedDropdownItem() {
|
|
1096
1108
|
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
1097
1109
|
}
|
|
1098
|
-
const __default__$
|
|
1110
|
+
const __default__$5 = {
|
|
1099
1111
|
name: "VvDropdownItem"
|
|
1100
1112
|
};
|
|
1101
|
-
const _sfc_main$
|
|
1102
|
-
...__default__$
|
|
1113
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1114
|
+
...__default__$5,
|
|
1103
1115
|
setup(__props) {
|
|
1104
1116
|
const { role, expanded } = useInjectedDropdownItem();
|
|
1105
1117
|
const element = ref(null);
|
|
@@ -1123,12 +1135,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1123
1135
|
};
|
|
1124
1136
|
}
|
|
1125
1137
|
});
|
|
1126
|
-
const _hoisted_1$
|
|
1127
|
-
const __default__$
|
|
1138
|
+
const _hoisted_1$3 = ["title"];
|
|
1139
|
+
const __default__$4 = {
|
|
1128
1140
|
name: "VvDropdownOption"
|
|
1129
1141
|
};
|
|
1130
|
-
const _sfc_main$
|
|
1131
|
-
...__default__$
|
|
1142
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1143
|
+
...__default__$4,
|
|
1132
1144
|
props: {
|
|
1133
1145
|
...DisabledProps,
|
|
1134
1146
|
...SelectedProps,
|
|
@@ -1165,7 +1177,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
1165
1177
|
}
|
|
1166
1178
|
});
|
|
1167
1179
|
return (_ctx, _cache) => {
|
|
1168
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1180
|
+
return openBlock(), createBlock(_sfc_main$5, {
|
|
1169
1181
|
class: normalizeClass(unref(bemCssClasses)),
|
|
1170
1182
|
tabindex: _ctx.disabled ? -1 : 0,
|
|
1171
1183
|
"aria-selected": _ctx.selected,
|
|
@@ -1180,13 +1192,33 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
1180
1192
|
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
|
|
1181
1193
|
createTextVNode(toDisplayString(unref(hintLabel)), 1)
|
|
1182
1194
|
])
|
|
1183
|
-
], 8, _hoisted_1$
|
|
1195
|
+
], 8, _hoisted_1$3)
|
|
1184
1196
|
]),
|
|
1185
1197
|
_: 3
|
|
1186
1198
|
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]);
|
|
1187
1199
|
};
|
|
1188
1200
|
}
|
|
1189
1201
|
});
|
|
1202
|
+
const _hoisted_1$2 = {
|
|
1203
|
+
class: "vv-dropdown-optgroup",
|
|
1204
|
+
role: "presentation",
|
|
1205
|
+
tabindex: "-1"
|
|
1206
|
+
};
|
|
1207
|
+
const __default__$3 = {
|
|
1208
|
+
name: "VvDropdownOptgroup"
|
|
1209
|
+
};
|
|
1210
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1211
|
+
...__default__$3,
|
|
1212
|
+
props: {
|
|
1213
|
+
...LabelProps
|
|
1214
|
+
},
|
|
1215
|
+
setup(__props) {
|
|
1216
|
+
const props = __props;
|
|
1217
|
+
return (_ctx, _cache) => {
|
|
1218
|
+
return openBlock(), createElementBlock("li", _hoisted_1$2, toDisplayString(props.label), 1);
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1190
1222
|
function equals(obj1, obj2, field) {
|
|
1191
1223
|
if (field)
|
|
1192
1224
|
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
@@ -1509,11 +1541,17 @@ function useOptions(props) {
|
|
|
1509
1541
|
return false;
|
|
1510
1542
|
return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
|
|
1511
1543
|
};
|
|
1544
|
+
const getOptionGrouped = (option) => {
|
|
1545
|
+
if (typeof option !== "object" && option !== null)
|
|
1546
|
+
return [];
|
|
1547
|
+
return option.options;
|
|
1548
|
+
};
|
|
1512
1549
|
return {
|
|
1513
1550
|
options,
|
|
1514
1551
|
getOptionLabel,
|
|
1515
1552
|
getOptionValue,
|
|
1516
|
-
getOptionDisabled
|
|
1553
|
+
getOptionDisabled,
|
|
1554
|
+
getOptionGrouped
|
|
1517
1555
|
};
|
|
1518
1556
|
}
|
|
1519
1557
|
const _hoisted_1$1 = ["for"];
|
|
@@ -1526,7 +1564,9 @@ const _hoisted_4$1 = { class: "vv-select__inner" };
|
|
|
1526
1564
|
const _hoisted_5$1 = ["id"];
|
|
1527
1565
|
const _hoisted_6$1 = ["disabled", "hidden"];
|
|
1528
1566
|
const _hoisted_7$1 = ["disabled", "value"];
|
|
1529
|
-
const _hoisted_8$1 =
|
|
1567
|
+
const _hoisted_8$1 = ["disabled", "label"];
|
|
1568
|
+
const _hoisted_9 = ["disabled", "value"];
|
|
1569
|
+
const _hoisted_10 = {
|
|
1530
1570
|
key: 1,
|
|
1531
1571
|
class: "vv-select__input-after"
|
|
1532
1572
|
};
|
|
@@ -1618,7 +1658,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1618
1658
|
invalid: props.invalid,
|
|
1619
1659
|
modelValue: props.modelValue
|
|
1620
1660
|
}));
|
|
1621
|
-
const {
|
|
1661
|
+
const {
|
|
1662
|
+
getOptionLabel,
|
|
1663
|
+
getOptionValue,
|
|
1664
|
+
getOptionDisabled,
|
|
1665
|
+
getOptionGrouped
|
|
1666
|
+
} = useOptions(props);
|
|
1622
1667
|
const localModelValue = computed({
|
|
1623
1668
|
get: () => {
|
|
1624
1669
|
return props.modelValue;
|
|
@@ -1630,6 +1675,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1630
1675
|
emit("update:modelValue", newValue);
|
|
1631
1676
|
}
|
|
1632
1677
|
});
|
|
1678
|
+
const isGroup = (option) => {
|
|
1679
|
+
if (typeof option === "string")
|
|
1680
|
+
return false;
|
|
1681
|
+
return option && option.options && option.options.length > 0;
|
|
1682
|
+
};
|
|
1633
1683
|
return (_ctx, _cache) => {
|
|
1634
1684
|
return openBlock(), createElementBlock("div", {
|
|
1635
1685
|
class: normalizeClass(unref(bemCssClasses))
|
|
@@ -1643,7 +1693,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1643
1693
|
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1644
1694
|
])) : createCommentVNode("", true),
|
|
1645
1695
|
createElementVNode("div", _hoisted_4$1, [
|
|
1646
|
-
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$
|
|
1696
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$7, mergeProps({
|
|
1647
1697
|
key: 0,
|
|
1648
1698
|
class: "vv-select__icon"
|
|
1649
1699
|
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
@@ -1660,21 +1710,35 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1660
1710
|
hidden: !_ctx.unselectable
|
|
1661
1711
|
}, toDisplayString(_ctx.placeholder), 9, _hoisted_6$1)) : createCommentVNode("", true),
|
|
1662
1712
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
|
|
1663
|
-
return openBlock(), createElementBlock(
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1713
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
1714
|
+
!isGroup(option) ? (openBlock(), createElementBlock("option", {
|
|
1715
|
+
key: index,
|
|
1716
|
+
disabled: unref(getOptionDisabled)(option),
|
|
1717
|
+
value: unref(getOptionValue)(option)
|
|
1718
|
+
}, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1)) : (openBlock(), createElementBlock("optgroup", {
|
|
1719
|
+
key: `group-${index}`,
|
|
1720
|
+
disabled: unref(getOptionDisabled)(option),
|
|
1721
|
+
label: unref(getOptionLabel)(option)
|
|
1722
|
+
}, [
|
|
1723
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(option), (item, i) => {
|
|
1724
|
+
return openBlock(), createElementBlock("option", {
|
|
1725
|
+
key: `group-${index}-item-${i}`,
|
|
1726
|
+
disabled: unref(getOptionDisabled)(item),
|
|
1727
|
+
value: unref(getOptionValue)(item)
|
|
1728
|
+
}, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9);
|
|
1729
|
+
}), 128))
|
|
1730
|
+
], 8, _hoisted_8$1))
|
|
1731
|
+
], 64);
|
|
1732
|
+
}), 256))
|
|
1669
1733
|
], 16, _hoisted_5$1), [
|
|
1670
1734
|
[vModelSelect, unref(localModelValue)]
|
|
1671
1735
|
]),
|
|
1672
|
-
unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$
|
|
1736
|
+
unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$7, mergeProps({
|
|
1673
1737
|
key: 1,
|
|
1674
1738
|
class: "vv-select__icon vv-select__icon-after"
|
|
1675
1739
|
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
|
|
1676
1740
|
]),
|
|
1677
|
-
_ctx.$slots.after ? (openBlock(), createElementBlock("div",
|
|
1741
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
1678
1742
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1679
1743
|
])) : createCommentVNode("", true)
|
|
1680
1744
|
]),
|
|
@@ -1781,7 +1845,7 @@ const _hoisted_8 = {
|
|
|
1781
1845
|
};
|
|
1782
1846
|
const __default__ = {
|
|
1783
1847
|
name: "VvCombobox",
|
|
1784
|
-
components: { VvDropdown: _sfc_main$
|
|
1848
|
+
components: { VvDropdown: _sfc_main$6, VvDropdownOption: _sfc_main$4, VvDropdownOptgroup: _sfc_main$3 }
|
|
1785
1849
|
};
|
|
1786
1850
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1787
1851
|
...__default__,
|
|
@@ -1901,7 +1965,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1901
1965
|
const hasOptions = computed(
|
|
1902
1966
|
() => props.searchable ? filteredOptions.value : props.options
|
|
1903
1967
|
);
|
|
1904
|
-
const {
|
|
1968
|
+
const {
|
|
1969
|
+
getOptionLabel,
|
|
1970
|
+
getOptionValue,
|
|
1971
|
+
getOptionDisabled,
|
|
1972
|
+
getOptionGrouped
|
|
1973
|
+
} = useOptions(props);
|
|
1905
1974
|
const filteredOptions = computed(() => {
|
|
1906
1975
|
var _a;
|
|
1907
1976
|
return (_a = props.options) == null ? void 0 : _a.filter((option) => {
|
|
@@ -1945,7 +2014,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1945
2014
|
let toReturn = value;
|
|
1946
2015
|
if (props.multiple) {
|
|
1947
2016
|
if (Array.isArray(props.modelValue)) {
|
|
1948
|
-
|
|
2017
|
+
const maxValues = Number(props.maxValues);
|
|
2018
|
+
if (props.maxValues !== void 0 && maxValues >= 0 && ((_a = props.modelValue) == null ? void 0 : _a.length) >= maxValues) {
|
|
1949
2019
|
if (!contains(value, props.modelValue)) {
|
|
1950
2020
|
return;
|
|
1951
2021
|
}
|
|
@@ -1994,6 +2064,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1994
2064
|
id: hasDropdownId.value,
|
|
1995
2065
|
reference: wrapperEl.value,
|
|
1996
2066
|
placement: props.placement,
|
|
2067
|
+
strategy: props.strategy,
|
|
1997
2068
|
transitionName: props.transitionName,
|
|
1998
2069
|
offset: props.offset,
|
|
1999
2070
|
shift: props.shift,
|
|
@@ -2020,6 +2091,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2020
2091
|
toggleExpanded();
|
|
2021
2092
|
}
|
|
2022
2093
|
});
|
|
2094
|
+
const isGroup = (option) => {
|
|
2095
|
+
if (typeof option === "string") {
|
|
2096
|
+
return false;
|
|
2097
|
+
}
|
|
2098
|
+
return option.options && option.options.length > 0;
|
|
2099
|
+
};
|
|
2023
2100
|
return (_ctx, _cache) => {
|
|
2024
2101
|
return !_ctx.native ? (openBlock(), createElementBlock("div", {
|
|
2025
2102
|
key: 0,
|
|
@@ -2036,7 +2113,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2036
2113
|
ref: wrapperEl,
|
|
2037
2114
|
class: "vv-select__wrapper"
|
|
2038
2115
|
}, [
|
|
2039
|
-
createVNode(_sfc_main$
|
|
2116
|
+
createVNode(_sfc_main$6, mergeProps({
|
|
2040
2117
|
modelValue: unref(expanded),
|
|
2041
2118
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(expanded) ? expanded.value = $event : null)
|
|
2042
2119
|
}, unref(dropdownProps), {
|
|
@@ -2047,7 +2124,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2047
2124
|
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2048
2125
|
])) : createCommentVNode("", true),
|
|
2049
2126
|
createElementVNode("div", _hoisted_5, [
|
|
2050
|
-
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$
|
|
2127
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$7, mergeProps({
|
|
2051
2128
|
key: 0,
|
|
2052
2129
|
class: "vv-select__icon"
|
|
2053
2130
|
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
@@ -2078,7 +2155,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2078
2155
|
"aria-label": unref(propsDefaults).deselectActionLabel,
|
|
2079
2156
|
onClick: withModifiers(($event) => onInput(option), ["stop"])
|
|
2080
2157
|
}, [
|
|
2081
|
-
createVNode(_sfc_main$
|
|
2158
|
+
createVNode(_sfc_main$7, { name: "close" })
|
|
2082
2159
|
], 8, _hoisted_7)) : createCommentVNode("", true)
|
|
2083
2160
|
]),
|
|
2084
2161
|
_: 2
|
|
@@ -2089,7 +2166,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2089
2166
|
], 64))
|
|
2090
2167
|
])
|
|
2091
2168
|
], 16, _hoisted_6),
|
|
2092
|
-
unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$
|
|
2169
|
+
unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$7, mergeProps({
|
|
2093
2170
|
key: 1,
|
|
2094
2171
|
class: "vv-select__icon vv-select__icon-after"
|
|
2095
2172
|
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
|
|
@@ -2100,31 +2177,64 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2100
2177
|
]),
|
|
2101
2178
|
items: withCtx(() => [
|
|
2102
2179
|
unref(filteredOptions).length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
|
|
2103
|
-
return openBlock(),
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2180
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
2181
|
+
isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2182
|
+
createVNode(_sfc_main$3, {
|
|
2183
|
+
label: unref(getOptionLabel)(option)
|
|
2184
|
+
}, null, 8, ["label"]),
|
|
2185
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
|
|
2186
|
+
option
|
|
2187
|
+
), (item, i) => {
|
|
2188
|
+
return openBlock(), createBlock(_sfc_main$4, mergeProps({
|
|
2189
|
+
disabled: unref(getOptionDisabled)(item),
|
|
2190
|
+
selected: getOptionSelected(item),
|
|
2191
|
+
unselectable: _ctx.unselectable,
|
|
2192
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
2193
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
2194
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
2195
|
+
}, {
|
|
2196
|
+
key: i,
|
|
2197
|
+
class: "vv-dropdown-option",
|
|
2198
|
+
onClickPassive: ($event) => onInput(item)
|
|
2199
|
+
}), {
|
|
2200
|
+
default: withCtx(() => [
|
|
2201
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
2202
|
+
option,
|
|
2203
|
+
selectedOptions: unref(selectedOptions),
|
|
2204
|
+
selected: getOptionSelected(item),
|
|
2205
|
+
disabled: unref(getOptionDisabled)(item)
|
|
2206
|
+
})), () => [
|
|
2207
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
|
|
2208
|
+
])
|
|
2209
|
+
]),
|
|
2210
|
+
_: 2
|
|
2211
|
+
}, 1040, ["onClickPassive"]);
|
|
2212
|
+
}), 128))
|
|
2213
|
+
], 64)) : (openBlock(), createBlock(_sfc_main$4, mergeProps({ key: 1 }, {
|
|
2214
|
+
disabled: unref(getOptionDisabled)(option),
|
|
2215
|
+
selected: getOptionSelected(option),
|
|
2216
|
+
unselectable: _ctx.unselectable,
|
|
2217
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
2218
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
2219
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
2220
|
+
}, {
|
|
2221
|
+
class: "vv-dropdown-option",
|
|
2222
|
+
onClickPassive: ($event) => onInput(option)
|
|
2223
|
+
}), {
|
|
2224
|
+
default: withCtx(() => [
|
|
2225
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
2226
|
+
option,
|
|
2227
|
+
selectedOptions: unref(selectedOptions),
|
|
2228
|
+
selected: getOptionSelected(option),
|
|
2229
|
+
disabled: unref(getOptionDisabled)(option)
|
|
2230
|
+
})), () => [
|
|
2231
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
|
|
2232
|
+
])
|
|
2233
|
+
]),
|
|
2234
|
+
_: 2
|
|
2235
|
+
}, 1040, ["onClickPassive"]))
|
|
2236
|
+
], 64);
|
|
2237
|
+
}), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$4, {
|
|
2128
2238
|
key: 1,
|
|
2129
2239
|
modifiers: "inert"
|
|
2130
2240
|
}, {
|
|
@@ -2134,7 +2244,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2134
2244
|
])
|
|
2135
2245
|
]),
|
|
2136
2246
|
_: 3
|
|
2137
|
-
})) : (openBlock(), createBlock(_sfc_main$
|
|
2247
|
+
})) : (openBlock(), createBlock(_sfc_main$4, {
|
|
2138
2248
|
key: 2,
|
|
2139
2249
|
modifiers: "inert"
|
|
2140
2250
|
}, {
|