"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),T=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]"&&!i.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 v(e){return s.isArray(e)?e.join("."):e}function h(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(h(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 l=n.get(r)||n.get(`${r}`);if(l){if(typeof l=="object"&&l?.text){t.push({text:l?.text,value:r,label:l?.text,disabled:l.disabled});return}t.push({text:l,label:l,value:r})}}),t},O=e=>s.isUndefined(e)||e<0?0:e;function m(e,t){return!e||!s.isFunction(e)?e:e(t)}function F(e){let t=e.valueType||"text";return e.valueEnum&&(t="status"),t}function E(e,t,n,o){const r=p.apTableRenderItemMap[e];return r?i.createVNode(r,i.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 i.cloneVNode(r,{...e.fieldProps,span:e.span,...r.props||{}})};const n=p.apTableFormItemMap[e.valueType];if(n)return()=>i.createVNode(n,i.mergeProps(e.fieldProps,{span:e.span}),null);const o=t?.[e.valueType];return()=>{const r=o?.renderFormItem?.(e.fieldProps.field);return r?i.createVNode(C.default,i.mergeProps(e.fieldProps,{span:e.span}),N(r)?r:{default:()=>[r]}):null}}function x(e,t){const n=m(e.fieldProps,t),o=n?.field||n||{},r=e.valueType==="switch",l=e.valueType==="index",c=r?{checked:t.value}:{value:l?t.index+1:t.value};return e.valueEnum&&(o.valueEnum=e.valueEnum),{...s.omit(o,["request"]),...c}}function V(e){const t={...e};return s.isBoolean(e.filters)&&e.filters&&e.valueEnum&&(t.filters=a(e.valueEnum)),t}function R(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}),l=r?.filter(u=>u.type!==Symbol.for("v-cmt"))||[];if(r&&l.length>0)return r;const d=s.isString(e.title)?i.createVNode("span",{class:t,style:{textAlign:e.align||"left"},title:e.title},[e._requireMark?i.createVNode("span",{style:{color:"#FF4D4F",paddingRight:"2px"}},[i.createTextVNode("*")]):null,e.title]):e.title,f=e.tooltip?s.isFunction(e.tooltip)?e.tooltip(e):i.createVNode(i.Fragment,null,[e.tooltip]):null;return f?i.createVNode("span",{style:{display:"inline-flex",alignItems:"center",maxWidth:"100%"}},[d,i.createVNode(b.Tooltip,{title:f,placement:"bottom",getPopupContainer:u=>u.closest(".ant-table")||u.closest(".ant-modal")||u.closest(".vxe-table")||document.body},{default:()=>[i.createVNode(T.QuestionCircleOutlined,{style:{paddingInline:"4px",color:o,verticalAlign:"middle"}},null)]})]):d}function A(e,t){const n=[];function o(r){for(const l of r)l.children?.length?o(l.children):n.push(t(l))}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=V;exports.dataIndexToStr=v;exports.falseToUndefined=_;exports.formatParamsValueType=g;exports.getColumnOrder=O;exports.getFieldProps=m;exports.getSearchFormItemRenderNode=P;exports.getTableCellRenderNode=E;exports.getTableRenderProps=x;exports.getTableRenderType=F;exports.getTableTitle=q;exports.isEqualCustom=I;exports.objectToMap=y;exports.objectToString=S;exports.parseFieldValue=j;exports.recursionApColumns=A;exports.updateFormProps=R;exports.valueEnumToArray=a;
