UNPKG

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.9 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),n=require("element-plus"),d=require("./common.js"),S=require("../../keys.js"),u=require("../../locale/lang.js"),c=require("../../locale/packages.js"),f=(l,r)=>typeof r=="function"?r()[l]:r?r[l]:"",o=a.defineComponent({name:"PTFSelect",props:{...d.props,propData:{type:Object,default:()=>({prop:""})}},emits:["headerFilterChange"],setup(l,{emit:r,expose:m}){const b=a.inject(S.SizeSymbol),t=a.reactive({value:[],options:[],selectVisible:!1,visible:!1}),y=e=>{e?t.selectVisible=e:t.visible=!1},v=e=>{e.length||(e=[]),r("headerFilterChange",e,l.headerData)},g=a.watch(()=>l.propData,e=>{var i,s;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 p=[];p.push({value:u.t(c.LangKey.Open),key:f("activeValue",(i=e.data)==null?void 0:i.property)||1},{value:u.t(c.LangKey.Close),key:f("inactiveValue",(s=e.data)==null?void 0:s.property)||0}),t.options=p}},{immediate:!0,deep:!0});return m({state:t,header:l.headerData}),a.onBeforeUnmount(()=>{g()}),()=>a.createVNode(n.ElPopover,{visible:t.visible,"onUpdate:visible":e=>t.visible=e,placement:"bottom-start",trigger:"contextmenu",width:200},{default:()=>[a.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:b,"onVisible-change":y,onChange:v},{default:()=>{var e;return[(e=t.options)==null?void 0:e.map((i,s)=>a.createVNode(n.ElOption,{key:s,label:i.value,value:i.key},null))]}})],...d.slots(t,l.headerData)})}}),h=o;h.install=l=>{l.component(o.name,o)};exports.FSelect=o;exports.PTFSelect=h;exports.default=o;