@pantograph/vue 0.23.25 → 0.23.26
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/Combobox/index.js +1 -1
- package/dist/Combobox/index.umd.cjs +1 -1
- package/dist/Combobox.vue_vue_type_style_index_0_lang-DOcOXELp.js +1 -0
- package/dist/{Combobox.vue_vue_type_style_index_0_lang-7lJ-1k2G.js → Combobox.vue_vue_type_style_index_0_lang-Oc5nUJgi.js} +153 -152
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
- package/dist/Combobox.vue_vue_type_style_index_0_lang-L-Fdp-q2.js +0 -1
package/dist/Combobox/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as s, C as t, a as x, i as C, p as a } from "../Combobox.vue_vue_type_style_index_0_lang-
|
|
1
|
+
import { _ as s, C as t, a as x, i as C, p as a } from "../Combobox.vue_vue_type_style_index_0_lang-Oc5nUJgi.js";
|
|
2
2
|
export {
|
|
3
3
|
s as Combobox,
|
|
4
4
|
t as ComboboxSizes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../Combobox.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../Combobox.vue_vue_type_style_index_0_lang-DOcOXELp.js");exports.Combobox=o._sfc_main;exports.ComboboxSizes=o.ComboboxSizes;exports.ComboboxStatuses=o.ComboboxStatuses;exports.injectComboboxContext=o.injectComboboxContext;exports.provideComboboxContext=o.provideComboboxContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),U=require("reka-ui"),G=require("./FormItem.vue_vue_type_style_index_0_lang-Bo3o8_6v.js"),ce=require("./options-CWrQ7gsa.js"),g=require("@pantograph/utils"),x=require("./index-DWw7aruo.js"),_e=require("class-variance-authority"),pe=require("./omit-CYbreqlf.js"),we=require("./Empty.vue_vue_type_style_index_0_lang-DidQV2p4.js"),Ae=require("./Skeleton.vue_vue_type_style_index_0_lang-CWNX_-Jl.js"),ve=require("./Divider.vue_vue_type_style_index_0_lang-DoEWjJx6.js"),D=require("./element-BjE0SVc4.js"),Be=require("./useInputDataStates-D1X-Whwt.js"),Ne=require("./useLazyLoading-H6VG5aE-.js"),Se=require("./Popover.vue_vue_type_style_index_0_lang-txLoIoSw.js"),Ke=require("./ScrollContainer.vue_vue_type_style_index_0_lang-BIoD2_5T.js"),Re=require("./Tree.vue_vue_type_style_index_0_lang-26mqYWer.js"),Ee=require("./uniq-DGkyiyS4.js"),Q=require("./isEmpty-bCllo8T9.js"),Fe=require("./Chip.vue_vue_type_style_index_0_lang-CtgInoR3.js"),We=require("./ChipGroup.vue_vue_type_style_index_0_lang-BVwWqy-3.js"),ye=require("./Icon.vue_vue_type_style_index_0_lang-D3cRtJNJ.js"),he=require("./Avatar.vue_vue_type_style_index_0_lang-CLZz5CmG.js"),Ge=require("./GraphicalObjectGroup.vue_vue_type_style_index_0_lang-CDFDVi-0.js"),Pe=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-BZ5qLbnJ.js"),je=require("./Input.vue_vue_type_style_index_0_lang-CWW5TIRh.js"),ke=require("@vueuse/core"),Ue=require("lodash-es"),$e=require("./MenuItem.vue_vue_type_style_index_0_lang-CYOdJYFY.js");require("@iconify/vue");const He=require("./Checkbox.vue_vue_type_style_index_0_lang-Bz-fwglK.js");require("@pantograph/tokens");const[de,Ie]=U.createContext("Combobox"),[Ye,Je]=U.createContext("_Combobox"),A=g.getBemBlock("combobox");var Qe=1/0;function Xe(p){var n=p==null?0:p.length;return n?pe.baseFlatten(p,Qe):[]}const ue=p=>G.isNumber(p)||x.isString(p);function Ze({getValue:p,arr:n,getChildren:o}){const e=[],c=(i,O)=>{i.forEach(I=>{const V=p(I);if(ue(V)){e.push({...I,_parentKeys:O,_key:V});const y=o(I);y!=null&&y.length&&c(y,[...O??[],V])}})};return c(n),e}const et=({getData:p,getModel:n,getValue:o,getChildren:e})=>{const c=t.computed(()=>Ze({arr:t.unref(p()),getChildren:e,getValue:o})),i=(a,f=!1)=>{const d=o(a);return c.value.filter(s=>{var B;if(f){const C=pe.last(s._parentKeys??[]);return C&&C===d}return(B=s._parentKeys)==null?void 0:B.includes(d)})},O=a=>{if(a&&x.isArray(a))return G.cloneDeep(a);const f=t.unref(n());return f&&x.isArray(f)?G.cloneDeep(f):[]},I=(a,f)=>{const d=O(f),s=i(a);if(s!=null&&s.length)return s.some(B=>{var l;const C=B._key;return C&&((l=d==null?void 0:d.includes)==null?void 0:l.call(d,C))})},V=(a,f)=>{const d=O(f),s=i(a);if(s!=null&&s.length)return s.every(B=>{var l;const C=B._key;return C&&((l=d==null?void 0:d.includes)==null?void 0:l.call(d,C))})},y=(a,f)=>{const d=O(f),s=i(a),B=o(a);return s!=null&&s.length?V(a)?!0:I(a)?"intermediate":!1:d.includes(B)},K=a=>ue(a)?c.value.find(f=>f._key===a):void 0;return{flattenData:c,getNodeChildren:i,isSomeChildrenSelected:I,isAllChildrenSelected:V,isSelected:y,selectValues:(a,f)=>{if(a.length){let d=O();const s=a.filter(ue);f?d.push(...s):d=d.filter(v=>!s.includes(v));const B=d.map(K).filter(v=>v&&v._parentKeys),l=Ee.uniq(Xe(B.map(v=>v._parentKeys))).filter(ue).map(K).filter(Boolean),k=[],S=[];return l.forEach(v=>{const M=o(v);V(v,d)?k.push(M):S.push(M)}),d.push(...k),Ee.uniq(d.filter(v=>!S.includes(v)))}}}},be=["sm","md","lg"],Te=["error","warning","success"],tt={key:1},ze=t.defineComponent({__name:"ComboboxInput",setup(p){const n=de();ke.whenever(()=>n.open.value&&n.headerInputElement.value,()=>{n.headerInputElement.value&&n.open.value&&n.focusOnInput()});const o=t.computed(()=>!Q.isEmpty(n.modelValue.value)),e=t.computed(()=>o.value?x.isArray(n.modelValue.value)?n.getLabelByValue(Ue.last(n.modelValue.value)):n.getLabelByValue(n.modelValue.value):n.props.placeholder),c=I=>{if(I.key==="Backspace"&&n.props.multiple&&x.isArray(n.modelValue.value)&&Q.isEmpty(n.searchModel.value)&&(n.setModelValue(n.modelValue.value.slice(0,-1)),Q.isEmpty(n.modelValue.value))){const V=setTimeout(()=>{n.focusOnInput(),clearTimeout(V)},2)}},i=g.getBemElement(A,"input"),O=_e.cva(i,{variants:{valuePlaceholder:g.generateVariantClassList("value-placeholder",i)}});return(I,V)=>(t.openBlock(),t.createBlock(t.unref(U.ComboboxInput),t.mergeProps(t.unref(n).comboboxInputBinding.value,{disabled:t.unref(n).getDisabled.value,placeholder:e.value,"as-child":"",modelValue:t.unref(n).searchModel.value,"onUpdate:modelValue":V[0]||(V[0]=y=>t.unref(n).searchModel.value=y),onKeydown:c,class:t.unref(O)({valuePlaceholder:o.value}),displayValue:()=>""}),{default:t.withCtx(()=>[t.unref(n).props.headerSearch?(t.openBlock(),t.createBlock(je._sfc_main,{key:0,ref:t.unref(n).headerInputElement,placeholder:t.unref(n).props.placeholder},{leading:t.withCtx(({iconSize:y})=>[t.createVNode(ye._sfc_main,{size:y,icon:"tabler:search",flipOnDir:"rtl"},null,8,["size"])]),_:1},8,["placeholder"])):(t.openBlock(),t.createElementBlock("input",tt))]),_:1},16,["disabled","placeholder","modelValue","class"]))}}),ot=t.defineComponent({name:ce.getComponentName("ComboboxTrigger"),props:{},setup(p,{slots:n,attrs:o}){const e=de(),c=({value:l},k)=>{if(k.stopPropagation(),l&&x.isArray(e.modelValue.value)&&!e.getDisabled.value){const S=e.modelValue.value.filter(v=>v!==l);e.setModelValue(S)}},i=g.getBemElement(A,"trigger"),O=_e.cva(i,{variants:{size:g.generateVariantClassList(be,i),headerSearch:g.generateVariantClassList("header-search",i),status:g.generateVariantClassList(Te,i),bordered:g.generateVariantClassList("bordered",i),multiple:g.generateVariantClassList("multiple",i),contentFit:g.generateVariantClassList("content-fit",i),wrapped:g.generateVariantClassList("wrapped",i),filled:g.generateVariantClassList("filled",i)}}),I=t.computed(()=>{switch(e.getSize.value){case"sm":return"2xsm";case"md":default:return"xsm"}}),V=t.computed(()=>{if(!e.props.multiple&&x.isString(e.modelValue.value)&&!Q.isEmpty(e.modelValue.value))return e.getOptionByValue(e.modelValue.value)}),y=(l=V.value)=>{if(e.props.selectedItemIconAsTrailingIcon&&x.isObject(l)&&"icon"in l)return l.icon},K=t.computed(()=>y()),R=t.computed(()=>{if(!e.props.noTrailing)return e.props.trailingIcon}),a=t.computed(()=>{var S,v;const l=G.cloneDeep(e.modelValue.value),k=x.isArray(e.modelValue.value);return{modelValue:l,open:G.cloneDeep(e.open.value),option:k?void 0:e.getOptionByValue(e.modelValue.value),options:k?(v=(S=e.modelValue.value).map)==null?void 0:v.call(S,e.getOptionByValue).filter(Boolean):void 0}}),f=()=>{e.onOpenChange(!e.open.value)},d=l=>{e.props.headerSearch},s=t.computed(()=>({disabled:e.getDisabled.value,tabindex:e.getDisabled.value||!e.props.headerSearch?-1:0,reference:e.props.reference,"data-disabled":e.getDisabled.value?"":void 0,"aria-disabled":e.getDisabled.value??void 0,"aria-label":"Show popup","aria-haspopup":"listbox","aria-expanded":e.open.value,"aria-controls":e.contentId,"data-state":e.open.value?"open":"closed",class:[O({size:e.getSize.value,status:e.getStatus.value==="success"&&Q.isEmpty(e.modelValue.value)?void 0:e.getStatus.value,bordered:e.props.bordered,multiple:e.props.multiple,contentFit:e.props.contentFit,wrapped:e.props.wrapped,filled:!Q.isEmpty(e.modelValue.value),headerSearch:e.props.headerSearch}),e.props.triggerCls],...o})),B=(l,k=I.value)=>t.h(ye._sfc_main,{icon:l,size:k}),C=()=>{var S;let l;const k=(S=n.triggerTrailing)==null?void 0:S.call(n,a.value);if(D.isEmptyElement(k)?R.value&&(l=B(R.value)):l=k,l)return t.h("div",{class:[g.getBemElement(i,"trailing"),e.props.triggerTrailingCls]},l)};return()=>{var v;const l=(v=n.trigger)==null?void 0:v.call(n,a.value),S=(()=>{if(D.isEmptyElement(l))return!1;const M=D.filterEmpty(l)??null,N=M.length===1?M[0]:M;return N?D.isValidElement(N)&&!D.isFragment(N):!0})();return t.h(U.ComboboxAnchor,{...s.value,...e.comboboxTriggerBinding.value,asChild:S,as:S?"template":"button",key:String(S),onKeyUp:d,onClick:f},()=>{if(!D.isEmptyElement(l))return l;const M=z=>{var Y,j;const w=e.getOptionByValue(z);return t.h(he._sfc_main,{...w?((j=(Y=e.props).getTagProps)==null?void 0:j.call(Y,w))??{}:{},size:e.getTagSize.value})},N=z=>{var Y,j;const w=e.getOptionByValue(z);return t.h(Pe._sfc_main,{...w?((j=(Y=e.props).getTagProps)==null?void 0:j.call(Y,w))??{}:{},size:e.getTagSize.value})},X=()=>{if(!e.props.multiple&&!x.isArray(e.modelValue.value)&&e.modelValue.value&&(e.props.tagRenderMode&&["avatar","go"].includes(e.props.tagRenderMode)||K.value||e.props.leadingIcon)){let z;if(e.props.tagRenderMode==="avatar"?z=M(e.modelValue.value):e.props.tagRenderMode==="go"?z=N(e.modelValue.value):K.value?z=B(K.value):e.props.leadingIcon&&(z=B(e.props.leadingIcon)),!D.isEmptyElement(z))return t.h("div",{class:[g.getBemElement(i,"leading"),e.props.triggerLeadingCls]},z)}},ge=()=>{const z=[],w=[g.getBemElement(i,"tags"),e.props.triggerContentCls,Q.isEmpty(e.modelValue.value)?e.props.triggerContentPlaceholderCls:e.props.triggerContentValueCls],j=(()=>{if(e.props.multiple&&x.isArray(e.modelValue.value)){if(e.props.tagRenderMode==="avatar")return t.h(he._sfc_main$1,{maxCount:e.props.maxCount,size:e.getTagSize.value,closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:w},()=>e.modelValue.value.map(M));if(e.props.tagRenderMode==="go")return t.h(Ge._sfc_main,{maxCount:e.props.maxCount,size:e.getTagSize.value,closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:w},()=>e.modelValue.value.map(N));if(e.props.tagRenderMode==="chip")return t.h(We._sfc_main,{maxCount:e.props.maxCount,size:e.getTagSize.value,color:"primary",closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:w,onClose:c},()=>e.modelValue.value.map(ee=>{var oe,ae;const te=()=>e.getLabelByValue(ee),re=({size:se})=>{const ie=y(e.getOptionByValue(ee))??e.props.leadingIcon;return ie?B(ie,se):null},J=e.getOptionByValue(ee);return t.h(Fe._sfc_main,{...J?((ae=(oe=e.props).getTagProps)==null?void 0:ae.call(oe,J))??{}:{},value:ee,class:[g.getBemElement(i,"tag"),e.props.tagCls],closeIconCls:g.getBemElement(i,"tag__close")},{text:te,leading:re})}))}})();return j&&z.push(j),e.props.headerSearch||z.push(t.h(ze)),t.h("div",{class:g.getBemElement(i,"content")},z)},Z=[],$=X();D.isEmptyElement($)||Z.push($),Z.push(ge());const ne=C();return D.isEmptyElement(ne)||Z.push(ne),Z})}}}),nt=t.defineComponent({__name:"ComboboxLabel",setup(p){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(g.getBemElement)(t.unref(A),"label"))},[t.renderSlot(n.$slots,"default")],2))}}),Oe=t.defineComponent({name:ce.getComponentName("SelectOption"),props:{option:{type:[Object,String],required:!0}},slots:Object,setup(p,{slots:n}){const o=de(),e=t.computed(()=>{switch(o.getSize.value){case"sm":return"2xsm";case"lg":return"sm";case"md":default:return"xsm"}}),c=t.computed(()=>o.getOptionValue(p.option)),i=t.computed(()=>o.getOptionNoCheckbox(p.option)),O=t.computed(()=>o.getOptionClear(p.option)),I=t.computed(()=>o.getOptionSingle(p.option)),V=t.computed(()=>o.getOptionLabel(p.option)),y=t.computed(()=>o.getOptionIcon(p.option)),K=t.computed(()=>o.props.tree?void 0:o.getOptionDescription(p.option)),R=t.computed(()=>o.getOptionDisabled(p.option)),a=t.computed(()=>o.isItemSelected(c.value)),f=g.getBemElement(A,"option"),d=()=>{if(!(o.props.tree||!c.value||R.value))if(o.props.multiple)if(O.value)o.setModelValue([]),o.emit("select",void 0,!1);else if(I.value)o.setModelValue([c.value]),o.emit("select",c.value,!0);else{let s=x.isArray(o.modelValue.value)?o.modelValue.value:[];const B=s.includes(c.value);s.length===1&&o.getSingleByValue(s[0])&&c.value!==s[0]&&(s=[]),B?(o.setModelValue(s.filter(C=>C!==c.value)),o.emit("select",c.value,!0)):(o.setModelValue([...s,c.value]),o.emit("select",c.value,!1))}else O.value?(o.setModelValue(void 0),o.emit("select",void 0,!1)):(o.setModelValue(c.value),o.emit("select",c.value,!0))};if(!p.option)throw new Error("option is required");return()=>{const s=C=>{var S,v,M,N,X;const l=[];!o.props.tree&&o.props.multiple&&o.props.checkbox&&!i.value&&l.push(t.h(He._sfc_main,{modelValue:a.value,size:C.checkboxSize,disabled:R.value}));const k=(S=n.leading)==null?void 0:S.call(n,{option:p.option});return D.isEmptyElement(k)?o.props.tagRenderMode==="avatar"?l.push(t.h(he._sfc_main,{...((M=(v=o.props).getTagProps)==null?void 0:M.call(v,p.option))??{},size:o.getTagSize.value})):o.props.tagRenderMode==="go"?l.push(t.h(Pe._sfc_main,{...((X=(N=o.props).getTagProps)==null?void 0:X.call(N,p.option))??{},size:o.getTagSize.value})):y.value&&l.push(t.h(ye._sfc_main,{icon:y.value,size:e.value})):l.push(k),D.isEmptyElement(l)?null:l};return(()=>{const C=!!K.value;return t.h($e._sfc_main$1,{class:f,description:K.value,title:V.value,key:c.value,selected:a.value,unFocusable:!0,leadingCenter:!C,size:o.getSize.value,disabled:R.value,onClick:d},{leading:s,trailing:()=>{var l;return(l=n.trailing)==null?void 0:l.call(n,{option:p.option})}})})()}}}),rt=t.defineComponent({name:ce.getComponentName("ComboboxWrapper"),setup(p,{slots:n}){const o=Ye(),e=U.injectComboboxRootContext(),c=t.ref();Ne.useLazyLoading({target:c});const i=t.ref(),O=Se.getPopoverPortalProps({triggerRef:i,props:o.props}),{getFlipOnDir:I,getDir:V}=x.useConfig(),y=I("reversePlacementOnDir"),K=V(),R=Se.getPopoverContentProps({props:o.props,flip:y,emitsAsProps:o.emitsAsProps,_dir:K,controlAutoFocus:!1,extraPropNames:["bodyLock","position"]}),a=({key:r,getterKey:u,defaultValue:h,noReturnOption:P})=>_=>{const L=x.isFunction(h)?h(_):h;if(x.isObject(_)){const F=_[r]??L,W=u&&o.props[u];if(W){if(x.isString(W))return _[W]??F;if(x.isFunction(W))return W(_)??F}return F}return x.isString(_)&&!P?_??L:L},f=a({getterKey:"getValue",key:"value"}),d=a({getterKey:"getNoCheckbox",key:"noCheckbox"}),s=a({getterKey:"getSingle",key:"single",noReturnOption:!0}),B=a({getterKey:"getClear",key:"clear",noReturnOption:!0}),C=a({getterKey:"getLabel",key:"label",defaultValue:f}),l=a({getterKey:"getIcon",key:"icon",noReturnOption:!0}),k=a({getterKey:"getDescription",key:"description",noReturnOption:!0}),S=a({getterKey:"getDisabled",key:"disabled",defaultValue:!1,noReturnOption:!0}),v=a({getterKey:"getGroupLabel",key:"label",noReturnOption:!0}),M=a({getterKey:"getGroupOptions",key:"options",noReturnOption:!0}),N=r=>{const u=h=>{if(h!=null&&h.length&&r)for(const P of h){if(f(P)===r)return P;const _=M(P);if(_!=null&&_.length){const L=u(_);if(L)return L}}};return u(o.props.options)},X=r=>{const u=N(r);return u?C(u)??r:r},ge=r=>{const u=N(r);return u?s(u)??!1:!1},{contains:Z}=U.useFilter({sensitivity:"base"}),$=t.computed(()=>{const r=u=>u==null?void 0:u.map(h=>{const P=C(h),_=f(h),L=S(h),F=v(h),W=!o.searchModel.value||P&&Z(P,o.searchModel.value),m=M(h),E=!o.props.tree||_;if(m&&E){const b=r(m);if(b!=null&&b.length||W)return{groupLabel:F,title:P,key:_,disabled:L,children:b,_option:h}}return W&&E?{title:P,key:_,disabled:L,_option:h}:null}).filter(Boolean);if(o.props.options)return r(o.props.options)}),{getDisabled:ne,getStatus:z,getSize:w}=Be.useFormInput({getDisabled:()=>o.props.disabled,getSize:()=>o.props.size,getStatus:()=>o.props.status}),Y=t.computed(()=>{switch(w.value){case"sm":return"xsm";case"lg":return"md";case"md":default:return"sm"}}),{inputBindings:j,rootBindings:ee}=Be.UseInputDataStates({getDisabled:()=>ne.value}),te=t.ref(),re=()=>{var r,u,h,P,_,L,F;e.open.value&&e.inputElement.value&&(o.props.headerSearch&&((r=te.value)!=null&&r.input)?document.activeElement!==((u=te.value)==null?void 0:u.input)&&((_=(P=(h=te.value)==null?void 0:h.input)==null?void 0:P.focus)==null||_.call(P)):document.activeElement!==e.inputElement.value&&((F=(L=e.inputElement.value)==null?void 0:L.focus)==null||F.call(L)))},J=r=>{e.modelValue.value=r,o.emit("update:modelValue",r)},oe=r=>r===void 0?!1:Array.isArray(e.modelValue.value)?!!(r&&e.modelValue.value.includes(r)):e.modelValue.value===r;Ie({...o,getOptionValue:f,getOptionLabel:C,getOptionSingle:s,getOptionClear:B,getOptionNoCheckbox:d,getOptionDescription:k,getOptionDisabled:S,getOptionIcon:l,getOptionByValue:N,isItemSelected:oe,getLabelByValue:X,getSingleByValue:ge,focusOnInput:re,setModelValue:J,headerInputElement:te,getDisabled:ne,getStatus:z,getSize:w,getTagSize:Y,comboboxInputBinding:j,comboboxTriggerBinding:ee,...e,modelValue:e.modelValue}),t.watch(()=>[o.props.clearOnChangeMultiple,o.props.multiple],()=>{o.props.clearOnChangeMultiple&&J(void 0)});const ae=t.computed(()=>{const r=o.props.scrollContainerProps??{};return{...r,areaCls:[g.getBemElement(A,"scroll_area"),r==null?void 0:r.class,r==null?void 0:r.areaCls]}}),se=g.getBemElement(A,"popup"),ie=_e.cva(se,{variants:{size:g.generateVariantClassList(be,se)}}),me=r=>{if(Number(r)>0)return`${r}px`;if(typeof r=="string")return r},Le=t.computed(()=>me(o.props.popupWidth)),De=t.computed(()=>me(o.props.popupHeight)),Ce=t.computed(()=>me(o.props.minWidth)),xe=t.computed(()=>({type:w.value==="sm"?"simple":"advance",...pe.omit(o.props.emptyProps??{},"class")})),Me=t.computed(()=>pe.omit(o.props.skeletonProps??{},"class")),{selectValues:qe}=et({getValue:r=>r==null?void 0:r.key,getChildren:r=>r==null?void 0:r.children,getModel:()=>G.cloneDeep(e.modelValue.value),getData:()=>G.cloneDeep($.value??[])});return()=>{var F,W;const r=m=>t.h(Oe,{option:m},{trailing:n.optionTrailing,leading:n.optionLeading}),u=[];let h;if(o.props.tree){const E=x.isArray(e.modelValue.value)?e.modelValue.value:e.modelValue.value?[e.modelValue.value]:[];h=t.h(Re._sfc_main,{data:$.value??[],selectable:!0,checkbox:o.props.multiple&&o.props.checkbox,multiple:o.props.multiple,defaultExpandAll:!0,syncCheckboxAndSelect:o.props.multiple,showLine:!0,modelValue:E,checkedKeys:E,onExpand:re,onSelect:(b,q,T)=>{if(o.props.multiple){const H=x.isArray(T)?T:[T];J(qe(H,q))}else J(T)},class:"w-full"},{title:b=>r(b._option)}),u.push(h)}else{let m=!1;const E=[];if(($.value??[]).forEach(b=>{var q;if((q=b.children)!=null&&q.length){const T=[];b.children.forEach(H=>{const le=r(H._option);oe(f(H._option))&&o.props.sortSelectedItems?E.push(le):T.push(le)}),T.length&&((m||u.length)&&(u.push(t.h(ve._sfc_main)),m=!1),b.groupLabel&&u.push(t.h(nt,{class:o.props.labelCls},()=>b.groupLabel)),u.push(...T),m=!0)}else{const T=r(b._option);oe(f(b._option))&&o.props.sortSelectedItems?E.push(T):(m&&(u.push(t.h(ve._sfc_main)),m=!1),u.push(T))}}),o.props.sortSelectedItems&&E.length){const b=!!u.length;u.splice(0,0,...E),b&&u.splice(E.length,0,t.h(ve._sfc_main))}}const P=D.flattenChildrenByType(h?[h]:u,Oe).filter(m=>{var E;return x.isObject(m==null?void 0:m.props)&&((E=m==null?void 0:m.props)==null?void 0:E.option)}),_=!!(o.props.tree&&((F=$.value)!=null&&F.length)||P!=null&&P.length),L=()=>{var E,b;const m=[];if(_||o.props.loading){const q=[];if(_&&q.push(...u),o.props.loading){const T=(E=n.loading)==null?void 0:E.call(n,{});if(!D.isEmptyElement(T))q.push(T);else{const H=new Array(_?2:o.props.loadingRowCount).fill(1);q.push(...H.map(()=>t.h(Ae._sfc_main,{size:w.value,class:[g.getBemElement(A,"skeleton"),o.props.skeletonCls],...Me.value})))}}m.push(t.h("div",{class:[g.getBemElement(A,"options"),o.props.optionsCls]},q))}else if(!_){const q=(b=n.empty)==null?void 0:b.call(n,xe.value);D.isEmptyElement(q)?m.push(t.h(we._sfc_main,{class:[g.getBemElement(A,"empty"),o.props.emptyCls],...xe.value},{title:n.emptyTitle,description:n.emptyDescription,actions:n.emptyActions,image:n.emptyImage})):m.push(q)}return o.props.lazyLoading&&m.push(t.h("div",{class:g.getBemElement(A,"lazy_loading")},t.h("div",{class:g.getBemElement(A,"lazy_loading_trigger"),ref:c}))),m};return[t.h(ot,{ref:i,...o.attrs,style:{...((W=o.attrs)==null?void 0:W.style)??{},"--ptc-combobox-trigger-min-w":Ce.value}},{trigger:n.trigger,triggerTrailing:n.triggerTrailing}),t.h(U.ComboboxPortal,O.value,()=>t.h(U.ComboboxContent,{...R.value,vShow:e.open.value,class:[ie(o.props),o.props.popupCls],style:{"--ptc-combobox-popup-width":o.props.samePopupWidth?void 0:Le.value,"--ptc-combobox-popup-height":De.value,"--ptc-combobox-trigger-min-w":Ce.value},onClick:re},()=>{var T,H,le,Ve;const m=[],E=(H=n.header)==null?void 0:H.call(n,{isEmpty:!((T=$.value)!=null&&T.length),search:o.searchModel.value}),b=!D.isEmptyElement(E);if(o.props.headerSearch||b){const fe=[];b&&fe.push(E),o.props.headerSearch&&fe.push(t.h(ze)),m.push(t.h("div",{class:g.getBemElement(A,"header")},fe))}m.push(t.h(Ke._sfc_main,ae.value,L));const q=(Ve=n.footer)==null?void 0:Ve.call(n,{isEmpty:!((le=$.value)!=null&&le.length),search:o.searchModel.value});return D.isEmptyElement(q)||m.push(t.h("div",{class:g.getBemElement(A,"footer")},q)),m}))]}}}),lt=t.defineComponent({...ce.getComponentOptions("Combobox"),__name:"Combobox",props:{size:{default:"md"},status:{},multiple:{type:Boolean,default:void 0},checkbox:{type:Boolean,default:!0},tagRenderMode:{default:"chip"},getTagProps:{},tree:{type:Boolean},contentFit:{type:Boolean},wrapped:{type:Boolean},sortSelectedItems:{type:Boolean},noTrailing:{type:Boolean},leadingIcon:{},trailingIcon:{default:"tabler:chevron-down"},selectedItemIconAsTrailingIcon:{type:Boolean,default:!0},maxCount:{},to:{},placeholder:{},indicatorIcon:{default:"tabler:check"},options:{},getDisabled:{},getLabel:{},getDescription:{},getValue:{},getNoCheckbox:{},getSingle:{},getClear:{},getGroupOptions:{},getGroupLabel:{},getIcon:{},placement:{default:"bottom-start"},reversePlacementOnDir:{},loading:{type:Boolean},skeletonProps:{},loadingRowCount:{default:10},lazyLoading:{type:Boolean},bordered:{type:Boolean,default:!0},clearOnChangeMultiple:{type:Boolean,default:!0},triggerCls:{},triggerLeadingCls:{},triggerContentCls:{},triggerContentPlaceholderCls:{},triggerContentValueCls:{},triggerTrailingCls:{},itemLeadingCls:{},optionCls:{},tagCls:{},popupCls:{},labelCls:{},optionsCls:{},optionTextCls:{},optionContentCls:{},emptyCls:{},skeletonCls:{},scrollContainerProps:{},emptyProps:{},samePopupWidth:{type:Boolean,default:!0},popupHeight:{default:384},popupWidth:{},minWidth:{},headerSearch:{type:Boolean},search:{},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},resetSearchTermOnBlur:{type:Boolean,default:!0},resetSearchTermOnSelect:{type:Boolean,default:!0},modelValue:{},defaultValue:{},dir:{},disabled:{type:Boolean,default:void 0},highlightOnHover:{type:Boolean},by:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},reference:{},forceMount:{type:Boolean,default:void 0},position:{default:"popper"},bodyLock:{type:Boolean},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean,default:void 0},collisionBoundary:{},collisionPadding:{default:4},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean,default:void 0},positionStrategy:{default:"fixed"},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean,default:void 0},prioritizePosition:{type:Boolean,default:void 0},disableOutsidePointerEvents:{type:Boolean},defer:{type:Boolean}},emits:["update:search","select","update:modelValue","highlight","update:open","escapeKeyDown","pointerDownOutside","focusOutside","interactOutside"],setup(p,{emit:n}){const o=p,e=n,c=U.useEmitAsProps(e),i=t.computed(()=>G.omitBy({...G.pick(o,"open","defaultOpen","defaultValue","modelValue","by","dir","multiple","disabled"),...G.pick(c,"onUpdate:modelValue","onUpdate:open"),ignoreFilter:!0},G.isUndefined)),O=ke.useVModel(o,"search",e,{passive:o.search===void 0});t.watch(()=>o.open,y=>{y||(O.value=void 0)});const I=t.useSlots(),V=t.useAttrs();return Je({attrs:V,props:o,emit:e,searchModel:O,emitsAsProps:c}),(y,K)=>(t.openBlock(),t.createBlock(t.unref(U.ComboboxRoot),t.mergeProps(i.value,{class:t.unref(A)}),{default:t.withCtx(()=>[t.createVNode(t.unref(rt),null,t.createSlots({_:2},[t.renderList(Object.keys(I),R=>({name:R,fn:t.withCtx(a=>[t.renderSlot(y.$slots,R,t.normalizeProps(t.guardReactiveProps(a)))])}))]),1024)]),_:3},16,["class"]))}});exports.ComboboxSizes=be;exports.ComboboxStatuses=Te;exports._sfc_main=lt;exports.injectComboboxContext=de;exports.provideComboboxContext=Ie;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed as m, unref as
|
|
1
|
+
import { computed as m, unref as L, defineComponent as re, createBlock as Ve, openBlock as pe, mergeProps as we, withCtx as me, createElementBlock as Ee, createVNode as Ke, h as l, normalizeClass as Ye, renderSlot as Re, ref as ye, watch as Ne, useSlots as Je, useAttrs as Qe, createSlots as Xe, renderList as Ze, normalizeProps as et, guardReactiveProps as tt } from "vue";
|
|
2
2
|
import { createContext as Ae, ComboboxInput as ot, ComboboxAnchor as nt, injectComboboxRootContext as at, useFilter as rt, ComboboxPortal as lt, ComboboxContent as st, useEmitAsProps as it, ComboboxRoot as pt } from "reka-ui";
|
|
3
3
|
import { g as ut, h as ae, o as ct, f as Te, j as dt } from "./FormItem.vue_vue_type_style_index_0_lang-BpgRONei.js";
|
|
4
4
|
import { a as xe, g as gt } from "./options-D4et5euX.js";
|
|
@@ -30,7 +30,7 @@ import { a as Nt } from "./MenuItem.vue_vue_type_style_index_0_lang-7T_SPKSm.js"
|
|
|
30
30
|
import "@iconify/vue";
|
|
31
31
|
import { _ as At } from "./Checkbox.vue_vue_type_style_index_0_lang-aDK0Pvm-.js";
|
|
32
32
|
import "@pantograph/tokens";
|
|
33
|
-
const [Be, $t] = Ae("Combobox"), [Ft, Wt] = Ae("_Combobox"),
|
|
33
|
+
const [Be, $t] = Ae("Combobox"), [Ft, Wt] = Ae("_Combobox"), R = mt("combobox");
|
|
34
34
|
var Gt = 1 / 0;
|
|
35
35
|
function Ut(u) {
|
|
36
36
|
var o = u == null ? 0 : u.length;
|
|
@@ -42,13 +42,13 @@ function jt({
|
|
|
42
42
|
arr: o,
|
|
43
43
|
getChildren: t
|
|
44
44
|
}) {
|
|
45
|
-
const e = [], c = (i,
|
|
45
|
+
const e = [], c = (i, B) => {
|
|
46
46
|
i.forEach((T) => {
|
|
47
47
|
const _ = u(T);
|
|
48
48
|
if (ge(_)) {
|
|
49
|
-
e.push({ ...T, _parentKeys:
|
|
50
|
-
const
|
|
51
|
-
|
|
49
|
+
e.push({ ...T, _parentKeys: B, _key: _ });
|
|
50
|
+
const y = t(T);
|
|
51
|
+
y != null && y.length && c(y, [...B ?? [], _]);
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
};
|
|
@@ -61,7 +61,7 @@ const Ht = ({
|
|
|
61
61
|
getChildren: e
|
|
62
62
|
}) => {
|
|
63
63
|
const c = m(
|
|
64
|
-
() => jt({ arr:
|
|
64
|
+
() => jt({ arr: L(u()), getChildren: e, getValue: t })
|
|
65
65
|
), i = (r, f = !1) => {
|
|
66
66
|
const d = t(r);
|
|
67
67
|
return c.value.filter((s) => {
|
|
@@ -72,13 +72,13 @@ const Ht = ({
|
|
|
72
72
|
}
|
|
73
73
|
return (x = s._parentKeys) == null ? void 0 : x.includes(d);
|
|
74
74
|
});
|
|
75
|
-
},
|
|
75
|
+
}, B = (r) => {
|
|
76
76
|
if (r && U(r))
|
|
77
77
|
return ae(r);
|
|
78
|
-
const f =
|
|
78
|
+
const f = L(o());
|
|
79
79
|
return f && U(f) ? ae(f) : [];
|
|
80
80
|
}, T = (r, f) => {
|
|
81
|
-
const d =
|
|
81
|
+
const d = B(f), s = i(r);
|
|
82
82
|
if (s != null && s.length)
|
|
83
83
|
return s.some((x) => {
|
|
84
84
|
var a;
|
|
@@ -86,15 +86,15 @@ const Ht = ({
|
|
|
86
86
|
return V && ((a = d == null ? void 0 : d.includes) == null ? void 0 : a.call(d, V));
|
|
87
87
|
});
|
|
88
88
|
}, _ = (r, f) => {
|
|
89
|
-
const d =
|
|
89
|
+
const d = B(f), s = i(r);
|
|
90
90
|
if (s != null && s.length)
|
|
91
91
|
return s.every((x) => {
|
|
92
92
|
var a;
|
|
93
93
|
const V = x._key;
|
|
94
94
|
return V && ((a = d == null ? void 0 : d.includes) == null ? void 0 : a.call(d, V));
|
|
95
95
|
});
|
|
96
|
-
},
|
|
97
|
-
const d =
|
|
96
|
+
}, y = (r, f) => {
|
|
97
|
+
const d = B(f), s = i(r), x = t(r);
|
|
98
98
|
return s != null && s.length ? _(r) ? !0 : T(r) ? "intermediate" : !1 : d.includes(x);
|
|
99
99
|
}, A = (r) => ge(r) ? c.value.find((f) => f._key === r) : void 0;
|
|
100
100
|
return {
|
|
@@ -102,16 +102,16 @@ const Ht = ({
|
|
|
102
102
|
getNodeChildren: i,
|
|
103
103
|
isSomeChildrenSelected: T,
|
|
104
104
|
isAllChildrenSelected: _,
|
|
105
|
-
isSelected:
|
|
105
|
+
isSelected: y,
|
|
106
106
|
selectValues: (r, f) => {
|
|
107
107
|
if (r.length) {
|
|
108
|
-
let d =
|
|
108
|
+
let d = B();
|
|
109
109
|
const s = r.filter(ge);
|
|
110
110
|
f ? d.push(...s) : d = d.filter((v) => !s.includes(v));
|
|
111
111
|
const x = d.map(A).filter((v) => v && v._parentKeys), a = De(Ut(x.map((v) => v._parentKeys))).filter(ge).map(A).filter(Boolean), I = [], S = [];
|
|
112
112
|
return a.forEach((v) => {
|
|
113
|
-
const
|
|
114
|
-
_(v, d) ? I.push(
|
|
113
|
+
const w = t(v);
|
|
114
|
+
_(v, d) ? I.push(w) : S.push(w);
|
|
115
115
|
}), d.push(...I), De(d.filter((v) => !S.includes(v)));
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -132,32 +132,32 @@ const Ht = ({
|
|
|
132
132
|
o.focusOnInput(), clearTimeout(_);
|
|
133
133
|
}, 2);
|
|
134
134
|
}
|
|
135
|
-
}, i = k(
|
|
135
|
+
}, i = k(R, "input"), B = Se(i, {
|
|
136
136
|
variants: {
|
|
137
137
|
valuePlaceholder: H("value-placeholder", i)
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
|
-
return (T, _) => (pe(), Ve(
|
|
141
|
-
disabled:
|
|
140
|
+
return (T, _) => (pe(), Ve(L(ot), we(L(o).comboboxInputBinding.value, {
|
|
141
|
+
disabled: L(o).getDisabled.value,
|
|
142
142
|
placeholder: e.value,
|
|
143
143
|
"as-child": "",
|
|
144
|
-
modelValue:
|
|
145
|
-
"onUpdate:modelValue": _[0] || (_[0] = (
|
|
144
|
+
modelValue: L(o).searchModel.value,
|
|
145
|
+
"onUpdate:modelValue": _[0] || (_[0] = (y) => L(o).searchModel.value = y),
|
|
146
146
|
onKeydown: c,
|
|
147
|
-
class:
|
|
147
|
+
class: L(B)({
|
|
148
148
|
valuePlaceholder: t.value
|
|
149
149
|
}),
|
|
150
150
|
displayValue: () => ""
|
|
151
151
|
}), {
|
|
152
152
|
default: me(() => [
|
|
153
|
-
|
|
153
|
+
L(o).props.headerSearch ? (pe(), Ve(wt, {
|
|
154
154
|
key: 0,
|
|
155
|
-
ref:
|
|
156
|
-
placeholder:
|
|
155
|
+
ref: L(o).headerInputElement,
|
|
156
|
+
placeholder: L(o).props.placeholder
|
|
157
157
|
}, {
|
|
158
|
-
leading: me(({ iconSize:
|
|
158
|
+
leading: me(({ iconSize: y }) => [
|
|
159
159
|
Ke(Oe, {
|
|
160
|
-
size:
|
|
160
|
+
size: y,
|
|
161
161
|
icon: "tabler:search",
|
|
162
162
|
flipOnDir: "rtl"
|
|
163
163
|
}, null, 8, ["size"])
|
|
@@ -182,7 +182,7 @@ const Ht = ({
|
|
|
182
182
|
const S = e.modelValue.value.filter((v) => v !== a);
|
|
183
183
|
e.setModelValue(S);
|
|
184
184
|
}
|
|
185
|
-
}, i = k(
|
|
185
|
+
}, i = k(R, "trigger"), B = Se(i, {
|
|
186
186
|
variants: {
|
|
187
187
|
size: H(We, i),
|
|
188
188
|
headerSearch: H("header-search", i),
|
|
@@ -204,10 +204,10 @@ const Ht = ({
|
|
|
204
204
|
}), _ = m(() => {
|
|
205
205
|
if (!e.props.multiple && fe(e.modelValue.value) && !X(e.modelValue.value))
|
|
206
206
|
return e.getOptionByValue(e.modelValue.value);
|
|
207
|
-
}),
|
|
207
|
+
}), y = (a = _.value) => {
|
|
208
208
|
if (e.props.selectedItemIconAsTrailingIcon && _e(a) && "icon" in a)
|
|
209
209
|
return a.icon;
|
|
210
|
-
}, A = m(() =>
|
|
210
|
+
}, A = m(() => y()), $ = m(() => {
|
|
211
211
|
if (!e.props.noTrailing)
|
|
212
212
|
return e.props.trailingIcon;
|
|
213
213
|
}), r = m(() => {
|
|
@@ -234,7 +234,7 @@ const Ht = ({
|
|
|
234
234
|
"aria-expanded": e.open.value,
|
|
235
235
|
"aria-controls": e.contentId,
|
|
236
236
|
"data-state": e.open.value ? "open" : "closed",
|
|
237
|
-
class: [
|
|
237
|
+
class: [B({
|
|
238
238
|
size: e.getSize.value,
|
|
239
239
|
status: e.getStatus.value === "success" && X(e.modelValue.value) ? void 0 : e.getStatus.value,
|
|
240
240
|
bordered: e.props.bordered,
|
|
@@ -261,8 +261,8 @@ const Ht = ({
|
|
|
261
261
|
var v;
|
|
262
262
|
const a = (v = o.trigger) == null ? void 0 : v.call(o, r.value), S = (() => {
|
|
263
263
|
if (F(a)) return !1;
|
|
264
|
-
const
|
|
265
|
-
return
|
|
264
|
+
const w = Ct(a) ?? null, N = w.length === 1 ? w[0] : w;
|
|
265
|
+
return N ? Vt(N) && !_t(N) : !0;
|
|
266
266
|
})();
|
|
267
267
|
return l(nt, {
|
|
268
268
|
...s.value,
|
|
@@ -275,30 +275,30 @@ const Ht = ({
|
|
|
275
275
|
}, () => {
|
|
276
276
|
if (!F(a))
|
|
277
277
|
return a;
|
|
278
|
-
const
|
|
278
|
+
const w = (M) => {
|
|
279
279
|
var J, j;
|
|
280
|
-
const
|
|
280
|
+
const K = e.getOptionByValue(M);
|
|
281
281
|
return l($e, {
|
|
282
|
-
...
|
|
282
|
+
...K ? ((j = (J = e.props).getTagProps) == null ? void 0 : j.call(J, K)) ?? {} : {},
|
|
283
283
|
size: e.getTagSize.value
|
|
284
284
|
});
|
|
285
|
-
},
|
|
285
|
+
}, N = (M) => {
|
|
286
286
|
var J, j;
|
|
287
|
-
const
|
|
287
|
+
const K = e.getOptionByValue(M);
|
|
288
288
|
return l(Fe, {
|
|
289
|
-
...
|
|
289
|
+
...K ? ((j = (J = e.props).getTagProps) == null ? void 0 : j.call(J, K)) ?? {} : {},
|
|
290
290
|
size: e.getTagSize.value
|
|
291
291
|
});
|
|
292
292
|
}, Z = () => {
|
|
293
293
|
if (!e.props.multiple && !U(e.modelValue.value) && e.modelValue.value && (e.props.tagRenderMode && ["avatar", "go"].includes(e.props.tagRenderMode) || A.value || e.props.leadingIcon)) {
|
|
294
294
|
let M;
|
|
295
|
-
if (e.props.tagRenderMode === "avatar" ? M =
|
|
295
|
+
if (e.props.tagRenderMode === "avatar" ? M = w(e.modelValue.value) : e.props.tagRenderMode === "go" ? M = N(e.modelValue.value) : A.value ? M = x(A.value) : e.props.leadingIcon && (M = x(e.props.leadingIcon)), !F(M))
|
|
296
296
|
return l("div", {
|
|
297
297
|
class: [k(i, "leading"), e.props.triggerLeadingCls]
|
|
298
298
|
}, M);
|
|
299
299
|
}
|
|
300
300
|
}, ve = () => {
|
|
301
|
-
const M = [],
|
|
301
|
+
const M = [], K = [k(i, "tags"), e.props.triggerContentCls, X(e.modelValue.value) ? e.props.triggerContentPlaceholderCls : e.props.triggerContentValueCls], j = (() => {
|
|
302
302
|
if (e.props.multiple && U(e.modelValue.value)) {
|
|
303
303
|
if (e.props.tagRenderMode === "avatar")
|
|
304
304
|
return l(Dt, {
|
|
@@ -307,8 +307,8 @@ const Ht = ({
|
|
|
307
307
|
closeable: !e.getDisabled.value,
|
|
308
308
|
noPopover: !0,
|
|
309
309
|
noWrap: !e.props.wrapped,
|
|
310
|
-
class:
|
|
311
|
-
}, () => e.modelValue.value.map(
|
|
310
|
+
class: K
|
|
311
|
+
}, () => e.modelValue.value.map(w));
|
|
312
312
|
if (e.props.tagRenderMode === "go")
|
|
313
313
|
return l(Lt, {
|
|
314
314
|
maxCount: e.props.maxCount,
|
|
@@ -316,8 +316,8 @@ const Ht = ({
|
|
|
316
316
|
closeable: !e.getDisabled.value,
|
|
317
317
|
noPopover: !0,
|
|
318
318
|
noWrap: !e.props.wrapped,
|
|
319
|
-
class:
|
|
320
|
-
}, () => e.modelValue.value.map(
|
|
319
|
+
class: K
|
|
320
|
+
}, () => e.modelValue.value.map(N));
|
|
321
321
|
if (e.props.tagRenderMode === "chip")
|
|
322
322
|
return l(Mt, {
|
|
323
323
|
maxCount: e.props.maxCount,
|
|
@@ -326,14 +326,14 @@ const Ht = ({
|
|
|
326
326
|
closeable: !e.getDisabled.value,
|
|
327
327
|
noPopover: !0,
|
|
328
328
|
noWrap: !e.props.wrapped,
|
|
329
|
-
class:
|
|
329
|
+
class: K,
|
|
330
330
|
onClose: c
|
|
331
331
|
}, () => e.modelValue.value.map((te) => {
|
|
332
332
|
var ne, ue;
|
|
333
333
|
const oe = () => e.getLabelByValue(te), se = ({
|
|
334
334
|
size: ce
|
|
335
335
|
}) => {
|
|
336
|
-
const de =
|
|
336
|
+
const de = y(e.getOptionByValue(te)) ?? e.props.leadingIcon;
|
|
337
337
|
return de ? x(de, ce) : null;
|
|
338
338
|
}, Q = e.getOptionByValue(te);
|
|
339
339
|
return l(zt, {
|
|
@@ -362,7 +362,7 @@ const Ht = ({
|
|
|
362
362
|
__name: "ComboboxLabel",
|
|
363
363
|
setup(u) {
|
|
364
364
|
return (o, t) => (pe(), Ee("div", {
|
|
365
|
-
class: Ye(
|
|
365
|
+
class: Ye(L(k)(L(R), "label"))
|
|
366
366
|
}, [
|
|
367
367
|
Re(o.$slots, "default")
|
|
368
368
|
], 2));
|
|
@@ -389,10 +389,10 @@ const Ht = ({
|
|
|
389
389
|
default:
|
|
390
390
|
return "xsm";
|
|
391
391
|
}
|
|
392
|
-
}), c = m(() => t.getOptionValue(u.option)), i = m(() => t.getOptionNoCheckbox(u.option)),
|
|
392
|
+
}), c = m(() => t.getOptionValue(u.option)), i = m(() => t.getOptionNoCheckbox(u.option)), B = m(() => t.getOptionClear(u.option)), T = m(() => t.getOptionSingle(u.option)), _ = m(() => t.getOptionLabel(u.option)), y = m(() => t.getOptionIcon(u.option)), A = m(() => t.props.tree ? void 0 : t.getOptionDescription(u.option)), $ = m(() => t.getOptionDisabled(u.option)), r = m(() => t.isItemSelected(c.value)), f = k(R, "option"), d = () => {
|
|
393
393
|
if (!(t.props.tree || !c.value || $.value))
|
|
394
394
|
if (t.props.multiple)
|
|
395
|
-
if (
|
|
395
|
+
if (B.value)
|
|
396
396
|
t.setModelValue([]), t.emit("select", void 0, !1);
|
|
397
397
|
else if (T.value)
|
|
398
398
|
t.setModelValue([c.value]), t.emit("select", c.value, !0);
|
|
@@ -401,12 +401,12 @@ const Ht = ({
|
|
|
401
401
|
const x = s.includes(c.value);
|
|
402
402
|
s.length === 1 && t.getSingleByValue(s[0]) && c.value !== s[0] && (s = []), x ? (t.setModelValue(s.filter((V) => V !== c.value)), t.emit("select", c.value, !0)) : (t.setModelValue([...s, c.value]), t.emit("select", c.value, !1));
|
|
403
403
|
}
|
|
404
|
-
else
|
|
404
|
+
else B.value ? (t.setModelValue(void 0), t.emit("select", void 0, !1)) : (t.setModelValue(c.value), t.emit("select", c.value, !0));
|
|
405
405
|
};
|
|
406
406
|
if (!u.option) throw new Error("option is required");
|
|
407
407
|
return () => {
|
|
408
408
|
const s = (V) => {
|
|
409
|
-
var S, v,
|
|
409
|
+
var S, v, w, N, Z;
|
|
410
410
|
const a = [];
|
|
411
411
|
!t.props.tree && t.props.multiple && t.props.checkbox && !i.value && a.push(l(At, {
|
|
412
412
|
modelValue: r.value,
|
|
@@ -417,13 +417,13 @@ const Ht = ({
|
|
|
417
417
|
option: u.option
|
|
418
418
|
});
|
|
419
419
|
return F(I) ? t.props.tagRenderMode === "avatar" ? a.push(l($e, {
|
|
420
|
-
...((
|
|
420
|
+
...((w = (v = t.props).getTagProps) == null ? void 0 : w.call(v, u.option)) ?? {},
|
|
421
421
|
size: t.getTagSize.value
|
|
422
422
|
})) : t.props.tagRenderMode === "go" ? a.push(l(Fe, {
|
|
423
|
-
...((Z = (
|
|
423
|
+
...((Z = (N = t.props).getTagProps) == null ? void 0 : Z.call(N, u.option)) ?? {},
|
|
424
424
|
size: t.getTagSize.value
|
|
425
|
-
})) :
|
|
426
|
-
icon:
|
|
425
|
+
})) : y.value && a.push(l(Oe, {
|
|
426
|
+
icon: y.value,
|
|
427
427
|
size: e.value
|
|
428
428
|
})) : a.push(I), F(a) ? null : a;
|
|
429
429
|
};
|
|
@@ -461,15 +461,15 @@ const Ht = ({
|
|
|
461
461
|
Bt({
|
|
462
462
|
target: c
|
|
463
463
|
});
|
|
464
|
-
const i = ye(),
|
|
464
|
+
const i = ye(), B = Pt({
|
|
465
465
|
triggerRef: i,
|
|
466
466
|
props: t.props
|
|
467
467
|
}), {
|
|
468
468
|
getFlipOnDir: T,
|
|
469
469
|
getDir: _
|
|
470
|
-
} = ft(),
|
|
470
|
+
} = ft(), y = T("reversePlacementOnDir"), A = _(), $ = kt({
|
|
471
471
|
props: t.props,
|
|
472
|
-
flip:
|
|
472
|
+
flip: y,
|
|
473
473
|
emitsAsProps: t.emitsAsProps,
|
|
474
474
|
_dir: A,
|
|
475
475
|
controlAutoFocus: !1,
|
|
@@ -478,19 +478,19 @@ const Ht = ({
|
|
|
478
478
|
key: n,
|
|
479
479
|
getterKey: p,
|
|
480
480
|
defaultValue: h,
|
|
481
|
-
noReturnOption:
|
|
482
|
-
}) => (
|
|
483
|
-
const
|
|
484
|
-
if (_e(
|
|
485
|
-
const W =
|
|
481
|
+
noReturnOption: P
|
|
482
|
+
}) => (b) => {
|
|
483
|
+
const D = ze(h) ? h(b) : h;
|
|
484
|
+
if (_e(b)) {
|
|
485
|
+
const W = b[n] ?? D, G = p && t.props[p];
|
|
486
486
|
if (G) {
|
|
487
487
|
if (fe(G))
|
|
488
|
-
return
|
|
489
|
-
if (ze(G)) return G(
|
|
488
|
+
return b[G] ?? W;
|
|
489
|
+
if (ze(G)) return G(b) ?? W;
|
|
490
490
|
}
|
|
491
491
|
return W;
|
|
492
492
|
}
|
|
493
|
-
return fe(
|
|
493
|
+
return fe(b) && !P ? b ?? D : D;
|
|
494
494
|
}, f = r({
|
|
495
495
|
getterKey: "getValue",
|
|
496
496
|
key: "value"
|
|
@@ -526,27 +526,28 @@ const Ht = ({
|
|
|
526
526
|
getterKey: "getGroupLabel",
|
|
527
527
|
key: "label",
|
|
528
528
|
noReturnOption: !0
|
|
529
|
-
}),
|
|
529
|
+
}), w = r({
|
|
530
530
|
getterKey: "getGroupOptions",
|
|
531
531
|
key: "options",
|
|
532
532
|
noReturnOption: !0
|
|
533
|
-
}),
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
if (
|
|
533
|
+
}), N = (n) => {
|
|
534
|
+
const p = (h) => {
|
|
535
|
+
if (h != null && h.length && n)
|
|
536
|
+
for (const P of h) {
|
|
537
|
+
if (f(P) === n) return P;
|
|
538
|
+
const b = w(P);
|
|
539
|
+
if (b != null && b.length) {
|
|
540
|
+
const D = p(b);
|
|
541
|
+
if (D) return D;
|
|
542
|
+
}
|
|
542
543
|
}
|
|
543
|
-
|
|
544
|
-
return
|
|
544
|
+
};
|
|
545
|
+
return p(t.props.options);
|
|
545
546
|
}, Z = (n) => {
|
|
546
|
-
const p =
|
|
547
|
+
const p = N(n);
|
|
547
548
|
return p ? V(p) ?? n : n;
|
|
548
549
|
}, ve = (n) => {
|
|
549
|
-
const p =
|
|
550
|
+
const p = N(n);
|
|
550
551
|
return p ? s(p) ?? !1 : !1;
|
|
551
552
|
}, {
|
|
552
553
|
contains: ee
|
|
@@ -554,23 +555,23 @@ const Ht = ({
|
|
|
554
555
|
sensitivity: "base"
|
|
555
556
|
}), q = m(() => {
|
|
556
557
|
const n = (p) => p == null ? void 0 : p.map((h) => {
|
|
557
|
-
const
|
|
558
|
-
if (g &&
|
|
558
|
+
const P = V(h), b = f(h), D = S(h), W = v(h), G = !t.searchModel.value || P && ee(P, t.searchModel.value), g = w(h), O = !t.props.tree || b;
|
|
559
|
+
if (g && O) {
|
|
559
560
|
const C = n(g);
|
|
560
561
|
if (C != null && C.length || G)
|
|
561
562
|
return {
|
|
562
563
|
groupLabel: W,
|
|
563
|
-
title:
|
|
564
|
-
key:
|
|
565
|
-
disabled:
|
|
564
|
+
title: P,
|
|
565
|
+
key: b,
|
|
566
|
+
disabled: D,
|
|
566
567
|
children: C,
|
|
567
568
|
_option: h
|
|
568
569
|
};
|
|
569
570
|
}
|
|
570
|
-
return G &&
|
|
571
|
-
title:
|
|
572
|
-
key:
|
|
573
|
-
disabled:
|
|
571
|
+
return G && O ? {
|
|
572
|
+
title: P,
|
|
573
|
+
key: b,
|
|
574
|
+
disabled: D,
|
|
574
575
|
_option: h
|
|
575
576
|
} : null;
|
|
576
577
|
}).filter(Boolean);
|
|
@@ -579,13 +580,13 @@ const Ht = ({
|
|
|
579
580
|
}), {
|
|
580
581
|
getDisabled: le,
|
|
581
582
|
getStatus: M,
|
|
582
|
-
getSize:
|
|
583
|
+
getSize: K
|
|
583
584
|
} = St({
|
|
584
585
|
getDisabled: () => t.props.disabled,
|
|
585
586
|
getSize: () => t.props.size,
|
|
586
587
|
getStatus: () => t.props.status
|
|
587
588
|
}), J = m(() => {
|
|
588
|
-
switch (
|
|
589
|
+
switch (K.value) {
|
|
589
590
|
case "sm":
|
|
590
591
|
return "xsm";
|
|
591
592
|
case "lg":
|
|
@@ -600,8 +601,8 @@ const Ht = ({
|
|
|
600
601
|
} = Ot({
|
|
601
602
|
getDisabled: () => le.value
|
|
602
603
|
}), oe = ye(), se = () => {
|
|
603
|
-
var n, p, h,
|
|
604
|
-
e.open.value && e.inputElement.value && (t.props.headerSearch && ((n = oe.value) != null && n.input) ? document.activeElement !== ((p = oe.value) == null ? void 0 : p.input) && ((
|
|
604
|
+
var n, p, h, P, b, D, W;
|
|
605
|
+
e.open.value && e.inputElement.value && (t.props.headerSearch && ((n = oe.value) != null && n.input) ? document.activeElement !== ((p = oe.value) == null ? void 0 : p.input) && ((b = (P = (h = oe.value) == null ? void 0 : h.input) == null ? void 0 : P.focus) == null || b.call(P)) : document.activeElement !== e.inputElement.value && ((W = (D = e.inputElement.value) == null ? void 0 : D.focus) == null || W.call(D)));
|
|
605
606
|
}, Q = (n) => {
|
|
606
607
|
e.modelValue.value = n, t.emit("update:modelValue", n);
|
|
607
608
|
}, ne = (n) => n === void 0 ? !1 : Array.isArray(e.modelValue.value) ? !!(n && e.modelValue.value.includes(n)) : e.modelValue.value === n;
|
|
@@ -615,7 +616,7 @@ const Ht = ({
|
|
|
615
616
|
getOptionDescription: I,
|
|
616
617
|
getOptionDisabled: S,
|
|
617
618
|
getOptionIcon: a,
|
|
618
|
-
getOptionByValue:
|
|
619
|
+
getOptionByValue: N,
|
|
619
620
|
isItemSelected: ne,
|
|
620
621
|
getLabelByValue: Z,
|
|
621
622
|
getSingleByValue: ve,
|
|
@@ -624,7 +625,7 @@ const Ht = ({
|
|
|
624
625
|
headerInputElement: oe,
|
|
625
626
|
getDisabled: le,
|
|
626
627
|
getStatus: M,
|
|
627
|
-
getSize:
|
|
628
|
+
getSize: K,
|
|
628
629
|
getTagSize: J,
|
|
629
630
|
comboboxInputBinding: j,
|
|
630
631
|
comboboxTriggerBinding: te,
|
|
@@ -637,9 +638,9 @@ const Ht = ({
|
|
|
637
638
|
const n = t.props.scrollContainerProps ?? {};
|
|
638
639
|
return {
|
|
639
640
|
...n,
|
|
640
|
-
areaCls: [k(
|
|
641
|
+
areaCls: [k(R, "scroll_area"), n == null ? void 0 : n.class, n == null ? void 0 : n.areaCls]
|
|
641
642
|
};
|
|
642
|
-
}), ce = k(
|
|
643
|
+
}), ce = k(R, "popup"), de = Se(ce, {
|
|
643
644
|
variants: {
|
|
644
645
|
size: H(We, ce)
|
|
645
646
|
}
|
|
@@ -649,7 +650,7 @@ const Ht = ({
|
|
|
649
650
|
if (typeof n == "string")
|
|
650
651
|
return n;
|
|
651
652
|
}, Ue = m(() => he(t.props.popupWidth)), je = m(() => he(t.props.popupHeight)), Pe = m(() => he(t.props.minWidth)), ke = m(() => ({
|
|
652
|
-
type:
|
|
653
|
+
type: K.value === "sm" ? "simple" : "advance",
|
|
653
654
|
...Me(t.props.emptyProps ?? {}, "class")
|
|
654
655
|
})), He = m(() => Me(t.props.skeletonProps ?? {}, "class")), {
|
|
655
656
|
selectValues: qe
|
|
@@ -669,7 +670,7 @@ const Ht = ({
|
|
|
669
670
|
}), p = [];
|
|
670
671
|
let h;
|
|
671
672
|
if (t.props.tree) {
|
|
672
|
-
const
|
|
673
|
+
const O = U(e.modelValue.value) ? e.modelValue.value : e.modelValue.value ? [e.modelValue.value] : [];
|
|
673
674
|
h = l(Tt, {
|
|
674
675
|
data: q.value ?? [],
|
|
675
676
|
selectable: !0,
|
|
@@ -678,13 +679,13 @@ const Ht = ({
|
|
|
678
679
|
defaultExpandAll: !0,
|
|
679
680
|
syncCheckboxAndSelect: t.props.multiple,
|
|
680
681
|
showLine: !0,
|
|
681
|
-
modelValue:
|
|
682
|
-
checkedKeys:
|
|
682
|
+
modelValue: O,
|
|
683
|
+
checkedKeys: O,
|
|
683
684
|
onExpand: se,
|
|
684
|
-
onSelect: (C,
|
|
685
|
+
onSelect: (C, E, z) => {
|
|
685
686
|
if (t.props.multiple) {
|
|
686
687
|
const Y = U(z) ? z : [z];
|
|
687
|
-
Q(qe(Y,
|
|
688
|
+
Q(qe(Y, E));
|
|
688
689
|
} else
|
|
689
690
|
Q(z);
|
|
690
691
|
},
|
|
@@ -694,65 +695,65 @@ const Ht = ({
|
|
|
694
695
|
}), p.push(h);
|
|
695
696
|
} else {
|
|
696
697
|
let g = !1;
|
|
697
|
-
const
|
|
698
|
+
const O = [];
|
|
698
699
|
if ((q.value ?? []).forEach((C) => {
|
|
699
|
-
var
|
|
700
|
-
if ((
|
|
700
|
+
var E;
|
|
701
|
+
if ((E = C.children) != null && E.length) {
|
|
701
702
|
const z = [];
|
|
702
703
|
C.children.forEach((Y) => {
|
|
703
704
|
const ie = n(Y._option);
|
|
704
|
-
ne(f(Y._option)) && t.props.sortSelectedItems ?
|
|
705
|
+
ne(f(Y._option)) && t.props.sortSelectedItems ? O.push(ie) : z.push(ie);
|
|
705
706
|
}), z.length && ((g || p.length) && (p.push(l(Ce)), g = !1), C.groupLabel && p.push(l(Qt, {
|
|
706
707
|
class: t.props.labelCls
|
|
707
708
|
}, () => C.groupLabel)), p.push(...z), g = !0);
|
|
708
709
|
} else {
|
|
709
710
|
const z = n(C._option);
|
|
710
|
-
ne(f(C._option)) && t.props.sortSelectedItems ?
|
|
711
|
+
ne(f(C._option)) && t.props.sortSelectedItems ? O.push(z) : (g && (p.push(l(Ce)), g = !1), p.push(z));
|
|
711
712
|
}
|
|
712
|
-
}), t.props.sortSelectedItems &&
|
|
713
|
+
}), t.props.sortSelectedItems && O.length) {
|
|
713
714
|
const C = !!p.length;
|
|
714
|
-
p.splice(0, 0, ...
|
|
715
|
+
p.splice(0, 0, ...O), C && p.splice(O.length, 0, l(Ce));
|
|
715
716
|
}
|
|
716
717
|
}
|
|
717
|
-
const
|
|
718
|
-
var
|
|
719
|
-
return _e(g == null ? void 0 : g.props) && ((
|
|
720
|
-
}),
|
|
721
|
-
var
|
|
718
|
+
const P = xt(h ? [h] : p, Le).filter((g) => {
|
|
719
|
+
var O;
|
|
720
|
+
return _e(g == null ? void 0 : g.props) && ((O = g == null ? void 0 : g.props) == null ? void 0 : O.option);
|
|
721
|
+
}), b = !!(t.props.tree && ((W = q.value) != null && W.length) || P != null && P.length), D = () => {
|
|
722
|
+
var O, C;
|
|
722
723
|
const g = [];
|
|
723
|
-
if (
|
|
724
|
-
const
|
|
725
|
-
if (
|
|
726
|
-
const z = (
|
|
727
|
-
if (!F(z))
|
|
724
|
+
if (b || t.props.loading) {
|
|
725
|
+
const E = [];
|
|
726
|
+
if (b && E.push(...p), t.props.loading) {
|
|
727
|
+
const z = (O = o.loading) == null ? void 0 : O.call(o, {});
|
|
728
|
+
if (!F(z)) E.push(z);
|
|
728
729
|
else {
|
|
729
|
-
const Y = new Array(
|
|
730
|
-
|
|
731
|
-
size:
|
|
732
|
-
class: [k(
|
|
730
|
+
const Y = new Array(b ? 2 : t.props.loadingRowCount).fill(1);
|
|
731
|
+
E.push(...Y.map(() => l(yt, {
|
|
732
|
+
size: K.value,
|
|
733
|
+
class: [k(R, "skeleton"), t.props.skeletonCls],
|
|
733
734
|
...He.value
|
|
734
735
|
})));
|
|
735
736
|
}
|
|
736
737
|
}
|
|
737
738
|
g.push(l("div", {
|
|
738
|
-
class: [k(
|
|
739
|
-
},
|
|
740
|
-
} else if (!
|
|
741
|
-
const
|
|
742
|
-
F(
|
|
743
|
-
class: [k(
|
|
739
|
+
class: [k(R, "options"), t.props.optionsCls]
|
|
740
|
+
}, E));
|
|
741
|
+
} else if (!b) {
|
|
742
|
+
const E = (C = o.empty) == null ? void 0 : C.call(o, ke.value);
|
|
743
|
+
F(E) ? g.push(l(bt, {
|
|
744
|
+
class: [k(R, "empty"), t.props.emptyCls],
|
|
744
745
|
...ke.value
|
|
745
746
|
}, {
|
|
746
747
|
title: o.emptyTitle,
|
|
747
748
|
description: o.emptyDescription,
|
|
748
749
|
actions: o.emptyActions,
|
|
749
750
|
image: o.emptyImage
|
|
750
|
-
})) : g.push(
|
|
751
|
+
})) : g.push(E);
|
|
751
752
|
}
|
|
752
753
|
return t.props.lazyLoading && g.push(l("div", {
|
|
753
|
-
class: k(
|
|
754
|
+
class: k(R, "lazy_loading")
|
|
754
755
|
}, l("div", {
|
|
755
|
-
class: k(
|
|
756
|
+
class: k(R, "lazy_loading_trigger"),
|
|
756
757
|
ref: c
|
|
757
758
|
}))), g;
|
|
758
759
|
};
|
|
@@ -766,7 +767,7 @@ const Ht = ({
|
|
|
766
767
|
}, {
|
|
767
768
|
trigger: o.trigger,
|
|
768
769
|
triggerTrailing: o.triggerTrailing
|
|
769
|
-
}), l(lt,
|
|
770
|
+
}), l(lt, B.value, () => l(st, {
|
|
770
771
|
...$.value,
|
|
771
772
|
vShow: e.open.value,
|
|
772
773
|
class: [de(t.props), t.props.popupCls],
|
|
@@ -778,24 +779,24 @@ const Ht = ({
|
|
|
778
779
|
onClick: se
|
|
779
780
|
}, () => {
|
|
780
781
|
var z, Y, ie, Ie;
|
|
781
|
-
const g = [],
|
|
782
|
+
const g = [], O = (Y = o.header) == null ? void 0 : Y.call(o, {
|
|
782
783
|
isEmpty: !((z = q.value) != null && z.length),
|
|
783
784
|
search: t.searchModel.value
|
|
784
|
-
}), C = !F(
|
|
785
|
+
}), C = !F(O);
|
|
785
786
|
if (t.props.headerSearch || C) {
|
|
786
787
|
const be = [];
|
|
787
|
-
C && be.push(
|
|
788
|
-
class: k(
|
|
788
|
+
C && be.push(O), t.props.headerSearch && be.push(l(Ge)), g.push(l("div", {
|
|
789
|
+
class: k(R, "header")
|
|
789
790
|
}, be));
|
|
790
791
|
}
|
|
791
|
-
g.push(l(It, ue.value,
|
|
792
|
-
const
|
|
792
|
+
g.push(l(It, ue.value, D));
|
|
793
|
+
const E = (Ie = o.footer) == null ? void 0 : Ie.call(o, {
|
|
793
794
|
isEmpty: !((ie = q.value) != null && ie.length),
|
|
794
795
|
search: t.searchModel.value
|
|
795
796
|
});
|
|
796
|
-
return F(
|
|
797
|
-
class: k(
|
|
798
|
-
},
|
|
797
|
+
return F(E) || g.push(l("div", {
|
|
798
|
+
class: k(R, "footer")
|
|
799
|
+
}, E)), g;
|
|
799
800
|
}))];
|
|
800
801
|
};
|
|
801
802
|
}
|
|
@@ -924,13 +925,13 @@ const Ht = ({
|
|
|
924
925
|
},
|
|
925
926
|
dt
|
|
926
927
|
)
|
|
927
|
-
),
|
|
928
|
+
), B = Kt(t, "search", e, {
|
|
928
929
|
passive: t.search === void 0
|
|
929
930
|
});
|
|
930
931
|
Ne(
|
|
931
932
|
() => t.open,
|
|
932
|
-
(
|
|
933
|
-
|
|
933
|
+
(y) => {
|
|
934
|
+
y || (B.value = void 0);
|
|
934
935
|
}
|
|
935
936
|
);
|
|
936
937
|
const T = Je(), _ = Qe();
|
|
@@ -938,15 +939,15 @@ const Ht = ({
|
|
|
938
939
|
attrs: _,
|
|
939
940
|
props: t,
|
|
940
941
|
emit: e,
|
|
941
|
-
searchModel:
|
|
942
|
+
searchModel: B,
|
|
942
943
|
emitsAsProps: c
|
|
943
|
-
}), (
|
|
944
|
+
}), (y, A) => (pe(), Ve(L(pt), we(i.value, { class: L(R) }), {
|
|
944
945
|
default: me(() => [
|
|
945
|
-
Ke(
|
|
946
|
+
Ke(L(Xt), null, Xe({ _: 2 }, [
|
|
946
947
|
Ze(Object.keys(T), ($) => ({
|
|
947
948
|
name: $,
|
|
948
949
|
fn: me((r) => [
|
|
949
|
-
Re(
|
|
950
|
+
Re(y.$slots, $, et(tt(r)))
|
|
950
951
|
])
|
|
951
952
|
}))
|
|
952
953
|
]), 1024)
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { _ as X, i as Y, p as $ } from "./ColorPicker.vue_vue_type_style_index_0
|
|
|
12
12
|
import { _ as oe, C as ae, a as te } from "./ColorSwatch.vue_vue_type_style_index_0_lang-CdoLi2ow.js";
|
|
13
13
|
import { _ as re } from "./ColorSwatchGroup.vue_vue_type_style_index_0_lang-DyXou_Un.js";
|
|
14
14
|
import { _ as ie, C as ne } from "./ColorTrigger.vue_vue_type_style_index_0_lang-CbOky0vB.js";
|
|
15
|
-
import { _ as me, C as Ce, a as ce, i as Se, p as le } from "./Combobox.vue_vue_type_style_index_0_lang-
|
|
15
|
+
import { _ as me, C as Ce, a as ce, i as Se, p as le } from "./Combobox.vue_vue_type_style_index_0_lang-Oc5nUJgi.js";
|
|
16
16
|
import { C as ue, c as _e, p as de, u as be } from "./index-jwkhq8oW.js";
|
|
17
17
|
import { _ as Te } from "./DataTable.vue_vue_type_style_index_0_lang-BmUHso6v.js";
|
|
18
18
|
import { _ as ve, D as Ie } from "./Divider.vue_vue_type_style_index_0_lang-B6fQsp1Y.js";
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("./BaseBadge.model-Bz8P4acF.js"),n=require("./ButtonGroup.vue_vue_type_script_setup_true_lang-D_6kzAX6.js"),E=require("./ActionButton.vue_vue_type_script_setup_true_lang-B7vGsGcO.js"),q=require("./Alert.vue_vue_type_style_index_0_lang-BgHgn7SC.js"),t=require("./Avatar.vue_vue_type_style_index_0_lang-CLZz5CmG.js"),w=require("./Badge.vue_vue_type_script_setup_true_lang-BIli_mJS.js"),M=require("./Button.vue_vue_type_script_setup_true_lang-8omci6bm.js"),o=require("./Checkbox.vue_vue_type_style_index_0_lang-Bz-fwglK.js"),$=require("./Chip.vue_vue_type_style_index_0_lang-CtgInoR3.js"),s=require("./ChipGroup.vue_vue_type_style_index_0_lang-BVwWqy-3.js"),m=require("./ColorPicker.vue_vue_type_style_index_0_lang-0SIDliS4.js"),C=require("./ColorSwatch.vue_vue_type_style_index_0_lang-BK2Ak9jv.js"),R=require("./ColorSwatchGroup.vue_vue_type_style_index_0_lang-qx6S3kVF.js"),I=require("./ColorTrigger.vue_vue_type_style_index_0_lang-LcImZnD-.js"),a=require("./Combobox.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("./BaseBadge.model-Bz8P4acF.js"),n=require("./ButtonGroup.vue_vue_type_script_setup_true_lang-D_6kzAX6.js"),E=require("./ActionButton.vue_vue_type_script_setup_true_lang-B7vGsGcO.js"),q=require("./Alert.vue_vue_type_style_index_0_lang-BgHgn7SC.js"),t=require("./Avatar.vue_vue_type_style_index_0_lang-CLZz5CmG.js"),w=require("./Badge.vue_vue_type_script_setup_true_lang-BIli_mJS.js"),M=require("./Button.vue_vue_type_script_setup_true_lang-8omci6bm.js"),o=require("./Checkbox.vue_vue_type_style_index_0_lang-Bz-fwglK.js"),$=require("./Chip.vue_vue_type_style_index_0_lang-CtgInoR3.js"),s=require("./ChipGroup.vue_vue_type_style_index_0_lang-BVwWqy-3.js"),m=require("./ColorPicker.vue_vue_type_style_index_0_lang-0SIDliS4.js"),C=require("./ColorSwatch.vue_vue_type_style_index_0_lang-BK2Ak9jv.js"),R=require("./ColorSwatchGroup.vue_vue_type_style_index_0_lang-qx6S3kVF.js"),I=require("./ColorTrigger.vue_vue_type_style_index_0_lang-LcImZnD-.js"),a=require("./Combobox.vue_vue_type_style_index_0_lang-DOcOXELp.js"),p=require("./index-DWw7aruo.js"),Z=require("./DataTable.vue_vue_type_style_index_0_lang-DlCKsldZ.js"),G=require("./Divider.vue_vue_type_style_index_0_lang-DoEWjJx6.js"),S=require("./DropZone.vue_vue_type_style_index_0_lang-gFBvGjz1.js"),j=require("./Empty.vue_vue_type_style_index_0_lang-DidQV2p4.js"),V=require("./FloatButton.vue_vue_type_script_setup_true_lang-CF1FWNxr.js"),e=require("./FormItem.vue_vue_type_style_index_0_lang-Bo3o8_6v.js"),x=require("./getEmojiList-5BGH5AZ_.js"),H=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-BZ5qLbnJ.js"),y=require("./GraphicalObjectGroup.vue_vue_type_style_index_0_lang-CDFDVi-0.js"),B=require("./Icon/index.umd.cjs"),K=require("./IconButton.vue_vue_type_script_setup_true_lang-B7dwj__6.js"),l=require("./Image.vue_vue_type_style_index_0_lang-DCoVuK7u.js"),d=require("./IndentLevel.vue_vue_type_style_index_0_lang-I_4wqG59.js"),U=require("./Indicator.vue_vue_type_script_setup_true_lang-CgN-sjj_.js"),g=require("./Input.vue_vue_type_style_index_0_lang-CWW5TIRh.js"),J=require("./Kbd.vue_vue_type_style_index_0_lang-CjNtLg1e.js"),k=require("./Link.vue_vue_type_style_index_0_lang-C1i1VsGw.js"),_=require("./MenuItem.vue_vue_type_style_index_0_lang-CYOdJYFY.js"),f=require("./Popover.vue_vue_type_style_index_0_lang-txLoIoSw.js"),A=require("./RadioGroup.vue_vue_type_script_setup_true_lang-D6pRyJ0t.js"),b=require("./ScrollContainer.vue_vue_type_style_index_0_lang-BIoD2_5T.js"),P=require("./Segmented.vue_vue_type_style_index_0_lang-m8iNyqtw.js"),i=require("./Select.vue_vue_type_style_index_0_lang-CbJsb6VK.js"),N=require("./Shortcut.vue_vue_type_style_index_0_lang-DOhEtw_i.js"),h=require("./Skeleton.vue_vue_type_style_index_0_lang-CWNX_-Jl.js"),L=require("./Spinner.vue_vue_type_style_index_0_lang-DGxzzl6D.js"),F=require("./Switch.vue_vue_type_style_index_0_lang-aODjQm2H.js"),r=require("./THead.vue_vue_type_style_index_0_lang-oUsIia-h.js"),T=require("./Textarea.vue_vue_type_style_index_0_lang-DtO8cFFA.js"),z=require("./Tooltip.vue_vue_type_script_setup_true_lang-DWMPc3HZ.js"),u=require("./Tree.vue_vue_type_style_index_0_lang-26mqYWer.js"),v=require("./element-BjE0SVc4.js"),O=require("./options-CWrQ7gsa.js"),Q=require("./style-CYb6EX2Q.js"),W=require("./useInputDataStates-D1X-Whwt.js"),D=require("./Icon.vue_vue_type_style_index_0_lang-D3cRtJNJ.js"),X=["3xsm","2xsm","xsm","sm","md","lg","xlg","2xlg"],Y={};exports.BadgeColors=c.BadgeColors;exports.BadgeColorsSubtle=c.BadgeColorsSubtle;exports.BadgeSizes=c.BadgeSizes;exports.BadgeTypes=c.BadgeTypes;exports.ButtonColors=n.ButtonColors;exports.ButtonGroup=n._sfc_main;exports.ButtonSizes=n.ButtonSizes;exports.ButtonTypes=n.ButtonTypes;exports.ButtonVariants=n.ButtonVariants;exports.injectButtonGroupContext=n.injectButtonGroupContext;exports.provideButtonGroupContext=n.provideButtonGroupContext;exports.ActionButton=E._sfc_main;exports.Alert=q._sfc_main;exports.AlertTypes=q.AlertTypes;exports.Avatar=t._sfc_main;exports.AvatarGroup=t._sfc_main$1;exports.AvatarOnlineAlignments=t.AvatarOnlineAlignments;exports.AvatarShapes=t.AvatarShapes;exports.AvatarSizes=t.AvatarSizes;exports.AvatarStrokes=t.AvatarStrokes;exports.injectAvatarGroupContext=t.injectAvatarGroupContext;exports.provideAvatarGroupContext=t.provideAvatarGroupContext;exports.Badge=w._sfc_main;exports.Button=M._sfc_main;exports.Checkbox=o._sfc_main;exports.CheckboxGroup=o._sfc_main$1;exports.CheckboxSizes=o.CheckboxSizes;exports.injectCheckboxGroupContext=o.injectCheckboxGroupContext;exports.provideCheckboxGroupContext=o.provideCheckboxGroupContext;exports.useColoredPantographCheckbox=o.useColoredPantographCheckbox;exports.useColoredPantographCheckboxGroup=o.useColoredPantographCheckboxGroup;exports.Chip=$._sfc_main;exports.ChipColors=s.ChipColors;exports.ChipGroup=s._sfc_main;exports.ChipSizes=s.ChipSizes;exports.injectChipGroupContext=s.injectChipGroupContext;exports.provideChipGroupContext=s.provideChipGroupContext;exports.ColorPicker=m._sfc_main;exports.injectColorPickerContext=m.injectColorPickerContext;exports.provideColorPickerContext=m.provideColorPickerContext;exports.ColorSwatch=C._sfc_main;exports.ColorSwatchSizes=C.ColorSwatchSizes;exports.ColorSwatchTypes=C.ColorSwatchTypes;exports.ColorSwatchGroup=R._sfc_main;exports.ColorTrigger=I._sfc_main;exports.ColorTriggerSizes=I.ColorTriggerSizes;exports.Combobox=a._sfc_main;exports.ComboboxSizes=a.ComboboxSizes;exports.ComboboxStatuses=a.ComboboxStatuses;exports.injectComboboxContext=a.injectComboboxContext;exports.provideComboboxContext=a.provideComboboxContext;exports.ConfigProvider=p.ConfigProvider;exports.injectConfigContext=p.injectConfigContext;exports.provideConfigContext=p.provideConfigContext;exports.useConfig=p.useConfig;exports.DataTable=Z._sfc_main;exports.Divider=G._sfc_main;exports.DividerTypes=G.DividerTypes;exports.DropZone=S._sfc_main;exports.DropZoneSizes=S.DropZoneSizes;exports.DropZoneTypes=S.DropZoneTypes;exports.Empty=j._sfc_main;exports.EmptyTypes=j.EmptyTypes;exports.FloatButton=V._sfc_main;exports.Form=e._sfc_main;exports.FormItem=e._sfc_main$1;exports.FormItemSizes=e.FormItemSizes;exports.FormItemStatuses=e.FormItemStatuses;exports.Label=e._sfc_main$2;exports.LabelSizes=e.LabelSizes;exports.injectFormContext=e.injectFormContext;exports.injectFormItemContext=e.injectFormItemContext;exports.provideFormContext=e.provideFormContext;exports.provideFormItemContext=e.provideFormItemContext;exports.GOPicker=x._sfc_main;exports.emojiList=x.emojiList;exports.getEmojiList=x.getEmojiList;exports.GraphicalObject=H._sfc_main;exports.GraphicalObjectGroup=y._sfc_main;exports.injectGraphicalObjectGroupContext=y.injectGraphicalObjectGroupContext;exports.provideGraphicalObjectGroupContext=y.provideGraphicalObjectGroupContext;exports.defineLocaleIconCollection=B.defineLocaleIconCollection;exports.disableIconCache=B.disableIconCache;exports.IconButton=K._sfc_main;exports.Image=l._sfc_main;exports.ImageAspectRatios=l.ImageAspectRatios;exports.ImageSizeRanges=l.ImageSizeRanges;exports.ImageTypes=l.ImageTypes;exports.IndentLevel=d._sfc_main;exports.IndentLevelShowLines=d.IndentLevelShowLines;exports.IndentLevelSizes=d.IndentLevelSizes;exports.Indicator=U._sfc_main;exports.Input=g._sfc_main;exports.InputSizes=g.InputSizes;exports.InputStatuses=g.InputStatuses;exports.Kbd=J._sfc_main;exports.Link=k._sfc_main;exports.LinkStyles=k.LinkStyles;exports.Menu=_._sfc_main;exports.MenuGaps=_.MenuGaps;exports.MenuItem=_._sfc_main$1;exports.MenuItemSizes=_.MenuItemSizes;exports.SubMenu=_._sfc_main$2;exports.injectMenuContext=_.injectMenuContext;exports.provideMenuContext=_.provideMenuContext;exports.Popover=f._sfc_main;exports.PopoverPlacements=f.PopoverPlacements;exports.PopoverSizes=f.PopoverSizes;exports.RadioGroup=A._sfc_main;exports.RadioGroupItem=A._sfc_main$1;exports.ScrollContainer=b._sfc_main;exports.ScrollContainerSizes=b.ScrollContainerSizes;exports.ScrollContainerTypes=b.ScrollContainerTypes;exports.Segmented=P._sfc_main;exports.SegmentedSizes=P.SegmentedSizes;exports.Select=i._sfc_main;exports.SelectLabel=i._sfc_main$1;exports.SelectOption=i.SelectOption;exports.SelectSizes=i.SelectSizes;exports.SelectStatuses=i.SelectStatuses;exports.injectSelectContext=i.injectSelectContext;exports.provideSelectContext=i.provideSelectContext;exports.Shortcut=N._sfc_main;exports.Skeleton=h._sfc_main;exports.SkeletonSizes=h.SkeletonSizes;exports.SkeletonTypes=h.SkeletonTypes;exports.Spinner=L._sfc_main;exports.SpinnerSizes=L.SpinnerSizes;exports.Switch=F._sfc_main;exports.SwitchSizes=F.SwitchSizes;exports.TBody=r._sfc_main$4;exports.THead=r._sfc_main$5;exports.Table=r._sfc_main;exports.TableSizes=r.TableSizes;exports.Td=r._sfc_main$2;exports.Th=r._sfc_main$1;exports.Tr=r._sfc_main$3;exports.Textarea=T._sfc_main;exports.TextareaSizes=T.TextareaSizes;exports.TextareaStatuses=T.TextareaStatuses;exports.Tooltip=z._sfc_main;exports.importTippyStyles=z.importTippyStyles;exports.registerTippy=z.registerTippy;exports.Tree=u._sfc_main;exports.TreeGaps=u.TreeGaps;exports.TreeSizes=u.TreeSizes;exports.injectTreeContext=u.injectTreeContext;exports.provideTreeContext=u.provideTreeContext;exports.filterEmpty=v.filterEmpty;exports.isEmptyElement=v.isEmptyElement;exports.isFragment=v.isFragment;exports.isValidElement=v.isValidElement;exports.componentPrefix=O.componentPrefix;exports.getComponentOptions=O.getComponentOptions;exports.getStyleObject=Q.getStyleObject;exports.UseInputDataStates=W.UseInputDataStates;exports.Icon=D._sfc_main;exports.IconSizes=D.IconSizes;exports.default=Y;exports.systemSizes=X;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),U=require("reka-ui"),G=require("./FormItem.vue_vue_type_style_index_0_lang-Bo3o8_6v.js"),ce=require("./options-CWrQ7gsa.js"),g=require("@pantograph/utils"),x=require("./index-DWw7aruo.js"),_e=require("class-variance-authority"),pe=require("./omit-CYbreqlf.js"),we=require("./Empty.vue_vue_type_style_index_0_lang-DidQV2p4.js"),Ae=require("./Skeleton.vue_vue_type_style_index_0_lang-CWNX_-Jl.js"),ve=require("./Divider.vue_vue_type_style_index_0_lang-DoEWjJx6.js"),L=require("./element-BjE0SVc4.js"),Be=require("./useInputDataStates-D1X-Whwt.js"),Ne=require("./useLazyLoading-H6VG5aE-.js"),Se=require("./Popover.vue_vue_type_style_index_0_lang-txLoIoSw.js"),Ke=require("./ScrollContainer.vue_vue_type_style_index_0_lang-BIoD2_5T.js"),Re=require("./Tree.vue_vue_type_style_index_0_lang-26mqYWer.js"),Ee=require("./uniq-DGkyiyS4.js"),Q=require("./isEmpty-bCllo8T9.js"),Fe=require("./Chip.vue_vue_type_style_index_0_lang-CtgInoR3.js"),We=require("./ChipGroup.vue_vue_type_style_index_0_lang-BVwWqy-3.js"),ye=require("./Icon.vue_vue_type_style_index_0_lang-D3cRtJNJ.js"),he=require("./Avatar.vue_vue_type_style_index_0_lang-CLZz5CmG.js"),Ge=require("./GraphicalObjectGroup.vue_vue_type_style_index_0_lang-CDFDVi-0.js"),Pe=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-BZ5qLbnJ.js"),je=require("./Input.vue_vue_type_style_index_0_lang-CWW5TIRh.js"),ke=require("@vueuse/core"),Ue=require("lodash-es"),$e=require("./MenuItem.vue_vue_type_style_index_0_lang-CYOdJYFY.js");require("@iconify/vue");const He=require("./Checkbox.vue_vue_type_style_index_0_lang-Bz-fwglK.js");require("@pantograph/tokens");const[de,Ie]=U.createContext("Combobox"),[Ye,Je]=U.createContext("_Combobox"),w=g.getBemBlock("combobox");var Qe=1/0;function Xe(p){var n=p==null?0:p.length;return n?pe.baseFlatten(p,Qe):[]}const ue=p=>G.isNumber(p)||x.isString(p);function Ze({getValue:p,arr:n,getChildren:o}){const e=[],c=(i,P)=>{i.forEach(I=>{const V=p(I);if(ue(V)){e.push({...I,_parentKeys:P,_key:V});const _=o(I);_!=null&&_.length&&c(_,[...P??[],V])}})};return c(n),e}const et=({getData:p,getModel:n,getValue:o,getChildren:e})=>{const c=t.computed(()=>Ze({arr:t.unref(p()),getChildren:e,getValue:o})),i=(a,f=!1)=>{const d=o(a);return c.value.filter(s=>{var B;if(f){const C=pe.last(s._parentKeys??[]);return C&&C===d}return(B=s._parentKeys)==null?void 0:B.includes(d)})},P=a=>{if(a&&x.isArray(a))return G.cloneDeep(a);const f=t.unref(n());return f&&x.isArray(f)?G.cloneDeep(f):[]},I=(a,f)=>{const d=P(f),s=i(a);if(s!=null&&s.length)return s.some(B=>{var l;const C=B._key;return C&&((l=d==null?void 0:d.includes)==null?void 0:l.call(d,C))})},V=(a,f)=>{const d=P(f),s=i(a);if(s!=null&&s.length)return s.every(B=>{var l;const C=B._key;return C&&((l=d==null?void 0:d.includes)==null?void 0:l.call(d,C))})},_=(a,f)=>{const d=P(f),s=i(a),B=o(a);return s!=null&&s.length?V(a)?!0:I(a)?"intermediate":!1:d.includes(B)},K=a=>ue(a)?c.value.find(f=>f._key===a):void 0;return{flattenData:c,getNodeChildren:i,isSomeChildrenSelected:I,isAllChildrenSelected:V,isSelected:_,selectValues:(a,f)=>{if(a.length){let d=P();const s=a.filter(ue);f?d.push(...s):d=d.filter(v=>!s.includes(v));const B=d.map(K).filter(v=>v&&v._parentKeys),l=Ee.uniq(Xe(B.map(v=>v._parentKeys))).filter(ue).map(K).filter(Boolean),k=[],S=[];return l.forEach(v=>{const D=o(v);V(v,d)?k.push(D):S.push(D)}),d.push(...k),Ee.uniq(d.filter(v=>!S.includes(v)))}}}},be=["sm","md","lg"],Te=["error","warning","success"],tt={key:1},ze=t.defineComponent({__name:"ComboboxInput",setup(p){const n=de();ke.whenever(()=>n.open.value&&n.headerInputElement.value,()=>{n.headerInputElement.value&&n.open.value&&n.focusOnInput()});const o=t.computed(()=>!Q.isEmpty(n.modelValue.value)),e=t.computed(()=>o.value?x.isArray(n.modelValue.value)?n.getLabelByValue(Ue.last(n.modelValue.value)):n.getLabelByValue(n.modelValue.value):n.props.placeholder),c=I=>{if(I.key==="Backspace"&&n.props.multiple&&x.isArray(n.modelValue.value)&&Q.isEmpty(n.searchModel.value)&&(n.setModelValue(n.modelValue.value.slice(0,-1)),Q.isEmpty(n.modelValue.value))){const V=setTimeout(()=>{n.focusOnInput(),clearTimeout(V)},2)}},i=g.getBemElement(w,"input"),P=_e.cva(i,{variants:{valuePlaceholder:g.generateVariantClassList("value-placeholder",i)}});return(I,V)=>(t.openBlock(),t.createBlock(t.unref(U.ComboboxInput),t.mergeProps(t.unref(n).comboboxInputBinding.value,{disabled:t.unref(n).getDisabled.value,placeholder:e.value,"as-child":"",modelValue:t.unref(n).searchModel.value,"onUpdate:modelValue":V[0]||(V[0]=_=>t.unref(n).searchModel.value=_),onKeydown:c,class:t.unref(P)({valuePlaceholder:o.value}),displayValue:()=>""}),{default:t.withCtx(()=>[t.unref(n).props.headerSearch?(t.openBlock(),t.createBlock(je._sfc_main,{key:0,ref:t.unref(n).headerInputElement,placeholder:t.unref(n).props.placeholder},{leading:t.withCtx(({iconSize:_})=>[t.createVNode(ye._sfc_main,{size:_,icon:"tabler:search",flipOnDir:"rtl"},null,8,["size"])]),_:1},8,["placeholder"])):(t.openBlock(),t.createElementBlock("input",tt))]),_:1},16,["disabled","placeholder","modelValue","class"]))}}),ot=t.defineComponent({name:ce.getComponentName("ComboboxTrigger"),props:{},setup(p,{slots:n,attrs:o}){const e=de(),c=({value:l},k)=>{if(k.stopPropagation(),l&&x.isArray(e.modelValue.value)&&!e.getDisabled.value){const S=e.modelValue.value.filter(v=>v!==l);e.setModelValue(S)}},i=g.getBemElement(w,"trigger"),P=_e.cva(i,{variants:{size:g.generateVariantClassList(be,i),headerSearch:g.generateVariantClassList("header-search",i),status:g.generateVariantClassList(Te,i),bordered:g.generateVariantClassList("bordered",i),multiple:g.generateVariantClassList("multiple",i),contentFit:g.generateVariantClassList("content-fit",i),wrapped:g.generateVariantClassList("wrapped",i),filled:g.generateVariantClassList("filled",i)}}),I=t.computed(()=>{switch(e.getSize.value){case"sm":return"2xsm";case"md":default:return"xsm"}}),V=t.computed(()=>{if(!e.props.multiple&&x.isString(e.modelValue.value)&&!Q.isEmpty(e.modelValue.value))return e.getOptionByValue(e.modelValue.value)}),_=(l=V.value)=>{if(e.props.selectedItemIconAsTrailingIcon&&x.isObject(l)&&"icon"in l)return l.icon},K=t.computed(()=>_()),R=t.computed(()=>{if(!e.props.noTrailing)return e.props.trailingIcon}),a=t.computed(()=>{var S,v;const l=G.cloneDeep(e.modelValue.value),k=x.isArray(e.modelValue.value);return{modelValue:l,open:G.cloneDeep(e.open.value),option:k?void 0:e.getOptionByValue(e.modelValue.value),options:k?(v=(S=e.modelValue.value).map)==null?void 0:v.call(S,e.getOptionByValue).filter(Boolean):void 0}}),f=()=>{e.onOpenChange(!e.open.value)},d=l=>{e.props.headerSearch},s=t.computed(()=>({disabled:e.getDisabled.value,tabindex:e.getDisabled.value||!e.props.headerSearch?-1:0,reference:e.props.reference,"data-disabled":e.getDisabled.value?"":void 0,"aria-disabled":e.getDisabled.value??void 0,"aria-label":"Show popup","aria-haspopup":"listbox","aria-expanded":e.open.value,"aria-controls":e.contentId,"data-state":e.open.value?"open":"closed",class:[P({size:e.getSize.value,status:e.getStatus.value==="success"&&Q.isEmpty(e.modelValue.value)?void 0:e.getStatus.value,bordered:e.props.bordered,multiple:e.props.multiple,contentFit:e.props.contentFit,wrapped:e.props.wrapped,filled:!Q.isEmpty(e.modelValue.value),headerSearch:e.props.headerSearch}),e.props.triggerCls],...o})),B=(l,k=I.value)=>t.h(ye._sfc_main,{icon:l,size:k}),C=()=>{var S;let l;const k=(S=n.triggerTrailing)==null?void 0:S.call(n,a.value);if(L.isEmptyElement(k)?R.value&&(l=B(R.value)):l=k,l)return t.h("div",{class:[g.getBemElement(i,"trailing"),e.props.triggerTrailingCls]},l)};return()=>{var v;const l=(v=n.trigger)==null?void 0:v.call(n,a.value),S=(()=>{if(L.isEmptyElement(l))return!1;const D=L.filterEmpty(l)??null,A=D.length===1?D[0]:D;return A?L.isValidElement(A)&&!L.isFragment(A):!0})();return t.h(U.ComboboxAnchor,{...s.value,...e.comboboxTriggerBinding.value,asChild:S,as:S?"template":"button",key:String(S),onKeyUp:d,onClick:f},()=>{if(!L.isEmptyElement(l))return l;const D=z=>{var Y,j;const q=e.getOptionByValue(z);return t.h(he._sfc_main,{...q?((j=(Y=e.props).getTagProps)==null?void 0:j.call(Y,q))??{}:{},size:e.getTagSize.value})},A=z=>{var Y,j;const q=e.getOptionByValue(z);return t.h(Pe._sfc_main,{...q?((j=(Y=e.props).getTagProps)==null?void 0:j.call(Y,q))??{}:{},size:e.getTagSize.value})},X=()=>{if(!e.props.multiple&&!x.isArray(e.modelValue.value)&&e.modelValue.value&&(e.props.tagRenderMode&&["avatar","go"].includes(e.props.tagRenderMode)||K.value||e.props.leadingIcon)){let z;if(e.props.tagRenderMode==="avatar"?z=D(e.modelValue.value):e.props.tagRenderMode==="go"?z=A(e.modelValue.value):K.value?z=B(K.value):e.props.leadingIcon&&(z=B(e.props.leadingIcon)),!L.isEmptyElement(z))return t.h("div",{class:[g.getBemElement(i,"leading"),e.props.triggerLeadingCls]},z)}},ge=()=>{const z=[],q=[g.getBemElement(i,"tags"),e.props.triggerContentCls,Q.isEmpty(e.modelValue.value)?e.props.triggerContentPlaceholderCls:e.props.triggerContentValueCls],j=(()=>{if(e.props.multiple&&x.isArray(e.modelValue.value)){if(e.props.tagRenderMode==="avatar")return t.h(he._sfc_main$1,{maxCount:e.props.maxCount,size:e.getTagSize.value,closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:q},()=>e.modelValue.value.map(D));if(e.props.tagRenderMode==="go")return t.h(Ge._sfc_main,{maxCount:e.props.maxCount,size:e.getTagSize.value,closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:q},()=>e.modelValue.value.map(A));if(e.props.tagRenderMode==="chip")return t.h(We._sfc_main,{maxCount:e.props.maxCount,size:e.getTagSize.value,color:"primary",closeable:!e.getDisabled.value,noPopover:!0,noWrap:!e.props.wrapped,class:q,onClose:c},()=>e.modelValue.value.map(ee=>{var oe,ae;const te=()=>e.getLabelByValue(ee),re=({size:se})=>{const ie=_(e.getOptionByValue(ee))??e.props.leadingIcon;return ie?B(ie,se):null},J=e.getOptionByValue(ee);return t.h(Fe._sfc_main,{...J?((ae=(oe=e.props).getTagProps)==null?void 0:ae.call(oe,J))??{}:{},value:ee,class:[g.getBemElement(i,"tag"),e.props.tagCls],closeIconCls:g.getBemElement(i,"tag__close")},{text:te,leading:re})}))}})();return j&&z.push(j),e.props.headerSearch||z.push(t.h(ze)),t.h("div",{class:g.getBemElement(i,"content")},z)},Z=[],$=X();L.isEmptyElement($)||Z.push($),Z.push(ge());const ne=C();return L.isEmptyElement(ne)||Z.push(ne),Z})}}}),nt=t.defineComponent({__name:"ComboboxLabel",setup(p){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(g.getBemElement)(t.unref(w),"label"))},[t.renderSlot(n.$slots,"default")],2))}}),Oe=t.defineComponent({name:ce.getComponentName("SelectOption"),props:{option:{type:[Object,String],required:!0}},slots:Object,setup(p,{slots:n}){const o=de(),e=t.computed(()=>{switch(o.getSize.value){case"sm":return"2xsm";case"lg":return"sm";case"md":default:return"xsm"}}),c=t.computed(()=>o.getOptionValue(p.option)),i=t.computed(()=>o.getOptionNoCheckbox(p.option)),P=t.computed(()=>o.getOptionClear(p.option)),I=t.computed(()=>o.getOptionSingle(p.option)),V=t.computed(()=>o.getOptionLabel(p.option)),_=t.computed(()=>o.getOptionIcon(p.option)),K=t.computed(()=>o.props.tree?void 0:o.getOptionDescription(p.option)),R=t.computed(()=>o.getOptionDisabled(p.option)),a=t.computed(()=>o.isItemSelected(c.value)),f=g.getBemElement(w,"option"),d=()=>{if(!(o.props.tree||!c.value||R.value))if(o.props.multiple)if(P.value)o.setModelValue([]),o.emit("select",void 0,!1);else if(I.value)o.setModelValue([c.value]),o.emit("select",c.value,!0);else{let s=x.isArray(o.modelValue.value)?o.modelValue.value:[];const B=s.includes(c.value);s.length===1&&o.getSingleByValue(s[0])&&c.value!==s[0]&&(s=[]),B?(o.setModelValue(s.filter(C=>C!==c.value)),o.emit("select",c.value,!0)):(o.setModelValue([...s,c.value]),o.emit("select",c.value,!1))}else P.value?(o.setModelValue(void 0),o.emit("select",void 0,!1)):(o.setModelValue(c.value),o.emit("select",c.value,!0))};if(!p.option)throw new Error("option is required");return()=>{const s=C=>{var S,v,D,A,X;const l=[];!o.props.tree&&o.props.multiple&&o.props.checkbox&&!i.value&&l.push(t.h(He._sfc_main,{modelValue:a.value,size:C.checkboxSize,disabled:R.value}));const k=(S=n.leading)==null?void 0:S.call(n,{option:p.option});return L.isEmptyElement(k)?o.props.tagRenderMode==="avatar"?l.push(t.h(he._sfc_main,{...((D=(v=o.props).getTagProps)==null?void 0:D.call(v,p.option))??{},size:o.getTagSize.value})):o.props.tagRenderMode==="go"?l.push(t.h(Pe._sfc_main,{...((X=(A=o.props).getTagProps)==null?void 0:X.call(A,p.option))??{},size:o.getTagSize.value})):_.value&&l.push(t.h(ye._sfc_main,{icon:_.value,size:e.value})):l.push(k),L.isEmptyElement(l)?null:l};return(()=>{const C=!!K.value;return t.h($e._sfc_main$1,{class:f,description:K.value,title:V.value,key:c.value,selected:a.value,unFocusable:!0,leadingCenter:!C,size:o.getSize.value,disabled:R.value,onClick:d},{leading:s,trailing:()=>{var l;return(l=n.trailing)==null?void 0:l.call(n,{option:p.option})}})})()}}}),rt=t.defineComponent({name:ce.getComponentName("ComboboxWrapper"),setup(p,{slots:n}){const o=Ye(),e=U.injectComboboxRootContext(),c=t.ref();Ne.useLazyLoading({target:c});const i=t.ref(),P=Se.getPopoverPortalProps({triggerRef:i,props:o.props}),{getFlipOnDir:I,getDir:V}=x.useConfig(),_=I("reversePlacementOnDir"),K=V(),R=Se.getPopoverContentProps({props:o.props,flip:_,emitsAsProps:o.emitsAsProps,_dir:K,controlAutoFocus:!1,extraPropNames:["bodyLock","position"]}),a=({key:r,getterKey:u,defaultValue:h,noReturnOption:E})=>y=>{const N=x.isFunction(h)?h(y):h;if(x.isObject(y)){const F=y[r]??N,W=u&&o.props[u];if(W){if(x.isString(W))return y[W]??F;if(x.isFunction(W))return W(y)??F}return F}return x.isString(y)&&!E?y??N:N},f=a({getterKey:"getValue",key:"value"}),d=a({getterKey:"getNoCheckbox",key:"noCheckbox"}),s=a({getterKey:"getSingle",key:"single",noReturnOption:!0}),B=a({getterKey:"getClear",key:"clear",noReturnOption:!0}),C=a({getterKey:"getLabel",key:"label",defaultValue:f}),l=a({getterKey:"getIcon",key:"icon",noReturnOption:!0}),k=a({getterKey:"getDescription",key:"description",noReturnOption:!0}),S=a({getterKey:"getDisabled",key:"disabled",defaultValue:!1,noReturnOption:!0}),v=a({getterKey:"getGroupLabel",key:"label",noReturnOption:!0}),D=a({getterKey:"getGroupOptions",key:"options",noReturnOption:!0}),A=r=>{var u;if((u=o.props.options)!=null&&u.length&&r)for(const h of o.props.options){if(f(h)===r)return h;const E=D(h);if(E!=null&&E.length){for(const y of E)if(f(y)===r)return y}}return r},X=r=>{const u=A(r);return u?C(u)??r:r},ge=r=>{const u=A(r);return u?s(u)??!1:!1},{contains:Z}=U.useFilter({sensitivity:"base"}),$=t.computed(()=>{const r=u=>u==null?void 0:u.map(h=>{const E=C(h),y=f(h),N=S(h),F=v(h),W=!o.searchModel.value||E&&Z(E,o.searchModel.value),m=D(h),O=!o.props.tree||y;if(m&&O){const b=r(m);if(b!=null&&b.length||W)return{groupLabel:F,title:E,key:y,disabled:N,children:b,_option:h}}return W&&O?{title:E,key:y,disabled:N,_option:h}:null}).filter(Boolean);if(o.props.options)return r(o.props.options)}),{getDisabled:ne,getStatus:z,getSize:q}=Be.useFormInput({getDisabled:()=>o.props.disabled,getSize:()=>o.props.size,getStatus:()=>o.props.status}),Y=t.computed(()=>{switch(q.value){case"sm":return"xsm";case"lg":return"md";case"md":default:return"sm"}}),{inputBindings:j,rootBindings:ee}=Be.UseInputDataStates({getDisabled:()=>ne.value}),te=t.ref(),re=()=>{var r,u,h,E,y,N,F;e.open.value&&e.inputElement.value&&(o.props.headerSearch&&((r=te.value)!=null&&r.input)?document.activeElement!==((u=te.value)==null?void 0:u.input)&&((y=(E=(h=te.value)==null?void 0:h.input)==null?void 0:E.focus)==null||y.call(E)):document.activeElement!==e.inputElement.value&&((F=(N=e.inputElement.value)==null?void 0:N.focus)==null||F.call(N)))},J=r=>{e.modelValue.value=r,o.emit("update:modelValue",r)},oe=r=>r===void 0?!1:Array.isArray(e.modelValue.value)?!!(r&&e.modelValue.value.includes(r)):e.modelValue.value===r;Ie({...o,getOptionValue:f,getOptionLabel:C,getOptionSingle:s,getOptionClear:B,getOptionNoCheckbox:d,getOptionDescription:k,getOptionDisabled:S,getOptionIcon:l,getOptionByValue:A,isItemSelected:oe,getLabelByValue:X,getSingleByValue:ge,focusOnInput:re,setModelValue:J,headerInputElement:te,getDisabled:ne,getStatus:z,getSize:q,getTagSize:Y,comboboxInputBinding:j,comboboxTriggerBinding:ee,...e,modelValue:e.modelValue}),t.watch(()=>[o.props.clearOnChangeMultiple,o.props.multiple],()=>{o.props.clearOnChangeMultiple&&J(void 0)});const ae=t.computed(()=>{const r=o.props.scrollContainerProps??{};return{...r,areaCls:[g.getBemElement(w,"scroll_area"),r==null?void 0:r.class,r==null?void 0:r.areaCls]}}),se=g.getBemElement(w,"popup"),ie=_e.cva(se,{variants:{size:g.generateVariantClassList(be,se)}}),me=r=>{if(Number(r)>0)return`${r}px`;if(typeof r=="string")return r},Le=t.computed(()=>me(o.props.popupWidth)),De=t.computed(()=>me(o.props.popupHeight)),Ce=t.computed(()=>me(o.props.minWidth)),xe=t.computed(()=>({type:q.value==="sm"?"simple":"advance",...pe.omit(o.props.emptyProps??{},"class")})),Me=t.computed(()=>pe.omit(o.props.skeletonProps??{},"class")),{selectValues:qe}=et({getValue:r=>r==null?void 0:r.key,getChildren:r=>r==null?void 0:r.children,getModel:()=>G.cloneDeep(e.modelValue.value),getData:()=>G.cloneDeep($.value??[])});return()=>{var F,W;const r=m=>t.h(Oe,{option:m},{trailing:n.optionTrailing,leading:n.optionLeading}),u=[];let h;if(o.props.tree){const O=x.isArray(e.modelValue.value)?e.modelValue.value:e.modelValue.value?[e.modelValue.value]:[];h=t.h(Re._sfc_main,{data:$.value??[],selectable:!0,checkbox:o.props.multiple&&o.props.checkbox,multiple:o.props.multiple,defaultExpandAll:!0,syncCheckboxAndSelect:o.props.multiple,showLine:!0,modelValue:O,checkedKeys:O,onExpand:re,onSelect:(b,M,T)=>{if(o.props.multiple){const H=x.isArray(T)?T:[T];J(qe(H,M))}else J(T)},class:"w-full"},{title:b=>r(b._option)}),u.push(h)}else{let m=!1;const O=[];if(($.value??[]).forEach(b=>{var M;if((M=b.children)!=null&&M.length){const T=[];b.children.forEach(H=>{const le=r(H._option);oe(f(H._option))&&o.props.sortSelectedItems?O.push(le):T.push(le)}),T.length&&((m||u.length)&&(u.push(t.h(ve._sfc_main)),m=!1),b.groupLabel&&u.push(t.h(nt,{class:o.props.labelCls},()=>b.groupLabel)),u.push(...T),m=!0)}else{const T=r(b._option);oe(f(b._option))&&o.props.sortSelectedItems?O.push(T):(m&&(u.push(t.h(ve._sfc_main)),m=!1),u.push(T))}}),o.props.sortSelectedItems&&O.length){const b=!!u.length;u.splice(0,0,...O),b&&u.splice(O.length,0,t.h(ve._sfc_main))}}const E=L.flattenChildrenByType(h?[h]:u,Oe).filter(m=>{var O;return x.isObject(m==null?void 0:m.props)&&((O=m==null?void 0:m.props)==null?void 0:O.option)}),y=!!(o.props.tree&&((F=$.value)!=null&&F.length)||E!=null&&E.length),N=()=>{var O,b;const m=[];if(y||o.props.loading){const M=[];if(y&&M.push(...u),o.props.loading){const T=(O=n.loading)==null?void 0:O.call(n,{});if(!L.isEmptyElement(T))M.push(T);else{const H=new Array(y?2:o.props.loadingRowCount).fill(1);M.push(...H.map(()=>t.h(Ae._sfc_main,{size:q.value,class:[g.getBemElement(w,"skeleton"),o.props.skeletonCls],...Me.value})))}}m.push(t.h("div",{class:[g.getBemElement(w,"options"),o.props.optionsCls]},M))}else if(!y){const M=(b=n.empty)==null?void 0:b.call(n,xe.value);L.isEmptyElement(M)?m.push(t.h(we._sfc_main,{class:[g.getBemElement(w,"empty"),o.props.emptyCls],...xe.value},{title:n.emptyTitle,description:n.emptyDescription,actions:n.emptyActions,image:n.emptyImage})):m.push(M)}return o.props.lazyLoading&&m.push(t.h("div",{class:g.getBemElement(w,"lazy_loading")},t.h("div",{class:g.getBemElement(w,"lazy_loading_trigger"),ref:c}))),m};return[t.h(ot,{ref:i,...o.attrs,style:{...((W=o.attrs)==null?void 0:W.style)??{},"--ptc-combobox-trigger-min-w":Ce.value}},{trigger:n.trigger,triggerTrailing:n.triggerTrailing}),t.h(U.ComboboxPortal,P.value,()=>t.h(U.ComboboxContent,{...R.value,vShow:e.open.value,class:[ie(o.props),o.props.popupCls],style:{"--ptc-combobox-popup-width":o.props.samePopupWidth?void 0:Le.value,"--ptc-combobox-popup-height":De.value,"--ptc-combobox-trigger-min-w":Ce.value},onClick:re},()=>{var T,H,le,Ve;const m=[],O=(H=n.header)==null?void 0:H.call(n,{isEmpty:!((T=$.value)!=null&&T.length),search:o.searchModel.value}),b=!L.isEmptyElement(O);if(o.props.headerSearch||b){const fe=[];b&&fe.push(O),o.props.headerSearch&&fe.push(t.h(ze)),m.push(t.h("div",{class:g.getBemElement(w,"header")},fe))}m.push(t.h(Ke._sfc_main,ae.value,N));const M=(Ve=n.footer)==null?void 0:Ve.call(n,{isEmpty:!((le=$.value)!=null&&le.length),search:o.searchModel.value});return L.isEmptyElement(M)||m.push(t.h("div",{class:g.getBemElement(w,"footer")},M)),m}))]}}}),lt=t.defineComponent({...ce.getComponentOptions("Combobox"),__name:"Combobox",props:{size:{default:"md"},status:{},multiple:{type:Boolean,default:void 0},checkbox:{type:Boolean,default:!0},tagRenderMode:{default:"chip"},getTagProps:{},tree:{type:Boolean},contentFit:{type:Boolean},wrapped:{type:Boolean},sortSelectedItems:{type:Boolean},noTrailing:{type:Boolean},leadingIcon:{},trailingIcon:{default:"tabler:chevron-down"},selectedItemIconAsTrailingIcon:{type:Boolean,default:!0},maxCount:{},to:{},placeholder:{},indicatorIcon:{default:"tabler:check"},options:{},getDisabled:{},getLabel:{},getDescription:{},getValue:{},getNoCheckbox:{},getSingle:{},getClear:{},getGroupOptions:{},getGroupLabel:{},getIcon:{},placement:{default:"bottom-start"},reversePlacementOnDir:{},loading:{type:Boolean},skeletonProps:{},loadingRowCount:{default:10},lazyLoading:{type:Boolean},bordered:{type:Boolean,default:!0},clearOnChangeMultiple:{type:Boolean,default:!0},triggerCls:{},triggerLeadingCls:{},triggerContentCls:{},triggerContentPlaceholderCls:{},triggerContentValueCls:{},triggerTrailingCls:{},itemLeadingCls:{},optionCls:{},tagCls:{},popupCls:{},labelCls:{},optionsCls:{},optionTextCls:{},optionContentCls:{},emptyCls:{},skeletonCls:{},scrollContainerProps:{},emptyProps:{},samePopupWidth:{type:Boolean,default:!0},popupHeight:{default:384},popupWidth:{},minWidth:{},headerSearch:{type:Boolean},search:{},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},resetSearchTermOnBlur:{type:Boolean,default:!0},resetSearchTermOnSelect:{type:Boolean,default:!0},modelValue:{},defaultValue:{},dir:{},disabled:{type:Boolean,default:void 0},highlightOnHover:{type:Boolean},by:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},reference:{},forceMount:{type:Boolean,default:void 0},position:{default:"popper"},bodyLock:{type:Boolean},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean,default:void 0},collisionBoundary:{},collisionPadding:{default:4},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean,default:void 0},positionStrategy:{default:"fixed"},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean,default:void 0},prioritizePosition:{type:Boolean,default:void 0},disableOutsidePointerEvents:{type:Boolean},defer:{type:Boolean}},emits:["update:search","select","update:modelValue","highlight","update:open","escapeKeyDown","pointerDownOutside","focusOutside","interactOutside"],setup(p,{emit:n}){const o=p,e=n,c=U.useEmitAsProps(e),i=t.computed(()=>G.omitBy({...G.pick(o,"open","defaultOpen","defaultValue","modelValue","by","dir","multiple","disabled"),...G.pick(c,"onUpdate:modelValue","onUpdate:open"),ignoreFilter:!0},G.isUndefined)),P=ke.useVModel(o,"search",e,{passive:o.search===void 0});t.watch(()=>o.open,_=>{_||(P.value=void 0)});const I=t.useSlots(),V=t.useAttrs();return Je({attrs:V,props:o,emit:e,searchModel:P,emitsAsProps:c}),(_,K)=>(t.openBlock(),t.createBlock(t.unref(U.ComboboxRoot),t.mergeProps(i.value,{class:t.unref(w)}),{default:t.withCtx(()=>[t.createVNode(t.unref(rt),null,t.createSlots({_:2},[t.renderList(Object.keys(I),R=>({name:R,fn:t.withCtx(a=>[t.renderSlot(_.$slots,R,t.normalizeProps(t.guardReactiveProps(a)))])}))]),1024)]),_:3},16,["class"]))}});exports.ComboboxSizes=be;exports.ComboboxStatuses=Te;exports._sfc_main=lt;exports.injectComboboxContext=de;exports.provideComboboxContext=Ie;
|