"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),m=require("@ant-design/icons-vue"),b=require("@aplus-frontend/antdv"),s=require("lodash-unified");require("../ap-form/index.js");const p=require("./constants.js"),C=require("../ap-form/item/index.vue.js");function N(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!l.isVNode(e)}const g=(e,t,n)=>{let o={};return s.isObject(e)?Object.keys(e).forEach(r=>{s.isObject(e[r])?o[r]=g(e[r],t[r],n):o[r]=n(e[r],t)}):o=n(e,t),o},j=(e,t)=>{switch(e){case"dayjs":return t.valueOf();case"dayjsRange":return t.map(n=>n.valueOf());case"dayjsDayRange":{const[n,o]=t;return[n.startOf("day").valueOf(),o.endOf("day").valueOf()]}case"multiple":case"multipleNumber":return s.isArray(t)?t:[t];case"boolean":return t;case"object":return t;default:return t}};function h(e){return s.isArray(e)?e.join("."):e}function v(e){const t=Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase();return t==="string"&&typeof e=="object"?"object":e===null?"null":e===void 0?"undefined":t}const y=e=>{if(v(e)==="map")return e;const t=new Map;for(const[n,o]of Object.entries(e||{})){let r=n;n==="true"?r=!0:n==="false"&&(r=!1),t.set(r,o)}return t},a=e=>{const t=[],n=y(e);return n.forEach((o,r)=>{const i=n.get(r)||n.get(`${r}`);if(i){if(typeof i=="object"&&i?.text){t.push({text:i?.text,value:r,label:i?.text,disabled:i.disabled});return}t.push({text:i,label:i,value:r})}}),t},O=e=>s.isUndefined(e)||e<0?0:e;function T(e,t){return!e||!s.isFunction(e)?e:e(t)}function E(e){let t=e.valueType||"text";return e.valueEnum&&(t="status"),t}function F(e,t,n,o){const r=p.apTableRenderItemMap[e];return r?l.createVNode(r,l.mergeProps(t,{mode:"read"}),null):o?.[e]?.render?.(t.value,n,t)||t.value}function P(e,t){if(e.customRenderFormItem)return()=>{const r=e.customRenderFormItem(e);return l.cloneVNode(r,{...e.fieldProps,span:e.span,...r.props||{}})};const n=p.apTableFormItemMap[e.valueType];if(n)return()=>l.createVNode(n,l.mergeProps(e.fieldProps,{span:e.span}),null);const o=t?.[e.valueType];return()=>{const r=o?.renderFormItem?.(e.fieldProps.field);return r?l.createVNode(C.default,l.mergeProps(e.fieldProps,{span:e.span}),N(r)?r:{default:()=>[r]}):null}}function x(e,t){const n=T(e.fieldProps,t),o=n?.field||n||{},r=e.valueType==="switch",i=e.valueType==="index",c=r?{checked:t.value}:{value:i?t.index+1:t.value};return e.valueEnum&&(o.valueEnum=e.valueEnum),{...s.omit(o,["request"]),...c}}function R(e){const t={...e};return s.isBoolean(e.filters)&&e.filters&&e.valueEnum&&(t.filters=a(e.valueEnum)),t}function V(e,t){const n=t||{};return e.valueEnum&&!n.field?.options&&(n.field={...n.field,options:a(e.valueEnum)}),n}function S(e){if(!s.isObject(e))return e;try{return JSON.stringify(e)}catch{return e}}function q(e,t,n,o){const r=n?.({title:e.title,column:e}),i=r?.filter(u=>u.type!==l.Comment)||[];if(r&&i.length>0)return r;const d=s.isString(e.title)?l.createVNode("span",{class:t,style:{textAlign:e.align||"left"},title:e.title},[e._requireMark?l.createVNode("span",{style:{color:"#FF4D4F",paddingRight:"2px"}},[l.createTextVNode("*")]):null,e.title]):e.title,f=e.tooltip?s.isFunction(e.tooltip)?e.tooltip(e):e.tooltip:null;return f?l.createVNode("span",{style:{display:"inline-flex",alignItems:"center",maxWidth:"100%"}},[d,l.createVNode(b.Tooltip,{title:f,placement:"bottom",getPopupContainer:u=>u.closest(".ant-table")||u.closest(".ant-modal")||u.closest(".vxe-table")||document.body},{default:()=>[l.createVNode(m.QuestionCircleOutlined,{style:{paddingInline:"4px",color:o,verticalAlign:"middle"}},null)]})]):d}function A(e,t){const n=[];function o(r){for(const i of r)i.children?.length?o(i.children):n.push(t(i))}return o(e),n}function I(e,t){if(s.isArray(e)&&s.isArray(t))return s.isEqual(s.sortBy(e),s.sortBy(t));if(s.isPlainObject(e)&&s.isPlainObject(t)){const n=o=>s.every(o,r=>r==null)||s.isEmpty(o);if(n(e)&&n(t))return!0}}function _(e){if(e!==!1)return e}exports.apColumnToColumn=R;exports.dataIndexToStr=h;exports.falseToUndefined=_;exports.formatParamsValueType=g;exports.getColumnOrder=O;exports.getFieldProps=T;exports.getSearchFormItemRenderNode=P;exports.getTableCellRenderNode=F;exports.getTableRenderProps=x;exports.getTableRenderType=E;exports.getTableTitle=q;exports.isEqualCustom=I;exports.objectToMap=y;exports.objectToString=S;exports.parseFieldValue=j;exports.recursionApColumns=A;exports.updateFormProps=V;exports.valueEnumToArray=a;
