el-plus-powerful-table
Version:
## [DOCS](https://peng-xiao-shuai.github.io/vite-vue-admin-docs/zh-CN/component_directive/component/powerful-table-doc.html)
2 lines (1 loc) • 1.99 kB
JavaScript
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),n=require("element-plus"),p=require("./common.js"),g=require("../../keys.js"),u=require("../../locale/lang.js"),S=require("../../powerful-table/src/powerful-table-data.js"),c=require("../../locale/packages.js"),f=(l,i)=>typeof i=="function"?i()[l]:i?i[l]:"",o=r.defineComponent({name:"PTFSelect",props:{...p.props,propData:{type:Object,default:()=>({prop:""})}},emits:["headerFilterChange"],setup(l,{emit:i,expose:h}){const m=r.inject(g.SizeSymbol),t=r.reactive({value:[],options:[],selectVisible:!1,visible:!1}),b=e=>{e?t.selectVisible=e:t.visible=!1},y=e=>{e.length||(e=[]),i("headerFilterChange",e,l.headerData)},v=r.watch(()=>l.propData,e=>{const a=S.isData({row:{},index:0,props:e},e.data);if(e.filters)Array.isArray(e.filters)?t.options=e.filters:console.warn(l.headerData.label,"The filter attribute of the column must be an array Or set the isShowOrFilterColumn property to false");else if(e.type==="switch"){const s=[];s.push({value:u.t(c.LangKey.Open),key:f("activeValue",a==null?void 0:a.property)||1},{value:u.t(c.LangKey.Close),key:f("inactiveValue",a==null?void 0:a.property)||0}),t.options=s}},{immediate:!0,deep:!0});return h({state:t,header:l.headerData}),r.onBeforeUnmount(()=>{v()}),()=>r.createVNode(n.ElPopover,{visible:t.visible,"onUpdate:visible":e=>t.visible=e,placement:"bottom-start",trigger:"contextmenu",width:200},{default:()=>[r.createVNode(n.ElSelect,{modelValue:t.value,"onUpdate:modelValue":e=>t.value=e,multiple:!0,"collapse-tags":!0,clearable:!0,placeholder:u.t(c.LangKey.Select),style:"width: 100%",teleported:!1,size:m,"onVisible-change":b,onChange:y},{default:()=>{var e;return[(e=t.options)==null?void 0:e.map((a,s)=>r.createVNode(n.ElOption,{key:s,label:a.value,value:a.key},null))]}})],...p.slots(t,l.headerData)})}}),d=o;d.install=l=>{l.component(o.name,o)};exports.FSelect=o;exports.PTFSelect=d;exports.default=o;