沙钢智慧能源系统前端代码
houzhongjian
2024-10-09 314507f8ddadd9c66e98d260c3b2a5dad1a04015
1
import{f as X,w as D,aF as S,cY as L,aL as Y,R,cu as j,ad as b,d as q,$ as Z,az as ee,cq as te,cZ as z,cw as le,ct as ae,b0 as se,c_ as oe,r as G,A as $,b as de,bW as B,_ as ne}from"./index-BP6bNRoi.js";const re=q({extends:Z,setup(t,d){const r=Z.setup(t,d);delete r.selectOptionClick;const p=ee().proxy;return S(()=>{r.select.states.cachedOptions.get(p.value)||r.select.onOptionCreate(p)}),r},methods:{selectOptionClick(){this.$el.parentElement.click()}}});function F(t){return t||t===0}function I(t){return Array.isArray(t)&&t.length}function x(t){return Array.isArray(t)?t:F(t)?[t]:[]}function H(t,d,r,p,n){for(let c=0;c<t.length;c++){const f=t[c];if(d(f,c,t,n))return p?p(f,c,t,n):f;{const O=r(f);if(I(O)){const A=H(O,d,r,p,f);if(A)return A}}}}function T(t,d,r,p){for(let n=0;n<t.length;n++){const c=t[n];d(c,n,t,p);const f=r(c);I(f)&&T(f,d,r,c)}}var ce=q({props:{data:{type:Array,default:()=>[]}},setup(t){const d=se(oe);return D(()=>t.data,()=>{var r;t.data.forEach(n=>{d.states.cachedOptions.has(n.value)||d.states.cachedOptions.set(n.value,n)});const p=((r=d.selectRef)==null?void 0:r.querySelectorAll("input"))||[];Array.from(p).includes(document.activeElement)||d.setSelected()},{flush:"post",immediate:!0}),()=>{}}});const ue=q({name:"ElTreeSelect",inheritAttrs:!1,props:{...R.props,...z.props,cacheData:{type:Array,default:()=>[]}},setup(t,d){const{slots:r,expose:p}=d,n=G(),c=G(),f=b(()=>t.nodeKey||t.valueKey||"value"),O=((e,{attrs:C,emit:E},{select:K,tree:m,key:v})=>{const V=X("tree-select");return D(()=>e.data,()=>{e.filterable&&S(()=>{var u,a;(a=m.value)==null||a.filter((u=K.value)==null?void 0:u.states.inputValue)})},{flush:"post"}),{...L(Y(e),Object.keys(R.props)),...C,"onUpdate:modelValue":u=>E(j,u),valueKey:v,popperClass:b(()=>{const u=[V.e("popper")];return e.popperClass&&u.push(e.popperClass),u.join(" ")}),filterMethod:(u="")=>{var a;e.filterMethod?e.filterMethod(u):e.remoteMethod?e.remoteMethod(u):(a=m.value)==null||a.filter(u)}}})(t,d,{select:n,tree:c,key:f}),{cacheOptions:A,...J}=((e,{attrs:C,slots:E,emit:K},{select:m,tree:v,key:V})=>{D(()=>e.modelValue,()=>{e.showCheckbox&&S(()=>{const l=v.value;l&&!te(l.getCheckedKeys(),x(e.modelValue))&&l.setCheckedKeys(x(e.modelValue))})},{immediate:!0,deep:!0});const u=b(()=>({value:V.value,label:"label",children:"children",disabled:"disabled",isLeaf:"isLeaf",...e.props})),a=(l,s)=>{var o;const i=u.value[l];return ae(i)?i(s,(o=v.value)==null?void 0:o.getNode(a("value",s))):s[i]},W=x(e.modelValue).map(l=>H(e.data||[],s=>a("value",s)===l,s=>a("children",s),(s,o,i,k)=>k&&a("value",k))).filter(l=>F(l)),P=b(()=>{if(!e.renderAfterExpand&&!e.lazy)return[];const l=[];return T(e.data.concat(e.cacheData),s=>{const o=a("value",s);l.push({value:o,currentLabel:a("label",s),isDisabled:a("disabled",s)})},s=>a("children",s)),l});return{...L(Y(e),Object.keys(z.props)),...C,nodeKey:V,expandOnClickNode:b(()=>!e.checkStrictly&&e.expandOnClickNode),defaultExpandedKeys:b(()=>e.defaultExpandedKeys?e.defaultExpandedKeys.concat(W):W),renderContent:(l,{node:s,data:o,store:i})=>l(re,{value:a("value",o),label:a("label",o),disabled:a("disabled",o)},e.renderContent?()=>e.renderContent(l,{node:s,data:o,store:i}):E.default?()=>E.default({node:s,data:o,store:i}):void 0),filterNodeMethod:(l,s,o)=>e.filterNodeMethod?e.filterNodeMethod(l,s,o):!l||new RegExp(le(l),"i").test(a("label",s)||""),onNodeClick:(l,s,o)=>{var i,k,g,N;if((i=C.onNodeClick)==null||i.call(C,l,s,o),!e.showCheckbox||!e.checkOnClickNode){if(e.showCheckbox||!e.checkStrictly&&!s.isLeaf)e.expandOnClickNode&&o.proxy.handleExpandIconClick();else if(!a("disabled",l)){const M=(k=m.value)==null?void 0:k.states.options.get(a("value",l));(g=m.value)==null||g.handleOptionSelect(M)}(N=m.value)==null||N.focus()}},onCheck:(l,s)=>{var o;if(!e.showCheckbox)return;const i=a("value",l),k={};T([v.value.store.root],h=>k[h.key]=h,h=>h.childNodes);const g=s.checkedKeys,N=e.multiple?x(e.modelValue).filter(h=>!(h in k)&&!g.includes(h)):[],M=N.concat(g);if(e.checkStrictly)K(j,e.multiple?M:M.includes(i)?i:void 0);else if(e.multiple)K(j,N.concat(v.value.getCheckedKeys(!0)));else{const h=H([l],y=>!I(a("children",y))&&!a("disabled",y),y=>a("children",y)),w=h?a("value",h):void 0,Q=F(e.modelValue)&&!!H([l],y=>a("value",y)===e.modelValue,y=>a("children",y));K(j,w===e.modelValue||Q?void 0:w)}S(()=>{var h;const w=x(e.modelValue);v.value.setCheckedKeys(w),(h=C.onCheck)==null||h.call(C,l,{checkedKeys:v.value.getCheckedKeys(),checkedNodes:v.value.getCheckedNodes(),halfCheckedKeys:v.value.getHalfCheckedKeys(),halfCheckedNodes:v.value.getHalfCheckedNodes()})}),(o=m.value)==null||o.focus()},cacheOptions:P}})(t,d,{select:n,tree:c,key:f}),U=$({});return p(U),de(()=>{Object.assign(U,{...L(c.value,["filter","updateKeyChildren","getCheckedNodes","setCheckedNodes","getCheckedKeys","setCheckedKeys","setChecked","getHalfCheckedNodes","getHalfCheckedKeys","getCurrentKey","getCurrentNode","setCurrentKey","setCurrentNode","getNode","remove","append","insertBefore","insertAfter"]),...L(n.value,["focus","blur"])})}),()=>B(R,$({...O,ref:e=>n.value=e}),{...r,default:()=>[B(ce,{data:A.value}),B(z,$({...J,ref:e=>c.value=e}))]})}});var _=ne(ue,[["__file","tree-select.vue"]]);_.install=t=>{t.component(_.name,_)};const ie=_;export{ie as E};