"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue"),s=require("lodash-unified");require("../../ap-table/components/paragraph-ellipsis/index.vue.js");const S=require("../../ap-table/constants.js"),d=require("../../ap-table/utils.js");require("../../utils/index.js");const A=require("../../ap-table/components/paragraph-ellipsis/index.vue2.js"),R=require("../../utils/is.js");function h(e,t){if(t)return s.isArray(t)?t.reduce((r,n)=>r?.[n],e):e?.[t]}function y(e){if(!s.isUndefined(e))return s.isArray(e)?e.reduce((t,r)=>s.isString(r)?`${t}${t?".":""}${r}`:`${t}[${r}]`,""):String(e)}function b(e){if(e)return e===!0?"left":e}function _(e){return s.isBoolean(e)?{sortable:e}:e?{sortable:!0,sortType:e?.type,sortBy:e?.by}:{sortable:!1}}function N(e){let t;return s.isBoolean(e.filters)&&e.valueEnum?t=d.valueEnumToArray(e.valueEnum):t=e.filters,t?.map(r=>({label:s.isString(r.text)?r.text:"",value:r.value}))}function O(e){if(e)return t=>e(t.value,t.row)}function V(e,t){return e?s.isNumber(e)?{tooltip:t,rows:e}:e===!0||e==="tooltip"?{tooltip:t,rows:1}:{tooltip:null,rows:1,htmlTitle:e==="title"?t:""}:!1}function g(e,t,r){if(S.noRenderAsFormItemValueList.includes(e.valueType))return r;if(e.copyable||e.ellipsis){const n=V(e.ellipsis,t),i=d.objectToString(t);return p.createVNode(A.default,{rawValue:i,copyable:e.copyable,ellipsis:n,content:r},null)}return r}function c(e,t,r){const n=s.pick(e,["width","minWidth","align"]);return n.field=y(e.dataIndex),n.fixed=b(e.fixed),n.slots={header:()=>d.getTableTitle(e,r,void 0,t)},n.headerAlign=e.align,n.showOverflow=!1,n.showFooterOverflow=!1,n}function w(e,t,r){if(r)return s.isString(r)?e[r]:r(e,t)}const F=({value:e,...t},r,n,i=!0)=>{const a=d.getTableRenderType(r),u=d.getTableRenderProps({...r,valueType:a},{value:e,...t}),l=d.getTableCellRenderNode(a,u,t.record,n),o=r.renderText?.({value:e,...t})||e,v=r.renderText?o:l;let f=i?g(r,o,v):v;if(r.customRender){const q=r._path||[],x=w(t.record,t.rowIndex,t.params?.rowKey);f=r.customRender({value:e,...t,column:r,originalNode:f,originalText:o,path:R.isDef(x)&&[...q,String(x)]})}return p.createVNode(p.Fragment,null,[f])};function T(e,t,r,n){const i=s.pick(e,["width","minWidth","align","resizable","className","headerClassName","footerClassName","treeNode"]);i.field=y(e.dataIndex),i.fixed=b(e.fixed),i.headerAlign=e.align,i.footerAlign=e.align,i.showOverflow=!1,i.showFooterOverflow=!1,Object.assign(i,_(e.sorter)),i.filters=N(e),i.filterMultiple=e.filterMultiple,i.filterMethod=O(e.onFilter);const a=({row:u,rowIndex:l})=>F({value:h(u,e.dataIndex),text:h(u,e.dataIndex),record:u,index:l,renderIndex:l,column:e},e,n);return i.slots={header:()=>d.getTableTitle(e,r,void 0,t),default:a,footer:a},e.html&&(delete i.slots.default,delete i.slots.footer,i.type="html"),e.seq&&(i.type="seq",i.slots={}),i}function B(e,t,r,n){if(!e.children?.length)return T(e,t,r,n);function i(u){return u.map(l=>{if(l.children?.length){const o=c(l,t,r);return o.children=i(l.children),o}return T(l,t,r,n)})}const a=c(e,t,r);return a.children=i(e.children),a}exports.contentCustom=F;exports.dataIndexToField=y;exports.getValueByDataIndex=h;exports.transformCol=B;exports.transformFixed=b;exports.transformToColGroup=c;exports.transformToColumn=T;
