"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("@aplus-frontend/antdv/es/theme/internal"),C=require("clsx"),a=require("lodash-unified"),d=require("vue"),v=require("../../utils/warning.js"),s=require("../../ap-table/utils.js");require("../../config-provider/index.js");const g=require("../utils.js"),w=require("../../config-provider/hooks/use-namespace.js"),A=(r,m)=>{const{em:x,be:q}=w.useNamespace("editable-table"),T=v.useDevWarning("EditableTable"),h=d.useSlots(),[,F]=N.useToken();return d.computed(()=>{const c=r.columns;if(!c)return[];function i(I){return I.map(e=>({...a.omit(e,["ellipsis"]),children:i(e.children||[]),title:g.getEditableTableTitle(e,q("table-header","title"),x("header-cell","required"),h.headerCell,d.unref(F).colorTextTertiary),customRender({value:l,...n}){const o=a.isFunction(e.editable)?e.editable(n.text,n.record,n.index):!!e.editable;if(!e.valueType&&!e.customRender&&!e.customRenderFormItem)return T(!1,"usage","'can not render table cell because no `valueType` / `customRender` / `customRenderFormItem`'"),null;let u;if(o){const t=s.updateFormProps(e,s.getFieldProps(e.fieldProps,{value:l,...n})),f={};r.onFieldChange&&(f[`onUpdate:${t.valuePropName||"value"}`]=y=>r.onFieldChange?.(n.index,e.dataIndex,y));const R=a.isArray(e.dataIndex)?e.dataIndex:[e.dataIndex];u={name:[...a.isArray(r.name)?r.name:[r.name],n.index,...R],...t||{},field:{style:"width: 100%",...t?.field||{},...f,class:C.clsx("is-editable",t.class)}}}else u={field:s.getTableRenderProps(e,{value:l,...n})};const b=g.getFinalNode(e,o,u,l,n.record,d.unref(m));return e.customRender?e.customRender({value:l,...n,editable:o,originalNode:b}):b}}))}return i(c)})};exports.default=A;
