vue-devui 1.0.0-rc.1 → 1.0.0-rc.2
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/README.md +126 -200
- package/auto-complete/index.es.js +55 -77
- package/auto-complete/index.umd.js +3 -1
- package/auto-complete/style.css +1 -1
- package/editable-select/index.es.js +118 -162
- package/editable-select/index.umd.js +1 -1
- package/nuxt/components/tagProps.js +3 -0
- package/package.json +1 -1
- package/popover/index.es.js +2 -2
- package/popover/index.umd.js +4 -4
- package/progress/index.es.js +1 -1
- package/progress/index.umd.js +1 -1
- package/progress/style.css +1 -1
- package/radio/index.es.js +8 -2
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/ripple/index.es.js +43 -42
- package/ripple/index.umd.js +1 -1
- package/slider/index.es.js +58 -58
- package/slider/index.umd.js +1 -1
- package/splitter/index.es.js +168 -125
- package/splitter/index.umd.js +11 -11
- package/style.css +1 -1
- package/tag/index.es.js +13 -17
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/vue-devui.es.js +765 -605
- package/vue-devui.umd.js +18 -16
- package/accordion/index.d.ts +0 -7
- package/accordion/index.es.js +0 -723
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.d.ts +0 -7
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/package.json +0 -7
- package/anchor/style.css +0 -1
- package/back-top/index.d.ts +0 -7
- package/back-top/index.es.js +0 -130
- package/back-top/index.umd.js +0 -1
- package/back-top/package.json +0 -7
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -128
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/package.json +0 -7
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -314
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5971
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.es.js +0 -8196
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/date-picker/index.d.ts +0 -7
- package/date-picker/index.es.js +0 -1154
- package/date-picker/index.umd.js +0 -1
- package/date-picker/package.json +0 -7
- package/date-picker/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/drawer/index.d.ts +0 -7
- package/drawer/index.es.js +0 -234
- package/drawer/index.umd.js +0 -1
- package/drawer/package.json +0 -7
- package/drawer/style.css +0 -1
- package/dropdown/index.d.ts +0 -7
- package/dropdown/index.es.js +0 -693
- package/dropdown/index.umd.js +0 -1
- package/dropdown/package.json +0 -7
- package/dropdown/style.css +0 -1
- package/form/index.d.ts +0 -7
- package/form/index.es.js +0 -7876
- package/form/index.umd.js +0 -27
- package/form/package.json +0 -7
- package/form/style.css +0 -1
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -332
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/input-number/index.d.ts +0 -7
- package/input-number/index.es.js +0 -229
- package/input-number/index.umd.js +0 -1
- package/input-number/package.json +0 -7
- package/input-number/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Column.js +0 -3
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/Drawer.js +0 -3
- package/nuxt/components/DrawerService.js +0 -3
- package/nuxt/components/Dropdown.js +0 -3
- package/nuxt/components/DropdownMenu.js +0 -3
- package/nuxt/components/Form.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormItem.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/FormOperation.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/InputNumber.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/Select.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/Table.js +0 -3
- package/nuxt/components/Tabs.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Tooltip.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/Tree.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/dropdownMenuProps.js +0 -3
- package/nuxt/components/tooltipProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/select/index.d.ts +0 -7
- package/select/index.es.js +0 -706
- package/select/index.umd.js +0 -1
- package/select/package.json +0 -7
- package/select/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -242
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/table/index.d.ts +0 -7
- package/table/index.es.js +0 -2024
- package/table/index.umd.js +0 -1
- package/table/package.json +0 -7
- package/table/style.css +0 -1
- package/tabs/index.d.ts +0 -7
- package/tabs/index.es.js +0 -194
- package/tabs/index.umd.js +0 -1
- package/tabs/package.json +0 -7
- package/tabs/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1238
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/tooltip/index.d.ts +0 -7
- package/tooltip/index.es.js +0 -5835
- package/tooltip/index.umd.js +0 -27
- package/tooltip/package.json +0 -7
- package/tooltip/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7615
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree/index.d.ts +0 -7
- package/tree/index.es.js +0 -6495
- package/tree/index.umd.js +0 -27
- package/tree/package.json +0 -7
- package/tree/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -627
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
|
@@ -1 +1,3 @@
|
|
|
1
|
-
var Be=Object.defineProperty;var re=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var O=(p,t,m)=>t in p?Be(p,t,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[t]=m,E=(p,t)=>{for(var m in t||(t={}))Oe.call(t,m)&&O(p,m,t[m]);if(re)for(var m of re(t))je.call(t,m)&&O(p,m,t[m]);return p};var C=(p,t,m)=>(O(p,typeof t!="symbol"?t+"":t,m),m);(function(p,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],t):(p=typeof globalThis!="undefined"?globalThis:p||self,t(p.index={},p.Vue,p.dom))})(this,function(p,t,m){"use strict";const se={modelValue:{type:String,default:""},source:{type:Array,default:null},allowEmptyValueSearch:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},appendToBodyDirections:{type:Object,default:()=>({originX:"left",originY:"bottom",overlayX:"left",overlayY:"top"})},disabled:{type:Boolean,default:!1},delay:{type:Number,default:300},disabledKey:{type:String,default:null},formatter:{type:Function,default:e=>e?e.label||e.toString():""},isSearching:{type:Boolean,default:!1},sceneType:{type:String,default:null},searchFn:{type:Function,default:null},tipsText:{type:String,default:"\u6700\u8FD1\u8F93\u5165"},latestSource:{type:Array,default:null},valueParser:{type:Function,default:e=>e},enableLazyLoad:{type:Boolean,default:!1},dAutoCompleteWidth:{type:Number,default:null},showAnimation:{type:Boolean,default:!0},maxHeight:{type:Number,default:300},transInputFocusEmit:{type:Function,default:null},selectValue:{type:Function,default:null},loadMore:{type:Function,default:null}},j=Symbol("DropdownPropsKey");function ie(e,n){const o=(r,u)=>{const i={item:r,index:u};return e.slots.itemTemplate?e.slots.itemTemplate(i):null},l=()=>e.slots.noResultItemTemplate?e.slots.noResultItemTemplate(n.value):null,s=()=>e.slots.searchingTemplate?e.slots.searchingTemplate(n.value):null;return{customRenderSolts:()=>{const r={};return e.slots.itemTemplate&&(r.itemTemplate=o),e.slots.noResultItemTemplate&&(r.noResultItemTemplate=l),e.slots.searchingTemplate&&(r.searchingTemplate=s),r}}}function ue(e,n,o,l,s){const a=t.ref([]),r=t.ref(!1);return{handleSearch:async(d,c)=>{if(d==""&&!n.value){a.value=[],r.value=!1;return}let v=[];d=d.toLowerCase(),c?v=o.value:l.value?v=await l.value(d):o.value.forEach(f=>{let y=s.value(f);y=y.toLowerCase(),y.startsWith(d)&&v.push(f)}),a.value=v,a.value.length==0?r.value=!0:r.value=!1},recentlyFocus:d=>{d&&(a.value=d)},searchList:a,showNoResultItemTemplate:r}}function de(e,n,o,l,s,a,r,u,i,d){const c=t.ref(!1),v=t.ref(),f=t.ref(!1),h=((S,D)=>{let g;return(...b)=>{g&&clearTimeout(g),g=setTimeout(async()=>{f.value=!0,await S(...b),f.value=!1},D)}})(async S=>{await r(S),c.value=!0},a.value),T=S=>{const D=S.target;f.value=!1,o.value=!1,e.emit("update:modelValue",D.value),h(D.value)},A=()=>{r(l.value),i(d.value),u.value&&u.value()},V=()=>{c.value=!1,f.value=!1,o.value=!1};return{handleClose:V,toggleMenu:()=>{s.value||(c.value?V():(c.value=!0,e.slots.noResultItemTemplate&&n.value.length==0&&l.value.trim()!=""&&(o.value=!0)))},onInput:T,onFocus:A,inputRef:v,visible:c,searchStatus:f}}function ce(e,n,o,l,s,a){const r=t.ref(0),u=d=>{if(n.value.length==0)return 0;const c=n.value.indexOf(d);return c==-1?0:c};return{selectedIndex:r,selectOptionClick:async d=>{const c=s.value(d);e.emit("update:modelValue",c),a(),await l(c),r.value=u(c),o.value&&o.value()}}}function fe(e,n,o){const l=t.ref(!1),s=t.ref(),a=()=>{if(!e.enableLazyLoad&&l)return;const u=s.value,i=u.scrollHeight,d=u.clientHeight+u.scrollTop;d>=i&&d>=e.maxHeight&&(e.loadMore(),l.value=!0)};n.expose({loadFinish:r});async function r(){await o(e.modelValue,e.enableLazyLoad),l.value=!1}return{showLoading:l,dropDownRef:s,loadMore:a}}function pe(e,n,o,l,s,a,r,u){var v;const i=t.ref((v=l.value)!=null?v:0),d=f=>{const y=e.value,w=y.children[f];t.nextTick(()=>{if(w.scrollIntoViewIfNeeded)w.scrollIntoViewIfNeeded(!1);else{const h=y.getBoundingClientRect(),T=w.getBoundingClientRect();(T.bottom>h.bottom||T.top<h.top)&&w.scrollIntoView(!1)}})};return{hoverIndex:i,handlekeyDown:f=>{var h;const y=f.key||f.code;if(y==="Escape"&&(n.value&&o.value.length||s.value||a.value)){u();return}const w=n.value&&o.value.length&&!s.value&&!a.value;if(y==="ArrowDown"&&w){if(i.value===o.value.length-1){i.value=0,d(i.value);return}i.value=i.value+1,d(i.value)}else if(y==="ArrowUp"&&w){if(i.value===0){i.value=o.value.length-1,d(i.value);return}i.value=i.value-1,d(i.value)}if(y==="Enter"&&w){r(o.value[i.value]),i.value=(h=l.value)!=null?h:0;return}}}}var ze="";class M{constructor(){C(this,"top","50%");C(this,"left","50%")}}const ve={message:String,backdrop:Boolean,view:{type:Object,default:()=>new M},zIndex:Number,isFull:{type:Boolean,default:!1}};class me{constructor(){C(this,"target");C(this,"message");C(this,"loadingTemplateRef");C(this,"backdrop",!0);C(this,"positionType","relative");C(this,"view",new M);C(this,"zIndex")}}var _e="",ye=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:ve,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const o=t.ref(!1);return{style:n,isShow:o,open:()=>{o.value=!0},close:()=>{o.value=!1}}},render(){var r;const{isShow:e,isFull:n,backdrop:o,style:l,message:s,$slots:a}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((r=a.default)==null?void 0:r.call(a))||t.createVNode("div",{class:"devui-loading-wrapper"},[o?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:l,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),s?t.createVNode("span",{class:"devui-loading-text"},[s]):null])])])}});const H=Symbol("dev_component_container");function ge(e,n,o=null){const l=t.h(e,E({},n),o),s=document.createElement("div");return l[H]=s,t.render(l,s),l.component}function we(e){t.render(null,e==null?void 0:e.vnode[H])}const he=t.defineComponent(ye),F=new WeakSet,R=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},z=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),be=e=>{switch(z(e)){case"promise":return[e];case"array":return e.some(o=>z(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},_=e=>{F.delete(e),e.instance.proxy.close(),we(e.instance)},K=(e,n)=>{if(n.value){const o=be(n.value);if(o==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),F.add(e),o&&Promise.all(o).catch(l=>{console.error(new Error("Promise handling errors"),l)}).finally(()=>{_(e)})}else _(e)},$=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},W=(e,n)=>{const o=E(E({},new me),n),l=o.loadingTemplateRef,s=ge(he,E({},o),l?()=>l:null);e.style.position=o.positionType,e.options=o,e.instance=s,e.mask=s.proxy.$el},Te={mounted:function(e,n,o){W(e,o.props),$(e),!R(n.value)&&K(e,n)},updated:function(e,n,o){!R(n.value)&&F.has(e)||R(n.value)&&!F.has(e)||(!F.has(e)&&W(e,o.props),$(e),K(e,n))}};var Y=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:Te},setup(e,n){const o=t.inject(j),{visible:l,selectedIndex:s,selectOptionClick:a,searchList:r,searchStatus:u,dropDownRef:i,loadMore:d,showLoading:c,showNoResultItemTemplate:v,latestSource:f,modelValue:y,hoverIndex:w}=o,{disabled:h,maxHeight:T,appendToBody:A,formatter:V,disabledKey:k,isSearching:S}=o.props,D=g=>{g[k]||a(g)};return()=>t.withDirectives(t.createVNode("div",{class:["devui-dropdown-menu",A&&"devui-dropdown-menu-cdk",h&&"disabled",f.value&&"devui-dropdown-latestSource"]},[t.createVNode("ul",{ref:i,class:"devui-list-unstyled scroll-height",style:{maxHeight:`${T}px`},onScroll:d},[S&&n.slots.searchingTemplate&&u.value&&t.createVNode("li",{class:"devui-is-searching-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.searchingTemplate()])]),f.value&&!y.value&&t.createVNode("li",{class:"devui-popup-tips"},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!v.value&&!u.value&&r!=null&&r.value.length>0&&r.value.map((g,b)=>t.createVNode("li",{onClick:()=>D(g),class:["devui-dropdown-item",s.value==b&&"selected",{disabled:k&&g[k]},{"devui-dropdown-bg":w.value==b}],title:V(g),key:V(g)},[n.slots.itemTemplate?n.slots.itemTemplate(g,b):V(g)])),!u.value&&r.value.length==0&&n.slots.noResultItemTemplate&&v.value&&t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.noResultItemTemplate()])])])]),[[t.resolveDirective("dLoading"),c.value],[t.vShow,l.value&&r.value.length>0||n.slots.noResultItemTemplate&&v.value||S&&n.slots.searchingTemplate&&u.value]])}});const Ve=typeof window!="undefined";function q(e,n,o){document.addEventListener?e&&n&&o&&e.addEventListener(n,o,!1):e&&n&&o&&e.attachEvent("on"+n,o)}const N=Symbol("@@clickoutside"),x=new Map;let U,P=0,X=!0;function G(e,n,o){return Ve&&X&&(X=!1,q(document,"mousedown",l=>{U=l}),q(document,"mouseup",l=>{for(const[s,a]of x)a[N].documentHandler(l,U)})),function(l,s){!o||!n.instance||!l.target||!s.target||e.contains(l.target)||e.contains(s.target)||e===l.target||e[N].bindingFn&&e[N].bindingFn()}}const Se={beforeMount:function(e,n,o){P++,x.set(P,e),e[N]={nid:P,documentHandler:G(e,n,o),bindingFn:n.value}},updated:function(e,n,o){e[N].documentHandler=G(e,n,o),e[N].bindingFn=n.value},unmounted:function(e){x.delete(e[N].nid),delete e[N]}},Ce={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function J(e){const n=/(auto|scroll|hidden)/;for(let o=e;o=o.parentElement;o.parentElement!==document.body){const l=window.getComputedStyle(o);if(n.test(l.overflow+l.overflowX+l.overflowY))return o}return window}function Ne(e,n,o,l){let{x:s,y:a}=n;if(!e){const{width:r,height:u}=l;s&&o.includes("start")&&(s=12),s&&o.includes("end")&&(s=Math.round(r-24)),a&&o.includes("start")&&(a=10),a&&o.includes("end")&&(a=u-14)}return{x:s,y:a}}function Ae(e,n){const o=t.ref(),l=t.ref(),s=(r,u,i,d)=>{const{x:c,y:v}=Ne(e.isArrowCenter,i,u,d.getBoundingClientRect()),f={top:"bottom",right:"left",bottom:"top",left:"right"}[u.split("-")[0]];Object.assign(r.style,{left:c?`${c}px`:"",top:v?`${v}px`:"",right:"",bottom:"",[f]:"-4px"})},a=async()=>{const r=e.origin,u=t.unref(o.value),i=t.unref(l.value),d=[m.shift(),m.offset(e.offset),m.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&d.push(m.arrow({element:i}));const{x:c,y:v,placement:f,middlewareData:y}=await m.computePosition(r,u,{strategy:"fixed",middleware:d});n("positionChange",f),Object.assign(u.style,{top:`${v}px`,left:`${c}px`}),e.showArrow&&s(i,f,y.arrow,u)};return t.watch(()=>e.modelValue,()=>{const r=J(e.origin);e.modelValue&&e.origin?(t.nextTick(a),r.addEventListener("scroll",a),r!==window&&window.addEventListener("scroll",a),window.addEventListener("resize",a)):(r.removeEventListener("scroll",a),r!==window&&window.removeEventListener("scroll",a),window.removeEventListener("resize",a))}),t.onUnmounted(()=>{const r=J(e.origin);r.removeEventListener("scroll",a),r!==window&&window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}),{arrowRef:l,overlayRef:o,updatePosition:a}}var Ke="";const De=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:Ce,emits:["update:modelValue","positionChange"],setup(e,{slots:n,attrs:o,emit:l,expose:s}){const{arrowRef:a,overlayRef:r,updatePosition:u}=Ae(e,l);return s({updatePosition:u}),()=>{var i;return e.modelValue&&t.createVNode("div",t.mergeProps({ref:r,class:"devui-flexible-overlay"},o),[(i=n.default)==null?void 0:i.call(n),e.showArrow&&t.createVNode("div",{ref:a,class:"devui-flexible-overlay-arrow"},null)])}}});function Q(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var L=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:Se},props:se,emits:["update:modelValue"],setup(e,n){const{disabled:o,modelValue:l,appendToBody:s,dAutoCompleteWidth:a,delay:r,allowEmptyValueSearch:u,formatter:i,transInputFocusEmit:d,selectValue:c,source:v,searchFn:f,appendToBodyDirections:y,latestSource:w,showAnimation:h}=t.toRefs(e),{handleSearch:T,searchList:A,showNoResultItemTemplate:V,recentlyFocus:k}=ue(n,u,v,f,i),{onInput:S,onFocus:D,inputRef:g,visible:b,searchStatus:Z,handleClose:B,toggleMenu:ke}=de(n,A,V,l,o,r,T,d,k,w),{selectedIndex:ee,selectOptionClick:te}=ce(n,A,c,T,i,B),{showLoading:Fe,dropDownRef:oe,loadMore:Le}=fe(e,n,T),{customRenderSolts:ne}=ie(n,l),{hoverIndex:Ee,handlekeyDown:Re}=pe(oe,b,A,ee,Z,V,te,B);t.provide(j,{props:e,visible:b,term:"",searchList:A,selectedIndex:ee,searchStatus:Z,selectOptionClick:te,dropDownRef:oe,showLoading:Fe,loadMore:Le,latestSource:w,modelValue:l,showNoResultItemTemplate:V,hoverIndex:Ee});const le=t.ref(),ae=t.reactive({appendToBodyDirections:{}});ae.appendToBodyDirections=y;const xe=()=>{if(s.value){let I;return t.createVNode(De,{hasBackdrop:!1,origin:le,position:ae.appendToBodyDirections,visible:b.value,"onUpdate:visible":Pe=>b.value=Pe},{default:()=>[t.createVNode("div",{class:"devui-dropdown devui-auto-complete-menu",style:{width:a.value>0&&a.value+"px"}},[t.createVNode(Y,null,Q(I=ne())?I:{default:()=>[I]})])]})}else{let I;return t.createVNode("div",{class:"devui-dropdown",style:{width:a.value>0&&a.value+"px"}},[t.createVNode(t.Transition,{name:h?"fade":""},{default:()=>[t.createVNode(Y,null,Q(I=ne())?I:{default:()=>[I]})]})])}};return()=>t.withDirectives(t.createVNode("div",{class:["devui-auto-complete","devui-form-group","devui-has-feedback",b.value&&"devui-select-open"],ref:le,style:{width:a.value>0&&a.value+"px"}},[t.createVNode("input",{disabled:o.value,type:"text",onClick:ke,class:["devui-form-control","devui-dropdown-origin","devui-dropdown-origin-open",o.value&&"disabled"],placeholder:"Search",onInput:S,onFocus:D,value:l.value,ref:g,onKeydown:Re},null),xe()]),[[t.resolveDirective("click-outside"),B]])}});L.install=function(e){e.component(L.name,L)};var Ie={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(L)}};p.AutoComplete=L,p.default=Ie,Object.defineProperty(p,"__esModule",{value:!0}),p[Symbol.toStringTag]="Module"});
|
|
1
|
+
var Pe=Object.defineProperty;var te=Object.getOwnPropertySymbols;var Re=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable;var B=(p,t,m)=>t in p?Pe(p,t,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[t]=m,k=(p,t)=>{for(var m in t||(t={}))Re.call(t,m)&&B(p,m,t[m]);if(te)for(var m of te(t))Oe.call(t,m)&&B(p,m,t[m]);return p};var T=(p,t,m)=>(B(p,typeof t!="symbol"?t+"":t,m),m);(function(p,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],t):(p=typeof globalThis!="undefined"?globalThis:p||self,t(p.index={},p.Vue,p.dom))})(this,function(p,t,m){"use strict";const oe={modelValue:{type:String,default:""},source:{type:Array,default:null},allowEmptyValueSearch:{type:Boolean,default:!1},position:{type:Array,default:["bottom-end"]},disabled:{type:Boolean,default:!1},delay:{type:Number,default:300},disabledKey:{type:String,default:null},formatter:{type:Function,default:e=>e?e.label||e.toString():""},isSearching:{type:Boolean,default:!1},sceneType:{type:String,default:null},searchFn:{type:Function,default:null},tipsText:{type:String,default:"\u6700\u8FD1\u8F93\u5165"},latestSource:{type:Array,default:null},valueParser:{type:Function,default:e=>e},enableLazyLoad:{type:Boolean,default:!1},width:{type:Number,default:400},showAnimation:{type:Boolean,default:!0},maxHeight:{type:Number,default:300},transInputFocusEmit:{type:Function,default:null},selectValue:{type:Function,default:null},loadMore:{type:Function,default:null}},M=Symbol("DropdownPropsKey");function ne(e,n){const o=(a,s)=>{const u={item:a,index:s};return e.slots.item?e.slots.item(u):null},l=()=>e.slots.nothing?e.slots.nothing(n.value):null,i=()=>e.slots.searching?e.slots.searching(n.value):null;return{customRenderSolts:()=>{const a={};return e.slots.item&&(a.itemTemplate=o),e.slots.nothing&&(a.noResultItemTemplate=l),e.slots.searching&&(a.searchingTemplate=i),a}}}function le(e,n,o,l,i){const r=t.ref(),a=t.ref(!1);return{handleSearch:async(d,c)=>{if(d===""&&!n.value){r.value=[],a.value=!1;return}let v=[];d=d.toLowerCase(),c?v=o.value:l.value?v=await l.value(d):o.value.forEach(f=>{let g=i.value(f);g=g.toLowerCase(),g.startsWith(d)&&v.push(f)}),r.value=v,r.value.length===0?a.value=!0:a.value=!1},recentlyFocus:d=>{d&&(r.value=d)},searchList:r,showNoResultItemTemplate:a}}function ae(e,n,o,l,i,r,a,s,u,d){const c=t.ref(!1),v=t.ref(),f=t.ref(!1),h=((N,y)=>{let b;return(...E)=>{b&&clearTimeout(b),b=setTimeout(async()=>{f.value=!0,await N(...E),f.value=!1},y)}})(async N=>{await a(N),c.value=!0},r.value),V=N=>{const y=N.target;f.value=!1,o.value=!1,e.emit("update:modelValue",y.value),h(y.value)},C=()=>{a(l.value),u(d.value),s.value&&s.value()},S=()=>{c.value=!1,f.value=!1,o.value=!1};return{handleClose:S,toggleMenu:()=>{i.value||(c.value?S():(c.value=!0,e.slots.noResultItemTemplate&&n.value.length===0&&l.value.trim()!==""&&(o.value=!0)))},onInput:V,onFocus:C,inputRef:v,visible:c,searchStatus:f}}function re(e,n,o,l,i,r){const a=t.ref(0),s=d=>{if(n.value.length===0)return 0;const c=n.value.indexOf(d);return c===-1?0:c};return{selectedIndex:a,selectOptionClick:async d=>{const c=i.value(d);e.emit("update:modelValue",c),r(),await l(c),a.value=s(c),o.value&&o.value(c)}}}function ie(e,n,o){const l=t.ref(!1),i=t.ref(),r=()=>{if(!e.enableLazyLoad&&l)return;const s=i.value,u=s.scrollHeight,d=s.clientHeight+s.scrollTop;d>=u&&d>=e.maxHeight&&(e.loadMore(),l.value=!0)};n.expose({loadFinish:a});async function a(){await o(e.modelValue,e.enableLazyLoad),l.value=!1}return{showLoading:l,dropDownRef:i,loadMore:r}}function se(e,n,o,l,i,r,a,s){var v;const u=t.ref((v=l.value)!=null?v:0),d=f=>{const g=e.value,w=g.children[f];t.nextTick(()=>{if(w.scrollIntoViewIfNeeded)w.scrollIntoViewIfNeeded(!1);else{const h=g.getBoundingClientRect(),V=w.getBoundingClientRect();(V.bottom>h.bottom||V.top<h.top)&&w.scrollIntoView(!1)}})};return{hoverIndex:u,handlekeyDown:f=>{var h;const g=f.key||f.code;if(g==="Escape"&&(n.value&&o.value.length||i.value||r.value)){s();return}const w=n.value&&o.value.length&&!i.value&&!r.value;if(g==="ArrowDown"&&w){if(u.value===o.value.length-1){u.value=0,d(u.value);return}u.value=u.value+1,d(u.value)}else if(g==="ArrowUp"&&w){if(u.value===0){u.value=o.value.length-1,d(u.value);return}u.value=u.value-1,d(u.value)}if(g==="Enter"&&w){a(o.value[u.value]),u.value=(h=l.value)!=null?h:0;return}}}}var je="";class j{constructor(){T(this,"top","50%");T(this,"left","50%")}}const ue={message:String,backdrop:Boolean,view:{type:Object,default:()=>new j},zIndex:Number,isFull:{type:Boolean,default:!1}};class de{constructor(){T(this,"target");T(this,"message");T(this,"loadingTemplateRef");T(this,"backdrop",!0);T(this,"positionType","relative");T(this,"view",new j);T(this,"zIndex")}}var He="",ce=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:ue,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const o=t.ref(!1);return{style:n,isShow:o,open:()=>{o.value=!0},close:()=>{o.value=!1}}},render(){var a;const{isShow:e,isFull:n,backdrop:o,style:l,message:i,$slots:r}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((a=r.default)==null?void 0:a.call(r))||t.createVNode("div",{class:"devui-loading-wrapper"},[o?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:l,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),i?t.createVNode("span",{class:"devui-loading-text"},[i]):null])])])}});const H=Symbol("dev_component_container");function fe(e,n,o=null){const l=t.h(e,k({},n),o),i=document.createElement("div");return l[H]=i,t.render(l,i),l.component}function pe(e){t.render(null,e==null?void 0:e.vnode[H])}const ve=t.defineComponent(ce),F=new WeakSet,D=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},z=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),me=e=>{switch(z(e)){case"promise":return[e];case"array":return e.some(o=>z(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},_=e=>{F.delete(e),e.instance.proxy.close(),pe(e.instance)},$=(e,n)=>{if(n.value){const o=me(n.value);if(o==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),F.add(e),o&&Promise.all(o).catch(l=>{console.error(new Error("Promise handling errors"),l)}).finally(()=>{_(e)})}else _(e)},K=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},q=(e,n)=>{const o=k(k({},new de),n),l=o.loadingTemplateRef,i=fe(ve,k({},o),l?()=>l:null);e.style.position=o.positionType,e.options=o,e.instance=i,e.mask=i.proxy.$el},ge={mounted:function(e,n,o){q(e,o.props),K(e),!D(n.value)&&$(e,n)},updated:function(e,n,o){!D(n.value)&&F.has(e)||D(n.value)&&!F.has(e)||(!F.has(e)&&q(e,o.props),K(e),$(e,n))}};var ye=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:ge},setup(e,n){const o=t.inject(M),{visible:l,selectedIndex:i,selectOptionClick:r,searchList:a,searchStatus:s,dropDownRef:u,loadMore:d,showLoading:c,showNoResultItemTemplate:v,latestSource:f,modelValue:g,hoverIndex:w}=o,{disabled:h,maxHeight:V,formatter:C,disabledKey:S,isSearching:L}=o.props,N=y=>{y[S]||r(y)};return()=>t.withDirectives(t.createVNode("div",{class:["devui-dropdown-menu","devui-dropdown-menu-cdk",h&&"disabled",f.value&&"devui-dropdown-latestSource"]},[t.createVNode("ul",{ref:u,class:"devui-list-unstyled scroll-height",style:{maxHeight:`${V}px`},onScroll:d},[L&&n.slots.searchingTemplate&&(s==null?void 0:s.value)&&t.createVNode("li",{class:"devui-is-searching-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.searchingTemplate()])]),f.value&&!g.value&&t.createVNode("li",{class:"devui-popup-tips"},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!v.value&&!(s==null?void 0:s.value)&&a!=null&&a.value.length>0&&a.value.map((y,b)=>t.createVNode("li",{onClick:()=>N(y),class:["devui-dropdown-item",i.value===b&&"selected",{disabled:S&&y[S]},{"devui-dropdown-bg":w.value===b}],title:C(y),key:C(y)},[n.slots.itemTemplate?n.slots.itemTemplate(y,b):C(y)])),!(s==null?void 0:s.value)&&a.value.length===0&&n.slots.noResultItemTemplate&&v.value&&t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.noResultItemTemplate()])])])]),[[t.resolveDirective("dLoading"),c.value],[t.vShow,l.value&&a.value.length>0||n.slots.noResultItemTemplate&&v.value||L&&n.slots.searchingTemplate&&(s==null?void 0:s.value)]])}});const we=typeof window!="undefined";function U(e,n,o){document.addEventListener?e&&n&&o&&e.addEventListener(n,o,!1):e&&n&&o&&e.attachEvent("on"+n,o)}const A=Symbol("@@clickoutside"),x=new Map;let W,P=0,Y=!0;function X(e,n,o){return we&&Y&&(Y=!1,U(document,"mousedown",l=>{W=l}),U(document,"mouseup",l=>{for(const[i,r]of x)r[A].documentHandler(l,W)})),function(l,i){!o||!n.instance||!l.target||!i.target||e.contains(l.target)||e.contains(i.target)||e===l.target||e[A].bindingFn&&e[A].bindingFn()}}const he={beforeMount:function(e,n,o){P++,x.set(P,e),e[A]={nid:P,documentHandler:X(e,n,o),bindingFn:n.value}},updated:function(e,n,o){e[A].documentHandler=X(e,n,o),e[A].bindingFn=n.value},unmounted:function(e){x.delete(e[A].nid),delete e[A]}},be={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function G(e){const n=/(auto|scroll|hidden)/;for(let o=e;o=o.parentElement;o.parentElement!==document.body){const l=window.getComputedStyle(o);if(n.test(l.overflow+l.overflowX+l.overflowY))return o}return window}function Ve(e,n,o,l){let{x:i,y:r}=n;if(!e){const{width:a,height:s}=l;i&&o.includes("start")&&(i=12),i&&o.includes("end")&&(i=Math.round(a-24)),r&&o.includes("start")&&(r=10),r&&o.includes("end")&&(r=s-14)}return{x:i,y:r}}function Te(e,n){const o=t.ref(),l=t.ref(),i=(a,s,u,d)=>{const{x:c,y:v}=Ve(e.isArrowCenter,u,s,d.getBoundingClientRect()),f={top:"bottom",right:"left",bottom:"top",left:"right"}[s.split("-")[0]];Object.assign(a.style,{left:c?`${c}px`:"",top:v?`${v}px`:"",right:"",bottom:"",[f]:"-4px"})},r=async()=>{const a=e.origin,s=t.unref(o.value),u=t.unref(l.value),d=[m.shift(),m.offset(e.offset),m.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&d.push(m.arrow({element:u}));const{x:c,y:v,placement:f,middlewareData:g}=await m.computePosition(a,s,{strategy:"fixed",middleware:d});n("positionChange",f),Object.assign(s.style,{top:`${v}px`,left:`${c}px`}),e.showArrow&&i(u,f,g.arrow,s)};return t.watch(()=>e.modelValue,()=>{const a=G(e.origin);e.modelValue&&e.origin?(t.nextTick(r),a.addEventListener("scroll",r),a!==window&&window.addEventListener("scroll",r),window.addEventListener("resize",r)):(a.removeEventListener("scroll",r),a!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r))}),t.onUnmounted(()=>{const a=G(e.origin);a.removeEventListener("scroll",r),a!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}),{arrowRef:l,overlayRef:o,updatePosition:r}}var ze="";const Ce=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:be,emits:["update:modelValue","positionChange"],setup(e,{slots:n,attrs:o,emit:l,expose:i}){const{arrowRef:r,overlayRef:a,updatePosition:s}=Te(e,l);return i({updatePosition:s}),()=>{var u;return e.modelValue&&t.createVNode("div",t.mergeProps({ref:a,class:"devui-flexible-overlay"},o),[(u=n.default)==null?void 0:u.call(n),e.showArrow&&t.createVNode("div",{ref:r,class:"devui-flexible-overlay-arrow"},null)])}}});function Ne(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var I=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:he},props:oe,emits:["update:modelValue"],setup(e,n){const{disabled:o,modelValue:l,width:i,delay:r,allowEmptyValueSearch:a,formatter:s,transInputFocusEmit:u,selectValue:d,source:c,searchFn:v,position:f,latestSource:g,showAnimation:w}=t.toRefs(e),{handleSearch:h,searchList:V,showNoResultItemTemplate:C,recentlyFocus:S}=le(n,a,c,v,s),{onInput:L,onFocus:N,inputRef:y,visible:b,searchStatus:E,handleClose:R,toggleMenu:Se}=ae(n,V,C,l,o,r,h,u,S,g),{selectedIndex:J,selectOptionClick:Q}=re(n,V,d,h,s,R),{showLoading:Fe,dropDownRef:Z,loadMore:Ie}=ie(e,n,h),{customRenderSolts:Le}=ne(n,l),{hoverIndex:ke,handlekeyDown:Ee}=se(Z,b,V,J,E,C,Q,R);t.provide(M,{props:e,visible:b,term:"",searchList:V,selectedIndex:J,searchStatus:E,selectOptionClick:Q,dropDownRef:Z,showLoading:Fe,loadMore:Ie,latestSource:g,modelValue:l,showNoResultItemTemplate:C,hoverIndex:ke});const ee=t.ref(),De=()=>{let O;return t.createVNode(t.Teleport,{to:"body"},{default:()=>[t.createVNode(t.Transition,{name:w?"fade":""},{default:()=>[t.createVNode(Ce,{origin:ee.value,position:f.value,modelValue:b.value,"onUpdate:modelValue":xe=>b.value=xe},{default:()=>[t.createVNode("div",{class:"devui-auto-complete-menu",style:{width:`
|
|
2
|
+
${i.value+"px"}
|
|
3
|
+
`}},[t.createVNode(ye,null,Ne(O=Le())?O:{default:()=>[O]})])]})]})]})};return()=>t.withDirectives(t.createVNode("div",{class:["devui-auto-complete","devui-form-group","devui-has-feedback",b.value&&"devui-select-open"],ref:ee,style:{width:`${i.value+"px"}`}},[t.createVNode("input",{disabled:o.value,type:"text",onClick:Se,class:["devui-form-control","devui-dropdown-origin","devui-dropdown-origin-open",o.value&&"disabled"],placeholder:"Search",onInput:L,onFocus:N,value:l.value,ref:y,onKeydown:Ee},null),De()]),[[t.resolveDirective("click-outside"),R]])}});I.install=function(e){e.component(I.name,I)};var Ae={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(I)}};p.AutoComplete=I,p.default=Ae,Object.defineProperty(p,"__esModule",{value:!0}),p[Symbol.toStringTag]="Module"});
|
package/auto-complete/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.devui-auto-complete .devui-dropdown-menu,.devui-auto-complete-menu .devui-dropdown-menu{left:0!important;top:0!important}.devui-auto-complete .active{background:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-auto-complete .devui-dropdown-menu{width:100%;display:block}.devui-auto-complete .devui-dropdown-menu-cdk{position:static}.devui-auto-complete .devui-dropdown-item{cursor:pointer;display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:14px}.devui-auto-complete .devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected{color:var(--devui-list-item-active-text, #ffffff);background-color:var(--devui-list-item-active-bg, #5e7ce0)}.devui-auto-complete .devui-no-result-template,.devui-auto-complete .devui-is-searching-template{display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:not-allowed;background-color:var(--devui-disabled-bg, #f5f5f6);color:var(--devui-disabled-text, #adb0b8);line-height:14px}.devui-auto-complete .devui-no-result-template:hover,.devui-auto-complete .devui-no-result-template:active,.devui-auto-complete .devui-no-result-template:hover:active,.devui-auto-complete .devui-is-searching-template:hover,.devui-auto-complete .devui-is-searching-template:active,.devui-auto-complete .devui-is-searching-template:hover:active{background-color:var(--devui-unavailable, #f5f5f6)}.devui-auto-complete .devui-dropdown-item.disabled,.devui-auto-complete .devui-dropdown-item.disabled:hover{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}.devui-auto-complete ul.devui-list-unstyled{margin:0;overflow-y:auto}.devui-auto-complete .devui-dropdown-bg{background:var(--devui-list-item-hover-bg, #f2f5fc);color:var(--devui-list-item-hover-text, #526ecc)}.devui-auto-complete .devui-popup-tips{color:var(--devui-text-weak, #575d6c);padding:4px 12px}.devui-auto-complete .devui-dropdown-latestSource ul{line-height:initial!important}@keyframes devui-busy-spinner-anim{0%{transform:rotate(0) scale(1)}50%{transform:rotate(135deg) scale(1.5)}to{transform:rotate(270deg) scale(1)}}.devui-loading-mask{position:absolute;left:0;right:0;bottom:0;top:0;background-color:var(--devui-line, #adb0b8);opacity:.3}.devui-loading-wrapper{text-align:center}.devui-loading--full{position:fixed;left:0;right:0;bottom:0;top:0;z-index:9999}.devui-loading--hidden{overflow:hidden}.devui-loading-text{margin-left:10px}.devui-loading-area{position:absolute;transform:translate(-50%,-50%);padding:12px 14px;background:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius-card, 6px)}.devui-busy-default-spinner{position:relative;display:inline-block;width:15px;height:15px;animation:devui-busy-spinner-anim 1s linear infinite}.devui-busy-default-spinner div{position:absolute;left:44.5%;top:37%;width:6px;height:6px;border-radius:50%}.devui-busy-default-spinner .devui-loading-bar1{top:0;left:0;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-busy-default-spinner .devui-loading-bar2{top:0;left:9px;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar3{top:9px;left:0;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar4{top:9px;left:9px;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-connected-overlay, 0 2px 8px 0) var(--devui-shadow, rgba(0, 0, 0, .2));z-index:1000}.devui-flexible-overlay-arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}
|
|
1
|
+
@charset "UTF-8";.devui-auto-complete .devui-dropdown-menu,.devui-auto-complete-menu .devui-dropdown-menu{width:100%;left:0!important;top:0!important;margin:0!important}.devui-auto-complete .devui-dropdown-menu ul,.devui-auto-complete-menu .devui-dropdown-menu ul{width:100%;padding:0}.devui-auto-complete .devui-form-control{padding:4px 8px}.devui-auto-complete .active,.devui-auto-complete-menu .active{background:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-auto-complete .devui-dropdown-menu,.devui-auto-complete-menu .devui-dropdown-menu{width:100%;display:block}.devui-auto-complete .devui-dropdown-menu-cdk,.devui-auto-complete-menu .devui-dropdown-menu-cdk{position:static}.devui-auto-complete .devui-dropdown-item,.devui-auto-complete-menu .devui-dropdown-item{cursor:pointer;display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:14px}.devui-auto-complete .devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected,.devui-auto-complete-menu .devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected{color:var(--devui-list-item-active-text, #ffffff);background-color:var(--devui-list-item-active-bg, #5e7ce0)}.devui-auto-complete .devui-no-result-template,.devui-auto-complete .devui-is-searching-template,.devui-auto-complete-menu .devui-no-result-template,.devui-auto-complete-menu .devui-is-searching-template{display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:not-allowed;background-color:var(--devui-disabled-bg, #f5f5f6);color:var(--devui-disabled-text, #adb0b8);line-height:14px}.devui-auto-complete .devui-no-result-template:hover,.devui-auto-complete .devui-no-result-template:active,.devui-auto-complete .devui-no-result-template:hover:active,.devui-auto-complete .devui-is-searching-template:hover,.devui-auto-complete .devui-is-searching-template:active,.devui-auto-complete .devui-is-searching-template:hover:active,.devui-auto-complete-menu .devui-no-result-template:hover,.devui-auto-complete-menu .devui-no-result-template:active,.devui-auto-complete-menu .devui-no-result-template:hover:active,.devui-auto-complete-menu .devui-is-searching-template:hover,.devui-auto-complete-menu .devui-is-searching-template:active,.devui-auto-complete-menu .devui-is-searching-template:hover:active{background-color:var(--devui-unavailable, #f5f5f6)}.devui-auto-complete .devui-dropdown-item.disabled,.devui-auto-complete .devui-dropdown-item.disabled:hover,.devui-auto-complete-menu .devui-dropdown-item.disabled,.devui-auto-complete-menu .devui-dropdown-item.disabled:hover{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}.devui-auto-complete ul.devui-list-unstyled,.devui-auto-complete-menu ul.devui-list-unstyled{margin:0;overflow-y:auto}.devui-auto-complete .devui-dropdown-bg,.devui-auto-complete-menu .devui-dropdown-bg{background:var(--devui-list-item-hover-bg, #f2f5fc);color:var(--devui-list-item-hover-text, #526ecc)}.devui-auto-complete .devui-popup-tips,.devui-auto-complete-menu .devui-popup-tips{color:var(--devui-text-weak, #575d6c);padding:4px 12px}.devui-auto-complete .devui-dropdown-latestSource ul,.devui-auto-complete-menu .devui-dropdown-latestSource ul{line-height:initial!important}@keyframes devui-busy-spinner-anim{0%{transform:rotate(0) scale(1)}50%{transform:rotate(135deg) scale(1.5)}to{transform:rotate(270deg) scale(1)}}.devui-loading-mask{position:absolute;left:0;right:0;bottom:0;top:0;background-color:var(--devui-line, #adb0b8);opacity:.3}.devui-loading-wrapper{text-align:center}.devui-loading--full{position:fixed;left:0;right:0;bottom:0;top:0;z-index:9999}.devui-loading--hidden{overflow:hidden}.devui-loading-text{margin-left:10px}.devui-loading-area{position:absolute;transform:translate(-50%,-50%);padding:12px 14px;background:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius-card, 6px)}.devui-busy-default-spinner{position:relative;display:inline-block;width:15px;height:15px;animation:devui-busy-spinner-anim 1s linear infinite}.devui-busy-default-spinner div{position:absolute;left:44.5%;top:37%;width:6px;height:6px;border-radius:50%}.devui-busy-default-spinner .devui-loading-bar1{top:0;left:0;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-busy-default-spinner .devui-loading-bar2{top:0;left:9px;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar3{top:9px;left:0;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar4{top:9px;left:9px;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-connected-overlay, 0 2px 8px 0) var(--devui-shadow, rgba(0, 0, 0, .2));z-index:1000}.devui-flexible-overlay-arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}
|
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { computed, nextTick, defineComponent, ref, reactive, watch, withDirectives, createVNode, withModifiers, resolveComponent, resolveDirective, vShow, Transition } from "vue";
|
|
1
|
+
import { computed, ref, nextTick, defineComponent, watch, withDirectives, createVNode, withModifiers, resolveComponent, vShow, resolveDirective } from "vue";
|
|
18
2
|
const editableSelectProps = {
|
|
19
|
-
appendToBody: {
|
|
20
|
-
type: Boolean
|
|
21
|
-
},
|
|
22
3
|
options: {
|
|
23
4
|
type: Array,
|
|
24
5
|
default: () => []
|
|
@@ -48,9 +29,6 @@ const editableSelectProps = {
|
|
|
48
29
|
},
|
|
49
30
|
filterOption: {
|
|
50
31
|
type: [Function, Boolean]
|
|
51
|
-
},
|
|
52
|
-
loadMore: {
|
|
53
|
-
type: Function
|
|
54
32
|
}
|
|
55
33
|
};
|
|
56
34
|
const inBrowser = typeof window !== "undefined";
|
|
@@ -145,18 +123,21 @@ const useInput = (inputValue, ctx2) => {
|
|
|
145
123
|
handleInput
|
|
146
124
|
};
|
|
147
125
|
};
|
|
148
|
-
const useLazyLoad = (dropdownRef, inputValue, filterOtion,
|
|
126
|
+
const useLazyLoad = (dropdownRef, inputValue, filterOtion, ctx2) => {
|
|
149
127
|
const loadMore = () => {
|
|
128
|
+
const dropdownVal = dropdownRef.value;
|
|
150
129
|
if (filterOtion !== false) {
|
|
151
130
|
return;
|
|
152
131
|
}
|
|
153
|
-
if (
|
|
154
|
-
|
|
132
|
+
if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight) {
|
|
133
|
+
ctx2.emit("loadMore", inputValue.value);
|
|
155
134
|
}
|
|
156
135
|
};
|
|
157
136
|
return { loadMore };
|
|
158
137
|
};
|
|
159
|
-
const useKeyboardSelect = (dropdownRef,
|
|
138
|
+
const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, optionDisabledKey, filterOption, loading, handleClick, closeMenu, toggleMenu) => {
|
|
139
|
+
const hoverIndex = ref(0);
|
|
140
|
+
const selectedIndex = ref(0);
|
|
160
141
|
const updateHoveringIndex = (index2) => {
|
|
161
142
|
hoverIndex.value = index2;
|
|
162
143
|
};
|
|
@@ -175,66 +156,71 @@ const useKeyboardSelect = (dropdownRef, disabled, visible, hoverIndex, selectedI
|
|
|
175
156
|
}
|
|
176
157
|
});
|
|
177
158
|
};
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
|
|
159
|
+
const handleEscape = () => {
|
|
160
|
+
if (inputValue.value) {
|
|
161
|
+
inputValue.value = "";
|
|
162
|
+
} else {
|
|
163
|
+
closeMenu();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const handleEnter = () => {
|
|
167
|
+
const len = filteredOptions.value.length;
|
|
168
|
+
if (!visible.value) {
|
|
169
|
+
toggleMenu();
|
|
170
|
+
} else if (!len || len === 1) {
|
|
171
|
+
closeMenu();
|
|
172
|
+
} else if (len && len !== 1) {
|
|
173
|
+
handleClick(filteredOptions.value[hoverIndex.value]);
|
|
174
|
+
closeMenu();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const handleKeyboardNavigation = (direction) => {
|
|
178
|
+
const len = filteredOptions.value.length;
|
|
179
|
+
if (!len || len === 1) {
|
|
180
|
+
return;
|
|
181
181
|
}
|
|
182
182
|
if (!["ArrowDown", "ArrowUp"].includes(direction)) {
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
+
if (filterOption === false && loading.value) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
let newIndex = 0;
|
|
189
|
+
newIndex = hoverIndex.value;
|
|
185
190
|
if (direction === "ArrowUp") {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
updateHoveringIndex(newIndex);
|
|
190
|
-
return;
|
|
191
|
+
newIndex -= 1;
|
|
192
|
+
if (newIndex === -1) {
|
|
193
|
+
newIndex = len - 1;
|
|
191
194
|
}
|
|
192
|
-
newIndex = newIndex - 1;
|
|
193
195
|
} else if (direction === "ArrowDown") {
|
|
194
|
-
|
|
196
|
+
newIndex += 1;
|
|
197
|
+
if (newIndex === len) {
|
|
195
198
|
newIndex = 0;
|
|
196
|
-
scrollToItem(newIndex);
|
|
197
|
-
updateHoveringIndex(newIndex);
|
|
198
|
-
return;
|
|
199
199
|
}
|
|
200
|
-
newIndex = newIndex + 1;
|
|
201
200
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
hoverIndex.value = newIndex;
|
|
202
|
+
const option = filteredOptions.value[newIndex];
|
|
203
|
+
if (option[optionDisabledKey]) {
|
|
204
|
+
return handleKeyboardNavigation(direction);
|
|
205
205
|
}
|
|
206
|
-
scrollToItem(newIndex);
|
|
207
206
|
updateHoveringIndex(newIndex);
|
|
207
|
+
scrollToItem(newIndex);
|
|
208
208
|
};
|
|
209
209
|
const handleKeydown = (event) => {
|
|
210
210
|
const keyCode = event.key || event.code;
|
|
211
|
-
if (options.value.length === 0) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (!visible.value) {
|
|
215
|
-
return toggleMenu();
|
|
216
|
-
}
|
|
217
|
-
const onKeydownEnter = () => {
|
|
218
|
-
handleClick(options.value[hoverIndex.value]);
|
|
219
|
-
closeMenu();
|
|
220
|
-
};
|
|
221
|
-
const onKeydownEsc = () => {
|
|
222
|
-
closeMenu();
|
|
223
|
-
};
|
|
224
211
|
switch (keyCode) {
|
|
225
|
-
case "Enter":
|
|
226
|
-
onKeydownEnter();
|
|
227
|
-
break;
|
|
228
212
|
case "Escape":
|
|
229
|
-
|
|
213
|
+
event.preventDefault();
|
|
214
|
+
handleEscape();
|
|
215
|
+
break;
|
|
216
|
+
case "Enter":
|
|
217
|
+
handleEnter();
|
|
230
218
|
break;
|
|
231
219
|
default:
|
|
232
|
-
|
|
220
|
+
handleKeyboardNavigation(keyCode);
|
|
233
221
|
}
|
|
234
222
|
};
|
|
235
|
-
return {
|
|
236
|
-
handleKeydown
|
|
237
|
-
};
|
|
223
|
+
return { handleKeydown, hoverIndex, selectedIndex };
|
|
238
224
|
};
|
|
239
225
|
var EditableSelect = defineComponent({
|
|
240
226
|
name: "DEditableSelect",
|
|
@@ -244,101 +230,19 @@ var EditableSelect = defineComponent({
|
|
|
244
230
|
props: editableSelectProps,
|
|
245
231
|
emits: ["update:modelValue", "search", "loadMore"],
|
|
246
232
|
setup(props, ctx2) {
|
|
247
|
-
const
|
|
248
|
-
const {
|
|
249
|
-
optionDisabledKey: disabledKey
|
|
250
|
-
} = props;
|
|
251
|
-
return className("devui-dropdown-item", {
|
|
252
|
-
disabled: disabledKey ? !!option[disabledKey] : false,
|
|
253
|
-
selected: index2 === selectIndex.value,
|
|
254
|
-
"devui-dropdown-bg": index2 === hoverIndex.value
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
const renderDropdown = () => {
|
|
258
|
-
if (props.appendToBody) {
|
|
259
|
-
return createVNode(resolveComponent("d-flexible-overlay"), {
|
|
260
|
-
"origin": origin,
|
|
261
|
-
"visible": visible.value,
|
|
262
|
-
"onUpdate:visible": ($event) => visible.value = $event,
|
|
263
|
-
"position": position,
|
|
264
|
-
"hasBackdrop": false
|
|
265
|
-
}, {
|
|
266
|
-
default: () => [createVNode("div", {
|
|
267
|
-
"class": "devui-editable-select-dropdown",
|
|
268
|
-
"style": {
|
|
269
|
-
width: props.width + "px"
|
|
270
|
-
}
|
|
271
|
-
}, [withDirectives(createVNode("div", {
|
|
272
|
-
"class": "devui-dropdown-menu"
|
|
273
|
-
}, [createVNode("ul", {
|
|
274
|
-
"ref": dopdownRef,
|
|
275
|
-
"class": "devui-list-unstyled scroll-height",
|
|
276
|
-
"style": {
|
|
277
|
-
maxHeight: props.maxHeight + "px"
|
|
278
|
-
},
|
|
279
|
-
"onScroll": loadMore
|
|
280
|
-
}, [filteredOptions.value.map((option, index2) => {
|
|
281
|
-
return createVNode("li", {
|
|
282
|
-
"class": getItemCls(option, index2),
|
|
283
|
-
"onClick": (e) => {
|
|
284
|
-
e.stopPropagation();
|
|
285
|
-
handleClick(option);
|
|
286
|
-
}
|
|
287
|
-
}, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
|
|
288
|
-
}), withDirectives(createVNode("li", {
|
|
289
|
-
"class": "devui-no-result-template"
|
|
290
|
-
}, [createVNode("div", {
|
|
291
|
-
"class": "devui-no-data-tip"
|
|
292
|
-
}, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
|
|
293
|
-
});
|
|
294
|
-
} else {
|
|
295
|
-
return createVNode(Transition, {
|
|
296
|
-
"name": "fade"
|
|
297
|
-
}, {
|
|
298
|
-
default: () => [withDirectives(createVNode("div", {
|
|
299
|
-
"class": "devui-dropdown-menu"
|
|
300
|
-
}, [createVNode("ul", {
|
|
301
|
-
"ref": dopdownRef,
|
|
302
|
-
"class": "devui-list-unstyled scroll-height",
|
|
303
|
-
"style": {
|
|
304
|
-
maxHeight: props.maxHeight + "px"
|
|
305
|
-
},
|
|
306
|
-
"onScroll": loadMore
|
|
307
|
-
}, [filteredOptions.value.map((option, index2) => {
|
|
308
|
-
return createVNode("li", {
|
|
309
|
-
"class": getItemCls(option, index2),
|
|
310
|
-
"onClick": (e) => {
|
|
311
|
-
e.stopPropagation();
|
|
312
|
-
handleClick(option);
|
|
313
|
-
}
|
|
314
|
-
}, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
|
|
315
|
-
}), withDirectives(createVNode("li", {
|
|
316
|
-
"class": "devui-no-result-template"
|
|
317
|
-
}, [createVNode("div", {
|
|
318
|
-
"class": "devui-no-data-tip"
|
|
319
|
-
}, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[vShow, visible.value]])]
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
const dopdownRef = ref();
|
|
233
|
+
const dropdownRef = ref();
|
|
324
234
|
const origin = ref();
|
|
325
|
-
const position =
|
|
326
|
-
originX: "left",
|
|
327
|
-
originY: "bottom",
|
|
328
|
-
overlayX: "left",
|
|
329
|
-
overlayY: "top"
|
|
330
|
-
});
|
|
235
|
+
const position = ref(["bottom", "left"]);
|
|
331
236
|
const visible = ref(false);
|
|
332
|
-
const inputValue = ref(props.modelValue);
|
|
333
|
-
const
|
|
334
|
-
const selectIndex = ref(0);
|
|
237
|
+
const inputValue = ref(props.modelValue || "");
|
|
238
|
+
const loading = ref(props.loading);
|
|
335
239
|
const normalizeOptions = computed(() => {
|
|
336
240
|
return props.options.map((option) => {
|
|
337
241
|
if (typeof option === "object") {
|
|
338
|
-
return
|
|
242
|
+
return Object.assign({}, option, {
|
|
339
243
|
label: option.label ? option.label : option.value,
|
|
340
244
|
value: option.value
|
|
341
|
-
}
|
|
245
|
+
});
|
|
342
246
|
}
|
|
343
247
|
return {
|
|
344
248
|
label: option + "",
|
|
@@ -348,13 +252,16 @@ var EditableSelect = defineComponent({
|
|
|
348
252
|
});
|
|
349
253
|
const filteredOptions = userFilterOptions(normalizeOptions, inputValue, props.filterOption);
|
|
350
254
|
const emptyText = computed(() => {
|
|
351
|
-
let text;
|
|
255
|
+
let text = "";
|
|
352
256
|
if (props.filterOption !== false && !filteredOptions.value.length) {
|
|
353
257
|
text = "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55";
|
|
354
258
|
} else if (props.filterOption === false && !filteredOptions.value.length) {
|
|
355
259
|
text = "\u6CA1\u6709\u6570\u636E";
|
|
356
260
|
}
|
|
357
|
-
return
|
|
261
|
+
return text;
|
|
262
|
+
});
|
|
263
|
+
watch(() => props.loading, (newVal) => {
|
|
264
|
+
loading.value = newVal;
|
|
358
265
|
});
|
|
359
266
|
const toggleMenu = () => {
|
|
360
267
|
visible.value = !visible.value;
|
|
@@ -364,7 +271,7 @@ var EditableSelect = defineComponent({
|
|
|
364
271
|
};
|
|
365
272
|
const {
|
|
366
273
|
loadMore
|
|
367
|
-
} = useLazyLoad(
|
|
274
|
+
} = useLazyLoad(dropdownRef, inputValue, props.filterOption, ctx2);
|
|
368
275
|
const {
|
|
369
276
|
handleInput
|
|
370
277
|
} = useInput(inputValue, ctx2);
|
|
@@ -372,17 +279,32 @@ var EditableSelect = defineComponent({
|
|
|
372
279
|
const {
|
|
373
280
|
optionDisabledKey: disabledKey
|
|
374
281
|
} = props;
|
|
375
|
-
if (disabledKey && !!option[disabledKey])
|
|
282
|
+
if (disabledKey && !!option[disabledKey]) {
|
|
376
283
|
return;
|
|
284
|
+
}
|
|
377
285
|
ctx2.emit("update:modelValue", option.label);
|
|
378
286
|
closeMenu();
|
|
379
287
|
};
|
|
380
288
|
const {
|
|
381
|
-
handleKeydown
|
|
382
|
-
|
|
289
|
+
handleKeydown,
|
|
290
|
+
hoverIndex,
|
|
291
|
+
selectedIndex
|
|
292
|
+
} = useKeyboardSelect(dropdownRef, visible, inputValue, filteredOptions, props.optionDisabledKey, props.filterOption, loading, handleClick, closeMenu, toggleMenu);
|
|
383
293
|
watch(() => props.modelValue, (newVal) => {
|
|
384
|
-
|
|
294
|
+
if (newVal) {
|
|
295
|
+
inputValue.value = newVal;
|
|
296
|
+
}
|
|
385
297
|
});
|
|
298
|
+
const getItemCls = (option, index2) => {
|
|
299
|
+
const {
|
|
300
|
+
optionDisabledKey: disabledKey
|
|
301
|
+
} = props;
|
|
302
|
+
return className("devui-dropdown-item", {
|
|
303
|
+
disabled: disabledKey ? !!option[disabledKey] : false,
|
|
304
|
+
selected: index2 === selectedIndex.value,
|
|
305
|
+
"devui-dropdown-bg": index2 === hoverIndex.value
|
|
306
|
+
});
|
|
307
|
+
};
|
|
386
308
|
return () => {
|
|
387
309
|
const selectCls = className("devui-editable-select devui-form-group devui-has-feedback", {
|
|
388
310
|
"devui-select-open": visible.value === true
|
|
@@ -408,7 +330,41 @@ var EditableSelect = defineComponent({
|
|
|
408
330
|
"class": "devui-select-chevron-icon"
|
|
409
331
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
410
332
|
"name": "select-arrow"
|
|
411
|
-
}, null)])]),
|
|
333
|
+
}, null)])]), createVNode(resolveComponent("d-flexible-overlay"), {
|
|
334
|
+
"origin": origin.value,
|
|
335
|
+
"modelValue": visible.value,
|
|
336
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
337
|
+
"position": position.value,
|
|
338
|
+
"hasBackdrop": false
|
|
339
|
+
}, {
|
|
340
|
+
default: () => [createVNode("div", {
|
|
341
|
+
"class": "devui-editable-select-dropdown",
|
|
342
|
+
"style": {
|
|
343
|
+
width: props.width + "px"
|
|
344
|
+
}
|
|
345
|
+
}, [withDirectives(createVNode("div", {
|
|
346
|
+
"class": "devui-dropdown-menu"
|
|
347
|
+
}, [createVNode("ul", {
|
|
348
|
+
"ref": dropdownRef,
|
|
349
|
+
"class": "devui-list-unstyled scroll-height",
|
|
350
|
+
"style": {
|
|
351
|
+
maxHeight: props.maxHeight + "px"
|
|
352
|
+
},
|
|
353
|
+
"onScroll": loadMore
|
|
354
|
+
}, [filteredOptions.value.map((option, index2) => {
|
|
355
|
+
return createVNode("li", {
|
|
356
|
+
"class": getItemCls(option, index2),
|
|
357
|
+
"onClick": (e) => {
|
|
358
|
+
e.stopPropagation();
|
|
359
|
+
handleClick(option);
|
|
360
|
+
}
|
|
361
|
+
}, [ctx2.slots.item ? ctx2.slots.item(option) : option.label]);
|
|
362
|
+
}), withDirectives(createVNode("li", {
|
|
363
|
+
"class": "devui-no-result-template"
|
|
364
|
+
}, [createVNode("div", {
|
|
365
|
+
"class": "devui-no-data-tip"
|
|
366
|
+
}, [ctx2.slots.noResultItem ? ctx2.slots.noResultItem() : emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
|
|
367
|
+
})]), [[resolveDirective("click-outside"), closeMenu]]);
|
|
412
368
|
};
|
|
413
369
|
}
|
|
414
370
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(u,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(u=typeof globalThis!="undefined"?globalThis:u||self,t(u.index={},u.Vue))})(this,function(u,t){"use strict";const M={options:{type:Array,default:()=>[]},disabled:{type:Boolean},loading:{type:Boolean},optionDisabledKey:{type:String,default:""},placeholder:{type:String,default:"Search"},modelValue:{type:String},width:{type:Number},maxHeight:{type:Number},filterOption:{type:[Function,Boolean]}},B=typeof window!="undefined";function N(e,l,o){document.addEventListener?e&&l&&o&&e.addEventListener(l,o,!1):e&&l&&o&&e.attachEvent("on"+l,o)}const f=Symbol("@@clickoutside"),S=new Map;let x,k=0,F=!0;function K(e,l,o){return B&&F&&(F=!1,N(document,"mousedown",a=>{x=a}),N(document,"mouseup",a=>{for(const[c,i]of S)i[f].documentHandler(a,x)})),function(a,c){!o||!l.instance||!a.target||!c.target||e.contains(a.target)||e.contains(c.target)||e===a.target||e[f].bindingFn&&e[f].bindingFn()}}const O={beforeMount:function(e,l,o){k++,S.set(k,e),e[f]={nid:k,documentHandler:K(e,l,o),bindingFn:l.value}},updated:function(e,l,o){e[f].documentHandler=K(e,l,o),e[f].bindingFn=l.value},unmounted:function(e){S.delete(e[f].nid),delete e[f]}};function H(e,l){let o=e;return typeof l=="object"&&Object.keys(l).forEach(a=>{l[a]&&(o+=` ${a}`)}),o}var q="";const T=()=>(e,l)=>l.label.toLocaleLowerCase().indexOf(e.toLocaleLowerCase())>-1,j=(e,l,o)=>t.computed(()=>{const a=[];if(!l.value||o===!1)return e.value;const c=typeof o=="function"?o:T();return e.value.forEach(i=>{c(l.value,i)&&a.push(i)}),a}),A=(e,l)=>{const o=c=>{l.emit("search",c)};return{handleInput:c=>{const i=c.target.value;e.value=i,o(i)}}},R=(e,l,o,a)=>({loadMore:()=>{const i=e.value;o===!1&&i.clientHeight+i.scrollTop>=i.scrollHeight&&a.emit("loadMore",l.value)}}),P=(e,l,o,a,c,i,v,p,w,h)=>{const m=t.ref(0),I=t.ref(0),y=d=>{m.value=d},C=d=>{const r=e.value,n=r.children[d];t.nextTick(()=>{if(n.scrollIntoViewIfNeeded)n.scrollIntoViewIfNeeded(!1);else{const s=r.getBoundingClientRect(),b=n.getBoundingClientRect();(b.bottom>s.bottom||b.top<s.top)&&n.scrollIntoView(!1)}})},D=()=>{o.value?o.value="":w()},V=()=>{const d=a.value.length;l.value?!d||d===1?w():d&&d!==1&&(p(a.value[m.value]),w()):h()},E=d=>{const r=a.value.length;if(!r||r===1||!["ArrowDown","ArrowUp"].includes(d)||i===!1&&v.value)return;let n=0;if(n=m.value,d==="ArrowUp"?(n-=1,n===-1&&(n=r-1)):d==="ArrowDown"&&(n+=1,n===r&&(n=0)),m.value=n,a.value[n][c])return E(d);y(n),C(n)};return{handleKeydown:d=>{const r=d.key||d.code;switch(r){case"Escape":d.preventDefault(),D();break;case"Enter":V();break;default:E(r)}},hoverIndex:m,selectedIndex:I}};var g=t.defineComponent({name:"DEditableSelect",directives:{clickOutside:O},props:M,emits:["update:modelValue","search","loadMore"],setup(e,l){const o=t.ref(),a=t.ref(),c=t.ref(["bottom","left"]),i=t.ref(!1),v=t.ref(e.modelValue||""),p=t.ref(e.loading),w=t.computed(()=>e.options.map(n=>typeof n=="object"?Object.assign({},n,{label:n.label?n.label:n.value,value:n.value}):{label:n+"",value:n})),h=j(w,v,e.filterOption),m=t.computed(()=>{let n="";return e.filterOption!==!1&&!h.value.length?n="\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55":e.filterOption===!1&&!h.value.length&&(n="\u6CA1\u6709\u6570\u636E"),n});t.watch(()=>e.loading,n=>{p.value=n});const I=()=>{i.value=!i.value},y=()=>{i.value=!1},{loadMore:C}=R(o,v,e.filterOption,l),{handleInput:D}=A(v,l),V=n=>{const{optionDisabledKey:s}=e;s&&!!n[s]||(l.emit("update:modelValue",n.label),y())},{handleKeydown:E,hoverIndex:L,selectedIndex:d}=P(o,i,v,h,e.optionDisabledKey,e.filterOption,p,V,y,I);t.watch(()=>e.modelValue,n=>{n&&(v.value=n)});const r=(n,s)=>{const{optionDisabledKey:b}=e;return H("devui-dropdown-item",{disabled:b?!!n[b]:!1,selected:s===d.value,"devui-dropdown-bg":s===L.value})};return()=>{const n=H("devui-editable-select devui-form-group devui-has-feedback",{"devui-select-open":i.value===!0});return t.withDirectives(t.createVNode("div",{class:n,ref:a,style:{width:e.width+"px"}},[t.createVNode("input",{class:"devui-form-control devui-dropdown-origin devui-dropdown-origin-open",onClick:t.withModifiers(I,["self"]),onInput:D,onKeydown:E,value:v.value,disabled:e.disabled,placeholder:e.placeholder,type:"text"},null),t.createVNode("span",{class:"devui-form-control-feedback"},[t.createVNode("span",{class:"devui-select-chevron-icon"},[t.createVNode(t.resolveComponent("d-icon"),{name:"select-arrow"},null)])]),t.createVNode(t.resolveComponent("d-flexible-overlay"),{origin:a.value,modelValue:i.value,"onUpdate:modelValue":s=>i.value=s,position:c.value,hasBackdrop:!1},{default:()=>[t.createVNode("div",{class:"devui-editable-select-dropdown",style:{width:e.width+"px"}},[t.withDirectives(t.createVNode("div",{class:"devui-dropdown-menu"},[t.createVNode("ul",{ref:o,class:"devui-list-unstyled scroll-height",style:{maxHeight:e.maxHeight+"px"},onScroll:C},[h.value.map((s,b)=>t.createVNode("li",{class:r(s,b),onClick:_=>{_.stopPropagation(),V(s)}},[l.slots.item?l.slots.item(s):s.label])),t.withDirectives(t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[l.slots.noResultItem?l.slots.noResultItem():m.value])]),[[t.vShow,!h.value.length]])])]),[[t.resolveDirective("dLoading"),e.loading],[t.vShow,i.value]])])]})]),[[t.resolveDirective("click-outside"),y]])}}});g.install=function(e){e.component(g.name,g)};var U={title:"EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(g)}};u.EditableSelect=g,u.default=U,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
|
package/package.json
CHANGED
package/popover/index.es.js
CHANGED
|
@@ -5767,8 +5767,8 @@ function usePopover(props, visible, placement, origin, popoverRef) {
|
|
|
5767
5767
|
transformOrigin: TransformOriginMap[placement.value]
|
|
5768
5768
|
}));
|
|
5769
5769
|
const onDocumentClick = (e) => {
|
|
5770
|
-
var _a;
|
|
5771
|
-
if (!origin.value.contains(e.target) && !((
|
|
5770
|
+
var _a, _b;
|
|
5771
|
+
if (!((_a = origin.value) == null ? void 0 : _a.contains(e.target)) && !((_b = popoverRef.value.$el) == null ? void 0 : _b.contains(e.target))) {
|
|
5772
5772
|
visible.value = false;
|
|
5773
5773
|
}
|
|
5774
5774
|
};
|