@jiaozhiye/qm-design-react 1.7.55 → 1.7.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.full.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={787:t=>{t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{n.r(a),n.d(a,{Affix:()=>O.Affix,Alert:()=>O.Alert,Anchor:()=>O.Anchor,AutoComplete:()=>O.AutoComplete,Avatar:()=>O.Avatar,BackTop:()=>O.BackTop,Badge:()=>O.Badge,Breadcrumb:()=>O.Breadcrumb,Button:()=>O.Button,Calendar:()=>H,Card:()=>O.Card,Carousel:()=>O.Carousel,Cascader:()=>O.Cascader,Checkbox:()=>O.Checkbox,Col:()=>O.Col,Collapse:()=>O.Collapse,Comment:()=>O.Comment,ConfigProvider:()=>O.ConfigProvider,DatePicker:()=>q,DcpAnchor:()=>Wt,DcpButton:()=>he,DcpCollapse:()=>De,DcpConfigProvider:()=>X,DcpCopyToClipboard:()=>Xs,DcpCountup:()=>ct,DcpCropper:()=>Kl,DcpDivider:()=>Ie,DcpDownload:()=>$t,DcpDrawer:()=>nr,DcpEmpty:()=>mt,DcpForm:()=>gl,DcpGuideTracker:()=>Md,DcpModal:()=>cr,DcpPrint:()=>yd,DcpRangeTableHelper:()=>Cc,DcpScrollbar:()=>Pt,DcpSearchHelper:()=>dc,DcpSearchTree:()=>so,DcpSpace:()=>xe,DcpSpin:()=>ft,DcpSplit:()=>nt,DcpTable:()=>oc,DcpTabs:()=>Jt,DcpTinymce:()=>$l,DcpTour:()=>Xc,DcpTransition:()=>td,DcpTreeHelper:()=>yc,DcpTreeTableHelper:()=>gc,DcpUploadFile:()=>Ul,DcpUploadImg:()=>Zl,DcpWatermark:()=>Vd,Descriptions:()=>O.Descriptions,Divider:()=>O.Divider,Drawer:()=>O.Drawer,Dropdown:()=>O.Dropdown,Empty:()=>O.Empty,Form:()=>O.Form,Grid:()=>O.Grid,Image:()=>O.Image,Input:()=>O.Input,InputNumber:()=>O.InputNumber,Layout:()=>O.Layout,List:()=>O.List,Mentions:()=>O.Mentions,Menu:()=>O.Menu,Modal:()=>O.Modal,PageHeader:()=>O.PageHeader,Pagination:()=>O.Pagination,Popconfirm:()=>O.Popconfirm,Popover:()=>O.Popover,Progress:()=>O.Progress,QmAnchor:()=>Wt,QmButton:()=>he,QmCollapse:()=>De,QmConfigProvider:()=>X,QmCopyToClipboard:()=>Xs,QmCountup:()=>ct,QmCropper:()=>Kl,QmDivider:()=>Ie,QmDownload:()=>$t,QmDrawer:()=>nr,QmEmpty:()=>mt,QmForm:()=>gl,QmGuideTracker:()=>Md,QmModal:()=>cr,QmPrint:()=>yd,QmRangeTableHelper:()=>Cc,QmScrollbar:()=>Pt,QmSearchHelper:()=>dc,QmSearchTree:()=>so,QmSpace:()=>xe,QmSpin:()=>ft,QmSplit:()=>nt,QmTable:()=>oc,QmTabs:()=>Jt,QmTinymce:()=>$l,QmTour:()=>Xc,QmTransition:()=>td,QmTreeHelper:()=>yc,QmTreeTableHelper:()=>gc,QmUploadFile:()=>Ul,QmUploadImg:()=>Zl,QmWatermark:()=>Vd,Radio:()=>O.Radio,Rate:()=>O.Rate,Result:()=>O.Result,Row:()=>O.Row,Segmented:()=>O.Segmented,Select:()=>O.Select,Skeleton:()=>O.Skeleton,Slider:()=>O.Slider,Space:()=>O.Space,Spin:()=>O.Spin,Statistic:()=>O.Statistic,Steps:()=>O.Steps,Switch:()=>O.Switch,Tabs:()=>O.Tabs,Tag:()=>O.Tag,TimePicker:()=>M,Timeline:()=>O.Timeline,Tooltip:()=>O.Tooltip,Transfer:()=>O.Transfer,Tree:()=>O.Tree,TreeSelect:()=>O.TreeSelect,Typography:()=>O.Typography,Upload:()=>O.Upload,message:()=>O.message,notification:()=>O.notification,pinyin:()=>Wr,version:()=>zd});var e=n(787),t=n.n(e);const r=require("prop-types");var i=n.n(r);const l=(0,e.createContext)({locale:"zh-cn",size:"middle"}),o=require("dayjs");var s=n.n(o);const c={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传"},uploadCropper:{dragableText:"拖放或点击",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},mergeCell:{cancel:"恢复",confirm:"合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let d=c;function u(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const p=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const[n,a]=t;let i;const l=n.split(".");let o=d;for(let e=0,t=l.length;e<t;e++){if(i=o[l[e]],e===t-1)return u(i,a);if(!i)return"";o=i}return""},m=e=>{d=e||d,d.name&&s().locale(d.name)};class h extends Error{constructor(e){super(e),this.name="QmDesignError"}}function f(e,t){throw new h(`[${e}] ${t}`)}function g(e,t){console.warn(new h(`[${e}] ${t}`))}const b=e=>["","small","middle","large"].includes(e),y=require("dayjs/plugin/localeData");var v=n.n(y);const x=require("dayjs/plugin/advancedFormat");var E=n.n(x);const S=require("dayjs/plugin/customParseFormat");var C=n.n(S);const w=require("dayjs/plugin/quarterOfYear");var T=n.n(w);const N=require("dayjs/plugin/weekOfYear");var I=n.n(N);const R=require("dayjs/plugin/weekday");var P=n.n(R);s().extend(v()),s().extend(E()),s().extend(C()),s().extend(T()),s().extend(I()),s().extend(P());const O=require("antd"),A=require("rc-picker/es/generate/dayjs");var k=n.n(A);const F=require("antd/es/calendar/generateCalendar");var L=n.n(F);require("antd/es/calendar/style");const H=L()(k()),$=require("antd/es/date-picker/generatePicker");var D=n.n($);require("antd/es/date-picker/style/index");const q=D()(k());function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_.apply(this,arguments)}const j=e.forwardRef(((t,r)=>e.createElement(q,_({},t,{picker:"time",mode:void 0,ref:r}))));j.displayName="TimePicker";const K=e.forwardRef(((t,r)=>e.createElement(q.RangePicker,_({},t,{picker:"time",mode:void 0,ref:r}))));K.displayName="RangePicker",j.RangePicker=K;const M=j,V={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload"},uploadCropper:{dragableText:"Drop or click",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},mergeCell:{cancel:"reset",confirm:"merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},z=require("antd/es/locale/zh_CN");var U=n.n(z);const B=require("antd/es/locale/en_GB");function W(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const G={[V.name]:{qm:V,antd:n.n(B)()},[c.name]:{qm:c,antd:U()}};class Y extends e.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},m(Object.assign({},G,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:r,size:n}=t.value,{locale:a,size:i,global:l}=e;return a!==r&&m(Object.assign({},G,l.langPackage)[a].qm),a!==r||i!==n?{value:Object.assign({},t.value,{locale:a,size:i})}:null}render(){const{global:e}=this.props,{value:r}=this.state,n=Object.assign({},G,e.langPackage);return t().createElement(l.Provider,{value:r},t().createElement(O.ConfigProvider,{locale:n[r.locale].antd,componentSize:r.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}W(Y,"propTypes",{locale:i().string,size:(e,t,r)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},theme:i().string,global:i().object}),W(Y,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const X=Y,Q=require("omit.js");var Z=n.n(Q);const J=require("lodash-es"),ee="undefined"==typeof window,te=e=>t().isValidElement(e),re=e=>te(e)&&e.type===t().Fragment,ne=()=>{},ae=()=>!0,ie=async e=>new Promise((t=>setTimeout(t,e))),le=e=>{Promise.resolve().then(e)},oe=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),se=e=>!!(!e&&0!==e||(0,J.isArray)(e)&&!e.length||(0,J.isPlainObject)(e)&&!Object.keys(e).length),ce=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,J.isPlainObject)(e)||(0,J.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const a=r?void 0:Object.keys(e);return function(e,t){let r=-1;const n=e.length;for(;++r<n;)t(e[r],r)}(a||e,((r,i)=>{a&&(i=r),n[i]=ce(e[i],t)})),n}return e},de=e=>(0,J.isNumber)(e)?`${e}px`:e.toString();function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ue.apply(this,arguments)}function pe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class me extends e.Component{constructor(){super(...arguments),pe(this,"state",{isLoading:!1}),pe(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{await(this.props.click?.(e))}catch(e){g("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:r,authConfig:n,click:a,confirm:i}=this.props,{isLoading:l}=this.state,o=e||this.context.size||"",s=(0,J.isFunction)(a)?{onClick:this.clickHandle}:null,c={...Z()(this.props,["authConfig","click","confirm"]),size:o,loading:l||r||!1,...s};if(n){const{visible:e=1,disabled:t}=n||{};if(!e)return null;t&&(c.disabled=!0)}return i?t().createElement(O.Popconfirm,{title:i.title||p("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{i.onConfirm?.(),c.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},t().createElement(O.Button,ue({},c,{onClick:ne}),this.props.children)):t().createElement(O.Button,c,this.props.children)}}pe(me,"propTypes",{click:i().func,confirm:i().shape({title:i().node,onConfirm:i().func,onCancel:i().func})}),pe(me,"contextType",l);const he=me;var fe,ge,be,ye=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ye||{});class ve extends e.Component{render(){const{size:e}=this.props,r=e||this.context.size||"",n=(0,J.isNumber)(e)?e:ye[e||r||"default"],a={...this.props,size:n};return t().createElement(O.Space,a,this.props.children)}}fe=ve,be=l,(ge=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(ge="contextType"))in fe?Object.defineProperty(fe,ge,{value:be,enumerable:!0,configurable:!0,writable:!0}):fe[ge]=be;const xe=ve,Ee=require("classnames");var Se=n.n(Ee);const Ce=e=>`qm-${e}`,we=require("@ant-design/icons");function Te(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ne extends e.Component{constructor(){super(...arguments),Te(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=ne}=this.props;t(!e)}))}render(){const{size:e,label:r,extra:n,collapse:a,bordered:i,disabled:l,id:o,className:s,style:c}=this.props,d=e||this.context.size||"",u=Ce("divider"),m={[u]:!0,[`${u}-borderless`]:!i,[`${u}--lg`]:"large"===d,[`${u}--sm`]:"small"===d};return t().createElement("div",{id:o,className:Se()(m,s),style:c},t().createElement("span",{className:Se()(`${u}__title`)},r),t().createElement("div",{className:Se()(`${u}__extra`)},n),void 0!==a&&t().createElement(O.Button,{type:"link",className:Se()(`${u}__collapse`),disabled:l,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}Te(Ne,"contextType",l),Te(Ne,"propTypes",{label:i().string,size:(e,t,r)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},extra:i().oneOfType([i().element,i().string]),collapse:i().bool,bordered:i().bool}),Te(Ne,"defaultProps",{bordered:!0});const Ie=Ne,Re=()=>({height:0,opacity:0}),Pe=(e,t)=>"height"===t.propertyName,Oe={motionName:"rc-collapse-motion",onEnterStart:Re,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Re,onEnterEnd:Pe,onLeaveEnd:Pe,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},Ae=require("rc-motion");var ke=n.n(Ae);const Fe=t().forwardRef(((e,r)=>{const{forceRender:n,className:a,style:i,boxStyle:l,isActive:o}=e,[s,c]=t().useState(o||n);if(t().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const d=Ce("collapse");return t().createElement("div",{ref:r,className:Se()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},a),style:i},t().createElement("div",{className:`${d}-content-box`,style:l},e.children))}));Fe.displayName="PanelContent";const Le=Fe;function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},He.apply(this,arguments)}const $e=e=>{const{defaultActive:r,label:n,extra:a,className:i,style:l,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[m,h]=t().useState(!!r),f=Ce("collapse"),g=Se()({[`${f}`]:!0,[`${f}-active`]:m,[`${f}-disabled`]:c},i);return t().createElement("div",{className:g,style:l},t().createElement(Ie,{label:n,extra:a,collapse:m,bordered:s,disabled:c,onCollapseChange:e=>{h(e),p?.(e)}}),t().createElement(ke(),He({visible:m},Oe,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),((r,n)=>{let{className:a,style:i}=r;return t().createElement(Le,{ref:n,prefixCls:f,className:a,style:i,boxStyle:o,isActive:m,forceRender:d},e.children)})))};$e.displayName="QmCollapse";const De=$e,qe=t().createContext(void 0);function _e(t,r){((r,n)=>{const a=e.useRef(!0);e.useEffect((()=>(e=>{if(!e)return t()})(a.current)),n),e.useEffect((()=>(a.current=!1,()=>{a.current=!0})),[])})(0,r)}const je=require("react-draggable");var Ke=n.n(je);const Me=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Ve=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},ze=e=>e.stopPropagation(),Ue=e=>e.preventDefault(),Be=(e,t,r)=>{!ee&&e&&t&&((0,J.isPlainObject)(t)?Object.keys(t).forEach((r=>{Be(e,r,t[r])})):(t=oe(t),e.style[t]=r))},We=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},Ge=(e,t)=>Math.abs(We(e)-We(t)),Ye=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},Xe=(e,t)=>{if(ee||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},Qe=e=>{const{minValues:r,onDragChange:n,onDragging:a}=e,{splitRef:i,direction:l}=t().useContext(qe),[o,s]=t().useState(),[c,d]=t().useState(0),u="vertical"===l?"y":"x",m={[`${Ce("split")}__resize-bar`]:!0,vertical:"vertical"===l,horizontal:"horizontal"===l};return t().createElement(Ke(),{bounds:o,axis:u,position:{x:0,y:0},positionOffset:{[u]:-1*c},onStart:()=>{n(!0),(()=>{const e=i.current.children[0];if(!e)return;const t=(()=>{const{w:e,h:t}={w:i.current.offsetWidth,h:i.current.offsetHeight};return[r[0],("vertical"===l?t:e)-r[1]]})(),n=e.offsetWidth,a=e.offsetHeight;s({left:t[0]-n,right:t[1]-n,top:t[0]-a,bottom:t[1]-a})})()},onDrag:(e,t)=>{d(t[u]),a(t[u])},onStop:()=>n(!1)},t().createElement("div",{className:Se()(m),title:p("qm.split.resize")}))};Qe.displayName="ResizeBar";const Ze=Qe,Je=t().forwardRef(((e,r)=>{const{offset:n,className:a,style:i}=e,{direction:l,dragging:o}=t().useContext(qe),s="vertical"===l?"height":"width",c={[Ce("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===l,vertical:"vertical"===l,[a]:!!a},d=void 0!==n?{[s]:de(n)}:{flex:1,[s]:0};return t().createElement("div",{ref:r,className:Se()(c),style:{...d,...i}},e.children)}));Je.displayName="QmSplitPane";const et=Je;function tt(){return tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tt.apply(this,arguments)}const rt=e=>{const{direction:r="horizontal",defaultValue:n="50%",uniqueKey:a,className:i,style:o,onDragStart:s,onDrag:c=ne,onDragEnd:d}=e,{global:u}=t().useContext(l),p=t().useRef(null),m=t().useRef(null),h=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=t().useMemo((()=>a?`split_${a}`:""),[a]),[y,v]=t().useState(!1),[x,E]=t().useState(h(n)),S=t().useRef(0);_e((()=>{y?(S.current="vertical"===r?m.current.offsetHeight:m.current.offsetWidth,s?.(f(x))):(d?.(f(x)),localStorage.setItem(b,x),T(b,x))}),[y]),t().useEffect((()=>{C()}),[]);const C=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(h(e)):w(b).then((e=>{localStorage.setItem(b,h(e||n)),C()})).catch((()=>{}))},w=async e=>{const t=u?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},T=async(e,t)=>{const r=u?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},N=t().useMemo((()=>({splitRef:p,direction:r,dragging:y})),[r,y]),I=[];t().Children.map(e.children,(e=>{te(e)&&!re(e)&&"QmSplitPane"===e.type?.displayName&&I.push(e)}));const[R,P]=I,O=t().useMemo((()=>[g(R),g(P)]),[R,P]),A={[Ce("split")]:!0,vertical:"vertical"===r};return t().createElement(qe.Provider,{value:N},t().createElement("div",{ref:p,className:Se()(A,i),style:o},t().createElement(et,tt({},R.props,{ref:m,offset:x})),t().createElement(Ze,{minValues:O,onDragChange:e=>v(e),onDragging:e=>{const t=S.current+e;E(`${t}px`),c(t)}}),t().createElement(et,P.props)))};rt.Pane=et,rt.displayName="QmSplit";const nt=rt,at=require("react-countup");var it=n.n(at);function lt(){return lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lt.apply(this,arguments)}function ot(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class st extends e.Component{render(){const{size:e,className:r,style:n}=this.props,a=e||this.context.size||"",i=Ce("countup"),l={[i]:!0,[`${i}--lg`]:"large"===a,[`${i}--sm`]:"small"===a};return t().createElement(it(),lt({},this.props,{className:Se()(l,r),style:n}),this.props.children)}}ot(st,"defaultProps",{duration:2}),ot(st,"contextType",l);const ct=st;function dt(){return dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dt.apply(this,arguments)}function ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class pt extends e.Component{render(){const{size:e,className:r}=this.props,n=e||this.context.size||"",a=Ce("empty"),i={...this.props,image:O.Empty.PRESENTED_IMAGE_SIMPLE},l={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return t().createElement(O.Empty,dt({},i,{className:Se()(l,r)}))}}ut(pt,"contextType",l),ut(pt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const mt=pt;class ht extends e.Component{render(){const{fullHeight:e,className:r,style:n={}}=this.props,a={[`${Ce("spin")}-full-height`]:e},i={wrapperClassName:Se()(a,r),...Z()(this.props,["fullHeight"]),style:{...n,maxHeight:"none"}};return t().createElement(O.Spin,i,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ht,"defaultProps",{tip:"Loading...",fullHeight:!1});const ft=ht,gt=t().createContext(void 0),bt=require("resize-observer-polyfill");var yt=n.n(bt);const vt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},xt=function(e,t){!ee&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(yt())(vt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},Et=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function St(t){const[r,n]=e.useState({width:0,height:0});return e.useEffect((()=>{const e=t.current,r=e=>{const{width:t,height:r}=e.contentRect;n({width:t,height:r})};return e&&xt(e,r),()=>{e&&Et(e,r)}}),[t]),r}function Ct(t,r){var n=this;const a=e.useRef(null);return e.useEffect((()=>()=>{clearTimeout(a.current),a.current=null}),[]),function(){for(var e=arguments.length,i=new Array(e),l=0;l<e;l++)i[l]=arguments[l];a.current&&clearTimeout(a.current),a.current=setTimeout((()=>t.apply(n,i)),r)}}const wt=6,Tt={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",reverse:"width",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",reverse:"height",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},Nt=e=>{const{thumb:r,always:n,barSize:a=wt,direction:i="vertical",onDrag:l=ne}=e,{dragging:o,scrollbarElement:s,wrapElement:c}=t().useContext(gt),d=Tt[i],u=t().useRef(r),p=t().useRef(null),m=t().useRef(null),h=t().useRef({}),f=t().useRef(!1),g=t().useRef(!1),b=t().useRef(ee?null:document.onselectstart),[y,v]=t().useState(!1);t().useEffect((()=>{u.current=r}),[r]),t().useEffect((()=>{const e=s.current;return Me(e,"mousemove",C),Me(e,"mouseleave",w),()=>{S(),Ve(document,"mouseup",E),Ve(e,"mousemove",C),Ve(e,"mouseleave",w)}}),[]);const x=e=>{if(!p.current||!m.current)return;if(!f.current)return;const t=h.current[d.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[d.direction]-e[d.client])-(m.current[d.offset]-t))/p.current[d.offset];c.current[d.scroll]=r*c.current[d.scrollSize]/100,l(!0)},E=()=>{f.current=!1,h.current={[d.axis]:0},Ve(document,"mousemove",x),Ve(document,"mouseup",E),S(),g.current&&v(!1),l(!1)},S=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},C=()=>{g.current=!1,v(!!u.current.size)},w=()=>{g.current=!0,v(f.current)},T=Ce("scrollbar"),N={[`${T}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},I={[d.reverse]:a},R={[d.size]:r.size,transform:`translate${d.axis}(${r.offset}%)`};return t().createElement(td,{name:"fade",in:n||o||y,timeout:300},t().createElement("div",{ref:p,className:Se()(N),style:I},t().createElement("div",{ref:m,className:`${T}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),Me(document,"mousemove",x),Me(document,"mouseup",E),f.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[d.axis]:t[d.offset]-(e[d.client]-t.getBoundingClientRect()[d.direction])})}})))},It=20,Rt=t().forwardRef(((e,r)=>{const{wrapClassName:n,wrapStyle:a,barWidth:i,always:l,native:o,minSize:s=It,onScroll:c}=e,d=t().useRef(null),u=t().useRef(null),p=t().useRef(null),[m,h]=t().useState({size:0,offset:0,ratio:1}),[f,b]=t().useState({size:0,offset:0,ratio:1}),[y,v]=t().useState(!1),x=St(d),E=St(p);_e((()=>{!o&&S()}),[E.width,E.height,x.width,x.height]);const S=Ct((()=>{if(!u.current)return;const e=u.current.offsetHeight-4,t=u.current.offsetWidth-4,r=e**2/u.current.scrollHeight,n=t**2/u.current.scrollWidth,a=Math.max(r,s),i=Math.max(n,s),l=r/(e-r)/(a/(e-a)),o=n/(t-n)/(i/(t-i)),c=a+4<e?a:0,d=i+4<t?i:0,p=100*u.current.scrollTop/e*l,g=100*u.current.scrollLeft/t*o;h(Object.assign({},m,{size:d,ratio:o,offset:g})),b(Object.assign({},f,{size:c,ratio:l,offset:p}))}),5),C=e=>{v(e)},w=e=>{(0,J.isNumber)(e)?u.current.scrollTop=e:g("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=e=>{(0,J.isNumber)(e)?u.current.scrollLeft=e:g("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t().useImperativeHandle(r,(()=>({container:d.current,scrollTop:u.current?.scrollTop||0,scrollLeft:u.current?.scrollLeft||0,SET_SCROLL_TOP:w,SET_SCROLL_LEFT:T})));const N=t().useMemo((()=>({dragging:y,scrollbarElement:d,wrapElement:u})),[y]),I=Ce("scrollbar"),R={[`${I}__wrap`]:!0,[`${I}__wrap--hidden`]:!o};return t().createElement("div",{ref:d,className:Se()(I,e.className),style:e.style},t().createElement("div",{ref:u,className:Se()(R,n),style:a,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!o&&(()=>{if(!u.current)return;const e=u.current.offsetHeight-4,t=u.current.offsetWidth-4,r=100*u.current.scrollTop/e*f.ratio,n=100*u.current.scrollLeft/t*m.ratio;h(Object.assign({},m,{offset:n})),b(Object.assign({},f,{offset:r}))})(),c?.({scrollTop:t,scrollLeft:r})}},t().createElement("div",{ref:p,className:`${I}__view`},e.children)),!o&&t().createElement(gt.Provider,{value:N},t().createElement(Nt,{direction:"horizontal",thumb:m,barSize:i,always:l,onDrag:C}),t().createElement(Nt,{direction:"vertical",thumb:f,barSize:i,always:l,onDrag:C})))}));Rt.displayName="QmScrollbar";const Pt=Rt,Ot=require("axios");var At=n.n(Ot);const kt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Ft(){return Ft=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ft.apply(this,arguments)}function Lt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ht extends e.Component{constructor(){super(...arguments),Lt(this,"state",{loading:!1}),Lt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{const{action:e,beforeDownload:t=ae}=this.props,r=(0,J.isString)(e)?e:await this.getActionUrl();if(!r)return g("Download","参数 `action` 有误!");if(!t(r))return;await this.downloadFile(r),await ie(100),this.props.onSuccess?.(),O.message.success(p("qm.download.success"))}catch(e){this.props.onError?.(e),O.message.error(p("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}async downloadFile(e){const{fileName:t,headers:r,params:n,withCredentials:a}=this.props,i=await At()({url:e,params:n,headers:r,withCredentials:a,responseType:"blob"}),l=i.data,o=i.headers["content-disposition"],s=t||(o?o.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));kt(l,s)}render(){const{size:e}=this.props,{loading:r}=this.state,n=e||this.context.size||"",a=Z()(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t().createElement(O.Button,Ft({},a,{size:n,loading:r,onClick:this.downloadHandle}),this.props.children)}}Lt(Ht,"propTypes",{action:i().oneOfType([i().string,i().shape({api:i().func.isRequired,params:i().object})]),size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},fileName:i().string,headers:i().object,withCredentials:i().bool,params:i().object,beforeDownload:i().func,onSuccess:i().func,onError:i().func}),Lt(Ht,"defaultProps",{icon:t().createElement(we.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),Lt(Ht,"contextType",l);const $t=Ht,Dt=require("add-dom-event-listener");var qt=n.n(Dt);const _t=require("scroll-into-view-if-needed");var jt=n.n(_t);class Kt extends e.Component{renderLabel(){const{activeKey:e,labels:r,onTabClick:n}=this.props;return r.map(((r,a)=>{const i={item:!0,actived:a===e};return t().createElement("div",{key:a,className:Se()(i),onClick:e=>n(a,e)},t().createElement("span",null,r))}))}render(){return t().createElement(t().Fragment,null,this.renderLabel())}}const Mt=Kt;class Vt extends e.Component{render(){const{label:e,showDivider:r,className:n,style:a}=this.props,i={[Ce("anchor-item")]:!0};return t().createElement("div",{className:Se()(i,n),style:a},r&&t().createElement(Ie,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Vt,"displayName","QmAnchorItem");const zt=Vt;function Ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bt extends e.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(t){super(t),Ut(this,"currentState","ready"),Ut(this,"itemsTotal",void 0),Ut(this,"timer",void 0),Ut(this,"scrollEvent",void 0),Ut(this,"scrollRef",(0,e.createRef)()),Ut(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),Ut(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),jt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),Ut(this,"SCROLL_TO_ITEM",(e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)})),this.state={activeKey:t.defaultActiveIndex||0}}componentDidMount(){this.initialHandle(),this.scrollEvent=qt()(this.scrollRef.current,"scroll",(0,J.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=Ge(this.getTargetElement(e),this.scrollRef.current))}createDistances(){const{labelList:e=[]}=this.props;return(this.__is_conf?e.map((e=>document.getElementById(e.id))):Array.from(this.scrollRef.current?.children||[])).map((e=>Ge(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),r=this.createDistances();let n=-1;for(let e=0;e<r.length;e++){const a=r[e],i=r[e+1]||1e4;t>=a-1&&t<i&&(n=e)}return n}getTargetElement(e){const{labelList:t=[]}=this.props;return this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e]}render(){const{activeKey:e}=this.state,{size:r,labelWidth:n,tabPosition:a,labelList:i=[],onTabClick:l,className:o,style:s}=this.props,c=r||this.context.size||"",d=Ce("anchor"),u={[d]:!0,[`${d}-left`]:"left"===a,[`${d}-top`]:"top"===a,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmAnchorItem"===e.type?.displayName&&p.push(e)}));const m=this.__is_conf?i.map((e=>e.label)):p.map((e=>e.props.label)),h=this.__is_conf?i.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=m.length,t().createElement("div",{className:Se()(u,o),style:s},t().createElement("div",{className:Se()("anchor-nav"),style:{width:n?de(n):""}},t().createElement(Mt,{activeKey:e,labels:m,onTabClick:(e,t)=>{this.onTabClickHandle(e),l?.({label:m[e],id:h[e]},t)}})),t().createElement("div",{ref:this.scrollRef,className:Se()("anchor-container")},this.__is_conf?this.props.children:p))}}Ut(Bt,"Item",zt),Ut(Bt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},labelWidth:(e,t,r)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.");var n},labelList:i().arrayOf(i().shape({id:i().string,label:i().string}))}),Ut(Bt,"defaultProps",{tabPosition:"left"}),Ut(Bt,"contextType",l);const Wt=Bt;class Gt extends e.Component{render(){return t().createElement(O.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Gt,"displayName","QmTabPane");const Yt=Gt;function Xt(){return Xt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xt.apply(this,arguments)}function Qt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Zt extends e.Component{render(){const{items:e,size:r,tabPosition:n,tabBarGutter:a,className:i,authConfig:l}=this.props,o=r||this.context.size||"",s=Ce("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===o,[`${s}--sm`]:"small"===o},d={...Z()(this.props,["items","authConfig"]),size:o,tabBarGutter:a??(["top","bottom"].includes(n)?30:0)},u=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmTabPane"===e.type?.displayName&&u.push(e)}));const p=e?[...e]:u.map((e=>{let{key:t,props:r}=e;return{key:t,label:r.tab,disabled:r.disabled,closable:r.closable,forceRender:r.forceRender,children:r.children}}));if(l){const{fieldList:e=[]}=l||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:a=1,disabled:i}=n||{};a?i&&(r.disabled=!0):(p.splice(t,1),t--)}}return t().createElement(O.Tabs,Xt({},d,{items:p,className:Se()(c,i)}))}}Qt(Zt,"TabPane",Yt),Qt(Zt,"contextType",l),Qt(Zt,"defaultProps",{tabPosition:"top"});const Jt=Zt;function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},er.apply(this,arguments)}function tr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class rr extends e.Component{constructor(){super(...arguments),tr(this,"titleRef",t().createRef()),tr(this,"$drawer",null),tr(this,"opened",!1),tr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),tr(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;e?(this.opened=!0,(0,J.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(this.props.onClosed?.(),this.setState({fullscreen:!1}))})),tr(this,"toggleHandle",(()=>{this.$drawer=Ye(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),tr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),tr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,destroyOnClose:i}=this.props,l=n??r,o=e.open??e.visible,{fullscreen:s}=this.state;l&&l!==o&&(!i&&this.opened||(0,J.isUndefined)(a)&&this.setState({spinning:!0})),this.$drawer&&s!==t.fullscreen&&Be(this.$drawer,s?{width:"100%"}:{width:de(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{showFullScreen:r}=this.props;return t().createElement(t().Fragment,null,t().createElement("span",{ref:this.titleRef,className:Se()("text")},this.props.title),r&&t().createElement("span",{className:Se()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:r}=this.state,{visible:n,open:a,size:i,className:l,loading:o,maskClosable:s,onClose:c}=this.props,d=this.context.global,u=i||this.context.size||"",p=Ce("drawer"),m={[p]:!0,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return t().createElement(O.Drawer,er({},Z()(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??n,maskClosable:s??d?.maskClosable??!1,className:Se()(m,l),title:this.renderTitle(),footer:null,onClose:c,afterOpenChange:this.afterVisibleChange}),this.props.children,(o||r||e)&&t().createElement(ft,{spinning:!0,className:Se()("spinning")}))}}tr(rr,"contextType",l),tr(rr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),tr(rr,"defaultProps",{width:"72%",showFullScreen:!0,destroyOnClose:!0,footer:null});const nr=rr;function ar(){return ar=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ar.apply(this,arguments)}function ir(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const lr="10vh";var or=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e}(or||{});class sr extends e.Component{constructor(){super(...arguments),ir(this,"$event",null),ir(this,"draggleRef",t().createRef()),ir(this,"opened",!1),ir(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),ir(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=qt()(document.body,"mousedown",ze))})),ir(this,"removeMouseDownEvent",(()=>{this.$event&&(this.$event?.remove(),this.$event=null)})),ir(this,"onStart",((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,a=this.draggleRef.current.getBoundingClientRect();a&&this.setState({bounds:{left:-a.left+t.x,right:r-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1}})})),ir(this,"toggleHandle",(e=>{const t=Ye(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body"),{height:n}=this.props,{fullscreen:a}=this.state;a?(Be(t,{width:de(this.props.width||"60%"),height:"auto",top:lr}),Be(r,{height:n?de(n):this.defaultHeight,maxHeight:"auto"===n?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(r,{height:`calc(100vh - ${or[this.$size]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),ir(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),ir(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),ir(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${lr} - ${lr} - ${or[this.$size]}px)`}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,stopMouseDownEvent:i,destroyOnClose:l}=this.props,o=n??r,s=e.open??e.visible,{fullscreen:c}=this.state;if(o&&o!==s){if(!l&&this.opened||(0,J.isUndefined)(a)&&this.setState({spinning:!0}),i&&this.addMouseDownEvent(),!l&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,J.isUndefined)(a)&&this.setState({spinning:!1})}),400)}o||this.removeMouseDownEvent(),c!==t.fullscreen&&(c?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:r}=this.state,{showFullScreen:n}=this.props;return t().createElement("div",{onMouseOver:()=>{r&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},t().createElement("span",{className:Se()("text")},this.props.title),n&&t().createElement("span",{className:Se()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:r,fullscreen:n,disabled:a,bounds:i,position:l}=this.state,{visible:o,open:s,height:c,className:d,loading:u,draggable:p,maskClosable:m,bodyStyle:h,onClose:f}=this.props,g=this.context.global,b=Ce("modal"),y={height:c?de(c):this.defaultHeight,maxHeight:"auto"===c?this.defaultHeight:"",overflow:"auto"},v={[b]:!0,[`${b}--lg`]:"large"===this.$size,[`${b}--sm`]:"small"===this.$size};return t().createElement(O.Modal,ar({},Z()(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:s??o,maskClosable:m??g?.maskClosable??!1,className:Se()(v,d),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},y,h),onCancel:f,afterClose:this.afterVisibleChange,modalRender:e=>t().createElement(Ke(),{disabled:!p||a||n,bounds:i,position:l,onStart:(e,t)=>this.onStart(e,t)},t().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(u||r||e)&&t().createElement(ft,{spinning:!0,className:Se()("spinning")}))}}ir(sr,"contextType",l),ir(sr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),ir(sr,"defaultProps",{width:"60%",showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:lr}});const cr=sr,dr=require("memoize-one");var ur=n.n(dr);const pr=(0,e.createContext)(void 0),mr=80,hr="1",fr="0",gr=400,br=["RANGE_INPUT","RANGE_INPUT_NUMBER","RANGE_SEARCH_HELPER","MULTIPLE_CHECKBOX","MULTIPLE_SELECT","RANGE_DATE","RANGE_TIME","MULTIPLE_TREE_SELECT","MULTIPLE_SEARCH_HELPER","MULTIPLE_TREE_TABLE_HELPER","MULTIPLE_CASCADER","UPLOAD_IMG","UPLOAD_FILE"],yr={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let vr=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),xr=function(e){return e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY",e}({}),Er=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Sr={items:i().arrayOf(i().shape({type:i().string.isRequired,fieldName:i().string.isRequired})),initialValues:i().object,initialExtras:i().object,layout:i().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!b(e[t]||""))return f("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:i().number,customClass:i().string,compactMode:i().bool,labelWidth:i().oneOfType([i().number,i().string]),labelAlign:i().oneOf(["left","right"]),labelWrap:i().bool,formType:i().oneOf(["default","search","onlyShow"]),disabled:i().bool,uniqueKey:i().string,defaultRows:i().number,defaultExpand:i().bool,searchButtonCols:i().number,scrollToFirstError:i().bool,authConfig:i().object,isAutoFocus:i().bool,isCollapse:i().bool,isFieldsDefine:i().bool,isSearchBtn:i().bool,isSubmitBtn:i().bool,fieldsChange:i().func,onValuesChange:i().func,onFieldsChange:i().func,onFinish:i().func,onFinishFailed:i().func,onReset:i().func,onCollapse:i().func},Cr={layout:"horizontal",labelWidth:mr,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:ne,onFieldsChange:ne,onFinish:ne,onFinishFailed:ne,onReset:ne,onCollapse:ne,onFormItemsChange:ne},wr=(e,t)=>{if(!e)return null;if(t===xr.week){const t=e.match(/^(\d{4})-(\d+)/);return t?s()().year(Number(t[1])).week(Number(t[2])):null}if(t===xr.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?s()().year(Number(t[1])).quarter(Number(t[2])):null}return s()(e,t)},Tr=(e,t)=>e?s()(e).format(t):"",Nr=e=>""===e||null==e,Ir=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,a=r.length;t<a;t++)n+=(e[r[t].trim()]??"")+(t===a-1?"":" | ");return n},Rr=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Pr=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Or=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),e.isLeaf&&(n.isLeaf=!0),!(0,J.isUndefined)(e.selectable)&&(n.selectable=e.selectable),Array.isArray(e.children)&&(n.children=Or(e.children,t,r)),n})),Ar=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=Ar(r.children,t);if(e)return e}}return null},kr=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...kr(e.children,t,r+1))})),n},Fr=(e,t,r,n)=>{const a={};return a.filters=e.filters?.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t}))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(a.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Lr={PINYINS:["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],UNIHANS:["阿","哎","安","肮","凹","八","挀","扳","邦","勹","陂","奔","伻","屄","边","灬","憋","汃","冫","癶","峬","嚓","偲","参","仓","撡","冊","嵾","曽","叉","芆","辿","伥","抄","车","抻","阷","吃","充","抽","出","欻","揣","巛","刅","吹","旾","逴","呲","匆","凑","粗","汆","崔","邨","搓","咑","呆","丹","当","刀","嘚","扥","灯","氐","甸","刁","爹","丁","丟","东","吺","厾","耑","垖","吨","多","妸","诶","奀","鞥","儿","发","帆","匚","飞","分","丰","覅","仏","紑","夫","旮","侅","甘","冈","皋","戈","给","根","刯","工","勾","估","瓜","乖","关","光","归","丨","呙","哈","咍","佄","夯","茠","诃","黒","拫","亨","噷","叿","齁","乎","花","怀","欢","巟","灰","昏","吙","丌","加","戋","江","艽","阶","巾","坕","冂","丩","凥","姢","噘","军","咔","开","刊","忼","尻","匼","肎","劥","空","抠","扝","夸","蒯","宽","匡","亏","坤","扩","垃","来","兰","啷","捞","肋","勒","崚","哩","俩","奁","良","撩","毟","拎","伶","溜","囖","龙","瞜","噜","驴","娈","掠","抡","罗","呣","妈","埋","嫚","牤","猫","么","呅","门","甿","咪","宀","喵","乜","民","名","谬","摸","哞","毪","嗯","拏","腉","囡","囔","孬","疒","娞","恁","能","妮","拈","娘","鸟","捏","囜","宁","妞","农","羺","奴","女","奻","疟","黁","挪","喔","讴","妑","拍","眅","乓","抛","呸","喷","匉","丕","囨","剽","氕","姘","乒","钋","剖","仆","七","掐","千","呛","悄","癿","亲","靑","卭","丘","区","峑","缺","夋","呥","穣","娆","惹","人","扔","日","茸","厹","邚","挼","堧","婑","瞤","捼","仨","毢","三","桒","掻","閪","森","僧","杀","筛","山","伤","弰","奢","申","升","尸","収","书","刷","衰","闩","双","脽","吮","说","厶","忪","捜","苏","狻","夊","孙","唆","他","囼","坍","汤","夲","忑","熥","剔","天","旫","帖","厅","囲","偷","凸","湍","推","吞","乇","穵","歪","弯","尣","危","昷","翁","挝","乌","夕","虲","仙","乡","灱","些","心","星","凶","休","吁","吅","削","坃","丫","恹","央","幺","倻","一","囙","应","哟","佣","优","扜","囦","曰","晕","帀","災","兂","匨","傮","则","贼","怎","増","扎","捚","沾","张","佋","蜇","贞","争","之","中","州","朱","抓","拽","专","妆","隹","宒","卓","乲","宗","邹","租","钻","厜","尊","昨","兙"],EXCEPTIONS:{曾:"ZENG",沈:"SHEN",嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬤:"MO",嬷:"MO",蹒:"PAN",蹊:"XI",丬:"PAN",霰:"XIAN",莘:"XIN",豉:"CHI",饧:"XING",筠:"JUN",长:"CHANG",帧:"ZHEN",峙:"SHI",郍:"NA",芎:"XIONG",谁:"SHUI"}},Hr="阿",$r="鿿",Dr=1,qr=2,_r=3;let jr,Kr=null;function Mr(e){return e||null===Kr?("object"==typeof Intl&&Intl.Collator?(jr=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Kr=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Kr=!1,Kr):Kr}function Vr(e){const t=Lr.UNIHANS,r=Lr.PINYINS,n=Lr.EXCEPTIONS,a={source:e};if(e in n)return a.type=qr,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=Dr,a.target=e,a;if(i=jr.compare(e,Hr),i<0)return a.type=_r,a.target=e,a;if(0===i)a.type=qr,l=0;else{if(i=jr.compare(e,$r),i>0)return a.type=_r,a.target=e,a;0===i&&(a.type=qr,l=t.length-1)}if(a.type=qr,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=jr.compare(e,a),0===i)break;i>0?r=l+1:n=l-1}}return i<0&&l--,a.target=r[l],a.target||(a.type=_r,a.target=a.source),a}function zr(e){return"string"==typeof e&&Mr()?e.split("").map((e=>Vr(e))):e}const Ur={isSupported:Mr,parse:zr,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Lr)})))},genToken:Vr,convertToPinyin:(e,t,r)=>zr(e).map((e=>t&&e.type===qr?e.target.toLowerCase():e.target)).join(r||"")},Br={patcher:function(e){e.EXCEPTIONS={嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬷:"MO",蹊:"XI",丬:"PAN",霰:"XIAN",豉:"CHI",饧:"XING",帧:"ZHEN",芎:"XIONG",谁:"SHUI",钶:"KE"},e.UNIHANS[91]="伕",e.UNIHANS[347]="仚",e.UNIHANS[393]="诌",e.UNIHANS[39]="婤",e.UNIHANS[50]="腠",e.UNIHANS[369]="攸",e.UNIHANS[123]="乯",e.UNIHANS[171]="刕",e.UNIHANS[102]="佝",e.UNIHANS[126]="犿",e.UNIHANS[176]="列",e.UNIHANS[178]="刢",e.UNIHANS[252]="娝",e.UNIHANS[330]="偸"},shouldPatch:function(e){return"function"==typeof e&&"FOU"===e("伕").target&&"XIA"===e("仚").target&&"ZHONG"===e("诌").target&&"CHONG"===e("婤").target&&"CONG"===e("腠").target&&"YONG"===e("攸").target&&"HOU"===e("乯").target&&"LENG"===e("刕").target&&"GONG"===e("佝").target&&"HUAI"===e("犿").target&&"LIAO"===e("列").target&&"LIN"===e("刢").target&&"E"===e("钶").target}};Ur.isSupported()&&Br.shouldPatch(Ur.genToken)&&Ur.patchDict(Br);const Wr=Ur,Gr=e=>{const{value:r,bordered:n}=e;return t().createElement(O.Input,{value:r,title:r,bordered:n,readOnly:!0})};Gr.displayName="FormItemView";const Yr=Gr;function Xr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qr(){return Qr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qr.apply(this,arguments)}const{Option:Zr}=O.Select,Jr=e=>{const{$$form:r}=t().useContext(pr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{options:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=e.option,{itemList:b=[],filterable:y=!0,listHeight:v=gr,collapseTags:x,maxTagTextLength:E,openPyt:S=!0}=c,C=se(b)?a:b,w=e=>i?C.filter((t=>e?.includes(t.value))).map((e=>e.text)).join(","):C.find((t=>t.value===e))?.text||"";return r.isOnlyShow?t().createElement(Yr,{value:w(n),bordered:m}):t().createElement(O.Select,Qr({value:n,mode:i?"multiple":void 0,placeholder:u,style:d,loading:l,bordered:m,allowClear:h,disabled:g,showSearch:y,listHeight:v,maxTagCount:x?"responsive":void 0,maxTagTextLength:E},i?{title:w(n)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=Wr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(S?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,w(e),C)})(e)}}),C.map((e=>t().createElement(Zr,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class en extends e.Component{constructor(){super(...arguments),Xr(this,"state",{itemList:[],loading:!1}),Xr(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r,loading:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:m,validateTrigger:h,rules:f=[],onChange:g=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(i),className:Se()(o,u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(f)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(Jr,{option:this.props.option,items:r,loading:n,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(o,r)}}))),m&&t().createElement(O.Col,null,e.renderFormItemButton(o,m)),p&&t().createElement(O.Col,{flex:de(p.labelWidth||mr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Xr(en,"contextType",pr);const tn=en,rn=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:d=r.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=fr,trueValue:h=hr}=o;return t().createElement(O.Checkbox,{checked:n===h,style:s,disabled:d||r.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{a?.(e),i(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(t?h:m)}},u?l:null)};class nn extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option,{labelToCheckbox:h}=o;return t().createElement(O.Form.Item,{label:h?" ":e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(rn,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(nn,"contextType",pr);const an=nn,ln=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],on={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)ln.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,r){return e.split(t).join(r)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},sn=["==","<",">","<=",">=","!=","like","likes","in","nin"],cn=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)sn.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),sn.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},dn=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,un=["string","number","boolean","symbol"],pn=e=>un.includes(typeof e),mn=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),hn=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(dn,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(hn(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(hn(t))));break;case"in":pn(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":pn(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(mn(e)?e.slice(0,10):e)!=r;break;case"<":n=(mn(e)?e.slice(0,10):e)<r;break;case"<=":n=(mn(e)?e.slice(0,10):e)<=r;break;case">":n=(mn(e)?e.slice(0,10):e)>r;break;case">=":n=(mn(e)?e.slice(0,10):e)>=r;break;default:n=(mn(e)?e.slice(0,10):e)==r}return n})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const fn=on.stringify,gn=on.array_format,bn=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},yn=(e,t,r)=>{let n=[];t=on.replace_symbols(t);try{if(r){const r=new Function("record",`return ${cn(t,"record")};`);n=Wn(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${cn(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)r(e,t)&&n.push(e[t])}}catch(t){g("Table","组件 `initialFilter` 参数有误!"),n=e}return n},vn=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...vn(e.children)):t.push(e)})),t},xn=e=>{const t=[];return e.forEach((e=>{let r=e;e.children&&(r={...e},r.children=xn(e.children)),e.hidden||e.noAuth||t.push(r)})),t},En=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...En(e.children))})),t},Sn=(e,t)=>e.map((e=>(e.children&&(e.children=Sn(e.children,t)),t?.(e),e))),Cn=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Cn(r.children,t);if(e)return e}}return null},wn=e=>{const t=e.children;return t?t[0].children?wn(t[0]):t[0]:e},Tn=e=>{const t=e.children;return t?t[t.length-1].children?Tn(t[t.length-1]):t[t.length-1]:e},Nn=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),In=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=In(r.children,t);if(e)return e}}return null},Rn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Rn(e.children))})),t},Pn=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return En(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},On=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return On(e.offsetParent,t,r)}return r},An=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,kn=(e,t)=>(0,J.transform)(e,((e,r,n)=>{(0,J.isEqual)(r,t[n])||(e[n]=(0,J.isPlainObject)(r)&&(0,J.isPlainObject)(t[n])?kn(r,t[n]):r)})),Fn=(e,t)=>(0,J.intersection)(e,t).length===t.length,Ln=(e,t)=>(0,J.get)(e,t)??"",Hn=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,J.set)(e,t,r??"")},$n=(e,t)=>{if(!t.includes("|"))return Ln(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(Ln(e,t))})),r.every((e=>!e))?"":r.join(" | ")},Dn=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),qn=(e,t)=>e?s()(e,t):null,_n=(e,t)=>e?s()(e).format(t):"",jn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},Kn=e=>{const t=[];if(te(e)){const{children:r}=e.props;Array.isArray(r)?r.forEach((e=>t.push(...Kn(e)))):r&&t.push(...Kn(r))}else t.push(e);return t},Mn=e=>e.filter((e=>!e._group)),Vn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="";if(Array.isArray(e)){let n=0;for(let a=0,i=e.length;a<i;a++){const i=e[a];if(!i.fieldName)continue;const l=Array.isArray(i.condition)?gn(i.condition):fn(i.condition,"^");r+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,n=i.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,i]=n.includes("|")?n.split("|"):[n,""],l=e[n];for(const e in l)r+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?gn(l[e]):fn(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},zn=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((r=>{const n=JSON.stringify((t=>{const r=[];return e.forEach((e=>r.push(Ln(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},Un=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=Un(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},Bn=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=Bn(r.children,t);if(e)return e}if(t(r))return r}return null},Wn=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Wn(e.children,t),t(e)||e.children&&e.children.length))),Gn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Yn=require("react-sortablejs");function Xn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Qn extends e.Component{constructor(){super(...arguments),Xn(this,"linkRef",t().createRef()),Xn(this,"state",{visible:!1}),Xn(this,"getFormFieldsConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Xn(this,"saveFormFieldsConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}}))}get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}componentDidMount(){this.initLocalfields()}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):this.context.global?.getComponentConfigApi&&this.setLocalFields(this.props.items)})).catch((()=>{})),e?(0,J.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,J.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,J.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,J.isEqual)(t,r)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveFormFieldsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;t?.([...e])}popupRender(){const{items:e}=this.props;return t().createElement(pr.Consumer,null,(r=>{const n=r.$$form;return t().createElement("div",{className:Se()("ant-dropdown-menu","fields-list")},t().createElement(Yn.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const r=t.map((e=>e.fieldName)),a=e.map((e=>e.fieldName));if((0,J.isEqual)(r,a))return;n.setExpandHandle(!0);const i=Gn(t);this.changeHandle(i),this.setLocalFields(i)}},e.map((r=>t().createElement("li",{key:r.fieldName,className:"item",style:r.noAuth?{display:"none"}:void 0},t().createElement(O.Checkbox,{disabled:r.rules?.findIndex((e=>e.required))>-1,checked:!r.hidden,onChange:t=>{const{checked:n}=t.target;r.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),t().createElement(we.HolderOutlined,{className:"handle",title:p("qm.form.draggable")}),t().createElement("span",{className:"title"},n.getFormItemLabel(r.label||"")))))))}))}render(){const{visible:e}=this.state,r=Ce("form-fields-filter");return t().createElement(pr.Consumer,null,(n=>{const{$size:a}=n.$$form,i={[r]:!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a};return t().createElement(O.Dropdown,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:Se()(i),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},t().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},t().createElement(we.UnorderedListOutlined,null)))}))}}Xn(Qn,"contextType",l);const Zn=Qn;function Jn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ea=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(pr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:m,disabled:h,onBlur:f=ne,onEnter:g=ne}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:S,toTrim:C,autoFocus:w,autoComplete:T,secretType:N}=o,I=N&&(m||h),R=t().useRef(),P=e=>{i?.(e),l(e)},A=v?O.Input.Password:O.Input,k=I?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e}(a,N):a;return n.isOnlyShow?t().createElement(Yr,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(k),bordered:d}):t().createElement(A,{ref:e=>{R.current=e,"function"==typeof r&&r(e)},value:k,autoComplete:v?"new-password":T,autoFocus:w,placeholder:c,style:s,title:v?"":k,prefix:b,suffix:y,maxLength:x,bordered:d,allowClear:u,readOnly:m,disabled:h,onBlur:t=>{let r=t.target.value??"";if(C){const e=r.trim();r!==e&&(r=e,P(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),f(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),n.isFilterType&&(n.SUBMIT_FORM(),R.current?.blur())}},onChange:e=>{let t=e.target.value;(0,J.isRegExp)(E)&&(t=E.test(t)?t:a??""),S&&(t=t.toUpperCase()),P(t)}})}));ea.displayName="VInput";class ta extends e.Component{constructor(){super(...arguments),Jn(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ea,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),u&&t().createElement(O.Col,null,e.renderFormItemButton(i,u)),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}Jn(ta,"contextType",pr);const ra=ta,na=e=>{const{$$form:r}=t().useContext(pr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:m,suffix:h,maxLength:f}=l,g=e=>{const t=e.every((e=>!e))?[]:e;a?.(t),i(t,b(t))},b=e=>e.join(" - ");return r.isOnlyShow?t().createElement(Yr,{value:b(n),bordered:s}):t().createElement(O.Input.Group,null,t().createElement(O.Input,{value:n[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:o[0],prefix:m,suffix:h,maxLength:f,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([t,n[1]])}}),t().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t().createElement(O.Input,{value:n[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:o[1],prefix:m,suffix:h,maxLength:f,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class aa extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,s),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(o)},required:e.getFormItemRequired(u)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(na,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&t().createElement(O.Col,{flex:de(c.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...c}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(aa,"contextType",pr);const ia=aa,la=require("big.js");var oa=n.n(la);function sa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ca=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(pr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:m,onBlur:h=ne,onEnter:f=ne}=e.option,{step:g=1,min:b,max:y,precision:v,autoFocus:x,stringMode:E,textAlign:S="left",controls:C=!0,formatter:w,parser:T}=o,N=t().useRef(),I=t().useRef(a),R=e=>{const t=Nr(e)?"":(0,J.isNumber)(e)?e.toFixed(v):new(oa())(e).toFixed(v);return"function"==typeof w?w(t):t},P={[S]:!0,controls:C};return n.isOnlyShow?t().createElement(Yr,{value:R(a),bordered:d}):t().createElement(O.InputNumber,{ref:e=>{N.current=e,"function"==typeof r&&r(e)},value:a,className:Se()(P),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:C,precision:v,autoFocus:x,stringMode:E,formatter:w,parser:T,bordered:d,readOnly:u,disabled:m,onBlur:()=>{le((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(I.current),h(I.current)}))},onKeyUp:e=>{13===e.keyCode&&(f(a),n.isFilterType&&(n.SUBMIT_FORM(),N.current?.blur()))},onChange:e=>{const t=e??"";!E&&t.toString().replace(/^-|\./g,"").length>17||(e=>{I.current=e,i?.(e),l(e,R(e))})(t)}})}));ca.displayName="VInputNumber";class da extends e.Component{constructor(){super(...arguments),sa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ca,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,null,e.renderFormItemButton(i,u)),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}sa(da,"contextType",pr);const ua=da,pa=e=>{const{$$form:r}=t().useContext(pr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:m=1,min:h=0,max:f,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=l,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];a?.(t),i(t,C(t))},C=e=>Nr(e)?"":e.map((e=>Nr(e)?"":Number(e).toFixed(y))),w={[g]:!0,controls:b};return r.isOnlyShow?t().createElement(Yr,{value:C(n),bordered:s}):t().createElement(O.Input.Group,null,t().createElement(O.InputNumber,{value:n[0],className:Se()("site-input-left",w),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:o[0],step:m,min:h,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([e,n[1]])},onBlur:()=>{E(n)}}),t().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t().createElement(O.InputNumber,{value:n[1],className:Se()("site-input-right",w),style:{width:"calc(50% - 5px)"},placeholder:o[1],step:m,min:h,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([n[0],e])},onBlur:()=>{E(n)}}))};class ma extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,s),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(o)},required:e.getFormItemRequired(u)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(pa,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&t().createElement(O.Col,{flex:de(c.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...c}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ma,"contextType",pr);const ha=ma;let fa=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function ga(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:ba}=O.Input;class ya extends e.Component{constructor(e){var t;super(e),t=this,ga(this,"searchHelper",{}),ga(this,"alias",void 0),ga(this,"extras",void 0),ga(this,"deriveParams",void 0),ga(this,"valueKey",void 0),ga(this,"_is_change",!1),ga(this,"_record",void 0),ga(this,"_prevValue",void 0),ga(this,"state",{visible:!1,loading:!1}),ga(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ga(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t}=this.props.option;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const{fieldAliasMap:r,extraAliasMap:n,fieldsDefine:a}=this.searchHelper;if(r||g("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof r?r():r||{},this.extras="function"==typeof n?n():n||{},a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(t)||g("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),ga(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),ga(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),ga(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,fieldAliasMap:i,extraAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof i?i():i||{},s="function"==typeof l?l():l||{},c=this.getItemValue();if(e&&!se(c)){this.setState({loading:!0});try{const i=await e(r({...t,key:c}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,n)??[];if(e[0]){const t=e[0];o&&Rr(t,this.alias,o),s&&Pr(t,this.extras,s),this._record=t,this.setFieldsValue(t),a?.([t])}}}catch(e){}this.setState({loading:!1})}})),ga(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),ga(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,a=("function"==typeof r?r():r)||[],i={[t]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,J.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i})),ga(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,J.merge)({},this.getLastedSearchHelper().table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(o))return l();this.setState({loading:!0});try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):l()}catch(e){l(e)}finally{le((()=>this.setState({loading:!1})))}}))})),ga(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Ir(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a))}for(const r in this.extras){const n=Ir(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),ga(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,a=e.filter((e=>Ir(e,t.alias[n])?.toString().toLowerCase().includes(r.toLowerCase())));if(1===a.length)return t.closeSearchHelper(a[0]);t.openSearchHelper(r)})),ga(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??ae)(r.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),ga(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Ir(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])});const n=Ir(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),ga(this,"closeButNotSelect",(()=>{const{onlySelect:e=!0}=this.searchHelper;this._is_change&&(e?this.clearSearchHelperValue():this.searchHelperChangeHandle(this.props.value)),this._is_change=!1,this.setVisible(!1)})),ga(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),ga(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),ga(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),ga(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),ga(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemText()}componentDidUpdate(e,t){const{value:r}=e,{value:n}=this.props;if(t.loading!==this.state.loading)return;const a=this.getItemValue();this._prevValue!==a&&a!==this._record?.[this.alias[this.valueKey]]&&r===n&&this.getItemText(),this._prevValue=a}render(){const{$$form:e}=this.context,{visible:r,loading:n}=this.state,{value:a}=this.props,{type:i,fieldName:l,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:r,title:p("qm.searchHelper.text"),width:s.width??"60%",loading:!1,bodyStyle:{paddingBottom:`${fa[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getLastedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Yr,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(ba,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;this.triggerBlur(t),this._is_change&&!r&&(t?n?a?.fetch?.api&&this.getSearchHelperTableData(t).then((e=>this.resetSearchHelperValue(e,t))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(t):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:t}=e.target;!r&&this.openSearchHelper(t)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):le((()=>this.clearSearchHelperValue())))}}),t().createElement(cr,v,t().createElement(dc,x)))}}ga(ya,"contextType",pr);class va extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),ga(this,"promiseRef",void 0),ga(this,"searchRef",void 0),ga(this,"state",{searchHelper:{}}),ga(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),ga(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[]}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ya,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(l,t)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}ga(va,"contextType",pr);const xa=va;function Ea(){return Ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ea.apply(this,arguments)}function Sa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ca=r=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,Sa(this,"startClick",void 0),Sa(this,"event1",null),Sa(this,"event2",null),Sa(this,"$el",null),Sa(this,"omitClassNames",[]),Sa(this,"state",{clickOutside:!1}),Sa(this,"mousedownHandler",(e=>{this.startClick=e})),Sa(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Sa(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,a=!r||!n,i=this.$el?.contains(r)||this.$el?.contains(n),l=this.$el===r,o=this.omitClassNames.map((e=>document.querySelector(e))),s=o.some((e=>e?.contains(r)))||o.includes(n);let c;c=!(a||i||l||s),this.setState({clickOutside:c})})),Sa(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Sa(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=qt()(document,"mousedown",this.mousedownHandler),this.event2=qt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:e}=this.props,{clickOutside:n}=this.state;return t().createElement(r,Ea({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Sa(n,"displayName",`OutsideClick(${r.displayName||r.name})`),t().forwardRef(((e,r)=>t().createElement(n,Ea({},e,{forwardedRef:r}))))},wa=require("rc-trigger");var Ta,Na,Ia=n.n(wa);function Ra(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Pa=Ca((Na=class extends e.Component{constructor(e){var r;super(e),r=this,Ra(this,"searchHelper",{}),Ra(this,"alias",void 0),Ra(this,"_records",[]),Ra(this,"searchRef",t().createRef()),Ra(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Ra(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Ra(this,"getLastedSearchHelper",(()=>{const e=Object.assign({},this.searchHelper,this.props.option.searchHelper);return e.table&&!e.table.rowKey&&(e.table.rowKey=this.alias?.valueKey),e})),Ra(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ra(this,"setItemList",(e=>{this.setState({itemList:e})})),Ra(this,"setRecords",(e=>{this._records=e})),Ra(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Ra(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Ra(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ra(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=r.alias;r.setRecords((0,J.uniqBy)([...r._records.filter((e=>t.includes(e[n]))),...e],n));const a=r.recordsToDict();r.setItemList(a),r.triggerChange(a.map((e=>e.value)));const{closed:i}=r.searchHelper;r.setVisible(!1,(()=>{setTimeout((()=>i?.(r._records)),200)}))})),Ra(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(r,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,callback:l,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r&&!se(c)){this.setState({loading:!0});try{const o=await r(a({...n,keys:c}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,J.get)(o.data,i)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),l?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:r,visible2:n,loading:a,itemList:i}=this.state,{value:l}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:r,title:p("qm.searchHelper.text"),width:c.width??"60%",loading:!1,bodyStyle:{paddingBottom:`${fa[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getLastedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,J.merge)({},c.initialValue),defaultSelectedKeys:l,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>l?.includes(e.value))),S=t().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,w=Ce("form-multiple-search-helper"),{size:T}=e.context,N={[w]:!0,[`${w}--lg`]:"large"===T,[`${w}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${w}`]);const I=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Yr,{value:I,bordered:m}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(Ia(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(N),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:yr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:l,placeholder:u,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(O.Button,{className:"ant-input-search-button",disabled:g,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(cr,v,t().createElement(dc,x)))}},Ra(Na,"contextType",pr),Ta=Na))||Ta;class Oa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ra(this,"promiseRef",void 0),Ra(this,"state",{searchHelper:{}}),Ra(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ra(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Pa,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(l,r)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Ra(Oa,"contextType",pr);const Aa=Oa;function ka(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Fa}=O.Input;class La extends e.Component{constructor(e){super(e),ka(this,"searchHelper",{}),ka(this,"alias",void 0),ka(this,"extras",void 0),ka(this,"valueKey",void 0),ka(this,"_record",void 0),ka(this,"_prevValue",void 0),ka(this,"state",{visible:!1,loading:!1}),ka(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ka(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t}=this.props.option;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const{fieldAliasMap:r,extraAliasMap:n,fieldsDefine:a}=this.searchHelper;if(r||g("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof r?r():r||{},this.extras="function"==typeof n?n():n||{},a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(t)||g("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),ka(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),ka(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),ka(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,fieldAliasMap:a,extraAliasMap:i}=this.searchHelper.echoRequest||{},l="function"==typeof a?a():a||{},o="function"==typeof i?i():i||{},s=this.getItemValue();if(e&&!se(s)){this.setState({loading:!0});try{const a=await e(r({...t,key:s}));if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,n)??[];if(e[0]){const t=e[0];l&&Rr(t,this.alias,l),o&&Pr(t,this.extras,o),this._record=t,this.setFieldsValue(t)}}}catch(e){}this.setState({loading:!1})}})),ka(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Ir(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])})})),ka(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ka(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Ir(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])});const n=Ir(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),ka(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),ka(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),ka(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemText()}componentDidUpdate(e,t){const{value:r}=e,{value:n}=this.props;if(t.loading!==this.state.loading)return;const a=this.getItemValue();this._prevValue!==a&&a!==this._record?.[this.alias[this.valueKey]]&&r===n&&this.getItemText(),this._prevValue=a}render(){const{$$form:e}=this.context,{visible:r,loading:n}=this.state,{value:a=""}=this.props,{type:i,fieldName:l,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:r,title:p("qm.searchHelper.text"),width:s.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${fa[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getLastedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?t().createElement(Yr,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(Fa,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t().createElement(cr,v,t().createElement(gc,x)))}}ka(La,"contextType",pr);class Ha extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),ka(this,"promiseRef",void 0),ka(this,"state",{searchHelper:{}}),ka(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),ka(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(La,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(l,t)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}ka(Ha,"contextType",pr);const $a=Ha;var Da,qa;function _a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ja=Ca((qa=class extends e.Component{constructor(e){var r;super(e),r=this,_a(this,"searchHelper",{}),_a(this,"alias",void 0),_a(this,"_records",[]),_a(this,"searchRef",t().createRef()),_a(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),_a(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),_a(this,"getLastedSearchHelper",(()=>{const e=Object.assign({},this.searchHelper,this.props.option.searchHelper);return e.table&&!e.table.rowKey&&(e.table.rowKey=this.alias?.valueKey),e})),_a(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),_a(this,"setItemList",(e=>{this.setState({itemList:e})})),_a(this,"setRecords",(e=>{this._records=e})),_a(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),_a(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),_a(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),_a(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=r.alias;r.setRecords((0,J.uniqBy)([...r._records.filter((e=>t.includes(e[n]))),...e],n));const a=r.recordsToDict();r.setItemList(a),r.triggerChange(a.map((e=>e.value)));const{closed:i}=r.searchHelper;r.setVisible(!1,(()=>{setTimeout((()=>i?.(r._records)),200)}))})),_a(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(r,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r&&!se(s)){this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:r,visible2:n,loading:a,itemList:i}=this.state,{value:l}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:r,title:p("qm.searchHelper.text"),width:c.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${fa[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getLastedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,J.merge)({},c.initialValue),defaultSelectedKeys:l,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>l?.includes(e.value))),S=t().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,w=Ce("form-multiple-tree-table-helper"),{size:T}=e.context,N={[w]:!0,[`${w}--lg`]:"large"===T,[`${w}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${w}`]);const I=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Yr,{value:I,bordered:m}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(Ia(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(N),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:yr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:l,placeholder:u,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(O.Button,{className:"ant-input-search-button",disabled:g,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(cr,v,t().createElement(gc,x)))}},_a(qa,"contextType",pr),Da=qa))||Da;class Ka extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),_a(this,"promiseRef",void 0),_a(this,"state",{searchHelper:{}}),_a(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),_a(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ja,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(l,r)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}_a(Ka,"contextType",pr);const Ma=Ka;function Va(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const za=new Array(2).fill("");class Ua extends e.Component{constructor(e){var t;super(e),t=this,Va(this,"searchHelper",{}),Va(this,"alias",void 0),Va(this,"_is_change",!1),Va(this,"_ceho_data",void 0),Va(this,"_records",[]),Va(this,"_is_clear",!1),Va(this,"state",{visible:!1,loading:!1,itemList:[],textValue:za}),Va(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Va(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Va(this,"setItemList",(e=>{this.setState({itemList:e})})),Va(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Va(this,"setTextValue",(e=>{this.setState({textValue:e})})),Va(this,"setRecords",(e=>{this._records=e})),Va(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),Va(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),Va(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(za),this.triggerChange([])})),Va(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Va(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Va(this,"createFilters",(e=>{const{fieldName:t}=this.props.option;return{[t]:se(e)?void 0:e}})),Va(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,J.merge)({},this.getLastedSearchHelper().table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(o))return l();this.setState({loading:!0});const e=await t.fetch.api(o);if(le((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}l()}))})),Va(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:r}=t.state,{textKey:n}=t.alias,a=e.filter((e=>{const t=e[n]?.toString().toLowerCase();return r.some((e=>t?.includes(e.toLowerCase())))}));if(2===a.length)return t.closeSearchHelper(a);t.openSearchHelper()})),Va(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:r=[]}=this.props;(0,J.isEqual)((0,J.intersection)(t,r),r)||(0,J.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,J.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),r.length)){const e=za.map(((e,t)=>n[a].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r&&!se(s)){this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:r=[]}=this.props,{visible:n,loading:a,textValue:i}=this.state,{fieldName:l,options:o={},searchHelper:s={},placeholder:c=p("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,f={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${fa[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g={...this.getLastedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Yr,{value:i.join(" - "),bordered:d}):t().createElement(t().Fragment,null,t().createElement(O.Input.Group,null,t().createElement(O.Input,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),t().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),t().createElement(O.Input.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:a,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([i[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t().createElement(cr,f,t().createElement(Cc,g)))}}Va(Ua,"contextType",pr);class Ba extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Va(this,"promiseRef",void 0),Va(this,"state",{searchHelper:{}}),Va(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Va(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ua,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{h(t,n),e.setViewValue(l,r)}}))),u&&t().createElement(O.Col,null,e.renderFormItemButton(l,u)),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Va(Ba,"contextType",pr);const Wa=Ba;function Ga(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ya=e=>{const{$$form:r}=t().useContext(pr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return r.isOnlyShow?t().createElement(Yr,{value:h(n),bordered:c}):t().createElement(O.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{i?.(e),l(e,h(e))})(e)}},m.map((e=>t().createElement(O.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Xa extends e.Component{constructor(){super(...arguments),Ga(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ya,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Ga(Xa,"contextType",pr);const Qa=Xa,Za=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=r.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:m}=l;return t().createElement(O.Rate,{value:n,count:p,style:o,allowHalf:u,allowClear:s,tooltips:m,disabled:d||r.isOnlyShow,onChange:e=>{(e=>{var t;a?.(e),i(e,(t=e,m?m[Math.ceil(t)-1]:t.toString()))})(e)}})};class Ja extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Za,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ja,"contextType",pr);const ei=Ja;function ti(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ri=e=>{const{$$form:r}=t().useContext(pr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=r.isFormDisabled}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.find((t=>t.value===e))?.text??"";return r.isOnlyShow?t().createElement(Yr,{value:h(n),bordered:c}):t().createElement(O.Radio.Group,{value:n,style:{width:"100%",...s},disabled:u||r.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{i?.(e),l(e,h(e))})(t)}},m.map((e=>t().createElement(O.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ni extends e.Component{constructor(){super(...arguments),ti(this,"state",{itemList:[]}),ti(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ri,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}ti(ni,"contextType",pr);const ai=ni,ii=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:d=r.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=fr,trueValue:h=hr}=o;return t().createElement(t().Fragment,null,t().createElement(O.Switch,{checked:n===h,style:s,disabled:d||r.isOnlyShow,checkedChildren:t().createElement(we.CheckOutlined,null),unCheckedChildren:t().createElement(we.CloseOutlined,null),onChange:e=>{(e=>{a?.(e),i(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:m)}}),u?t().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},l):null)};class li extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option,{labelToSwitch:h}=o;return t().createElement(O.Form.Item,{label:h?" ":e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ii,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(li,"contextType",pr);const oi=li,si=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m,onBlur:h=ne,onEnter:f=ne}=e.option,{showCount:g,maxLength:b,autoSize:y}=l,v=Object.assign({},{minRows:1,maxRows:3},y);return t().createElement(O.Input.TextArea,{value:n,placeholder:s,style:o,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:d,readOnly:u||r.isOnlyShow,disabled:m,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;f(t)}},onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e)})(t)}})};class ci extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(si,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ci,"contextType",pr);const di=ci,ui=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:c=p("qm.form.datePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:m,disabled:h}=e.option,{dateType:f="date",format:g,disabledDate:b,minDateTime:y,maxDateTime:v,shortCuts:x=!0}=l,E=t().createRef(),S=e=>{e&&"date"===f&&(e=e.slice(0,10)+" 00:00:00"),a?.(e),i(e,C(e))},C=e=>Nr(e)?"":["date","exactdate"].includes(f)?e.slice(0,10):e,w=e=>{let t=Tr(s()().subtract(e,"day"),xr[f]);"date"===f&&(t=t.slice(0,10)),S(t),E.current.blur(),E.current.focus()};return r.isOnlyShow?t().createElement(Yr,{value:C(n),bordered:d}):t().createElement(q,{ref:E,style:{width:"100%",...o},picker:vr[f],format:g,bordered:d,showToday:!1,showTime:"datetime"===f&&{defaultValue:s()("00:00:00","HH:mm:ss")},allowClear:u,disabled:h,inputReadOnly:m,disabledDate:b??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[y,v])),renderExtraFooter:x?()=>t().createElement(t().Fragment,null,t().createElement(O.Tag,{color:"processing",onClick:()=>w(0)},p("qm.form.datePickers")[0]),t().createElement(O.Tag,{color:"processing",onClick:()=>w(1)},p("qm.form.datePickers")[1]),t().createElement(O.Tag,{color:"processing",onClick:()=>w(7)},p("qm.form.datePickers")[2]),t().createElement(O.Tag,{color:"processing",onClick:()=>w(30)},p("qm.form.datePickers")[3])):void 0,value:wr(n,xr[f]),onChange:(e,t)=>{S(Tr(e,xr[f]))}})};class pi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ui,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(pi,"contextType",pr);const mi=pi,hi=e=>[s()().subtract(e,"day"),s()()],fi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:c=p("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:m,disabled:h=r.isFormDisabled}=e.option,{dateType:f="date",format:g,disableds:b=[!1,!1],disabledDate:y,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=l,S={[p("qm.form.dateRangePickers")[0]]:hi(7),[p("qm.form.dateRangePickers")[1]]:hi(30),[p("qm.form.dateRangePickers")[2]]:hi(90),[p("qm.form.dateRangePickers")[3]]:hi(180)},C=e=>Nr(e)?"":e.map((e=>["date","exactdate"].includes(f)?e?.slice(0,10):e)).join(" - ");return r.isOnlyShow?t().createElement(Yr,{value:C(n),bordered:d}):t().createElement(q.RangePicker,{style:{width:"100%",...o},picker:vr[f],format:g,bordered:d,showTime:"datetime"===f&&{defaultValue:[s()("00:00:00","HH:mm:ss"),s()("23:59:59","HH:mm:ss")]},allowClear:u,disabled:h?[!0,!0]:b,inputReadOnly:m,disabledDate:y??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[v,x])),ranges:E?S:void 0,value:se(n)?null:[wr(n?.[0],xr[f]),wr(n?.[1],xr[f])],onChange:(e,t)=>{(e=>{"date"===f&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),a?.(e),i(e,C(e))})([Tr(e?.[0],xr[f]),Tr(e?.[1],xr[f])])}})};class gi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(fi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(gi,"contextType",pr);const bi=gi,yi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.timePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=e.option,{timeType:h="hour-minute-second",hourStep:f=1,minuteStep:g=1,secondStep:b=1}=l;return r.isOnlyShow?t().createElement(Yr,{value:n,bordered:c}):t().createElement(M,{style:{width:"100%",...o},bordered:c,showNow:!0,hourStep:f,minuteStep:g,secondStep:b,allowClear:d,disabled:m,inputReadOnly:u,format:Er[h],value:wr(n,Er[h]),onChange:(e,t)=>{(e=>{const t=Tr(e,Er[h]);a?.(t),i(t)})(e)}})};class vi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(yi,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(vi,"contextType",pr);const xi=vi,Ei=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.timerangePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m=r.isFormDisabled}=e.option,{timeType:h="hour-minute-second",disableds:f=[!1,!1],hourStep:g=1,minuteStep:b=1,secondStep:y=1}=l,v=e=>Nr(e)?"":e.join(" - ");return r.isOnlyShow?t().createElement(Yr,{value:v(n),bordered:c}):t().createElement(M.RangePicker,{style:{width:"100%",...o},bordered:c,showNow:!1,hourStep:g,minuteStep:b,secondStep:y,allowClear:d,disabled:m?[!0,!0]:f,inputReadOnly:u,format:Er[h],value:se(n)?null:[wr(n?.[0],Er[h]),wr(n?.[1],Er[h])],onChange:(e,t)=>{(e=>{const t=[Tr(e?.[0],Er[h]),Tr(e?.[1],Er[h])];a?.(t),i(t,v(t))})(e)}})};class Si extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Ei,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Si,"contextType",pr);const Ci=Si;function wi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ti extends e.Component{constructor(e){super(e),wi(this,"searchHelper",{}),wi(this,"alias",void 0),wi(this,"extras",void 0),wi(this,"valueKey",void 0),wi(this,"_clicking",!1),wi(this,"_record",void 0),wi(this,"_prevValue",void 0),wi(this,"searchRef",t().createRef()),wi(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),wi(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t,options:r,searchHelper:n}=this.props.option;this.searchHelper=Object.assign({},e,r,n);const{fieldAliasMap:a,extraAliasMap:i,fieldsDefine:l}=this.searchHelper;if(a||g("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof a?a():a||{},this.extras="function"==typeof i?i():i||{},l){const e=["valueKey","displayKey","extraKey"];for(const t in l)e.includes(t)&&(this[t]=l[t])}Object.keys(this.alias).includes(t)||g("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),wi(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),wi(this,"getLatestRequest",(()=>{const{request:e,searchHelper:t}=this.props.option;return Object.assign({},this.searchHelper.request,e,t?.request)})),wi(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,fieldAliasMap:a,extraAliasMap:i}=this.searchHelper.echoRequest||{},l="function"==typeof a?a():a||{},o="function"==typeof i?i():i||{},s=this.getItemValue();if(e&&!se(s))try{const a=await e(r({...t,key:s}));if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,n)??[];if(e[0]){const t=e[0];l&&Rr(t,this.alias,l),o&&Pr(t,this.extras,o),this._record=t,this.setFieldsValue(t)}}}catch(e){}})),wi(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const a=Ir(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])})})),wi(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),wi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),wi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),wi(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),wi(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:Ir(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:Ir(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Ir(e,this.alias[n]);this.triggerChange(a),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}componentDidMount(){this.getItemText()}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList();const{value:n}=e,{value:a}=this.props,i=this.getItemValue();this._prevValue!==i&&i!==this._record?.[this.alias[this.valueKey]]&&n===a&&this.getItemText(),this._prevValue=i}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i}=this.getLatestRequest();if(r){this.setState({loading:!0});try{const l=await r(a({...n,[t]:e}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:r,loading:n,itemList:a,inputText:i}=this.state,{value:o}=this.props,{options:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{listHeight:g=gr}=s,{hideHeader:b,onlySelect:y=!0}=this.searchHelper||s,v=this.searchHelper.columns||[],x=Ce("form-immediate"),E=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,S=t().createElement(O.Spin,{spinning:n},a.length?t().createElement("table",{cellSpacing:0,cellPadding:0,className:Se()("table")},!b&&t().createElement("thead",null,t().createElement("tr",null,v.filter((e=>!e.hidden)).map((e=>t().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t().createElement("tbody",null,a.map(((e,r)=>t().createElement("tr",{key:r,className:this.state.activeIndex===r?"active":"",onMouseEnter:()=>{this.setState({activeIndex:r})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},v.filter((e=>!e.hidden)).map((r=>t().createElement("td",{key:r.dataIndex},(0,J.get)(e,r.dataIndex))))))))):t().createElement(mt,null));return t().createElement(l.Consumer,null,(n=>{const l={[x]:!0,[`${x}--lg`]:"large"===n?.size,[`${x}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Yr,{value:o,bordered:u}):t().createElement(Ia(),{action:f?[]:["click"],popupVisible:!f&&r,popup:S,popupClassName:Se()(l),popupStyle:{minWidth:E,maxHeight:g},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:d,allowClear:m,bordered:u,readOnly:h,disabled:f,style:{width:"100%",...c},value:i??o,title:o,onFocus:()=>{!a.length&&this.fetchHandle(o)},onBlur:e=>{y&&!this._clicking&&i!==o&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(a[this.state.activeIndex],(()=>this.handleVisibleChange(!1))),38===e.keyCode||40===e.keyCode){if(!this.state.visible)return this.handleVisibleChange(!0);let t=this.state.activeIndex;const r=40===e.keyCode?++t%a.length:(--t+a.length)%a.length;this.setState({activeIndex:r})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),y?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}}))}))}}wi(Ti,"contextType",pr);class Ni extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),wi(this,"promiseRef",void 0),wi(this,"state",{searchHelper:{}}),wi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),wi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ti,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(l,t)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}wi(Ni,"contextType",pr);const Ii=Ni;class Ri extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,fieldName:a,className:i,style:l={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=ne}=o,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===a))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=d.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${n}${a}`})}))}return t().createElement(O.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},t().createElement(Ie,{id:a,label:n,className:i,extra:p.map((e=>e.text)).join(" | "),style:{...l},collapse:s[a],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[a]:t})}))),u(t)}}))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ri,"contextType",pr);const Pi=Ri;function Oi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ai(){return Ai=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ai.apply(this,arguments)}const ki=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:ki(e.children,t,r,n)}:e)),Fi=e=>{const{$$form:r}=t().useContext(pr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{options:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,asyncLoad:f,readOnly:g,disabled:b}=e.option,{itemList:y,filterable:v=!0,listHeight:x=gr,checkStrictly:E,checkStrategy:S="SHOW_CHILD",collapseTags:C,openPyt:w=!0}=c,[T,N]=t().useState(se(y)?a:y);_e((()=>{N(se(y)?a:y)}),[y,a]);const I=e=>Ar(T,e)?.text||"",R=e=>i?e.map((e=>I(e))).filter((e=>!!e)).join(","):I(e);return r.isOnlyShow?t().createElement(Yr,{value:R(n),bordered:m}):t().createElement(O.TreeSelect,Ai({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:i,treeCheckable:i,treeCheckStrictly:E,showCheckedStrategy:O.TreeSelect[S],placeholder:u,listHeight:x,style:d,loading:l,bordered:m,allowClear:h,disabled:b,treeDefaultExpandAll:!f,showSearch:v,maxTagCount:C?"responsive":void 0,loadData:f?async e=>{let{key:t,children:r}=e;if(!f||r)return;const{fetchApi:n,params:a,dataKey:i,textKey:l="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=f;if(n)try{const e=await n(c({...a,[o]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=ki(T,t,o,Or(r,o,l));N(n),s?.(r)}}catch(e){}}:void 0,treeData:T},i?{title:R(n)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=Wr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,R(e),T)})(e)}}))};class Li extends e.Component{constructor(){super(...arguments),Oi(this,"state",{itemList:[],loading:!1}),Oi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=Or(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r,loading:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(i),className:Se()(o,u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(Fi,{option:this.props.option,items:r,loading:n,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&t().createElement(O.Col,{flex:de(p.labelWidth||mr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Oi(Li,"contextType",pr);const Hi=Li;function $i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Di(){return Di=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Di.apply(this,arguments)}const qi=e=>{const{$$form:r}=t().useContext(pr),{value:n,multiple:a,items:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=e.option,{changeOnSelect:h,checkStrictly:f,checkStrategy:g="SHOW_PARENT",filterable:b=!0,openPyt:y=!0}=l,{itemList:v=[]}=l,x=se(v)?i:v,E=e=>se(e)?"":a?e.map((e=>kr(x,e).map((e=>e.text)).join("/"))).join(","):kr(x,e).map((e=>e.text)).join("/");return r.isOnlyShow?t().createElement(Yr,{value:E(n),bordered:c}):t().createElement(O.Cascader,Di({value:(e=>se(e)?[]:a?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:x,multiple:a,maxTagCount:"responsive",changeOnSelect:h||f,showCheckedStrategy:O.Cascader[g],placeholder:s,style:o,bordered:c,allowClear:d,disabled:m,showSearch:b&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=Wr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(y?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))}},a?{title:E(n)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,E(t),x)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class _i extends e.Component{constructor(){super(...arguments),$i(this,"state",{itemList:[],loading:!1}),$i(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=Or(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:r}=this.props,{itemList:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(i),className:Se()(o,u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(qi,{option:this.props.option,multiple:r,items:n,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&t().createElement(O.Col,{flex:de(p.labelWidth||mr)},e.renderFormItemExtra({fieldName:o,...p}))))}}$i(_i,"contextType",pr);const ji=_i,Ki=require("china-area-data");var Mi=n.n(Ki);function Vi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const zi=["110000","120000","310000","500000"],Ui=["810000","820000"],Bi=[{text:"A",value:"A"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"L",value:"L"},{text:"N",value:"N"},{text:"Q",value:"Q"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],Wi=[{text:"A",value:"A"},{text:"B",value:"B"},{text:"C",value:"C"},{text:"D",value:"D"},{text:"E",value:"E"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"K",value:"K"},{text:"L",value:"L"},{text:"M",value:"M"},{text:"N",value:"N"},{text:"P",value:"P"},{text:"Q",value:"Q"},{text:"R",value:"R"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"W",value:"W"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],Gi=e=>Wr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Yi=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...zi,...Ui].includes(e))):Object.keys(e[t])).map((n=>({l:Gi(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:Yi(e,n,r+1)})))},Xi=(e,t)=>t.map((t=>({l:Gi(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Qi extends e.Component{constructor(e){super(e),Vi(this,"searchRef",t().createRef()),Vi(this,"scrollRef",t().createRef()),Vi(this,"zxsAndGa",void 0),Vi(this,"provinces",void 0),Vi(this,"allCities",void 0),Vi(this,"letterCities",void 0),Vi(this,"state",{visible:!1,select_type:"0",active_key:""}),Vi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Vi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)})),this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),jt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Xi(Mi(),zi)},{l:"Z2",n:"港澳",c:"",p:"",children:Xi(Mi(),Ui)}]}createProvince(){return(Yi(Mi(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Wi.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...zi,...Ui].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t().createElement(O.Radio.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},t().createElement(O.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),t().createElement(O.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:r}=this.state;return("0"===r?Bi:Wi).map((r=>t().createElement("li",{key:r.value,className:Se()({tag:!0,actived:r.value===e}),onClick:()=>this.scrollHandle(r.value.toString())},r.text)))}renderSelect(){const{value:e}=this.props;return t().createElement(O.Select,{size:"small",placeholder:p("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t().createElement(O.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:r}=this.state;return("0"===r?this.provinces:this.letterCities).map(((r,n)=>t().createElement("div",{key:n},t().createElement("dt",{ref:e=>this[`${r.l}Ref`]=e},r.n,":"),t().createElement("dd",null,r.children?.map((r=>t().createElement("li",{key:r.c,className:Se()({actived:r.c===e}),onClick:()=>this.clickHadnle(r.c)},r.n)))))))}render(){const{$$form:e}=this.context,{visible:r}=this.state,{value:n}=this.props,{options:a={},style:i={},placeholder:o=p("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=Ce("form-city-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,f=this.createTextValue(n),g=t().createElement("div",{className:"container",style:{...i}},t().createElement("div",{className:"city-drop"},t().createElement("div",{className:"city-drop-toper"},t().createElement("div",{className:"city-drop-toper__type"},this.renderType()),t().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t().createElement("div",{className:"city-drop-letter"},this.renderLetter()),t().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t().createElement("dl",null,this.renderCity(n)))));return t().createElement(l.Consumer,null,(n=>{const a={[m]:!0,[`${m}--lg`]:"large"===n?.size,[`${m}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Yr,{value:f,bordered:s}):t().createElement(Ia(),{action:u?[]:["click"],popupVisible:!u&&r,popup:g,popupClassName:Se()(a),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:{width:"100%",...i},value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}Vi(Qi,"contextType",pr);class Zi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Qi,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}Vi(Zi,"contextType",pr);const Ji=Zi;function el(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const tl=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:tl(e,r)})))};class rl extends e.Component{constructor(e){super(e),el(this,"searchRef",t().createRef()),el(this,"prevText",void 0),el(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),el(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const r=tl(Mi(),"86")||[];this.state={results:r,visible:!1,values:[],tabs:[r.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get leave(){return this.isFetch?4:3}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.text)).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=Ar(e,t[n]);if(a&&se(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(a?.children)&&(r[n+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,J.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[l],value:e[i]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,r=this.state.tabs.map(((r,n)=>{const a=r.find((t=>t.value===e[n]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return t().createElement(O.Tabs.TabPane,{key:n.toString(),tab:a},t().createElement("div",{className:"region-box"},r.map((r=>t().createElement("span",{key:r.value,className:Se()({"region-box__item":!0,actived:e.includes(r.value.toString())}),title:r.text,onClick:()=>{let{values:e}=this.state;e[n]=r.value.toString(),e=e.slice(0,n+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.leave-1:this.leave;if(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},r.text)))))}));return r.length?t().createElement(O.Tabs,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},r):t().createElement(mt,null)}render(){const{$$form:e}=this.context,{visible:r}=this.state,{value:n}=this.props,{options:a={},style:i={},placeholder:o=p("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=Ce("form-region-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,f=t().createElement("div",{className:"container"},this.renderTabs());let g=this.prevText;if(!r){const e=this.createTextValue(n);(""===e||e.split("/").every((e=>""!==e)))&&(g=e,this.prevText=g)}return t().createElement(l.Consumer,null,(n=>{const a={[m]:!0,[`${m}--lg`]:"large"===n?.size,[`${m}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Yr,{value:g,bordered:s}):t().createElement(Ia(),{action:u?[]:["click"],popupVisible:!u&&r,popup:f,popupClassName:Se()(a),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:{width:"100%",...i},readOnly:d,disabled:u,value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&le((()=>this.initial()))}}))}))}}el(rl,"contextType",pr);class nl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(rl,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}el(nl,"contextType",pr);const al=nl,il=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:m=1,fileTypes:h,fileSize:f,fileDirection:g,onPreview:b,onRemove:y}=l,{action:v,headers:x,params:E,withCredentials:S=!1,dataKey:C="",fieldAliasMap:w,beforeUpload:T,button:N}=o,I="function"==typeof w?w():w||{};return t().createElement(Ul,{name:"file",action:v,multiple:u,headers:x,data:E,withCredentials:S,beforeUpload:T,maxCount:m,fileTypes:h,fileSize:f,fileDirection:g,disabled:c,readOnly:r.isOnlyShow||d,button:N,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)},fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in I)r[n]=e[n]||t.data?.[I[n]]||"";return e.response&&200!==t.code&&O.message.error(t.message||p("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(C?(0,J.get)(t.data,C):t.data)||"",status:e.status}}));a?.(t.filter((e=>"done"!==e.status||!!e.url))),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onPreview:b,onRemove:y})};class ll extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(il,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ll,"contextType",pr);const ol=ll,sl=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:m=1,fixedSize:h,quality:f,openCropper:g,fileTypes:b,fileSize:y,onRemove:v}=l,{action:x,headers:E,params:S,withCredentials:C=!1,dataKey:w="",fieldAliasMap:T,beforeUpload:N}=o,I="function"==typeof T?T():T||{};return t().createElement(Zl,{name:"file",action:x,multiple:u,headers:E,data:S,withCredentials:C,beforeUpload:N,maxCount:m,fixedSize:h,quality:f,openCropper:g,fileTypes:b,fileSize:y,disabled:c,readOnly:r.isOnlyShow||d,fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in I)r[n]=e[n]||t.data?.[I[n]]||"";return e.response&&200!==t.code&&O.message.error(t.message||p("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(w?(0,J.get)(t.data,w):t.data)||"",status:e.status}}));a?.(t.filter((e=>"done"!==e.status||!!e.url))),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:v})};class cl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(sl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(cl,"contextType",pr);const dl=cl,ul=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o,style:s={},readOnly:c,disabled:d=r.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p}=l;return t().createElement($l,{value:n,tinymce:u,upload:o,thresholdSize:p,style:{width:"100%",...s},disabled:d||c||r.isOnlyShow,onChange:e=>{(e=>{a?.(e),i(e)})(e)}})};class pl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ul,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(pl,"contextType",pr);const ml=pl;function hl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fl extends e.Component{constructor(e){super(e),hl(this,"provide",{$$form:this,echo_data:{}}),hl(this,"_initialValues",void 0),hl(this,"_initialOthers",void 0),hl(this,"_initialExtras",void 0),hl(this,"_fieldAuth",{}),hl(this,"wrapperRef",t().createRef()),hl(this,"formRef",t().createRef()),hl(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),hl(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),hl(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),hl(this,"getFormItems",ur()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),hl(this,"getFlattenItems",ur()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,J.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),hl(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),hl(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),hl(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),hl(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),hl(this,"openValidateInfo",(e=>{const r=t().createElement("ul",null,e.map((e=>{const{label:r}=this.formItems.find((t=>t.fieldName===e.name[0]));return t().createElement("li",{key:e.name[0],style:{color:"#f5222d"}},"[",("string"==typeof r?`${r}: `:"")+e.errors.join(","),"]")})));O.notification.error({message:p("qm.form.validatePrompt"),description:r,duration:10})})),hl(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&jt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){xt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){Et(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&g("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,J.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,J.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,br.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??fr),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t!==this.getViewValue(e)&&this.setState((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){this.setState({collapse:e},(()=>{this.props.onCollapse?.(this.state.collapse)}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if("string"==typeof e)return e;const{fieldName:t,label:r,options:n={}}=e;if("string"==typeof r)return r;const{itemList:a=[]}=n,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:r}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){const t=n[e],a=this.dividers.find((e=>e.fieldName===t[0].fieldName)),i=a?.collapse?.showLimit??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===r&&e>i)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(Nr(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Nr(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,a]=t.split("|");e[n]=r[0]??"",e[a]=r[1]??""}}if(this.isFilterType)for(const t in e)se(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=Z()(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:a}=e.fetch;try{const e=await r(n);200===e.code&&(t=(a?(0,J.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const{visible:t=1,disabled:a,secretName:i}=n;t||(e.noAuth=!0),a&&(e.disabled=!0),i&&(e.options?e.options.secretType=i:e.options={secretType:i}),this.setFieldAuth(r,{visible:t,disabled:a,secretName:i})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return t().createElement(ra,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(ia,{option:e})}INPUT_NUMBER(e){return t().createElement(ua,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(ha,{option:e})}SEARCH_HELPER(e){return t().createElement(xa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t().createElement(Aa,{option:e})}TREE_TABLE_HELPER(e){return t().createElement($a,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t().createElement(Ma,{option:e})}RANGE_SEARCH_HELPER(e){return t().createElement(Wa,{option:e})}CHECKBOX(e){return t().createElement(an,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(Qa,{option:e})}RATE(e){return t().createElement(ei,{option:e})}RADIO(e){return t().createElement(ai,{option:e})}SWITCH(e){return t().createElement(oi,{option:e})}TEXT_AREA(e){return t().createElement(di,{option:e})}DATE(e){return t().createElement(mi,{option:e})}RANGE_DATE(e){return t().createElement(bi,{option:e})}TIME(e){return t().createElement(xi,{option:e})}RANGE_TIME(e){return t().createElement(Ci,{option:e})}SELECT(e){return t().createElement(tn,{option:e})}MULTIPLE_SELECT(e){return t().createElement(tn,{option:e,multiple:!0})}IMMEDIATE(e){return t().createElement(Ii,{option:e})}DIVIDER(e){return t().createElement(Pi,{option:e})}TREE_SELECT(e){return t().createElement(Hi,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(Hi,{option:e,multiple:!0})}CASCADER(e){return t().createElement(ji,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(ji,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(Ji,{option:e})}REGION_SELECT(e){return t().createElement(al,{option:e})}UPLOAD_FILE(e){return t().createElement(ol,{option:e})}UPLOAD_IMG(e){return t().createElement(dl,{option:e})}TINYMCE(e){return t().createElement(ml,{option:e})}renderFormLabel(e){if(!(0,J.isPlainObject)(e))return e;const{type:r,fieldName:n,label:a,options:i={},onChange:l=ne}=e,{itemList:o=[]}=i;return"SELECT"===r?t().createElement(O.Form.Item,{name:n,noStyle:!0},t().createElement(Jr,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>l(e,t)})):"CHECKBOX"===r?t().createElement(t().Fragment,null,t().createElement("span",{style:{paddingRight:5}},a),t().createElement(O.Form.Item,{name:n,noStyle:!0},t().createElement(rn,{option:e,onValuesChange:e=>l(e)}))):null}renderFormItemExtra(e){const{fieldName:r,isTooltip:n,style:a={},render:i}=e,{extra:l}=this.state;if(n)return t().createElement(O.Tooltip,{className:"extra-tooltip",title:l[r]},t().createElement(we.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===r));return t().createElement("div",{className:"extra-text",title:i?"":l[r],style:a},t().createElement("span",{className:"extra-overflow-cut"},i?i(o,this):l[r]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:r,fieldName:n,invisible:a,tooltip:i,className:l,labelWidth:o=this.props.labelWidth,rules:s=[],style:c={},render:d}=e;return se(this.state.formData)?null:t().createElement(O.Form.Item,{label:this.renderFormLabel(r),name:n,rules:s,tooltip:i,hidden:a,className:Se()(n,l),style:{width:"100%",...c},labelCol:{flex:de(o)}},d?.(e,this))}createFormItem(e){return(0,J.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(g("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:r,defaultRows:n,isFieldsDefine:a}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<r;e++)i.push({})}));const l=24/e,o=[],s=i.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return o.push(n),n}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,d=[],u=i.map(((r,n)=>{let{selfCol:a=1}=r;const{type:i,fieldName:s}=r;a=a>=24||"DIVIDER"===i||"TINYMCE"===i?e:a;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(r);return u&&d.push(o[n]),t().createElement(O.Col,{key:s??n,span:a*l,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},i?this.createFormItem(ce(r)):null)}));return a&&"default"===r&&u.push(t().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:r,collapse:n}=this.state,{searchButtonCols:a,isSearchBtn:i,isFieldsDefine:l=!0}=this.props;if(!this.isFilterType)return null;const o=24/r,s=a||1,c=r-e%r-s;return i?t().createElement(O.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t().createElement(O.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,icon:t().createElement(we.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),t().createElement(he,{size:this.$size,icon:t().createElement(we.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),l?this.createFieldsDefine():null,this.showFilterCollapse&&t().createElement("a",{onClick:()=>this.setExpandHandle(!n)},n?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:r,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const a=24/e;return n&&"default"===r?t().createElement(O.Row,{gutter:0},t().createElement(O.Col,{key:"-",span:a},t().createElement(O.Form.Item,null,t().createElement(O.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),t().createElement(he,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:r,fieldsChange:n}=this.props;return t().createElement(Zn,{uniqueKey:e,items:r,fieldsChange:n})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[p("qm.form.searchHelperTips")],warnings:[]})));r||a.length?t((r||[]).concat(a)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){g("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:a}=this.props,i=n.find((t=>t.fieldName===e));if(!i)return g("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return g("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,J.set)(i,r,t[r]));r&&(a?a([...n]):g("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:r,layout:n,disabled:a,labelWidth:i,labelAlign:l,labelWrap:o,customClass:s}=this.props,c=Ce("form"),d={required:"${label}"+p("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return t().createElement("div",{ref:this.wrapperRef,className:Se()(u,e),style:r},t().createElement(O.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:l,labelWrap:o,colon:!1,disabled:a,labelCol:{flex:this.verticalLayout?"initial":de(i)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t().createElement(pr.Provider,{value:this.provide},t().createElement(O.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}hl(fl,"contextType",l),hl(fl,"propTypes",Sr),hl(fl,"defaultProps",Cr);const gl=fl,bl={onActivate:r.func,onAddUndo:r.func,onBeforeAddUndo:r.func,onBeforeExecCommand:r.func,onBeforeGetContent:r.func,onBeforeRenderUI:r.func,onBeforeSetContent:r.func,onBeforePaste:r.func,onBlur:r.func,onChange:r.func,onClearUndos:r.func,onClick:r.func,onContextMenu:r.func,onCommentChange:r.func,onCopy:r.func,onCut:r.func,onDblclick:r.func,onDeactivate:r.func,onDirty:r.func,onDrag:r.func,onDragDrop:r.func,onDragEnd:r.func,onDragGesture:r.func,onDragOver:r.func,onDrop:r.func,onExecCommand:r.func,onFocus:r.func,onFocusIn:r.func,onFocusOut:r.func,onGetContent:r.func,onHide:r.func,onInit:r.func,onKeyDown:r.func,onKeyPress:r.func,onKeyUp:r.func,onLoadContent:r.func,onMouseDown:r.func,onMouseEnter:r.func,onMouseLeave:r.func,onMouseMove:r.func,onMouseOut:r.func,onMouseOver:r.func,onMouseUp:r.func,onNodeChange:r.func,onObjectResizeStart:r.func,onObjectResized:r.func,onObjectSelected:r.func,onPaste:r.func,onPostProcess:r.func,onPostRender:r.func,onPreProcess:r.func,onProgressState:r.func,onRedo:r.func,onRemove:r.func,onReset:r.func,onSaveContent:r.func,onSelectionChange:r.func,onSetAttrib:r.func,onSetContent:r.func,onShow:r.func,onSubmit:r.func,onUndo:r.func,onVisualAid:r.func,onSkinLoadError:r.func,onThemeLoadError:r.func,onModelLoadError:r.func,onPluginLoadError:r.func,onIconsLoadError:r.func,onLanguageLoadError:r.func},yl={apiKey:r.string,id:r.string,inline:r.bool,init:r.object,initialValue:r.string,onEditorChange:r.func,value:r.string,tagName:r.string,cloudChannel:r.string,plugins:r.oneOfType([r.string,r.array]),toolbar:r.oneOfType([r.string,r.array]),disabled:r.bool,textareaName:r.string,tinymceScriptSrc:r.string,rollback:r.oneOfType([r.number,r.oneOf([!1])]),scriptLoading:r.shape({async:r.bool,defer:r.bool,delay:r.number}),...bl},vl=e=>"function"==typeof e,xl=e=>e in bl,El=e=>e.substr(2),Sl=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(xl),c=Object.keys(l).filter(xl),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=El(e),r=o[t];n(t,r),delete o[t]})),u.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=El(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Cl=0;const wl=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Cl++,e+"_"+r+Cl+String(t)},Tl=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Nl=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Il=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Rl=()=>({listeners:[],scriptId:wl("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Pl=(()=>{let e=Rl();return{load:(t,r,n,a,i,l)=>{const o=()=>((t,r,n,a,i,l)=>{const o=r.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=n,o.async=a,o.defer=i;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),r.head&&r.head.appendChild(o)})(e.scriptId,t,r,n,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=Rl()}}})(),Ol=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Al(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class kl extends e.Component{constructor(t){var r;super(t),r=this,Al(this,"editor",void 0),Al(this,"id",void 0),Al(this,"elementRef",void 0),Al(this,"inline",void 0),Al(this,"currentContent",void 0),Al(this,"boundHandlers",void 0),Al(this,"rollbackTimer",void 0),Al(this,"valueCursor",void 0),Al(this,"rollbackChange",(()=>{const e=this.editor,t=this.props.value;e&&t&&t!==this.currentContent&&e.undoManager.ignore((()=>{if(e.setContent(t),this.valueCursor&&(!this.inline||e.hasFocus()))try{e.selection.moveToBookmark(this.valueCursor)}catch(e){}})),this.rollbackTimer=void 0})),Al(this,"handleBeforeInput",(e=>{if(void 0!==this.props.value&&this.props.value===this.currentContent&&this.editor&&(!this.inline||this.editor.hasFocus()))try{this.valueCursor=this.editor.selection.getBookmark(3)}catch(e){}})),Al(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Al(this,"handleEditorChange",(e=>{const t=this.editor;if(t&&t.initialized){const e=t.getContent();void 0!==this.props.value&&this.props.value!==e&&!1!==this.props.rollback&&(this.rollbackTimer||(this.rollbackTimer=window.setTimeout(this.rollbackChange,"number"==typeof this.props.rollback?this.props.rollback:200))),e!==this.currentContent&&(this.currentContent=e,"function"==typeof this.props.onEditorChange&&this.props.onEditorChange(e,t))}})),Al(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Al(this,"initialise",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=r.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(t)){if(0===e)setTimeout((()=>r.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>r.initialise(e+1)),100)}return}const n=Ol(r.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const a={...r.props.init,selector:void 0,target:t,readonly:r.props.disabled,inline:r.inline,plugins:(i=r.props.init?.plugins,l=r.props.plugins,Nl(i).concat(Nl(l))),toolbar:r.props.toolbar??r.props.init?.toolbar,setup:e=>{r.editor=e,r.bindHandlers({}),r.inline&&!Tl(t)&&e.once("PostRender",(t=>{e.setContent(r.getInitialValue(),{no_events:!0})})),r.props.init&&vl(r.props.init.setup)&&r.props.init.setup(e)},init_instance_callback:e=>{const t=r.getInitialValue();r.currentContent=r.currentContent??e.getContent(),r.currentContent!==t&&(r.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=r.props.disabled??!1;Il(r.editor,n?"readonly":"design"),r.props.init&&vl(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(e)}};var i,l;r.inline||(t.style.visibility=""),Tl(t)&&(t.value=r.getInitialValue()),n.init(a)})),this.id=this.props.id||wl("tiny-react"),this.elementRef=e.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Il(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==Ol(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Pl.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){const e=Ol(this.view)?.Env?.browser?.isIE();return e?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){Sl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):r&&!n&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}function Fl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Al(kl,"propTypes",yl),Al(kl,"defaultProps",{cloudChannel:"6"});var Ll=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(Ll||{});class Hl extends e.Component{constructor(){super(...arguments),Fl(this,"defaultOption",{height:400,plugins:"preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap emoticons",menubar:"file edit view insert format tools table help",toolbar:"undo redo | bold italic underline strikethrough | fontfamily fontsize blocks | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media template link anchor codesample | ltr rtl"})}render(){const{size:e,className:r,style:n,tinymce:a={},upload:i={},thresholdSize:l=.5,tinymceScriptSrc:o,disabled:s,value:c,onChange:d=ne}=this.props,u=this.context.global,m=this.context.locale,h=e||this.context.size||"",f=Ce("tinymce"),g={[f]:!0,[`${f}--lg`]:"large"===h,[`${f}--sm`]:"small"===h},b={init:{height:a.height||this.defaultOption.height,plugins:a.plugins||this.defaultOption.plugins,toolbar:a.toolbar||this.defaultOption.toolbar,menubar:a.menubar||this.defaultOption.menubar,language:Ll[m],skin:"tinymce-5",...Z()(a,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:a,withCredentials:o,dataKey:s}=i,c=`data:image/jpeg;base64,${e.base64()}`,d=new FormData;d.append("file",e.blob(),e.filename());const u=e.blob().size;if(n&&u/1024/1024>l)try{const{data:e}=await At().post(n,d,{headers:a,withCredentials:o});200===e.code&&t(s?(0,J.get)(e.data,s):e.data)}catch(e){O.message.error(p("qm.uploadCropper.uploadError"))}else t(c)}))},value:c,disabled:s,tinymceScriptSrc:o||u?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{d(t.getContent())}};return t().createElement("div",{className:Se()(g,r),style:n},t().createElement(kl,b))}}Fl(Hl,"contextType",l),Fl(Hl,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const $l=Hl,Dl=require("cropperjs");var ql=n.n(Dl);function _l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class jl extends e.Component{constructor(){super(...arguments),_l(this,"imgRef",t().createRef()),_l(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:r,alt:n,imgStyle:a,...i}=this.props,l={};for(const e in i)void 0!==this.props[e]&&(l[e]=this.props[e]);this.cropper=new(ql())(this.imgRef.current,l)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:r,src:n,alt:a,imgStyle:i}=this.props,l={[Ce("cropper")]:!0};return t().createElement("div",{className:Se()(l,e),style:r},t().createElement("img",{ref:this.imgRef,src:n,alt:a,style:{maxWidth:"100%",...i}}))}}_l(jl,"defaultProps",{src:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0});const Kl=jl;function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ml.apply(this,arguments)}function Vl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class zl extends e.Component{constructor(){super(...arguments),Vl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,maxCount:l,fileList:o=[],beforeUpload:s}=this.props,c=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),d=!i||e.size/1024/1024<i,u=!(l>1)||o.length<l,m=c&&d&&u;if(c||O.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),d||O.message.warning(p("qm.upload.sizeLimit",{size:i})),u||O.message.warning(p("qm.upload.countLimit",{count:l})),!m)return m||O.Upload.LIST_IGNORE;if(s){const a=s(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Vl(this,"doDownload",(async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){O.message.error(p("qm.download.error"))}}))}get $size(){return this.context.size??""}async downloadFile(e,t){const r=await At()({url:e,responseType:"blob",timeout:0}),n=r.data,a=r.headers["content-disposition"],i=t||(a?a.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));kt(n,i)}render(){const{fileList:e=[],button:r={},fileDirection:n,disabled:a,readOnly:i,className:l,onPreview:o,onChange:s}=this.props,c=Ce("upload-file"),d={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}--horizontal`]:"horizontal"===n};return t().createElement(O.Upload,Ml({className:Se()(d,l)},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:a||i,onChange:s,onPreview:async e=>{if("function"==typeof o)return o(e,(t=>this.doDownload(t||e)));a||await this.doDownload(e)},onDownload:async e=>{await this.doDownload(e)}}),this.props.children||i&&e.length?this.props.children:t().createElement(O.Button,{type:r.type??"default",icon:r.icon??t().createElement(we.UploadOutlined,null),disabled:a||i},r.text||p("qm.upload.text")))}}Vl(zl,"contextType",l),Vl(zl,"defaultProps",{name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}});const Ul=zl;function Bl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wl extends e.Component{constructor(){super(...arguments),Bl(this,"cropperRef",t().createRef()),Bl(this,"beforeUploadRef",void 0),Bl(this,"fileRef",void 0),Bl(this,"resolveRef",void 0),Bl(this,"rejectRef",void 0),Bl(this,"state",{src:""}),Bl(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:r,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let a=new File([e],r,{type:t});Object.assign(a,{uid:n});const{fileTypes:i=[],fileSize:l}=this.props;if(i.length&&!i.includes(a.name.slice(a.name.lastIndexOf(".")+1).toLowerCase()))return O.message.warning(p("qm.upload.tooltip",{type:i.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(a);const o=this.beforeUploadRef(a,[a]);if("boolean"==typeof o||o){if(!0===o)return this.resolveRef(a);if(!1===o)return this.rejectRef("not upload");if(o&&"function"==typeof o.then)try{const e=await o,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),this.resolveRef(a)}catch(e){this.rejectRef(e)}}else g("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await ie(100),this.onClose()})),Bl(this,"onOk",(()=>{this.confirmHandle()})),Bl(this,"onClose",(()=>{this.setSrc("")}))}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:r}=this.props,n=Array.isArray(e)?e[0]:e;if(!n)return null;const{beforeUpload:a,...i}=n.props;return this.beforeUploadRef=a,t().createElement(n.type,{...i,beforeUpload:(e,t)=>new Promise((async(n,a)=>{const i=()=>n(O.Upload.LIST_IGNORE);if(r&&!await r(e,t))return void i();this.fileRef=e,this.resolveRef=n,this.rejectRef=i;const l=new FileReader;l.onload=()=>{this.setSrc(l.result),l.onload=null},l.readAsDataURL(e)}))})}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return t().createElement("div",{className:"cropper-preview"},t().createElement("div",{className:"cropper-area"},t().createElement("div",{className:"img-cropper"},t().createElement(Kl,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),t().createElement("div",{className:"actions"},t().createElement(O.Space,{size:"small"},t().createElement(O.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},p("qm.uploadCropper.zoomIn")),t().createElement(O.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},p("qm.uploadCropper.zoomOut")),t().createElement(O.Button,{type:"primary",size:"middle",icon:t().createElement(we.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},p("qm.uploadCropper.rotatePlus")),t().createElement(O.Button,{type:"primary",size:"middle",icon:t().createElement(we.RotateLeftOutlined,null),onClick:()=>this.rotateHandle(-90)},p("qm.uploadCropper.rotateSubtract"))))),t().createElement("div",{className:"preview-area"},t().createElement("div",{className:"preview",style:this.previewSize})))}render(){const{src:e}=this.state,r=Ce("cropper-preview");return t().createElement(t().Fragment,null,this.renderUpload(),e&&t().createElement(O.Modal,{open:!0,wrapClassName:Se()(r),title:p("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}Bl(Wl,"contextType",l);const Gl=Wl;function Yl(){return Yl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yl.apply(this,arguments)}function Xl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ql extends e.Component{constructor(){super(...arguments),Xl(this,"state",{previewVisible:!1,currentIndex:0}),Xl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,beforeUpload:l}=this.props,o=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!i||e.size/1024/1024<i,c=o&&s;if(o||O.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),s||O.message.warning(p("qm.upload.sizeLimit",{size:i})),!c)return c||O.Upload.LIST_IGNORE;if(l){const a=l(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Xl(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})}))}get $size(){return this.context.size??""}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}render(){const{previewVisible:e,currentIndex:r}=this.state,{fileList:n=[],fixedSize:a,quality:i,fileTypes:l,fileSize:o,disabled:s,readOnly:c,className:d,openCropper:u,beforeCrop:m}=this.props,h=Ce("upload-img"),f={[h]:!0,[`${h}--lg`]:"large"===this.$size,[`${h}--sm`]:"small"===this.$size},g=t().createElement(O.Upload,Yl({className:Se()(f,d)},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:s||c,onPreview:this.handlePreview}),!this.showUploadButton||c&&n.length?null:t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("p",null,p("qm.uploadCropper.dragableText"))));return t().createElement(t().Fragment,null,u?t().createElement(Gl,{fixedSize:a,quality:i,fileTypes:l,fileSize:o,beforeCrop:m},g):g,t().createElement("div",{style:{display:"none"}},t().createElement(O.Image.PreviewGroup,{preview:{visible:e,current:r,onVisibleChange:e=>{this.setState({previewVisible:e})}}},n.map((e=>t().createElement(O.Image,{key:e.uid,src:e.url,alt:""}))))))}}Xl(Ql,"contextType",l),Xl(Ql,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const Zl=Ql,Jl=(e,t,r)=>{let n;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[r]===t)))n=i[r];else{const e=Jl(i.children,t,r);e&&(n=e)}}return n},eo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&eo(e.children,t),t(e)||e.children&&e.children.length))),to=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...to(e.children,t)),t(e)&&r.push(e)})),r},ro=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=ro(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},no=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:no(e.children,t,r,n)}:e)),ao=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...ao(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},io=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const a=io(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},lo=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...lo(e,t)))),r},oo=t().forwardRef(((e,r)=>{const{className:n,style:a,filterable:i=!0,multiple:o,draggable:s,dataSource:c,fetch:d,asyncLoad:u,checkStrictly:m,checkStrategy:h="SHOW_CHILD",placeholder:f=p("qm.form.inputPlaceholder"),fieldsDefine:g,value:b,height:y,defaultSelectedKeys:v=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:S=!0,onSelectChange:C,onCheckChange:w,onDragStart:T,onDragChange:N,onExpand:I}=e,{size:R}=t().useContext(l),P=t().useMemo((()=>e.size??R??""),[e.size,R]),A=g?.valueKey||"value",k=g?.textKey||"text",F=(g?.children,t().useRef(null)),L=St(F),[H,$]=t().useState(y),[D,q]=t().useState(!1),_=Ct((()=>{$(F.current.offsetHeight-Z.current.offsetHeight-10)}),5);_e((()=>{y||_()}),[L.height]);const[j,K]=t().useState([]),[M,V]=t().useState({}),[z,U]=t().useState([]),[B,W]=t().useState([]),[G,Y]=t().useState(""),[X,Q]=t().useState(x),Z=t().useRef(null),ee=t().useRef([]),te=t().useRef([]);t().useEffect((()=>{Array.isArray(c)&&(re(c),U(ne(c)),V({}))}),[c]),t().useEffect((()=>{le()}),[]),_e((()=>{le()}),[d?.params]),_e((()=>{W(ie())}),[M]),t().useImperativeHandle(r,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=ro(j,(t=>e===t[A]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],re([...j]))},REMOVE_RECORD:e=>{const t=Jl(j,e,A);if(void 0===t&&j.find((t=>t[A]===e)))re(j.filter((t=>t[A]!==e)));else{const r=ro(j,(e=>t===e[A]));if(!r)return;const n=r.children?.findIndex((t=>e===t[A]));n>=0&&(r.children.splice(n,1),re([...j]))}},UPDATE_RECORD:(e,t)=>{const r=ro(j,(t=>e===t[A]));r&&((0,J.merge)(r,t),re([...j]))}})));const re=e=>{K(e),ee.current=e,te.current=ao(e,A)},ne=e=>{if(o)return v;const t=to(e,(e=>v.includes(e[k])));return 1===t.length?[t[0][A]]:[]},ae=e=>io(j,e,A)?.slice(0,-1)||[],ie=()=>{if(x)return te.current;const e=[];return z.forEach((t=>{if(o){if("SHOW_ALL"===h&&!te.current.includes(t)&&e.push(...ae(t)),"SHOW_CHILD"===h&&e.push(...ae(t)),"SHOW_PARENT"===h){const r=Ar(j,t);if(r){const n=ae(t),a=lo(r,A);e.push(...n,...[t,...a].filter((e=>te.current.includes(e))))}}}else e.push(...ae(t))})),[...new Set(e)]},le=async()=>{if(!d)return;const{api:e,params:t,dataKey:r,callback:n}=d;try{q(!0);const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,r)??[];re(e),U(ne(e)),V({}),n?.(e)}}catch(e){}q(!1)},oe=e=>`${e}|${Wr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,se=Ce("search-tree"),ce={[se]:!0,[`${se}--lg`]:"large"===P,[`${se}--sm`]:"small"===P};return t().createElement("div",{ref:F,className:Se()(ce,n),style:a},t().createElement("div",{ref:Z,className:"topper"},E&&t().createElement(O.Input.Search,{value:G,size:P,placeholder:f,allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=eo(ee.current,(t=>{if(!e)return!0;const r=t[k]||"";return-1!==oe(r).indexOf(e)}));Y(e),K(t),x||e?W(ao(t,A)):V({})})(e.target.value)}),S&&t().createElement("a",{className:"trigger",onClick:()=>{Q(!X),W(X?[]:te.current)}},X?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(X?"qm.form.collect":"qm.form.spread"))),t().createElement(ft,{spinning:D},t().createElement(O.Tree,{fieldNames:{title:k,key:A,children:"children"},multiple:o,draggable:s,blockNode:s,checkable:o,selectable:!o,height:H,disabled:e.disabled,checkStrictly:m,selectedKeys:b??z,checkedKeys:b??z,expandedKeys:B,treeData:j,loadData:u?async e=>{let{key:t,children:r}=e;if(!d||r)return;const{api:n,params:a,dataKey:i,formatter:l=(e=>e)}=d;try{const e=await n(l({...a,[A]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=no(ee.current,t,A,r);re(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!G)return!1;const t=e[k]||"";return-1!==oe(t).indexOf(G)},onDragStart:T,onDragEnter:e=>{W(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),i=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][A]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},l=[...j];let o;if(i(l,r,((e,t,r)=>{r.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,r=[];i(l,t,((t,n,a)=>{r=a,e=n})),-1===a?r.splice(e,0,o):r.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(l)},onDragEnd:e=>{N?.(e,j)},onExpand:(e,t)=>{W(e),I?.(e,t)},onSelect:e=>{U(e);const t=to(ee.current,(t=>e.includes((0,J.get)(t,A))));C?.(o?t:t[0])},onCheck:e=>{m&&(e=e.checked),U(e),"SHOW_CHILD"===h&&(e=e.filter((e=>!te.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,r)=>!r.includes(Jl(j,e,A)))));const t=to(ee.current,(t=>e.includes((0,J.get)(t,A))));w?.(o?t:t[0])}})))}));oo.displayName="QmSearchTree";const so=oo,co=(0,e.createContext)(void 0),uo={dataIndex:i().string.isRequired,title:i().string.isRequired,description:i().string,colSpan:i().number,width:i().number,minWidth:i().number,fixed:i().oneOf(["left","right"]),align:i().oneOf(["left","center","right"]),theadAlign:i().oneOf(["left","center","right"]),printFixed:i().bool,hidden:i().bool,noAuth:i().bool,noFixed:i().bool,ellipsis:i().bool,className:i().string,theadClassName:i().string,children:i().array,sorter:i().oneOfType([i().bool,i().func]),filter:i().shape({type:i().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:i().arrayOf(i().shape({text:i().string,value:i().oneOfType([i().string,i().number])})),style:i().object}),precision:i().number,displayPrecision:i().number,formatType:i().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:i().bool,canCopy:i().bool,editRender:i().func,dictItems:i().arrayOf(i().shape({text:i().string,value:i().oneOfType([i().string,i().number])})),summation:i().shape({sumBySelection:i().bool,displayWhenNotSelect:i().bool,dataKey:i().string,unit:i().string,render:i().func}),groupSummary:i().shape({dataKey:i().string,unit:i().string,render:i().func}),headRender:i().func,render:i().func},po=(i().arrayOf(i().shape(uo)).isRequired,i().func,i().array,i().oneOfType([i().string,i().func]).isRequired,i().bool,i().bool,i().shape({api:i().func.isRequired,params:i().object.isRequired,formatter:i().func,beforeFetch:i().func,afterFetch:i().func,stopToFirst:i().bool,dataKey:i().string,callback:i().func}),i().bool,i().bool,i().string,i().string,i().bool,i().bool,i().bool,i().bool,i().oneOfType([i().object,i().func]),i().oneOfType([i().object,i().func]),i().array,i().func,i().bool,i().bool,i().object,i().object,i().shape({type:i().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:i().array,selectedRowKeys:i().array,hideSelectAll:i().bool,checkStrictly:i().bool,filterable:i().bool,selectByClickRow:i().bool,selectFirstRowOnChange:i().bool,clearableAfterFetched:i().bool,selectAllOnCurrentPage:i().bool,fetchSelectedRows:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),fetchAllRowKeys:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),disabled:i().func,onChange:i().func,onSelect:i().func,onSelectAll:i().func}),i().shape({currentRowKey:i().oneOfType([i().number,i().string]),disabled:i().func,onChange:i().func}),i().shape({virtual:i().bool,expandIconColumn:i().string}),i().shape({defaultExpandAllRows:i().bool,defaultExpandedRowKeys:i().array,expandedRowKeys:i().array,hideExpandAll:i().bool,rowExpandable:i().func,expandedRowClassName:i().string,expandedRowRender:i().func,onExpand:i().func,onChange:i().func}),i().shape({groupItems:i().arrayOf(i().shape({dataIndex:i().string.isRequired,titleIndex:i().string,color:i().string,backgroundColor:i().string})),fetch:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),onChange:i().func}),i().func,i().bool,i().bool,i().bool,i().bool,i().shape({current:i().number,pageSize:i().number,pageSizeOptions:i().array,showSizeChanger:i().bool,showQuickJumper:i().bool}),i().shape({fileName:i().string,fetch:i().shape({api:i().func.isRequired,params:i().object}),beforeExport:i().func,cellStyle:i().bool,hideIcon:i().bool}),i().shape({showLogo:i().bool}),i().shape({fetch:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),fieldList:i().arrayOf(i().object)}),i().shape({position:i().oneOf(["top","bottom"]),hideAlert:i().bool,hideClearButton:i().bool}),i().oneOf(["left","right"]),i().func,i().func,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,10),mo="1",ho="0",fo="YYYY-MM-DD",go="YYYY-MM-DD HH:mm:ss",bo="YYYYMMDDHHmmss",yo={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let vo=function(e){return e.left="flex-start",e.right="flex-end",e}({}),xo=[];const Eo={getFocusInstance:function(){return xo[0]??null},getInstance:function(e){return xo.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==xo.findIndex((e=>e===t))&&(this.deregister(e),xo=[t,...xo])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),xo=[{id:e,vm:t},...xo])},deregister:function(e){e&&(xo=xo.filter((t=>t.id!==e)))}};function So(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Co=class{constructor(){So(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),So(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),So(this,"removeFromRequired",(e=>{const t=this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.required.splice(t,1)})),So(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),So(this,"removeFromValidate",(e=>{const t=this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.validate.splice(t,1)})),So(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),So(this,"removeFromEdited",(e=>{const t=this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.edited.splice(t,1)})),So(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),So(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),So(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),So(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),So(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),So(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),So(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),So(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},wo={defaultColumnWidth:80,selectionColumnWidth:50,rowHeightMaps:{large:42,middle:34,small:26},sortDirections:["ascend","descend"],pagination:{current:1,pageSize:20,pageSizeOptions:[10,20,30,40,50],showSizeChanger:!0,showQuickJumper:!0},groupSummary:{total:{text:"记录数",value:"*"},recordTotalIndex:"nRecordsCount",summaryFieldName:"tsummary",groupbyFieldName:"tgroupby"},highSearch:{showSQL:!1},treeTable:{textIndent:17},dataKey:"records",summationKey:"summation",totalKey:"total",virtualScrollY:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};let To;const No=()=>{if(ee)return 0;if(void 0!==To)return To;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),To=t-n,To},Io=e=>e.map((e=>(e.children&&(e.children.forEach((t=>{t.parentDataIndex=e.dataIndex,e.fixed?t.fixed=e.fixed:delete t.fixed})),e.children=Io(e.children)),e))),Ro=(e,r)=>{const{fetch:n,columns:a,height:i,minHeight:l,maxHeight:o,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:m,webPagination:h,scrollPagination:f,dragMergeCell:g,showSuperSearch:b,showFastSearch:y,showGroupSummary:v,showTableImport:x,showClipboard:E,showSelectCollection:S,footRender:C}=e,{tableRef:w,tableFullData:T,tableData:N,selectionKeys:I,sorter:R,filters:P,superFilters:O,pagination:A}=r,{selectionRows:k,summaries:F}=w.current,{expandIconColumn:L=""}=m||{},H=t().useMemo((()=>!!n?.api),[n?.api]),$=t().useMemo((()=>!H&&!!h),[H,h]),D=t().useMemo((()=>H&&!!f),[H,f]),q=t().useMemo((()=>(H||$)&&!D),[H,$,D]),_=t().useMemo((()=>!!(i||l||o)),[i,l,o]),j=t().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?r.push(i):n.push(i)}return[...t,...n,...r]})(Io(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:wo.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:wo.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=u,a?.expandedRowRender?{dataIndex:wo.expandableColumn,title:"",width:wo.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),xn(t)})(a)),[a]),K=t().useMemo((()=>vn(j)),[j]),M=t().useMemo((()=>K.filter((e=>"function"==typeof e.editRender))),[K]),V=t().useMemo((()=>K.filter((e=>!!e.summation))),[K]),z=t().useMemo((()=>K.filter((e=>"left"===e.fixed))),[K]),U=t().useMemo((()=>K.filter((e=>"right"===e.fixed))),[K]),B=t().useMemo((()=>{const e=K.filter((e=>![wo.expandableColumn,wo.selectionColumn,wo.operationColumn].includes(e.dataIndex)));return L&&e.some((e=>e.dataIndex===L))?L:e[0]?.dataIndex??""}),[K,L]),W=t().useMemo((()=>V.length>0),[V]),G=t().useMemo((()=>!!C||W),[C,W]),Y=t().useMemo((()=>Pn(j).length>1),[j]),X=t().useMemo((()=>s||Y),[s,Y]),Q=t().useMemo((()=>K.some((e=>e.sorter))),[K]),Z=t().useMemo((()=>K.some((e=>e.filter))),[K]),J=t().useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),ee=t().useMemo((()=>!H&&!!x),[H,x]),te=t().useMemo((()=>!!E&&M.length>0),[E,M]),re=t().useMemo((()=>!!S&&"checkbox"===c?.type),[S,c]),ne=t().useMemo((()=>!!b&&Z),[b,Z]),ae=t().useMemo((()=>!H&&!!y&&Z),[H,y,Z]),ie=t().useMemo((()=>!!v&&K.some((e=>!!e.groupSummary))),[K]),le=t().useMemo((()=>!!d?.groupItems?.length),[d]),oe=t().useMemo((()=>!!g&&!H&&!h),[g,H,h]),se=t().useMemo((()=>T.some((e=>Array.isArray(e.children)))),[T]),ce=t().useMemo((()=>!N.length),[N]),de=t().useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:r,precision:n,summation:a}=t,{sumBySelection:i,displayWhenNotSelect:l,unit:o}=a,s=le?Mn(w.current.tableFullData):w.current.tableFullData,c=!k.length&&!!l;let d=(!i||c?s:k).reduce(((e,t)=>{if(t?.[wo.summaryIgnore])return e;const n=Number(Ln(t,r));return Number.isNaN(n)?e:new(oa())(e).plus(n).toNumber()}),0);!Object.keys(F).includes(r)||i&&!c||(d=Number(Ln(F,r))),Hn(e,r,d);let u=n>=0?d.toFixed(n):d;u=Dn(u),Hn(e,`${r}_text`,o?`${u} ${o}`:u)})),[e]})()),[N,I,F]),ue=t().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),pe=t().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=wo.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{r.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:wo.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(P,O);return{...e?{[wo.sorterFieldName]:e}:null,...t.length?{[wo.filterFieldName]:t}:null,...ue?{[wo.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...n?.params??null,[wo.currentPageName]:A.current,[wo.pageSizeName]:A.pageSize}}),[n?.params,A.current,A.pageSize,R,P,O,ue]);return{isFetch:H,isWebPagination:$,isScrollPagination:D,showPagination:q,shouldUpdateHeight:_,tableColumns:j,flattenColumns:K,editableColumns:M,summationColumns:V,leftFixedColumns:z,rightFixedColumns:U,treeExpandIndex:B,showSummary:W,showFooter:G,isHeadGroup:Y,bordered:X,isHeadSorter:Q,isHeadFilter:Z,isServiceSummation:J,isSelectCollection:re,isTableImport:ee,isTableClipboard:te,isSuperSearch:ne,isFastSearch:ae,isGroupSummary:ie,isGroupSubtotal:le,isDragMergeCell:oe,isTreeTable:se,isTableEmpty:ce,summationRows:de,fetchParams:pe}};function Po(t){const r=e.useRef();r.current=t;const n=e.useCallback((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.current?.(...t)}),[]);return n}const Oo=(e,r)=>{const{rowKey:n,dataSource:a,summation:i,fetch:l,initialSorter:o,initialFilter:s,rowSelection:c,expandable:d,treeConfig:u,authConfig:p,ignorePageIndex:m,columnsChange:h,onChange:f,onDataChange:b,onDataLoad:y,onScrollEnd:v,onFetchError:x}=e,{getRowKey:E,tableRef:S,tableElementRef:C,tableBodyRef:w,$size:T,tableColumns:N,flattenColumns:I,tableFullData:R,pagination:P,layout:O,filters:A,sorter:k,superFilters:F,fetchParams:L,selectionKeys:H,rowExpandedKeys:$,highlightKey:D,summationColumns:q,shouldUpdateHeight:_,isFetch:j,isTreeTable:K,isWebPagination:M,isScrollPagination:V,isServiceSummation:z,isGroupSubtotal:U,doLayout:B,setTableData:W,setTableFullData:G,setTableOriginData:Y,setAllTableData:X,setDeriveRowKeys:Q,setPagination:ee,setSpinning:te,setSorter:re,setFilters:ne,setSuperFilters:ie,setSelectionKeys:le,setRowExpandedKeys:oe,setHighlightKey:ce,setSelectionRows:de,setScrollYLoad:ue,setScrollYStore:pe,setFieldAuth:me,setResizeState:he,setSummaries:fe,setPermission:ge,setRecordsMap:be,resetTableScroll:ye,clearElementStore:ve,clearRecordsMap:xe}=r,{store:Ee}=S.current,Se=St(C),Ce=t().useRef({...L}),we=t().useRef(new Map),Te=t().useRef(!1);_e((()=>{B()}),[N,T,O.tableAutoHeight]),_e((()=>{Ne()}),[Se]),_e((()=>{lt(),ot(),st(),j||(M&&Qe(),Ue(a)),o&&re(o),s&&ne(s)}),[a,l?.params]),_e((()=>{const e=Me(L,Ce.current);e||j&&c?.clearableAfterFetched&&ct(),!e&&L[wo.currentPageName]>1&&!l?.stopToFirst?Qe():j&&ze(),Ce.current=L}),[L]),_e((()=>{M&&rt(),V||ye(),qe()}),[P.current,P.pageSize]),_e((()=>{j||Ie(R.length),B()}),[R]),_e((()=>{K&&u?.virtual&&(Ze(),rt())}),[$]);const Ne=()=>{const{scrollYLoad:e,resizeState:t}=S.current,{height:r}=t,{width:n,height:a}=Se,i=a!==r;B(),i&&_&&e&&rt(),he(Object.assign({},t,{width:n,height:a}))},Ie=e=>{e!==P.total&&ee((t=>Object.assign({},t,{total:e})))},Re=e=>{Te.current=e},Pe=Ct((e=>{Ge(),v?.(e)})),Oe=e=>U?Ae(ke(e,0)):e,Ae=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ae(e.children)),delete e.children,t.push(e)})),t},ke=(e,t)=>{const r=i.groupItems?.[t];return r?zn(e,[r.dataIndex]).map((e=>{const a={children:ke(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&Hn(a,n.toString(),jn()),r.titleIndex&&Hn(a,r.titleIndex,Ln(e[0],r.titleIndex)),Hn(a,r.dataIndex,Ln(e[0],r.dataIndex)),q.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[wo.summaryIgnore])return e;const n=Number(Ln(r,t));return Number.isNaN(n)?e:e+n}),0);Hn(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Fe=e=>{le(e),de((e=>{const{selectionRows:t,allTableData:r,recordsMap:n}=S.current;if(j)return[...t.filter((t=>e.includes(E(t,t.index)))),...r.filter((r=>{const n=E(r,r.index);return e.includes(n)&&-1===t.findIndex((e=>E(e,e.index)===n))}))];const a=[];for(let t=0,r=e.length;t<r;t++){const r=e[t];n.has(r)&&a.push(n.get(r))}return a})(e))},Le=e=>{const{type:t,checkStrictly:r=!0}=c||{},n=Array.isArray(e)?e:H;let a=[];return S.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{deriveRowKeys:r}=S.current,n=In(r,e);let a=[];if(!n)return a;const i=$e(n?.children||[]),l=Un(r,e)?.slice(0,-1).reverse()||[];return a=[...new Set([...t,...i])],l.forEach((e=>{const t=In(r,e),n=Fn(a,t?.children?.map((e=>e.rowKey))||[]);a=n?[...a,e]:a.filter((t=>t!==e))})),a})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},He=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:a}=d||{},i=Array.isArray(e)?e:$;if(S.current.treeTable){a&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...H];D&&e.unshift(D);let l=[];return e.forEach((e=>{const t=Un(S.current.deriveRowKeys,e)||[];l.push(...t.length>1?t.slice(0,-1).reverse():t)})),l=n?t:[...new Set([...i,...l])],l.filter((e=>!r.includes(e)))}return d?n?t.slice(0):[...i]:[]},$e=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...$e(e[r].children)),t.push(e[r].rowKey);return t},De=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...De(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...De(e,r[r.length-1])),r},qe=Ct((()=>{We(),f?.(P,Ke(A),je(k),F,{currentDataSource:et()})})),je=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},Ke=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[wo.showFilterType?`${n}|${a}`:n]=e[r]}return t},Me=(e,t)=>{const r=Object.keys(kn(e,t));return 1===r.length&&(r.includes(wo.currentPageName)||r.includes(wo.pageSizeName))},Ve=Po((async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=ae,afterFetch:r,callback:n}=l;if(!t(L))return;const a=!!i?.fetch?.api;te(!0);try{const[t,o]=a?await Promise.all([l.api(e(L)),i.fetch.api(e(L))]):[await l.api(e(L))];if(a?200===t.code&&200===o.code:200===t.code){const e=l.dataKey??wo.dataKey;let a=(0,J.get)(t.data,e)??[];a="function"==typeof r?await r(a):a;const i=(0,J.get)(t.data,e.replace(/[^.]+$/,wo.totalKey))||a.length||0;if(S.current.unMounted)return;Ue(Te.current?S.current.tableFullData.concat(a):a),Ie(i),Be(o?.data||t.data),n?.(t.data,t)}}catch(e){x?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),te(!1),Re(!1)})),ze=Ct(Ve),Ue=e=>{const t=e=>e.map(((e,r)=>(Array.isArray(e.children)&&(e.children=t(e.children)),e.index=r,m||(e.pageIndex=(e=>{const{current:t,pageSize:r}=P;return!j||V?e:(t-1)*r+e})(r)),e))),r=Oe(t(e));nt(r),at(r),it(),Fe(Le()),oe(He()),We(),y?.(r)},Be=e=>{if(!z)return;const t=i?.fetch?.dataKey??wo.summationKey,r=(t?(0,J.get)(e,t):e)??{},n={};q.filter((e=>!!e.summation.dataKey)).forEach((e=>{Hn(n,e.dataIndex,Number(Ln(r,e.summation.dataKey)))})),fe(n)},We=()=>{const{type:e,selectFirstRowOnChange:t}=c||{};if("radio"===e&&t){const e=et();if(e.length){const t=E(e[0],e[0].index);Fe([t])}else Fe([])}},Ge=()=>{if(!V)return;const e=Xe();Te.current||P.current>=e||(Re(!0),Ye({...P,current:P.current+1}))},Ye=e=>{let{current:t,pageSize:r}=e;ee((e=>Object.assign({},e,{current:t,pageSize:r})))},Xe=()=>{const{pageSize:e,total:t}=P;return Math.ceil(t/e)||1},Qe=()=>{Ye(Object.assign({},P,{current:1}))},Ze=()=>{if(!S.current.treeTable||!u?.virtual)return;const e=Je(S.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=S.current,{rowExpandable:r}=d||{},n=[];return"function"==typeof r&&e.forEach(((e,a)=>!r(e)&&n.push(t[a]))),n.length?$.filter((e=>!n.includes(e))):$})());we.current.clear(),e.forEach(((e,t)=>we.current.set(e,t)))},Je=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Je(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},et=()=>M?(()=>{const{current:e,pageSize:t}=P;return S.current.tableFullData.slice((e-1)*t,e*t)})():S.current.tableFullData,tt=e=>{const{scrollYLoad:t,scrollYStore:r}=S.current;W(t?e.slice(r.startIndex,r.endIndex):e)},rt=()=>{let e=et();S.current.treeTable&&u?.virtual&&(e=(e=>{const{allTableData:t,allRowKeys:r}=S.current,n=[];for(let e=0,a=r.length;e<a;e++){const a=r[e];we.current.has(a)&&n.push(t[e])}return n})()),ue(e.length>wo.virtualScrollY),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=S.current,{startIndex:a,rowHeight:i}=r;let l="",o="";n&&(l=`translateY(${Math.max(0,a*i)+"px"})`,o=e.length*i+"px"),t.$tableBody.style.transform=l,t.$tableYspace.style.height=o})(e),tt(e)},nt=e=>{G(e),X(e),Q(e),Ze(),rt()},at=e=>{Y(e)},it=()=>{const{allTableData:e}=S.current;xe(),e.forEach((e=>be(E(e,e.index),e)))},lt=()=>{re({})},ot=()=>{ne({})},st=()=>{ie([])},ct=()=>{Fe([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=Z()(p,["fetch"]);if(p.fetch){const{api:e,params:r,dataKey:n}=p.fetch;try{const a=await e(r);200===a.code&&(t=(n?(0,J.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;ge((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=S.current,n=Sn(e.columns,(e=>{const{dataIndex:n}=e,a=t.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:t=1,disabled:i,secretName:l}=a,o=Cn(r,n);me(n,{visible:t,disabled:i,secretName:l}),t||(e.noAuth=!0,o.noAuth=!0),l&&(e.formatType=`secret-${l}`,o.formatType=`secret-${l}`)}}));h?.(n)}})(),D&&w.current.setClickedValues([D,""]),"radio"===c?.type&&H.length&&w.current.setClickedValues([H[0],""]),j?Ve():Ue(a)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&g("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:nt,getTableData:Ve,handleTableData:tt,createTableData:Ue,createGroupData:Oe,createSelectionKeys:Le,createRowExpandedKeys:He,setSelectionKeysEffect:Fe,findParentRowKeys:De,getAllChildRowKeys:$e,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return g("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ee.removeFromRequired({x:r,y:n}),Ee.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&se(t)&&Ee.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||Ee.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=Ee.state,i=(0,J.intersection)(r,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:r.filter((e=>!i.includes(e))),updated:n.filter((e=>![...(0,J.intersection)(n,r),...(0,J.intersection)(n,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{b?.(S.current.tableFullData)},tableChange:qe,toLastPage:()=>{const e=Xe();P.current!==e&&Ye(Object.assign({},P,{current:e}))},toFirstPage:Qe,getPageCount:Xe,pagerChangeHandle:Ye,triggerScrollYEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=S.current,{startIndex:r,endIndex:n,offsetSize:a,visibleSize:i,rowHeight:l}=t,o=Math.floor(e/l),s=Math.max(0,o-1-a),c=o+i+a;(o<=r||o>=n-i-1)&&(r===s&&n===c||(pe(Object.assign({},t,{startIndex:s,endIndex:c})),rt()))}(e)},scrollBottomDebouncer:Pe,clearTableSorter:lt,clearTableFilter:ot,clearSuperFilters:st,clearRowSelection:ct,clearRowHighlight:()=>{ce("")},clearTableLog:()=>{Ee.clearAllLog()},destroy:()=>{ve(),Ee.destroy(),Eo.deregister(S.current.uid)}}},Ao=(e,r)=>{const{height:n,minHeight:a,maxHeight:i,resizable:l,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,$size:u,tableColumns:p,flattenColumns:m,leftFixedColumns:h,layout:f,scrollY:g,tableData:b,showFooter:y,showPagination:v,isWebPagination:x,isFullScreen:E,setLayout:S,setScrollX:C,setScrollY:w,setElementStore:T,setScrollYStore:N,setShouldToTop:I}=r,R=t().useRef(g),P=t().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=f,r={};return a&&Object.assign(r,{minHeight:`${An(a)}px`}),i&&Object.assign(r,{maxHeight:`${An(i)}px`}),E?{...r,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...r,height:"auto"!==n?`${An(n)}px`:`${t}px`}:r}),[n,i,a,E,f]),O=(e,t)=>{const{elementStore:r,scrollYStore:n,allTableData:a}=d.current,i=r.$tableBody.parentNode.parentNode;if(void 0!==t&&t>=0)i.scrollTop=t*n.rowHeight;else{const t=(x?Rn(b):a).findIndex((t=>e===c(t,t.index)));i.scrollTop=(t<0?0:t)*n.rowHeight}};return{createElementStore:e=>{Object.keys(e).forEach((t=>{T(t,e[t])}))},tableStyles:P,getSpan:(e,t,r,n,a)=>{let i=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});Array.isArray(o)?(i=o[0],l=o[1]):(0,J.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan)}const{mergeCells:o}=d.current;if(o.length>0){const e=o.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{m.findIndex((t=>t.dataIndex===e))<0&&(e=wn(Cn(p,e)).dataIndex);let t=0;for(let r=0;r<m.length;r++){const n=m[r];if(n.dataIndex===e)break;t+=An(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{m.findIndex((t=>t.dataIndex===e))<0&&(e=Tn(Cn(p,e)).dataIndex);let t=0;for(let r=m.length-1;r>=0;r--){const n=m[r];if(n.dataIndex===e)break;t+=An(n.width||n.renderWidth||0)}return t},scrollXToColumn:(e,t)=>{const{elementStore:r}=d.current,n=void 0===t?m.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=h.map((e=>e.width||e.renderWidth||wo.defaultColumnWidth)).reduce(((e,t)=>e+t),0);r.$tableBody.parentNode.parentNode.scrollLeft=r.$tableBody.querySelectorAll("tbody > tr > td")[n].offsetLeft-a},scrollYToRecord:O,rowInViewport:e=>{const{elementStore:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:a}=f,i=e*r.rowHeight,l=t.$tableBody.parentNode.parentNode;return!(i<l.scrollTop||i+r.rowHeight>l.scrollTop+(scrollX?n-a:n))},calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=d.current,r=t.winHeight-e.$table.getBoundingClientRect().top-(v?fa["small"!==u?"middle":u]+po:0)-po;S((e=>Object.assign({},e,{tableAutoHeight:r})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&O("",0),I(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=o?e.$header.offsetHeight:f.headerHeight,i=y?e.$footer.offsetHeight:f.footerHeight,l=n-a-i,s=e.$tableBody.offsetHeight,c=t||s>l;let p=0;if(E){const t=e.$toper?e.$toper.offsetHeight+po:0,n=e.$pager?e.$pager.offsetHeight+po:0;p=r.winHeight-t-n-20}l!==f.viewportHeight&&(e=>{const{scrollYStore:t,isIE:r}=d.current,{startIndex:n,endIndex:a}=t,i=wo.rowHeightMaps[u],l=Math.max(8,Math.ceil(e/i)+2),o=r?5:0;N(Object.assign({},t,{visibleSize:l,offsetSize:o,endIndex:Math.max(n+l+o,a),rowHeight:i}))})(l),R.current=c,w(c),S((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:l,tableBodyHeight:s,tableFullHeight:p})))})(),(()=>{const{elementStore:e}=d.current,t=e.$table.clientWidth,r=R.current?f.gutterWidth:0,{defaultColumnWidth:n}=wo,a=m.filter((e=>"number"!=typeof e.width));let i=0;if(m.forEach((e=>{"number"==typeof e.width&&(e.renderWidth=void 0)})),a.length>0){if(m.forEach((e=>{i+=e.width||e.minWidth||n})),i<=t-r){C(!1);const e=t-r-i;if(1===a.length&&l)a[0].renderWidth=(a[0].minWidth||n)+e;else{const t=e/a.reduce(((e,t)=>e+(t.minWidth||n)),0);let r=0;a.forEach(((e,a)=>{if(0===a)return;const i=Math.floor((e.minWidth||n)*t);r+=i,e.renderWidth=(e.minWidth||n)+i})),l&&(a[0].renderWidth=(a[0].minWidth||n)+e-r)}}else C(!0),a.forEach((e=>{e.renderWidth=e.minWidth||n}));S((e=>Object.assign({},e,{tableBodyWidth:Math.max(i,t)})))}else m.forEach((e=>{e.renderWidth=e.width||e.minWidth||n,i+=e.renderWidth})),C(i>t),S((e=>Object.assign({},e,{tableBodyWidth:i})));S((e=>Object.assign({},e,{tableWidth:t})))})()}}};function ko(){const[,t]=e.useReducer((e=>e+1),0);return t}const Fo=e=>{const{total:r}=e,{tableRef:n,tableProps:a,selectionKeys:i,isHeadSorter:l,isHeadFilter:o,isTreeTable:s,clearTableSorter:c,clearTableFilter:d,clearSuperFilters:u,clearRowSelection:m,clearRowHighlight:h}=t().useContext(co),{infoBarConfig:f,rowSelection:g,rowHighlight:b}=a,{allTableData:y,invalidRowKeys:v}=n.current,{hideAlert:x,hideClearButton:E}=f||{},S=t().useMemo((()=>!x),[x]),C=t().useMemo((()=>!E&&!!(l||o||g||b)),[E,l,o,g,b]),w={[`${Ce("table")}__alert`]:!0};return S?t().createElement("div",{className:Se()(w)},t().createElement("i",{className:"svgicon icon"},t().createElement(we.InfoCircleFilled,null)),t().createElement("span",null,p("qm.table.alert.total",{total:s?y.length:r}),g?`,${p("qm.table.alert.selected",{total:i.length-v.length})}`:""),C&&t().createElement("em",{onClick:()=>{c(),d(),u(),m(),h()}},p("qm.table.alert.clear"))):null},Lo=t().forwardRef(((e,r)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:i}=t().useContext(co),l=()=>{i(!n)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table");return a?t().createElement("span",{className:`${o}-full-screen`,title:p(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},n?t().createElement(we.FullscreenExitOutlined,null):t().createElement(we.FullscreenOutlined,null))):null}));Lo.displayName="FullScreen";const Ho=Lo,$o=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(co),i=()=>{a()};t().useImperativeHandle(r,(()=>({clickHandle:i})));const l=Ce("table");return n?t().createElement("span",{className:`${l}-reload`,title:p("qm.table.refresh.text"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ReloadOutlined,null))):null}));$o.displayName="Reload";const Do=$o,qo=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:s,tableProps:c,flattenColumns:d,summationRows:u,showSummary:m,getSpan:h}=t().useContext(co),{tablePrint:f,showHeader:g}=c,b=i?.print?.leftLogo??"",y=i?.print?.rightLogo??"",v=!(!b&&!y),x=t().useMemo((()=>ce(Nn(n,[wo.expandableColumn,wo.selectionColumn,wo.operationColumn]))),[n]),E=t().useMemo((()=>ce(Nn(d,[wo.expandableColumn,wo.selectionColumn,wo.operationColumn]))),[d]),S=t().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),C=(e,t)=>{const r=Object.assign({},Cn(t,e.parentDataIndex));return r.children=[e],r.level&&r.level>1?C(r,t):r},w=(e,t)=>(0,J.map)((0,J.groupBy)((0,J.flatten)(e),t),(0,J.spread)((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,J.mergeWith)(...r,((e,r)=>{if(Array.isArray(e))return w(e.concat(r),t)}))}))),T=()=>{const{allTableData:e}=o.current,t=(e=>{const t=[];let r=[],n=0,a=0;for(;a<e.length;){const i=e[a];n+=i.width||i.renderWidth||i.minWidth||wo.defaultColumnWidth,n<=wo.printWidth?(r.push(i),a===e.length-1&&t.push(r),a++):a>0?(e.splice(0,a),S.length&&e.unshift(...S),t.push(r),r=[],n=0,a=0):(i.width=wo.printWidth,r.push(i),t.push(r),a++)}return t})([...E]),r=((e,t)=>{const r=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(C(e,t))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:w(r,"dataIndex")[0]})))(n),r.push(Pn(n))})),r})(t,x);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=N(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},N=(e,t,r)=>{const{showLogo:n=!0}=f;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||wo.defaultColumnWidth}px">`})).join("")}</colgroup>`,g&&(a+=["<thead>",n&&v?`<tr><th colspan="${t.length}" style="border: 0">${['<table class="no-border" width="100%" border="0" cellspacing="0" cellpadding="0">',"<tr>",'<td width="50%" align="left">',b?`<img src="${b}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',y?`<img src="${y}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(a+=`<tbody>${r.map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:i}=h(e,t,e.index,n,r);return a&&i?`<td rowspan="${a}" colspan="${i}">${((e,t,r,n)=>s.current.renderCellTitle(r,e,t,n))(e,e.index,t,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),m&&u.length&&(a+=["<tfoot>",u.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(r):Ln(e,`${a}_text`);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},I=()=>{((e,t)=>{const{filename:r,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});kt(e,i)}})(0,T())?.then((e=>{let{content:t,blob:r}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),o.current.isIE?(n.contentDocument.write(t),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(r))}))};t().useImperativeHandle(r,(()=>({clickHandle:I})));const R=Ce("table");return a?t().createElement("span",{className:`${R}-print`,title:p("qm.table.print.text"),onClick:()=>I()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PrinterOutlined,null))):null}));qo.displayName="TablePrint";const _o=qo,jo=require("exceljs");var Ko=n.n(jo);const Mo="606060",Vo="thin",zo="d4d4d4",Uo=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Bo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Wo=()=>({top:{style:Vo,color:{argb:zo}},left:{style:Vo,color:{argb:zo}},bottom:{style:Vo,color:{argb:zo}},right:{style:Vo,color:{argb:zo}}}),Go=e=>{const{children:t}=e;return t&&t.length?Go(t[0]):e},Yo=e=>{const{precision:t,formatType:r}=e,n=t>=0?t?`0.${new Array(t).fill("0").join("")}`:"0":"";return n?{numFmt:n}:"percent"===r?{numFmt:t>=0?`${n}%`:"0%"}:"finance"===r?{numFmt:t>=0?`#,##${n}`:"#,##0"}:null},Xo=()=>{const{tableRef:e,tableProps:r,getSpan:n,showSummary:a,isHeadGroup:i}=t().useContext(co),{spanMethod:l,showHeader:o}=r,s=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(t,r,s,c)=>{const{columns:d,footSummation:u}=t,{scrollYStore:{rowHeight:m}}=e.current,h=vn(d),f=Pn(d),g=[],b=[],y=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,title:r,width:n,minWidth:a,renderWidth:i}=e;E[t]=r,y.push({key:t,width:(n||i||a||wo.defaultColumnWidth)/8})})),o&&(i?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Go(e),l=h.findIndex((e=>{let{dataIndex:t}=e;return t===i.dataIndex}));r[i.dataIndex]=e.title,0!==n&&(n>1||a>1)&&v.push({s:{r:t,c:l},e:{r:t+a-1,c:l+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const S=r.map(((e,t)=>{const a={};return h.forEach(((i,o)=>{if("function"==typeof l){const{rowSpan:a,colSpan:l}=n(e,i,t,o,r);(l>1||a>1)&&v.push({s:{r:t+x,c:o},e:{r:t+x+a-1,c:o+l-1}})}const s=["percent","finance"].includes(i.formatType);a[i.dataIndex]=s?Ln(e,i.dataIndex):c(e,t,i,o)})),a}));x+=S.length,a&&u&&s(h,r).forEach(((e,t)=>{const n={};h.forEach(((t,a)=>{const{dataIndex:i,summation:l}=t,o=l?.render?l.render(r):Ln(e,i);n[i]=0===a&&""===o?p("qm.table.config.summaryText"):te(o)?Kn(o).join(""):o})),b.push(n)}));const{sheetName:C,useStyle:w}=t,T=new(Ko().Workbook),N=T.addWorksheet(C);N.columns=y,o&&N.addRows(g).forEach((e=>{w&&Uo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Cn(d,t.key),{align:n,theadAlign:a}=r;Bo(e,a||n),w&&Object.assign(e,{font:{bold:!0,color:{argb:Mo}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Wo()})}))})),N.addRows(S).forEach((e=>{w&&Uo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Cn(d,t.key),{align:n}=r;Bo(e,n),Object.assign(e,Yo(r)),w&&Object.assign(e,{font:{color:{argb:Mo}},border:Wo()})}))})),a&&u&&N.addRows(b).forEach((e=>{w&&Uo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Cn(d,t.key),{align:n}=r;Bo(e,n),Object.assign(e,Yo(r)),w&&Object.assign(e,{font:{color:{argb:Mo}},border:Wo()})}))})),v.forEach((e=>{let{s:t,e:r}=e;N.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const I=await T.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,i,l="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)i=a.cells[n],l=l+(n?",":"")+r(i.textContent.trim());l+="\r\n"}return l})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),a=[];let i;for(i=0;i<n.length;i+=r){const e=n.slice(i,i+r),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const o=new window.Uint8Array(t);a.push(o)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,a=vn(r),i=new FileReader;i.onerror=()=>{O.message.error(p("qm.table.import.error"))},i.onload=e=>{const r=a.map((e=>e.title)),n=new(Ko().Workbook),i=e.target;i?n.xlsx.load(i.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],o=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,l);if(o){const n=e.slice(i+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;(0,J.isPlainObject)(n)&&(n=e.text),(0,J.isDate)(n)&&(n=_n(e,go)),t[l[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:l}=a[r];Array.isArray(l)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>s(l,e))).filter((e=>""!==e)):t[e]=s(l,t[e])),Hn(n,i,t[e])})),n}));t?.(n)}else O.message.error(p("qm.table.import.error"))}else O.message.error(p("qm.table.import.error"))})):O.message.error(p("qm.table.import.error"))},i.readAsArrayBuffer(n)}}},Qo=e=>{const{fileType:r,onChange:n}=e;let a,i;const l=Ce("table"),o=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return t().createElement(he,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),i=document.createElement("input"),a.className=`${l}--file-form`,i.name="file",i.type="file",a.appendChild(i),document.body.appendChild(a)),new Promise(((e,r)=>{const n=!t.type;i.multiple=!!t.multiple,i.accept=n?"":`.${t.type}`,i.onchange=l=>{const{files:s}=l.target,c=s[0];let d="";if(!n)for(let e=0;e<s.length;e++){const{type:r}=o(s[e]);if(t.type!==r){d=r;break}}d?(O.message.warning(p("qm.upload.notType",{type:d})),r()):e(c),document.body.removeChild(a),a=null,i=null},a.reset(),i.click()}))})({type:r});n?.(e.name,e)}catch(e){}})()},p("qm.upload.text"))},Zo=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableProps:i,createTableData:l,dataChange:o}=t().useContext(co),{beforeTableImport:s}=i,{importXLSX:c}=Xo(),d=t().useRef(null),[u,m]=t().useState(!1),[h,f]=t().useState(!0),g=e=>e.filter((e=>![wo.expandableColumn,wo.selectionColumn,"index","pageIndex",wo.operationColumn].includes(e.dataIndex))),[b,y]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName",render:(e,r)=>{const{fileName:n}=r.GET_FIELDS_VALUE(["fileName"]);return t().createElement(t().Fragment,null,n?t().createElement("span",null,n):t().createElement(Qo,{fileType:r.state.formData.fileType,onChange:(e,t)=>{r.SET_FIELDS_VALUE({fileName:e,file:t}),t&&f(!1)}}))}},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:p("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:p("qm.table.import.fillText"),value:"fill"},{text:p("qm.table.import.addText"),value:"add"},{text:p("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{b.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,y([...b])}},{type:"INPUT_NUMBER",label:p("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:a.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),v=Ce("table");return t().createElement("div",{className:`${v}-import__setting`},t().createElement(gl,{ref:d,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:b,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:u,disabled:h,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||(m(!0),c({columns:g(r),file:t.file},(async e=>{const{tableFullData:r,store:i}=a.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=await s(e)}catch(e){}if("fill"===t.importType&&l(e),"add"===t.importType&&l([...r,...e]),"insert"===t.importType){const{tableFullData:r}=a.current,n=t.posIndex,i=r.slice(0,n).concat(e).concat(r.slice(n));l(i)}e.forEach((e=>{i.addToInserted(e)})),o(),O.message.success(p("qm.table.import.success",{total:e.length})),m(!1),n()})))})()},p("qm.table.import.text"))))},Jo=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:o})));const s={[`${Ce("table")}-import`]:!0},c={visible:i,title:p("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(s),title:p("qm.table.import.textNoSpace"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ImportOutlined,null))),t().createElement(cr,c,t().createElement(Zo,{columns:n,onClose:()=>l(!1)})))}));Jo.displayName="TableImport";const es=Jo,ts=e=>{const{columns:r,onChange:n}=e,{$size:a}=t().useContext(co),i=t().useRef([]),[l,o]=t().useState(!1),[s,c]=t().useState(r);_e((()=>{u()}),[s]),t().useEffect((()=>{d()}),[r]);const d=()=>{const e=[];r.forEach(((t,n)=>{const a=t.colSpan;a>1&&r.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(r.slice(n,n+a))})),i.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=i.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...i.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=s.find((e=>e.dataIndex===n));return r>0&&void 0!==t.hidden&&(a.hidden=t.hidden),a})))})),n?.(e)},m=Ce("table"),h={[`${m}__popper`]:!0,"column-filter__popper":!0,[`${m}--lg`]:"large"===a,[`${m}--sm`]:"small"===a},f=[`${m}-column-filter`,{selected:l}];return t().createElement(Ia(),{action:["click"],popupVisible:l,popup:t().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"main"},t().createElement(Yn.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),r=s.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||c(Gn(e))}},s.map((e=>((e,r)=>{const{colSpan:n}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=["svgicon","handle","main-handle"];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(O.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,c([...s])}}),t().createElement("i",{className:Se()(a),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title))})(e)))))),popupClassName:Se()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{o(e)},builtinPlacements:yo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()(f),title:p("qm.table.columnFilter.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),t().createElement("span",null,p("qm.table.columnFilter.text"))))},rs=e=>{const{defaultValue:r,onClose:n,onOk:a}=e,{tableProps:i,selectionKeys:l,pagination:o,showSummary:c}=t().useContext(co),{rowSelection:d}=i,u=t().useRef(null),[m,h]=t().useState(!1),f=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(bo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:l.length?"selected":"all","startIndex|endIndex":[1,o.total],footSummation:c?1:0,useStyle:0},r,{columns:ce(r.columns||[])})),[]),[g,b]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:p("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:p("qm.table.export.all"),value:"all"},{text:p("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==d?.type},{text:p("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:p("qm.table.columnFilter.text"),fieldName:"columns",render:(e,r)=>t().createElement(ts,{columns:r.state.formData.columns,onChange:e=>{r.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:p("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:p("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ce("table");return t().createElement("div",{className:`${y}-export__setting`},t().createElement(gl,{ref:u,initialValues:f,items:g,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:m,onClick:()=>(async()=>{const[e,t]=await u.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);a(t),await ie(1e3),h(!1),n()}})()},p("qm.table.export.text"))))},ns=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:c,tableProps:d,flattenColumns:u,pagination:m,fetchParams:h,isFetch:f,isGroupSubtotal:g,showSummary:b,getSpan:y}=t().useContext(co),{exportExcel:v,fetch:x,showHeader:E}=d,[S,C]=t().useState(!1),[w,T]=t().useState(!1),N=t().useMemo((()=>!!v?.fetch?.api),[v]),I=t().useMemo((()=>!m.total||w),[m.total,w]),R=t().useMemo((()=>Nn(n,[wo.expandableColumn,wo.selectionColumn,wo.operationColumn])),[n]),P=t().useMemo((()=>Nn(u,[wo.expandableColumn,wo.selectionColumn,wo.operationColumn])),[u]),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(g?Mn(t):t).reduce(((e,t)=>{if(t?.[wo.summaryIgnore])return e;const r=Number(Ln(t,n));return Number.isNaN(r)?e:e+r}),0);Hn(r,n,a)})),[r]},k=(e,t,r,n)=>{const{precision:a,formatType:i}=r;let l=c.current.renderCellTitle(r,e,t,n);return a>=0&&!i&&""!==l&&(l=Number(l)),l},{exportXLSX:F,exportCSV:L}=Xo(),H=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:a}=x;let i=[];try{T(!0);const l=await t({...r(h),[wo.currentPageName]:1,[wo.pageSizeName]:e??m.total});if(200===l.code){let e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,a)??[];e="function"==typeof n?await n(e):e,i=Rn(e.map(((e,t)=>{const r={...e,index:t,pageIndex:t};return P.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&Hn(r,n,Ln(r,n))})),r})))}}catch(e){}return T(!1),i},$=e=>{const t=i?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},D=v?.fileName??`${s()().format(bo)}.xlsx`,q=D.slice(D.lastIndexOf(".")+1).toLowerCase(),_=()=>{if(I)return O.message.warning(p("qm.table.export.warnText"));N?(async e=>{T(!0);try{const{api:t,params:r}=v.fetch,n=await t({columns:P.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:r,type:a,hidden:n}})),...h,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[wo.currentPageName]:void 0,[wo.pageSizeName]:void 0});n.data&&(kt(n.data,e),$(e))}catch(e){}T(!1)})(D):C(!0)};t().useImperativeHandle(r,(()=>({clickHandle:_})));const j={[`${Ce("table")}-export`]:!0},K={visible:S,title:p("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},M={fileName:D.slice(0,D.lastIndexOf(".")),fileType:q,columns:R,useStyle:v?.cellStyle?1:0};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(j),title:p("qm.table.export.textNoSpace"),onClick:()=>_()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.DownloadOutlined,null))),t().createElement(cr,K,t().createElement(rs,{defaultValue:M,onClose:()=>C(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:a=1,endIndex:i}=e,{allTableData:l,selectionRows:s}=o.current;let c=[];if(f?("all"===n&&(c=await H()),"custom"===n&&(c=await H(i),c=c.slice(a-1))):("all"===n&&(c=l.slice(0)),"custom"===n&&(c=l.slice(a-1,i||void 0))),"selected"===n&&(c=s.slice(0)),"function"==typeof v?.beforeExport)try{c=v?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await F(e,c,A,k);kt(r,`${t}.xlsx`),$(`${t}.xlsx`)}if("csv"===r){const r=L(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=Pn(r),i=vn(r);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||wo.defaultColumnWidth}px">`})).join("")}</colgroup>`,E&&(l+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${t.map((e=>`<tr>${i.map(((r,n)=>{const{rowSpan:a,colSpan:i}=y(e,r,e.index,n,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${k(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),b&&n&&(l+=["<tfoot>",A(i,t).map((e=>`<tr>${i.map(((r,n)=>{const{dataIndex:a,summation:i}=r,l=i?.render?i.render(t):Ln(e,a);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):te(l)?Kn(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));kt(r,`${t}.csv`),$(`${t}.csv`)}})(Object.assign({},e,{columns:xn(e.columns)}))}})))}));ns.displayName="TableExport";const as=ns,is=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableBodyRef:i,tableProps:l,dataChange:o}=t().useContext(co),{beforeClipboard:s}=l,c=t().useRef(null),[d,u]=t().useState([{type:"INPUT_NUMBER",label:p("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:p("qm.table.clipboard.colIndex"),fieldName:"dataIndex",options:{itemList:r.map(((e,t)=>({value:t,text:e.title})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:p("qm.table.clipboard.content"),fieldName:"content",placeholder:p("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[m,h]=t().useState(!1),f=Ce("table");return t().createElement("div",{className:`${f}-clipboard__setting`},t().createElement("h3",{className:"info"},p("qm.table.clipboard.supportText")),t().createElement(gl,{ref:c,initialValues:{},initialExtras:{rowIndex:"行",dataIndex:"列"},items:d,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:m,onClick:()=>(async()=>{const[e,t]=await c.current.GET_FORM_DATA();if(e)return;const{tableFullData:l,store:d}=a.current;h(!0);const u=t.content.trim().replace(/(\r|\n)$/,"");let m=u.replace(/"[^"]+"/g,"^");(u.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{m=m.replace(/\^/,e)}));let f=m.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{f=await s(f,f[0].map(((e,n)=>r[t.dataIndex+n].dataIndex)))}catch(e){}f.forEach(((e,n)=>{e.forEach(((e,i)=>{const o=l[t.rowIndex-1+n],s=r[t.dataIndex+i];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||e.extra?.disabled||a.current.fieldAuth[s.dataIndex]?.disabled)}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(Hn(o,s.dataIndex,e),d.addToUpdated(o))}}))})),i.current.forceUpdate(),o(),O.message.success(p("qm.table.clipboard.success",{total:f.length})),h(!1),n()})()},p("qm.table.clipboard.text"))))},ls=t().forwardRef(((e,r)=>{const{flattenColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![wo.expandableColumn,wo.selectionColumn,"index","pageIndex",wo.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:s})));const c={[`${Ce("table")}-clipboard`]:!0},d={visible:i,title:p("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(c),title:p("qm.table.clipboard.textNoSpace"),onClick:()=>s()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CopyOutlined,null))),t().createElement(cr,d,t().createElement(is,{columns:o,onClose:()=>l(!1)})))}));ls.displayName="TableClipboard";const os=ls,ss=e=>{const{columns:r,onClose:n}=e,{tableProps:a,tableRef:i,$size:l,selectionKeys:o,setSelectionKeysEffect:s}=t().useContext(co),{rowKey:c}=a,d=t().useRef(null),u=St(d),m=e=>e.map((e=>{const t={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:e.dictItems??[],render:e.render};return Array.isArray(e.children)&&(t.children=m(e.children)),t})),[h,f]=t().useState([{title:p("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...m(r.filter((e=>![wo.expandableColumn,wo.selectionColumn,"index","pageIndex",wo.operationColumn].includes(e.dataIndex))))]),[g]=t().useState(i.current.selectionRows.map((e=>({...e,children:void 0})))),[b,y]=t().useState(300),v=Ct((()=>{const e=d.current;y(e.offsetHeight-2*fa[l]-30)}),5);return _e((()=>{v()}),[u.width]),t().createElement("div",{ref:d,style:{height:"100%"}},t().createElement(lc,{size:l,columns:h,dataSource:g,rowKey:c,height:b,rowSelection:{type:"checkbox",selectedRowKeys:o,onChange:e=>s(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),t().createElement("div",{style:{height:10}}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n()},p("qm.table.selectCollection.closeButton"))))},cs=t().forwardRef(((e,r)=>{const{columns:n,open:a=!0}=e,{tableProps:i,getRowKey:l,selectionKeys:o,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=t().useContext(co),{rowSelection:m}=i,[h,f]=t().useState(!1),g=t().useRef(!1);_e((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=m;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:o},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),d(n.map(((e,t)=>l(e,t)))),u(n),g.current=!0}}catch(e){}},y=()=>{f(!0)};t().useImperativeHandle(r,(()=>({clickHandle:y})));const v=Ce("table"),x={visible:h,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>f(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:`${v}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>y()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CheckSquareOutlined,null))),t().createElement(cr,x,t().createElement(ss,{columns:n,onClose:()=>f(!1)})))}));cs.displayName="SelectCollection";const ds=cs,us=require("localforage");var ps=n.n(us);const ms=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),hs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,tableRef:i,getRowKey:o,$size:s,flattenColumns:c,pagination:d,setPagination:u,scrollYToRecord:m,setHighlightKey:h,setShouldToTop:f,isTreeTable:b,isWebPagination:y}=t().useContext(co),{uniqueKey:v}=a,x=t().useRef(null),E=t().useRef(null),S=t().useRef([]),C=t().useRef(""),w=t().useRef(-1),T=t().useRef("stop");_e((()=>{const{current:e,pageSize:t}=d,r=i.current.tableFullData.slice((e-1)*t,e*t),n=Rn(r).findIndex((e=>o(e,e.index)===C.current));m("",n)}),[d.current]);const N=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},I=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:N(e.filter.type),fieldName:e.dataIndex,label:e.title,tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await x.current.GET_FORM_DATA(),[r,n]=await E.current.GET_FORM_DATA(),a=(0,J.omitBy)(Object.assign({},t,n),se);k(a)}}))),R={case:0,fullchar:0},P=t().useMemo((()=>c.filter((e=>![wo.expandableColumn,wo.selectionColumn,"index","pageIndex",wo.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[A,k]=t().useState({}),[F,L]=t().useState(R),[H]=t().useState(I([P[0]])),[$]=t().useState(I(P.slice(1))),[D,q]=t().useState(0),_=t().useMemo((()=>!Object.keys(A).length),[A]);_e((()=>{T.current="ready"}),[A,F]);const j=e=>{L(Object.assign({},F,e))},K=(e,t,r)=>new Promise(((n,a)=>{O.Modal.confirm({title:p("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),M=async e=>{if(!Object.keys(A).length)return O.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.queryCondition")});if("ready"===T.current&&(T.current="stop",S.current=(e=>{const{allTableData:t}=i.current,r=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];let i=!0;for(const t in e){const{type:r}=P.find((e=>e.dataIndex===t)).filter;let n=Ln(a,t),l=!0;if("text"===r||"textarea"===r?l=new RegExp(F.fullchar?`^${e[t]}$`:e[t],F.case?"":"i").test(n):(n=ms(n)?n.slice(0,10):n,l=n==e[t]),!l){i=!1;break}}i&&r.push(a)}return r})(A),q(S.current.length)),!S.current.length)return h(""),O.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>S.current.length-1&&await K(p("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=S.current.length-1))),"prev"===e&&(w.current=w.current<0?S.current.length-1:w.current-1,w.current<0&&await K(p("qm.table.fastSearch.toStart"),(()=>w.current=S.current.length-1),(()=>w.current=0)));const t=S.current[w.current],r=o(t,t.index);let n=t.index;if(b&&y){const e=Un(i.current.deriveRowKeys,r)[0];n=i.current.tableFullData.findIndex((t=>o(t,t.index)===e))}((e,t)=>{if(C.current=e,y){const{pageSize:e}=d,r=Math.ceil((t+1)/e);f(!1),u(Object.assign({},d,{current:r}))}else m(e)})(r,n),h(r)},V=()=>{x.current.RESET_FORM(),E.current.RESET_FORM()},z=t().useMemo((()=>v?`fastSearch_${v}`:""),[v]),[U,B]=t().useState([]),[W,G]=t().useState(""),[Y,X]=t().useState("");_e((()=>{if(Y){const{filters:e,config:t}=U.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(Z()(e,$.map((e=>e.fieldName)))),E.current.SET_FIELDS_VALUE(Z()(e,H.map((e=>e.fieldName)))),k(e),L(t)}else V(),k({}),L(R)}),[Y]),t().useEffect((()=>{Q()}),[]);const Q=async()=>{if(!z)return;let e=await ps().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await ps().setItem(z,e)),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))},ee=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},te=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},re=Ce("table");return t().createElement("div",{className:`${re}-fast-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"top"},t().createElement("div",{className:"container"},t().createElement(Jt,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t().createElement("span",null,p("qm.table.alert.total",{total:D}))},t().createElement(Jt.TabPane,{tab:p("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t().createElement(gl,{ref:x,items:H,cols:1,labelWidth:110})),t().createElement(Jt.TabPane,{tab:p("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t().createElement(gl,{ref:E,items:$,cols:1,labelWidth:110})))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(O.Input,{size:s,value:W,placeholder:p("qm.table.highSearch.configText"),disabled:_,onChange:e=>{const{value:t}=e.target;G(t)}}),t().createElement(he,{type:"primary",disabled:!W||_,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=jn(),t=[...U,{text:W,value:e,list:{filters:A,config:F}}];B(t),X(e),G(""),await ps().setItem(z,t),await te(z,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${wo.rowHeightMaps[s]}px`}},t().createElement("span",null,p("qm.table.fastSearch.savedSetting"))),t().createElement("ul",null,U.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===Y}),title:e.text,onClick:()=>(e=>{X(e!==Y?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=U.filter((t=>t.value!==e));B(t),e===Y&&X(""),await ps().setItem(z,t),await te(z,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!U.length&&t().createElement("div",{style:{padding:po}},t().createElement(mt,null)))))),t().createElement("div",{className:"bottom"},t().createElement("div",null,t().createElement(O.Checkbox,{checked:!!F.case,onChange:e=>j({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t().createElement(O.Checkbox,{checked:!!F.fullchar,onChange:e=>j({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t().createElement("div",null,t().createElement(he,{onClick:()=>V()},p("qm.table.fastSearch.clear"))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${fa[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.fastSearch.closeButton")),t().createElement(he,{type:"primary",style:{marginRight:8},onClick:()=>M("prev")},p("qm.table.fastSearch.queryPrev")),t().createElement(he,{type:"primary",onClick:()=>M("next")},p("qm.table.fastSearch.queryNext"))))},fs=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{$size:a}=t().useContext(co),[i,l]=t().useState(!1),o=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:o})));const s=Ce("table"),c={visible:i,title:p("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${fa[a]+20}px`},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${s}-super-search`,title:p("qm.table.fastSearch.text"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.MonitorOutlined,null))),t().createElement(cr,c,t().createElement(hs,{onClose:()=>l(!1)})))}));fs.displayName="FastSearch";const gs=fs,bs=e=>{const{columns:r,group:n,summary:a}=e,{tableRef:i,tableProps:l,$size:o,pagination:c,fetchParams:d,isFetch:u}=t().useContext(co),{fetch:m}=l,h=e=>{const t=r.find((t=>t.dataIndex===e));return{title:t.title,precision:t.precision,dictItems:t.dictItems??[]}},f=n.map((e=>({dataIndex:e.group,...h(e.group)}))),g=a.map((e=>e.summary===wo.groupSummary.total.value?{dataIndex:e.summary,title:wo.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...h(e.summary),formula:e.formula})),b=t().useMemo((()=>Object.assign({},d,{[wo.sorterFieldName]:void 0,[wo.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[wo.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[wo.currentPageName]:1})),[d,n,a]),[y,v]=t().useState(((e,t)=>[{title:p("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{const t=r.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=t?{summation:t}:null;return e.dataIndex===wo.groupSummary.total.value&&(n={dataIndex:wo.groupSummary.recordTotalIndex,summation:{render:()=>c.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(f,g)),[x]=t().useState(u?[]:(e=>{const t=zn(e,n.map((e=>e.group))),r=[];return t.forEach((e=>{const t={};y.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&Hn(t,n,Ln(e[0],n))})),a.forEach((r=>{const n=r.summary!==wo.groupSummary.total.value?r.summary:wo.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&Hn(t,n,e.length),"sum"===a&&Hn(t,n,(0,J.sumBy)(e,n)),"max"===a&&Hn(t,n,(0,J.maxBy)(e,n)[n]),"min"===a&&Hn(t,n,(0,J.minBy)(e,n)[n]),"avg"===a&&Hn(t,n,((0,J.sumBy)(e,n)/e.length).toFixed(2))})),r.push(t)})),r})(i.current.tableFullData)),E={size:o,height:400,...u?{fetch:{api:m.api,params:b,dataKey:m?.dataKey}}:{dataSource:x},columns:y,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${s()().format("YYYYMMDDHHmmss")}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>v(e)};return t().createElement(lc,E)},ys=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o}=t().useContext(co),{uniqueKey:s}=a,c=t().useRef(null),d=t().useRef(null),[u,m]=t().useState(!1),[h,f]=t().useState([]),[b,y]=t().useState(""),[v,x]=t().useState("");_e((()=>{if(v){const{group:e,summary:t}=h.find((e=>e.value===v)).list;I(e),k(t)}else{const e=$();I(e?.group||[]),k(e?.summary||[])}}),[v]),t().useEffect((()=>{D()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),S=t().useMemo((()=>o.filter((e=>![wo.expandableColumn,wo.selectionColumn,"index","pageIndex",wo.operationColumn].includes(e.dataIndex)))),[o]),C=S.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[wo.groupSummary.total,...S.filter((e=>!!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex})))],T=[{text:p("qm.table.groupSummary.sumText"),value:"sum"},{text:p("qm.table.groupSummary.maxText"),value:"max"},{text:p("qm.table.groupSummary.minText"),value:"min"},{text:p("qm.table.groupSummary.avgText"),value:"avg"},{text:p("qm.table.groupSummary.countText"),value:"count"}],[N,I]=t().useState([]),[R,P]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{c.current.REMOVE_RECORDS(r)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:p("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:C.map((e=>({...e,disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[A,k]=t().useState([]),[F,L]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(r)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:p("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:w.map((e=>({...e,disabled:A.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:p("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===wo.groupSummary.total.value?T.slice(T.length-1):T})}]),H=t().useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=A.length&&A.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,A]),$=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},D=async()=>{if(!E)return;const e=$();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await ps().getItem(E);t||(t=await q(E),Array.isArray(t)&&await ps().setItem(E,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},_=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},j=Ce("table"),K={visible:u,title:p("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>m(!1)};return t().createElement("div",{className:`${j}-group-summary__setting`},t().createElement("div",{className:"main"},t().createElement("div",{style:{width:"30%"}},t().createElement(lc,{ref:c,size:i,columns:R,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{I(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{c.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"container line"},t().createElement(lc,{ref:d,size:i,columns:F,dataSource:A,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>L(e),onDataChange:e=>{k(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(O.Input,{size:i,value:b,placeholder:p("qm.table.groupSummary.configText"),disabled:H,onChange:e=>{const{value:t}=e.target;y(t)}}),t().createElement(he,{type:"primary",disabled:!b||H,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=jn(),t=[...h,{text:b,value:e,list:{group:N.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))}}];f(t),x(e),y(""),await ps().setItem(E,t),await _(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${wo.rowHeightMaps[i]}px`}},t().createElement("span",null,p("qm.table.groupSummary.savedSetting"))),t().createElement("ul",null,h.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===v}),title:e.text,onClick:()=>(e=>{x(e!==v?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));f(t),e===v&&x(""),await ps().setItem(E,t),await _(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!h.length&&t().createElement("div",{style:{padding:po}},t().createElement(mt,null)))))),t().createElement(cr,K,t().createElement(bs,{columns:S,group:N,summary:A})),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.groupSummary.closeButton")),t().createElement(he,{type:"primary",disabled:H,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:N.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))})),void m(!0))},p("qm.table.groupSummary.confirmButton"))))},vs=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-group-summary`,title:p("qm.table.groupSummary.text"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PieChartOutlined,null))),t().createElement(cr,s,t().createElement(ys,{onClose:()=>i(!1)})))}));vs.displayName="GroupSummary";const xs=vs,Es=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(co),{uniqueKey:d}=a,u=t().useRef(null),[m,h]=t().useState([]),[f,b]=t().useState([]),[y,v]=t().useState(""),[x,E]=t().useState("");_e((()=>{h(x?f.find((e=>e.value===x)).list:$()||[])}),[x]),t().useEffect((()=>{D()}),[]);const S=t().useMemo((()=>d?`superSearch_${d}`:""),[d]),C=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=Vn(m),T=t().useMemo((()=>!(w&&bn(w))),[w]),N=t().useMemo((()=>!!m.length&&T),[m,T]),I=[{value:"and",text:p("qm.table.highSearch.andText")},{value:"or",text:p("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:e.title}))),P=e=>["in","nin"].includes(e),A=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:p("qm.table.highSearch.gtText")},{value:"<",text:p("qm.table.highSearch.ltText")},{value:">=",text:p("qm.table.highSearch.gteText")},{value:"<=",text:p("qm.table.highSearch.lteText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:p("qm.table.highSearch.inText")},{value:"nin",text:p("qm.table.highSearch.ninText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:p("qm.table.highSearch.likeText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}]}return t},[F,L]=t().useState([{title:p("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(r)}},p("qm.table.highSearch.removeText")))},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,r)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:p("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=C.find((e=>e.dataIndex===r))?.filter.type,a=k(n);e.fieldType=n,e.expression=r?a[0]?.value:"",e.condition=P(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:p("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:p("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=P(e.expression)?[]:""}}}},{title:p("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:A(r,P(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,r)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:I,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),H=()=>{S&&sessionStorage.setItem(S,JSON.stringify(m.filter((e=>!!e.fieldName))))},$=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},D=async()=>{if(!S)return;const e=$();e&&h(e);let t=await ps().getItem(S);t||(t=await q(S),Array.isArray(t)&&await ps().setItem(S,t)),Array.isArray(t)&&t.length&&(b(t),!e&&E(t[0].value))},q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},_=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},j=Ce("table");return t().createElement("div",{className:`${j}-super-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"container"},t().createElement(lc,{ref:u,size:i,columns:F,dataSource:m,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>L(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...m]))},onDataChange:e=>{h(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),wo.highSearch.showSQL&&w&&t().createElement("code",{className:"lang-js"},w)),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(O.Input,{size:i,value:y,placeholder:p("qm.table.highSearch.configText"),disabled:T,onChange:e=>{const{value:t}=e.target;v(t)}}),t().createElement(he,{type:"primary",disabled:!y||T,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!S)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=jn(),t=[...f,{text:y,value:e,list:m.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await ps().setItem(S,t),await _(S,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${wo.rowHeightMaps[i]}px`}},t().createElement("span",null,p("qm.table.highSearch.savedSetting"))),t().createElement("ul",null,f.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));b(t),e===x&&E(""),await ps().setItem(S,t),await _(S,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:po}},t().createElement(mt,null)))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.highSearch.closeButton")),t().createElement(he,{type:"primary",disabled:N,onClick:()=>(c(),s(m.map((e=>Z()(e,["index","pageIndex"])))),H(),void r())},p("qm.table.highSearch.searchButton"))))},Ss=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-super-search`,title:p("qm.table.highSearch.text"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.FunnelPlotOutlined,null))),t().createElement(cr,s,t().createElement(Es,{onClose:()=>i(!1)})))}));Ss.displayName="SuperSearch";const Cs=Ss,ws=t().forwardRef(((e,r)=>{const{tableColumns:n,showFullScreen:a,showReload:i,showPrint:o,showImport:s,showExport:c,showClipboard:d,showCollection:u,showFastSearch:m,showSuperSearch:h,showGroupSummary:f,showToolBox:b}=e,{global:y}=t().useContext(l),{tableProps:v,flattenColumns:x,isFullScreen:E,$size:S}=t().useContext(co),{uniqueKey:C,exportExcel:w}=v,T=t().useRef(null),N=t().useRef(null),I=t().useRef(null),R=t().useRef(null),P=t().useRef(null),A=t().useRef(null),k=t().useRef(null),F=t().useRef(null),L=t().useRef(null),H=t().useRef(null),$=t().useRef(!1),D=t().useMemo((()=>C?`toolBox_${C}`:""),[C]),[q,_]=t().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),j={fullScreen:a,reload:i,print:o,import:s,export:c&&!w?.hideIcon,clipboard:d,collection:u,fastSearch:m,superSearch:h,groupSummary:f},[K,M]=t().useState(!1);_e((()=>{$.current&&(z(),$.current=!1)}),[q]),t().useEffect((()=>{V()}),[]),t().useImperativeHandle(r,(()=>({exportHandle:()=>{if(!P.current)return g("Table","执行导出需要配置 `exportExcel` 参数");P.current.clickHandle()}})));const V=()=>{if(!D||!b)return;const e=JSON.parse(localStorage.getItem(D));e||U(D).then((e=>{e&&(_(Object.assign({},q,e)),localStorage.setItem(D,JSON.stringify(e)))})).catch((()=>{})),e&&_(Object.assign({},q,e))},z=()=>{if(!D||!b)return;const e={};for(const t in q)q[t]&&(e[t]=q[t]);localStorage.setItem(D,JSON.stringify(e)),B(D,e)},U=async e=>{const t=y?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},B=async(e,t)=>{const r=y?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},W=async e=>{M(!1),await ie(100),e.current.clickHandle()},G=(e,t)=>{$.current=!0,_(Object.assign({},q,{[t]:e}))},Y=Ce("table"),X={"top-toolbox__popper":!0,[`${Y}--lg`]:"large"===S,[`${Y}--sm`]:"small"===S};return t().createElement(t().Fragment,null,a&&t().createElement(Ho,{ref:T,isFullScreen:E,open:!b||q.fullScreen}),i&&t().createElement(Do,{ref:N,open:!b||q.reload}),o&&t().createElement(_o,{ref:I,tableColumns:n,open:!b||q.print}),s&&t().createElement(es,{ref:R,tableColumns:n,open:!b||q.import}),c&&t().createElement(as,{ref:P,tableColumns:n,open:(!b||q.export)&&!w?.hideIcon}),d&&t().createElement(os,{ref:A,flattenColumns:x,open:!b||q.clipboard}),u&&t().createElement(ds,{ref:k,columns:n,open:!b||q.collection}),m&&t().createElement(gs,{ref:F,open:!b||q.fastSearch}),f&&t().createElement(xs,{ref:L,open:!b||q.groupSummary}),h&&t().createElement(Cs,{ref:H,open:!b||q.superSearch}),b&&t().createElement(O.Dropdown,{open:K,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.fullScreen,style:{marginRight:6},onChange:e=>G(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.screen.full"))),onClick:()=>W(T)},{key:"reload",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.reload,style:{marginRight:6},onChange:e=>G(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.refresh.text"))),onClick:()=>W(N)},{key:"print",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.print,style:{marginRight:6},onChange:e=>G(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.print.text"))),onClick:()=>W(I)},{key:"import",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.import,style:{marginRight:6},onChange:e=>G(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.import.textNoSpace"))),onClick:()=>W(R)},{key:"export",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.export,style:{marginRight:6},onChange:e=>G(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.export.textNoSpace"))),onClick:()=>W(P)},{key:"clipboard",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.clipboard,style:{marginRight:6},onChange:e=>G(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.clipboard.textNoSpace"))),onClick:()=>W(A)},{key:"collection",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.collection,style:{marginRight:6},onChange:e=>G(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.selectCollection.text"))),onClick:()=>W(k)},{key:"fastSearch",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.fastSearch,style:{marginRight:6},onChange:e=>G(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.fastSearch.text"))),onClick:()=>W(F)},{key:"groupSummary",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.groupSummary,style:{marginRight:6},onChange:e=>G(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.groupSummary.text"))),onClick:()=>W(L)},{key:"superSearch",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.superSearch,style:{marginRight:6},onChange:e=>G(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.highSearch.text"))),onClick:()=>W(H)}];return t().createElement(O.Menu,{items:e.filter((e=>j[e.key]))})})(),overlayClassName:Se()(X),overlayStyle:{minWidth:120},onOpenChange:e=>{M(e)}},t().createElement("span",{className:`${Y}-toolbox`,title:p("qm.table.toolbox.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.AppstoreAddOutlined,null)))))}));ws.displayName="ToolBox";const Ts=ws,Ns=(e,t)=>e.map((e=>(e.children&&(e.children=Ns(e.children,t)),t(e)))),Is=t().forwardRef(((e,r)=>{const{columns:n}=e,{global:a}=t().useContext(l),{tableProps:i,tableRef:o,$size:s}=t().useContext(co),{showColumnDefine:c,uniqueKey:d,onlyShowIcon:u,columnsChange:m}=i,h=t().useRef([]),f=e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)),g=e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)),b=e=>e.filter((e=>!e.noAuth&&!e.fixed)),[y,v]=t().useState(!1),[x,E]=t().useState(f(n)),[S,C]=t().useState(g(n)),[w,T]=t().useState(b(n)),N=t().useMemo((()=>d?`table_${d}`:""),[d]),I=t().useMemo((()=>[...x,...w,...S]),[x,w,S]);_e((()=>{F(n),k(n),P(n)}),[n]),t().useLayoutEffect((()=>{A()}),[]),t().useImperativeHandle(r,(()=>({initialHandler:A})));const R=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=R(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),P=e=>{if(!N)return;const t=R(e),r=JSON.parse(localStorage.getItem(N));o.current.columnsDefined&&!(0,J.isEqual)(t,r)&&(localStorage.setItem(N,JSON.stringify(t)),(async(e,t)=>{const r=a?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(N,t))},A=()=>{const e=(()=>{if(!N)return;const e=JSON.parse(localStorage.getItem(N));return e||(async e=>{const t=a?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(N).then((e=>{e?(localStorage.setItem(N,JSON.stringify(e)),A()):a?.getComponentConfigApi&&P(n)})).catch((()=>{})),e?(0,J.xor)(En(e).map((e=>e.dataIndex)),En(n).map((e=>e.dataIndex))).length>0?Ns(n,(t=>{const r=Cn(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):Ns(e,(e=>{const t=Cn(n,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();e&&m?.(e)},k=e=>{const t=f(e),r=g(e),n=b(e);return E(t),C(r),T(n),[...t,...n,...r]},F=e=>{const t=[];e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const a=r.colSpan;a>1&&e.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+a))})),h.current=t},L=()=>{const e=[];I.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...h.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=I.find((e=>e.dataIndex===n));return r>0&&(void 0!==t.hidden&&(a.hidden=t.hidden),void 0!==t.fixed?a.fixed=t.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((t,r)=>{t.noAuth&&e.findIndex((e=>e.dataIndex===t.dataIndex))<0&&e.splice(r,0,t)})),m?.(e)},H=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const r=k(n);m?.(r)},$=(e,r)=>{const{colSpan:n,noFixed:a}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${r}-handle`],l=t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(O.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,L()}}),t().createElement("i",{className:Se()(i),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title),"main"===r?t().createElement("span",{className:Se()("fixed",a?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>H(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>H(e,"right")},t().createElement(we.StepForwardOutlined,null))):"sub"!==r?t().createElement("span",{className:Se()("fixed",a?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>H(e)},t().createElement(we.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?t().createElement(O.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:D(e.children,e.dataIndex)},l):l},D=(e,r)=>t().createElement("div",{className:"column-filter--wrap"},t().createElement(Yn.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const a=t.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,J.isEqual)(a,i)||((e,t)=>{Cn(n,t).children=e,m?.([...n])})(Gn(t),r)}},e.map((e=>$(e,"sub"))))),q=Ce("table"),_={[`${q}__popper`]:!0,"column-filter__popper":!0,[`${q}--lg`]:"large"===s,[`${q}--sm`]:"small"===s},j=[`${q}-column-filter`,{selected:y}];return c?t().createElement(Ia(),{action:["click"],popupVisible:y,popup:t().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"reset"},t().createElement(he,{type:"text",size:"small",onClick:()=>{m?.(ce(o.current.originColumns))}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement(Yn.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:x,setList:e=>{const t=e.map((e=>e.dataIndex)),r=x.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||E(Gn(e))},onEnd:()=>L()},x.map((e=>$(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement(Yn.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:w,setList:e=>{const t=e.map((e=>e.dataIndex)),r=w.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||T(Gn(e))},onEnd:()=>L()},w.map((e=>$(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement(Yn.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:S,setList:e=>{const t=e.map((e=>e.dataIndex)),r=S.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||C(Gn(e))},onEnd:()=>L()},S.map((e=>$(e,"right")))))),popupClassName:Se()(_),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{v(e)},builtinPlacements:yo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()(j),title:u?p("qm.table.columnFilter.text"):void 0},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),!u&&t().createElement("span",null,p("qm.table.columnFilter.text")))):null}));Is.displayName="ColumnFilter";const Rs=Is,Ps=()=>t().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}));function Os(){return Os=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Os.apply(this,arguments)}const As=e=>{const{column:r,filters:n}=e,{$size:a,setFilters:i,clearSuperFilters:l}=t().useContext(co),o=t().useRef(null),s=t().useRef(null),c=t().useRef(null),[d,u]=t().useState(!1),[m,h]=t().useState(!1),[f,b]=t().useState({}),y=t().useMemo((()=>{const{dataIndex:e,filter:t}=r;return`${e}|${t.type}`}),[r]),v=t().useMemo((()=>{let e=!1;for(const t in n[y])if(!se(n[y][t])||m){e=!0;break}return e}),[y,n,m]);t().useEffect((()=>{d&&setTimeout((()=>x()),50)}),[d]),t().useEffect((()=>{(0,J.isEqual)(f[y],n[y])||b({[y]:n[y]||{}}),h(""===n[y]?.["=="])}),[n]);const x=()=>{switch(r.filter.type){case"text":o.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},E=e=>{e&&b(e),l(),i((e=>{for(const t in e){for(const r in e[t])if(se(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...n,...f,...e})),u(!1)},S={text:e=>{const{title:r}=e;return t().createElement(t().Fragment,null,t().createElement(O.Input,{ref:o,size:a,placeholder:p("qm.table.filter.searchText",{text:r}),style:{width:"180px"},value:f[y]?.like??"",disabled:m,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(O.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":r,like:null}}))),h(t)}},p("qm.table.filter.nullValue"))))},textarea:e=>{const{title:r}=e;return t().createElement(t().Fragment,null,t().createElement(O.Input.TextArea,{ref:c,size:a,placeholder:p("qm.table.filter.searchAreaText",{text:r}),style:{width:"220px"},value:f[y]?.likes??"",disabled:m,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{likes:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(O.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":r,like:null}}))),h(t)}},p("qm.table.filter.nullValue"))))},number:e=>{const r=e=>({value:f[y]?.[e]??"",size:a,onChange:t=>{t?.toString().replace(/^-|\./g,"").length>17||b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(O.InputNumber,Os({ref:s},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(O.InputNumber,Os({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(O.InputNumber,Os({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(O.InputNumber,Os({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const r=e=>({value:qn(f[y]?.[e],fo),format:fo,size:a,onChange:t=>{b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:_n(t,fo)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(q,Os({},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(q,Os({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(q,Os({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(q,Os({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("ul",null,t().createElement(O.Radio.Group,{style:{width:"100%"},value:f[y]?.["=="],onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{"==":t}})))}},a.map((e=>t().createElement("li",{key:e.value},t().createElement(O.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("ul",null,t().createElement(O.Checkbox.Group,{style:{width:"100%"},value:f[y]?.in,onChange:e=>{b((t=>Object.assign({},t,{[y]:{in:e}})))}},a.map((e=>t().createElement("li",{key:e.value},t().createElement(O.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("div",{style:{height:200,...r.style}},t().createElement(so,{multiple:!0,value:f[y]?.in||[],dataSource:a,onCheckChange:e=>{const t=e.map((e=>e.value));b((e=>Object.assign({},e,{[y]:{in:t}})))}}))}},C=Ce("table"),w={"head-filter__popper":!0,[`${C}--lg`]:"large"===a,[`${C}--sm`]:"small"===a},T=["cell--filter",{selected:d,actived:v}];return t().createElement(Ia(),{action:["click"],popupVisible:d,popup:(()=>{const e=r.filter.type,n=S[e];return n?t().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t().createElement("div",null,n(r)),t().createElement(O.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t().createElement(he,{size:a,onClick:()=>{E({[y]:{}})}},p("qm.table.filter.reset")),t().createElement(he,{type:"primary",size:a,onClick:()=>E()},p("qm.table.filter.search")))):(g("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Se()(w),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:yo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("div",{className:Se()(T),title:p("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t().createElement("span",{className:"svgicon icon"},t().createElement(Ps,null))))},ks=e=>{const{column:r}=e,{tableProps:n,tableRef:a,bordered:i}=t().useContext(co),{columns:l,resizable:o,columnsChange:s=ne}=n,c=t().useMemo((()=>Tn(r)),[r]),d={resizable:!0,"is--line":o&&!i};return t().createElement("div",{className:Se()(d),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:r}=a.current,n=r.$resizableBar,i=t.offsetWidth/2,o=e.clientX,d=On(t,r.$table).left-r.$tableBody.parentNode.parentNode.scrollLeft+i;r.$table.classList.add("c--resize"),n.style.left=`${d}px`,n.style.display="block";const u=c.width||c.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-o,r=u+t;r<(c.minWidth||wo.defaultColumnWidth)||(p=Math.floor(r),n.style.left=`${t+d}px`)},document.onmouseup=function(){r.$table.classList.remove("c--resize"),n.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Cn(l,c.dataIndex).width=p,s([...l]))},!1}})},Fs=e=>{const{selectionKeys:r}=e,{tableRef:n,tableProps:a,getRowKey:i,pagination:l,fetchParams:o,setSelectionKeysEffect:s,setInvalidRowKeys:c,setSpinning:d,isFetch:u,isWebPagination:m}=t().useContext(co),{rowSelection:h}=a,{fetchAllRowKeys:f,selectAllOnCurrentPage:g,filterable:b,onSelectAll:y}=h,v=t().useRef([]),x=t().useMemo((()=>u&&!!f),[u,f]),E=t().useMemo((()=>!x&&!!g),[x,g]),S=t().useMemo((()=>(b??!0)&&!E),[b,E]),C=()=>{const{tableFullData:e}=n.current,{current:t,pageSize:r}=l;return m?e.slice((t-1)*r,t*r):e},w=(()=>{const{allTableData:e,allRowKeys:t,selectionRows:r}=n.current,{disabled:a}=h;if(x)return v.current.length?v.current:(0,J.union)(t,r.map((e=>i(e,e.index))));if(!E)return a?t.filter(((t,r)=>!a(e[r]))):t;const l=a?C().filter((e=>!a(e))).map((e=>i(e,e.index))):C().map((e=>i(e,e.index)));return(0,J.union)(l,r.map((e=>i(e,e.index))))})(),T=r.filter((e=>!w.includes(e))),N=r.length-T.length,I=N>0&&N<w.length,R=!!N&&N===w.length;c(T);const P=async()=>{const e=f;let t=[];d(!0);try{const r=await e.api(o);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[];const{disabled:n}=h;n&&(t=(0,J.xor)(t,C().filter((e=>n(e))).map((e=>i(e,e.index))))),v.current=t}}catch(e){}return d(!1),t},A=async e=>{let t=[];t=x?e?await P():[]:e?w.slice(0):[],t=[...new Set([...t,...T])],s(t),y?.(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(O.Checkbox,{checked:R,indeterminate:I,disabled:!w.length,onChange:e=>A(e.target.checked)}),S&&t().createElement(O.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{A(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=x?(0,J.xor)(r,await P()):(0,J.xor)(r,w),e=[...new Set([...e,...T])],s(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{A(!1)}}];return t().createElement(O.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),E&&t().createElement(O.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},Ls=e=>{const{style:r}=e,{tableProps:n,tableRef:a,isTreeTable:i,setRowExpandedKeys:l}=t().useContext(co),{expandable:o}=n,[s,c]=t().useState(o?.defaultExpandAllRows||!1);_e((()=>{const{allRowKeys:e,flattenRowKeys:t}=a.current;l(s?e.filter((e=>!(i&&t.includes(e)))):[])}),[s]);const d={[`${Ce("expand")}--icon`]:!0,expanded:s,collapsed:!s};return t().createElement("span",{className:Se()(d),title:"",onClick:e=>{e.stopPropagation(),c(!s)},style:r})},Hs=()=>t().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"})),$s=()=>t().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})),Ds=e=>{const{tableColumns:r,flattenColumns:n,sorter:a,filters:i}=e,{getRowKey:l,tableProps:o,tableRef:s,layout:c,scrollY:d,superFilters:u,selectionKeys:m,rightFixedColumns:h,treeExpandIndex:f,isFetch:g,isTreeTable:b,isGroupSubtotal:y,tableChange:v,setSorter:x,setElementStore:E,resetTableScroll:S,getStickyLeft:C,getStickyRight:w,createGroupData:T,createTableFullData:N}=t().useContext(co),{ellipsis:I,resizable:R,multipleSort:P,rowSelection:A,expandable:k}=o,[F,L]=wo.sortDirections,H=t().useRef(null),$=t().useMemo((()=>!g),[g]),D=t().useMemo((()=>!g),[g]),q=t().useMemo((()=>!k?.hideExpandAll),[k]),_=t().useMemo((()=>!(!A||(g?!A.selectAllOnCurrentPage&&!A.fetchAllRowKeys:A.hideSelectAll))),[g,A]);_e((()=>{U(),v(),S()}),[a]),_e((()=>{G(),v(),S()}),[i]),_e((()=>{G(),v(),S()}),[u]),t().useEffect((()=>{j(),!se(a)&&le((()=>U())),!se(i)&&le((()=>G()))}),[]);const j=()=>{E("$header",H.current)},K=e=>{const{dataIndex:r,type:n,sorter:i,title:l,description:o}=e;if(r===wo.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},_?t().createElement(Fs,{selectionKeys:m}):p("qm.table.config.selectionText"));if("radio"===n)return t().createElement("div",{className:"cell"},l)}const s=[];return s.push(t().createElement("div",{key:0,className:"cell",title:l},b&&r===f&&q?t().createElement(Ls,null):null,r===wo.expandableColumn&&q?t().createElement(Ls,null):l)),o&&s.push(t().createElement(O.Tooltip,{key:1,placement:"top",title:o},t().createElement(we.InfoCircleOutlined,{className:"tip"}))),i&&s.push(M(a[r])),s},M=e=>{const r=["svgicon cell--sorter__asc",{actived:e===F}],n=["svgicon cell--sorter__desc",{actived:e===L}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Se()(r)},t().createElement(Hs,null)),t().createElement("span",{className:Se()(n)},t().createElement($s,null)))},V=e=>t().createElement(As,{column:e,filters:i}),z=(e,t)=>{const{sorter:r,dataIndex:n}=t;if(r){const e=a[n],t=e?e===L?null:L:F;P?(delete a[n],x(Object.assign({},a,{[n]:t}))):x(Object.assign({},{[n]:t}))}},U=()=>{$&&B()},B=e=>{const t=(0,J.pickBy)(a,(e=>null!==e));for(const e in t){const r=n.find((t=>t.dataIndex===e));r?W(r,t[e]):delete t[e]}e||Object.keys(t).length||W({dataIndex:"index"},F)},W=(e,t)=>{const{tableFullData:r}=s.current,{dataIndex:n,sorter:a}=e,i=(e,r)=>{const a=Ln(e,n),i=Ln(r,n);return Number.isNaN(a-i)?t===F?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===F?a-i:i-a},l=y?T(Mn(r).sort("function"==typeof a?a:i)):r.sort("function"==typeof a?a:i).slice(0);N(l)},G=()=>{D&&Y()},Y=()=>{const{tableOriginData:e}=s.current,t=u.length?Vn(u):Vn(i),r=""!==t?y?T(yn(Mn(e),t,b)):yn(e,t,b):e;N(r),B(!0)},X=Pn(r),Q=Ce("table"),{tableBodyWidth:Z}=c;return t().createElement("div",{ref:H,className:`${Q}--header-wrapper`},t().createElement("table",{className:`${Q}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},(()=>{const{gutterWidth:e}=c;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),d&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("thead",null,(e=>{const{isIE:r}=s.current,n=["gutter",{"cell-fix-right":!!h.length}],i=r?null:{right:h.length?0:""};return e.map(((e,r)=>t().createElement("tr",{key:r,className:"header--row"},e.map(((r,n)=>((e,r,n)=>{const{isIE:i}=s.current,{gutterWidth:l}=c,{dataIndex:o,colSpan:u,rowSpan:p,fixed:m,align:h,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===u)return null;const E=f||h,S=["header--column",{"col--ellipsis":e.ellipsis??I,"col--center":"center"===E,"col--right":"right"===E,"column--required":!!v,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!a[o],"cell-fix-left":!i&&"left"===m,"cell-fix-right":!i&&"right"===m,"cell-fix-left-last":!i&&"left"===m&&!n[r+1]?.fixed,"cell-fix-right-first":!i&&"right"===m&&!n[r-1]?.fixed,[g]:!!g}],T=i?null:{left:"left"===m?`${C(o)}px`:"",right:"right"===m?`${w(o)+(d?l:0)}px`:""},N=R&&![wo.expandableColumn,wo.selectionColumn].includes(o);return t().createElement("th",{key:o,className:Se()(S),colSpan:u,rowSpan:p,style:{...T},onClick:t=>z(t,e)},t().createElement("div",{className:"cell--wrapper"},x?t().createElement("div",{className:"cell--text cell"},x(e,s.current.tableFullData)):t().createElement(t().Fragment,null,t().createElement("div",{className:"cell--text"},K(e)),y?V(e):null)),N&&t().createElement(ks,{column:e}))})(r,n,e))),d&&t().createElement("th",{className:Se()(n),style:{...i}}))))})(X))))};const qs=e=>{const{selectionKeys:r,column:n,record:a,rowKey:i}=e,{tableProps:l,tableRef:o,isTreeTable:s,getAllChildRowKeys:c}=t().useContext(co),{rowSelection:d}=l,u=t().useMemo((()=>n.type||""),[n.type]),p=e=>{const t=d.checkStrictly??!0;if(!s||t)return!1;const n=In(o.current.deriveRowKeys,e),a=c(n?.children??[]);return!(!Array.isArray(n?.children)||Fn(r,n?.children.map((e=>e.rowKey))||[]))&&a.some((e=>r.includes(e)))};return"radio"===u?(()=>{const e=d.disabled,n=e?.(a),l=!n&&r[0]===i;return t().createElement(O.Radio,{checked:l,disabled:n})})():(()=>{const e=d.disabled,n=e?.(a),l=!!r.includes(i);return t().createElement(O.Checkbox,{checked:l,indeterminate:p(i),disabled:n})})()},_s=e=>{const{record:r,rowKey:n,style:a}=e,{tableProps:i,rowExpandedKeys:l,setRowExpandedKeys:o}=t().useContext(co),{expandable:s={}}=i,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(r)),d=t().useMemo((()=>l.includes(n)),[l,n]);_e((()=>{s.onExpand?.(d,r)}),[d]);const u={[`${Ce("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t().createElement("span",{className:Se()(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?l.filter((e=>e!==n)):[...l,n];o(t)},style:a})},js=t().forwardRef(((e,r)=>{const{size:n,defaultValue:a,value:i,min:l,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:m,allowClear:h,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<l&&(t=l.toString()),p>=0&&""!==t&&(t=new(oa())(t).toFixed(p)),t},E=void 0!==i,[S,C]=t().useState(a??""),w=b(E?i:S),T=y(w);return _e((()=>{e.onChange?.(T)}),[S]),t().createElement(O.Input,{ref:r,size:n,value:w,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value);let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),l>=0&&r.startsWith("-")&&(n=!1),n){if(!m&&r.replace(/^-|\./g,"").length>17)return;(t=>{E?e.onChange?.(t):C(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(T);e.onBlur?.(t,T)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(T),T)}})}));js.displayName="InputNumber";const Ks=js;function Ms(){return Ms=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ms.apply(this,arguments)}const{Search:Vs}=O.Input,zs=t().forwardRef(((e,r)=>{const{column:n,record:a,rowKey:i,columnKey:l,clicked:o,text:s,cellBgColor:c}=e,{tableRef:d,tableBodyRef:u,$size:m,flattenColumns:h,updateTableData:f,doFieldValidate:b,dataChange:y}=t().useContext(co),v=ko(),{store:x,fieldAuth:E}=d.current,S=n.editRender?.(a,n)||{},C=t().useRef(null),w=t().useRef(null),T=t().useRef(null),N=t().useRef(null),I=t().useRef(null),R=t().useRef(null),P=t().useRef(!1),A=t().useRef({}),k=t().useRef({}),F=t().useRef([]),[L,H]=t().useState(!1),[$,D]=t().useState(!1),[_,j]=t().useState(!1),[K,V]=t().useState(S.items||[]),[z,U]=t().useState(),B=(S.editable||(0,J.isEqual)(o,[i,l]))&&!S.disabled&&!E[l]?.disabled,W=`${i}|${l}`,G=2===o.length?`${o[0]}|${o[1]}`:"",Y=![...x.state.required,...x.state.validate].some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),X=x.state.required.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",Q=x.state.validate.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",Z=x.state.edited.some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),ee=B||!Y||L||_||$,te=!!S.helper?.combinedDataIndex&&("search-helper"===S.type||"tree-helper"===S.type),re=S.type?.endsWith("multiple");t().useEffect((()=>{ee&&G===W&&se()}),[o]),t().useLayoutEffect((()=>{const{items:e}=S;re&&e&&oe(e.map((e=>({[k.current.valueKey]:e.value,[k.current.textKey]:e.text}))))}),[]),t().useLayoutEffect((()=>{const{extra:e={}}=S,t=w.current||C.current;!(0,J.isUndefined)(e.disabledBackgroundColor)&&t&&(t.parentNode.parentNode.style.backgroundColor=e.disabledBackgroundColor||c)}),[S.extra?.disabledBackgroundColor]);const ne=()=>{f(),y()},ie=(e,t)=>{H(e),t?.()},oe=e=>{F.current=e},se=()=>{const{type:e}=S;switch(e){case"text":T.current?.focus();break;case"number":N.current?.select();break;case"search-helper":I.current?.focus();break;case"tree-helper":R.current?.focus()}};t().useImperativeHandle(r,(()=>({focus:se})));const ce=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0}))},de=(e,t,r)=>{const{cornerSign:n=!0}=S.extra||{};x.addToUpdated(e),n&&x.addToEdited({x:t,y:r})},ue=e=>""!==e?Number(e):"",pe={text:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:c=[],onInput:d,onChange:u,onEnter:h,onBlur:f}=S,g=Ln(e,a),y=Object.assign({},{minRows:1,maxRows:4},s.autoSize),x=n?{rows:y.minRows,autoSize:y}:null,E=s.password?O.Input.Password:n?O.Input.TextArea:O.Input;return t().createElement(E,Ms({ref:T,size:m,value:g,maxLength:s.maxLength,showCount:s.showCount},x,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||p("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";Hn(e,a,r),b(c,r,i,l),v(),d?.({[W]:r}),P.current=!0},onFocus:()=>D(!0),onBlur:t=>{D(!1);const r=t.target.value??"";P.current&&(P.current=!1,de(e,i,l),u?.({[W]:r},e),f?.({[W]:r},e),ne())},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";h?.({[W]:r},e)}},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||e.preventDefault()}}))},textarea:(e,t)=>pe.text(e,t,!0),number:(e,r)=>{const{dataIndex:n,precision:a,formatType:o}=r,{type:s,extra:c={},rules:d=[],onInput:u,onChange:h,onEnter:f,onBlur:g}=S,y=Ln(e,n);let x,E;return"finance"===o&&(x=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},E=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(x=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(oa())(e).times(100).toNumber()}`,E=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(oa())(e).times(.01).toString()),t().createElement(Ks,{ref:N,size:m,value:y,min:c.min,max:c.max,precision:a,stringMode:c.stringMode,prefix:c.prefix,suffix:c.suffix??("percent"===o?"%":void 0),placeholder:c.placeholder||p("qm.table.editable.inputPlaceholder"),maxLength:c.maxLength,allowClear:c.allowClear,readOnly:c.readOnly,disabled:c.disabled,formatter:x,parser:E,onChange:t=>{Hn(e,n,t),b(d,t,i,l),v(),u?.({[W]:t}),P.current=!0},onFocus:()=>D(!0),onBlur:(t,r)=>{if(D(!1),!P.current)return;P.current=!1;let a=c.stringMode?t:ue(t);"percent"===o&&"."===r.charAt(r.length-1)&&(a=Number(t)/100),Hn(e,n,a),de(e,i,l),h?.({[W]:a},e),g?.({[W]:a},e),ne()},onEnter:(t,r)=>{let n=c.stringMode?t:ue(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),f?.({[W]:n},e)}})},select:(e,r,n)=>{const{dataIndex:a,dictItems:o=[]}=r,{type:s,extra:c={},rules:u=[],items:h,onChange:f,onEnter:g}=S,{elementStore:y}=d.current,v=h||o,x=Ln(e,a);let E=x;return t().createElement(O.Select,{mode:n?"multiple":void 0,size:m,popupClassName:"table-editable__popper",value:x||void 0,placeholder:c.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:c.allowClear,listHeight:c.listHeight,maxTagCount:c.collapseTags?"responsive":void 0,maxTagTextLength:c.maxTagTextLength,disabled:c.disabled,style:{width:"100%"},showSearch:c.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${Wr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{Hn(e,a,t),b(u,t,i,l),de(e,i,l),f?.({[W]:t},e),ne()},onSelect:e=>{E=e},onInputKeyDown:t=>{13===t.keyCode&&le((()=>g?.({[W]:E},e)))}},v.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>pe.select(e,t,!0),date:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:c=[],onChange:d}=S,u=n?go:fo,h=Ln(e,a);return t().createElement(q,{showTime:n,size:m,popupClassName:"table-editable__popper",value:qn(h,u)??void 0,format:s.format||u,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:p(n?"qm.table.editable.datetimePlaceholder":"qm.table.editable.datePlaceholder"),allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=_n(t,u);Hn(e,a,r),b(c,r,i,l),de(e,i,l),d?.({[W]:r},e),ne()}})},datetime:(e,t)=>pe.date(e,t,!0),time:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},rules:s=[],onChange:c}=S,d="HH:mm:ss",u=Ln(e,n);return t().createElement(M,{size:m,popupClassName:"table-editable__popper",value:qn(u,d)??void 0,format:o.format||d,placeholder:p("qm.table.editable.datetimePlaceholder"),allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=_n(t,d);Hn(e,n,r),b(s,r,i,l),de(e,i,l),c?.({[W]:r},e),ne()}})},checkbox:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=S,{trueValue:c=mo,falseValue:d=ho,disabled:u}=o,p=Ln(e,n);return t().createElement(O.Checkbox,{checked:p===c,disabled:u,onChange:t=>{const r=t.target.checked?c:d;Hn(e,n,r),de(e,i,l),s?.({[W]:r},e),ne()}})},switch:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=S,{trueValue:c=mo,falseValue:d=ho,disabled:u}=o,p=Ln(e,n);return t().createElement(O.Switch,{checked:p===c,disabled:u,onChange:t=>{const r=t?c:d;Hn(e,n,r),de(e,i,l),s?.({[W]:r},e),ne()}})},"search-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:c=[],helper:d={},onInput:u,onChange:f,onEnter:y}=S,v=$n(e,te?d.combinedDataIndex:n),x=d.fieldAliasMap;x||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),te&&(d.combinedDataIndex.split("|").every((e=>Object.keys(E).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),E[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=e=>{const{filterAliasMap:t}=d,r=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[n]:r};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,J.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i},T=e=>{const{autoQueryAssign:t=!0}=d;t&&(A.current=w(e)),H(!0)},N=(t,n)=>{const{beforeOpen:a}=d,i=(a??ae)({[W]:v},e,r);i?.then?i.then((()=>{T(t),n?.()})).catch((()=>{})):!1!==i&&(T(t),n?.())},R=e=>{const t={};for(const r in E){const a=E[r];r!==n&&(t[r]=$n(e,a))}const r=E[n]?$n(e,E[n]):"";k(r,t);const{closed:a}=d;ie(!1,(()=>ce(C.current))),se(),a?.(e)},O=()=>{const{onlySelect:e=!0}=d;P.current&&k(e?"":v),ie(!1,(()=>ce(C.current)))},k=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(r)&&Object.keys(r).length)for(const t in r){const n=r[t],a=h.find((e=>e.dataIndex===t));if(a){Hn(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&b(r.rules,n,i,t)}else Hn(e,t,n)}te&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return Hn(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&Hn(e,t,a[r]?.trim())}))})(e,d.combinedDataIndex),Hn(e,n,t,a),b(c,t,i,l),de(e,i,l),f?.({[W]:t},e),ne(),A.current={},P.current=!1,U(void 0)},F={visible:L,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${fa[m]+20}px`},onClose:()=>{O()}},$={...d,size:m,initialValue:Object.assign({},A.current,d.initialValue),onClose:e=>{e?R(e):O()}};return t().createElement(t().Fragment,null,t().createElement(Vs,{ref:I,value:z??v,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:r=!0,table:a}=d;if(P.current&&!L)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=d,{beforeFetch:n=ae}=t.fetch;return new Promise((async(a,i)=>{const l=(0,J.merge)({},t.fetch.params,{...r,...w(e)},{currentPage:1,pageSize:500});if(!n(l))return i();j(!0);try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{le((()=>j(!1)))}}))})(t).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>$n(t,E[n]).toString().includes(e)));if(1===t.length)return R(t[0]);N(e)}(e,t))).catch((()=>k(""))):void k(t)},onChange:e=>{const{value:t}=e.target;u?.({[W]:t}),P.current=!0,U(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";y?.({[W]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;N(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&N(e)}}),t().createElement(cr,F,t().createElement(dc,$)))},"search-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,items:o=[],extra:s={},rules:c=[],helper:d={},onInput:u,onChange:h,onEnter:f}=S,y=Ln(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof v?v():v||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),k.current=x;const E=t=>{const{beforeOpen:n}=d,a=(n??ae)({[W]:y},e,r);a?.then?a.then((()=>{H(!0),t?.()})).catch((()=>{})):!1!==a&&(H(!0),t?.())},w=()=>{ie(!1,(()=>ce(C.current)))},T=t=>{Hn(e,n,t),b(c,t,i,l),de(e,i,l),h?.({[W]:t},e,F.current),ne()},N={visible:L,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${fa[m]+20}px`},onClose:()=>{w()}},I={...d,size:m,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=x;oe((0,J.uniqBy)([...F.current.filter((e=>t.includes(e[n]))),...e],n));const a=F.current.map((e=>({text:e[r],value:e[n]}))),i=(0,J.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));V(i),T(i.map((e=>e.value)));const{closed:l}=d;ie(!1,(()=>ce(C.current))),l?.(F.current)})(e,t):w()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(O.Select,{mode:"multiple",open:!1,value:y,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&f?.({[W]:y},e)},onDoubleClick:()=>{s.disabled||E()},onChange:e=>{const{valueKey:t}=x;oe(F.current.filter((r=>e.includes(r[t])))),T(e)}},K.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(O.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{E()}})))),t().createElement(cr,N,t().createElement(dc,I)))},"tree-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:c=[],helper:d={},onChange:u,onEnter:f}=S,y=$n(e,te?d.combinedDataIndex:n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof v?v():v||{};Object.keys(x).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),te&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=t=>{const{beforeOpen:n}=d,a=(n??ae)({[W]:y},e,r);a?.then?a.then((()=>{H(!0),t?.()})).catch((()=>{})):!1!==a&&(H(!0),t?.())},w=()=>{ie(!1,(()=>ce(C.current)))},T=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(r)&&Object.keys(r).length)for(const t in r){const n=r[t],a=h.find((e=>e.dataIndex===t));if(a){Hn(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&b(r.rules,n,i,t)}else Hn(e,t,n)}Hn(e,n,t,a),b(c,t,i,l),de(e,i,l),u?.({[W]:t},e),ne()},N={visible:L,title:p("qm.searchHelper.text"),width:d.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${fa[m]+20}px`},onClose:()=>{w()}},I={...d,defaultSelectedKeys:[y],size:m,onClose:e=>{e?(e=>{const t={};for(const r in x){const a=x[r];r!==n&&(t[r]=$n(e,a))}const r=x[n]?$n(e,x[n]):"";T(r,t);const{closed:a}=d;ie(!1,(()=>ce(C.current))),se(),a?.(e)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement(Vs,{ref:R,value:y,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";f?.({[W]:r},e)}},onDoubleClick:()=>{E()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?E():T(""))}}),t().createElement(cr,N,t().createElement(yc,I)))},"tree-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},items:s=[],rules:c=[],helper:d={},onInput:u,onChange:h,onEnter:f}=S,y=Ln(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof v?v():v||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),k.current=x;const E=t=>{const{beforeOpen:n}=d,a=(n??ae)({[W]:y},e,r);a?.then?a.then((()=>{H(!0),t?.()})).catch((()=>{})):!1!==a&&(H(!0),t?.())},w=()=>{ie(!1,(()=>ce(C.current)))},T=t=>{Hn(e,n,t),b(c,t,i,l),de(e,i,l),h?.({[W]:t},e,F.current),ne()},N={visible:L,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${fa[m]+20}px`},onClose:()=>{w()}},I={...d,size:m,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=x;oe(e);const n=F.current.map((e=>({text:e[t],value:e[r]})));V(n),T(n.map((e=>e.value)));const{closed:a}=d;ie(!1,(()=>ce(C.current))),a?.(F.current)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(O.Select,{mode:"multiple",open:!1,value:y,placeholder:o.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&f?.({[W]:y},e)},onDoubleClick:()=>{o.disabled||E()},onChange:e=>{const{valueKey:t}=x;oe(F.current.filter((r=>e.includes(r[t])))),T(e)}},K.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(O.Button,{className:"ant-input-search-button",disabled:o.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{E()}})))),t().createElement(cr,N,t().createElement(yc,I)))}};return t().createElement(t().Fragment,null,ee?(()=>{const{type:e}=S,r=pe[e];if(!r)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!Y}];return t().createElement("div",{ref:C,className:Se()(i)},r(a,n),!Y&&t().createElement("div",{className:"cell-error"},X||Q))})():(()=>{const{extra:e={}}=S,r=te?$n(a,S.helper.combinedDataIndex):s;return t().createElement("span",{ref:w,style:{color:e.disabledColor}},r)})(),Z&&t().createElement("i",{className:"cell--sign"}))}));zs.displayName="CellEdit";const Us=zs,Bs=require("copy-to-clipboard");var Ws=n.n(Bs);const Gs=function(e){if(!t().isValidElement(e))return null;for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return t().cloneElement(e,...n)},Ys=e=>{const{text:r,options:n,showMessage:a=!0,onCopy:i}=e;return Gs(e.children,{onClick:l=>{const o=t().Children.only(e.children),s=Ws()(r,n);i?.(r,s),s&&a&&O.message.success(p("qm.clipboard.success")),o&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(l)}})};Ys.displayName="QmCopyToClipboard";const Xs=Ys;function Qs(){return Qs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qs.apply(this,arguments)}const Zs=t().forwardRef(((r,n)=>{const{tableData:a,flattenColumns:i}=r,{getRowKey:l,tableProps:o,tableRef:c,editableColumns:d,leftFixedColumns:u,rightFixedColumns:m,treeExpandIndex:h,sorter:f,layout:b,showFooter:y,scrollX:v,scrollY:x,selectionKeys:E,rowExpandedKeys:S,highlightKey:C,isPingLeft:w,isPingRight:T,isTableEmpty:N,isTreeTable:I,isGroupSubtotal:R,isWebPagination:P,isDragMergeCell:O,setElementStore:A,createTableFullData:k,setSelectionKeysEffect:F,setHighlightKey:L,getStickyLeft:H,getStickyRight:$,scrollXToColumn:D,scrollYToRecord:q,rowInViewport:_,dataChange:j,setPingLeft:K,setPingRight:M,setFullScreen:V,findParentRowKeys:z,getAllChildRowKeys:U,triggerScrollYEvent:B,scrollBottomDebouncer:W}=t().useContext(co),{height:G,minHeight:Y,maxHeight:X,rowSelection:Q,rowHighlight:Z,treeConfig:ee,expandable:re,stripe:ie,summation:le,rowStyle:se,cellStyle:ce,spanMethod:de,nativeScrollBar:ue,ellipsis:pe,showHeader:me,rowDraggable:fe,onRowClick:ge,onRowDblclick:be,onRowContextmenu:ye,onRowEnter:ve}=o,xe=t().useRef(null),Ee=t().useRef({}),Te=t().useRef(null),Ne=t().useRef({prevST:0,prevSL:0}),{dragStart:Ie,renderDragPanel:Re,closeDragPanel:Pe}=(()=>{const{tableProps:e,tableRef:r,layout:n,flattenColumns:a,isDragMergeCell:i}=t().useContext(co),{mergeCells:l=[],onMergeChange:o}=e,[s,c]=t().useState(!1),d=t().useRef(null),u=t().useRef(null),m=t().useRef({x:0,y:0,disX:0,disY:0}),h=Ce("table");_e((()=>{i||E()}),[i]);const f=()=>{E(),Be(d.current,{display:"none"})},g=e=>{const t=[];for(let r=0;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push([e.row+r,e.col+n]);return t},b=()=>{m.current={x:0,y:0,disX:0,disY:0},u.current&&!S(u.current)||(u.current=null,f()),c(!0),document.removeEventListener("mousemove",y)},y=e=>{const{pageX:t,pageY:r}=e,{x:a,y:i,disX:l,disY:o}=m.current;let s=l,c=o,u=t-a,p=r-i;return u<0&&(u=Math.abs(u),s=l-u,Be(d.current,{left:`${s}px`})),p<0&&(p=Math.abs(p),c=o-p,Be(d.current,{top:`${c+n.headerHeight}px`})),Be(d.current,{width:`${u}px`,height:`${p}px`}),v(s,c,u,p),!1},v=Ct(((e,t,n,i)=>{const{allTableData:l,scrollYStore:o}=r.current;let s=-1,c=-1,d=-1,p=-1;for(let e=0;e<l.length;e++)t>o.rowHeight*e&&t<o.rowHeight*(e+1)&&(s=e),t+i>o.rowHeight*e&&t+i<o.rowHeight*(e+1)&&(c=e);let m=0;for(let t=0;t<a.length;t++)e>m&&e<m+C(a[t])&&(d=t),e+n>m&&e+n<m+C(a[t])&&(p=t),m+=C(a[t]);const h={row:s,col:d,rowSpan:c-s+1,colSpan:p-d+1};(0,J.isEqual)(u,h)||(u.current=h,x(s,c,d,p))}),5),x=(e,t,n,a)=>{const{elementStore:i,scrollYStore:l}=r.current,o=i.$tableBody.querySelectorAll("tbody > tr");for(let r=0;r<o.length;r++){const i=o[r].children;for(let o=0;o<i.length;o++)if(i[o].classList.remove("selected"),(e!==t||n!==a)&&r+l.startIndex>=e&&r+l.startIndex<=t){const e=Number(i[o].getAttribute("colspan")),t=Number(i[o].getAttribute("data-index")),r=e>1?t+e-1:t;r>=n&&r<=a&&i[o].classList.add("selected")}}},E=()=>{const{elementStore:e}=r.current,t=e.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<t.length;e++){const r=t[e].children;for(let e=0;e<r.length;e++)r[e].classList.remove("selected")}},S=e=>1===e.rowSpan&&1===e.colSpan,C=e=>e.width||e.renderWidth||e.minWidth||wo.defaultColumnWidth;return{dragStart:e=>{const{pageX:t,pageY:a}=e,{elementStore:i}=r.current,{x:l,y:o}=(e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}})(i.$table),{scrollLeft:s,scrollTop:p}=i.$tableBody.parentNode.parentNode;u.current=null,m.current={x:t,y:a,disX:t+s-l,disY:a+p-(o+n.headerHeight)},Be(d.current,{width:0,height:0,left:t-l+"px",top:a-o+"px",display:"block"}),E(),c(!1),document.addEventListener("mousemove",y,{passive:!0}),document.addEventListener("mouseup",b,{passive:!0,once:!0})},renderDragPanel:()=>t().createElement("div",{ref:d,className:`${h}--merge-cell`,onMouseDown:e=>e.stopPropagation()},s&&t().createElement(t().Fragment,null,t().createElement(he,{size:"small",className:"btn cancel",onClick:()=>{if(u.current&&!S(u.current)){const e=g(u.current),t=l.findIndex((t=>{const r=g(t);return(0,J.intersectionWith)(r,e,J.isEqual).length===r.length}));-1!==t&&o?.(l.filter(((e,r)=>r!==t)))}f()}},p("qm.table.mergeCell.cancel")),t().createElement(he,{size:"small",type:"primary",className:"btn confirm",onClick:()=>{if(u.current&&!S(u.current)){const e=g(u.current);let t=!1;for(let r=0;r<l.length;r++)(0,J.intersectionWith)(g(l[r]),e,J.isEqual).length&&(t=!0);t||o?.([...l,u.current])}f()}},p("qm.table.mergeCell.confirm")))),closeDragPanel:f}})(),Oe={dateFormat:e=>{const t=e?s()(e).format(fo):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(go):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(go.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(Number(e))?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>Dn(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},Ae=t().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:a}=b,i={};return N&&Object.assign(i,{minHeight:"100px"}),Y&&Object.assign(i,{minHeight:An(Y)-e-r+"px"}),X&&Object.assign(i,{maxHeight:An(X)-e-r+"px"}),G||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[G,X,Y,N,b]),ke=t().useMemo((()=>{const{tableBodyWidth:e,gutterWidth:t}=b;return e&&x?e-t:e}),[b,x]),Fe=t().useMemo((()=>{const{scrollYStore:e}=c.current,{viewportHeight:t,gutterWidth:r}=b;return Math.floor((v?t-r:t)/e.rowHeight)}),[b,v]),[Le,He]=t().useState([]),$e=ko(),De=function(t,r){const[n,a]=e.useState(!1);return e.useEffect((()=>{let e;const n=t.current,i=t=>{e=t},l=t=>{((e,t)=>{const i=e.target,l=t?.target,o=!i||!l,s=n?.contains(i)||n?.contains(l),c=n===i,d=r?.map((e=>document.querySelector(e))),u=d?.some((e=>e?.contains(i)))||d?.includes(l);a(!(o||s||c||u))})(t,e)};return n&&(Me(document,"mousedown",i),Me(document,"mouseup",l)),()=>{n&&(Ve(document,"mousedown",i),Ve(document,"mouseup",l))}}),[t]),n}(xe,[".table-editable__popper"]);t().useImperativeHandle(n,(()=>({renderCellTitle:tt,setClickedValues:ze,createFocus:Ke,forceUpdate:$e}))),_e((()=>{De&&(ze([]),O&&Pe())}),[De]),_e((()=>{Le.length&&Eo.focus(c.current.uid)}),[Le]),t().useEffect((()=>{je()}),[]);const qe=t().useCallback((e=>{const{keyCode:t}=e;if(c.current.uid===Eo.getFocusInstance()?.id&&(27===t&&(ze([]),L(""),V(!1)),Le.length&&(Xe(document.activeElement,xe.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===Q?.type||Z)){const t=E[0]??C??null,r=a.find((e=>l(e,e.index)===t))??null;r&&ve?.(r,e)}if(38===t||40===t){Ue(e);const{allTableData:r}=c.current,n=P?Rn(a):r,i=n.length;let o=n.findIndex((e=>l(e,e.index)===Le[0]));const s=38===t?(--o+i)%i:++o%i,d=n[s],u=l(d,d.index);"radio"!==Q?.type||Q.disabled?.(d)||F([u]),Z&&!Z.disabled?.(d)&&L(u),_(s)||(38===t&&q(u,s),40===t&&q(u,Fe>s+1?0:s+1-Fe)),ze([u,Le[1]])}if(9===t){if(Ue(e),!d.length)return ze([]);const t=d.length;let r=d.findIndex((e=>e.dataIndex===Le[1]));const n=++r%t,a=d[n].dataIndex;ze([Le[0],a]),D(a)}}}),[Le,a,E,d,Fe]);t().useEffect((()=>{const e=qt()(document,"keydown",qe);return()=>e.remove()}),[qe]);const je=()=>{A("$tableBody",xe.current),A("$tableYspace",Te.current)},Ke=(e,t)=>{Ee.current[`${e}-${t}`]?.focus()},ze=e=>{(0,J.isEqual)(e,Le)||He(e)},We=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),Ge=(e,t,r)=>{const{deriveRowKeys:n}=c.current,a=In(n,e);let i=[];const l=U(a?.children||[]),o=Un(n,e)?.slice(0,-1).reverse()||[];return i=r?[...new Set([...t,e,...l])]:t.filter((t=>![e,...l].includes(t))),o.forEach((e=>{const t=In(n,e),r=Fn(i,t?.children?.map((e=>e.rowKey))||[]);i=r?[...i,e]:i.filter((t=>t!==e))})),i},Ye=e=>Array.isArray(e.children),Qe=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];return e.forEach((e=>{const a=e.index,o=l(e,e.index);if(n.push(Ze(e,a,o,r)),re?.expandedRowRender){const{expandedRowClassName:r,rowExpandable:l=ae}=re;S.includes(o)&&l(e)&&n.push(t().createElement("tr",{key:`expand_${o}`,className:"body--row-expanded"},t().createElement("td",{colSpan:i.length,className:"body--column",style:{paddingLeft:Q?2*wo.selectionColumnWidth:wo.selectionColumnWidth}},t().createElement("div",{className:Se()("cell",r)},re.expandedRowRender(e,a)))))}if(!ee?.virtual&&Ye(e)){const t="function"!=typeof re?.rowExpandable||re.rowExpandable(e);S.includes(o)&&t&&n.push(...Qe(e.children,r+1))}})),n},Ze=function(e,r,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const l=["body--row",{"body--row-striped":ie&&r%2!=0,"body--row-selected":E.includes(n),"body--row-current":C===n,...R?ot(e._group):null}];return t().createElement("tr",{key:n,className:Se()(l)},i.map(((t,i)=>Je(t,i,e,r,n,a))))},Je=(e,r,n,a,i,o)=>{const{isIE:s}=c.current,{dataIndex:d,fixed:p,align:h,className:g=""}=e,{rowSpan:b,colSpan:y}=at(n,e,a,r);if(!b||!y)return null;const v=e.ellipsis??pe,x=!s&&"left"===p,S=!s&&"right"===p,C=["body--column",{"col--ellipsis":v,"col--center":"center"===h,"col--right":"right"===h,"column--sort":!!f[d],"cell-fix-left":x,"cell-fix-right":S,"cell-fix-left-last":x&&u[u.length-1].dataIndex===d,"cell-fix-right-first":S&&m[0].dataIndex===d,[g]:!!g}],w=s?null:{left:x?`${H(d)}px`:"",right:S?`${$(d)}px`:""},T=se?"function"==typeof se?se(n,a):se:null,N=ce?"function"==typeof ce?ce(n,e,a,r):ce:null,P=R?lt(n._group):null,O=Object.assign({},w,P,T,N),A=tt(e,n,a,r);let k="";for(const e in O)e.startsWith("background")&&(k=O[e]??"");return t().createElement("td",{key:d,title:v?A:void 0,rowSpan:b>1?b:void 0,colSpan:y>1?y:void 0,"data-index":r,className:Se()(C),style:O,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([wo.expandableColumn,wo.operationColumn].includes(n))return;const a=l(t,t.index);ze([a,n]);const i=r.editRender?.(t,r),o=i&&!i.disabled,{type:s,selectByClickRow:c=!0,disabled:d=ne}=Q||{};!s||d(t)||o||(c||n===wo.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=Q||{};if("radio"===r&&F([e]),"checkbox"===r){const r=!E.includes(e),i=I&&!n?Ge(e,E,r):We(e,E,r);F(i),a?.(r,t,i)}})(a,t),[wo.selectionColumn].includes(n)||(!Z||Z.disabled?.(t)||o||L(a),ge?.(t,r,e))})(t,n,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[wo.expandableColumn,wo.selectionColumn,wo.operationColumn].includes(n)||be?.(t,r,e)})(t,n,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[wo.expandableColumn,wo.selectionColumn,wo.operationColumn].includes(n)||ye?.(t,r,e)})(t,n,e)},t().createElement("div",{className:"cell"},et(e,n,a,r,i,o,{cellText:A,cellBgColor:k})))},et=(e,r,n,a,i,l,o)=>{const{dataIndex:s,canCopy:c,editRender:d,render:u}=e,m=Ln(r,s);if(s===wo.expandableColumn)return t().createElement(_s,{record:r,rowKey:i});if(s===wo.selectionColumn)return t().createElement(qs,{selectionKeys:E,column:e,record:r,rowKey:i});const f=rt(m,e,r);if(d)return t().createElement(Us,{ref:e=>Ee.current[`${i}-${s}`]=e,column:e,record:r,rowKey:i,columnKey:s,clicked:Le,text:f,cellBgColor:o.cellBgColor});const g=u?u(m,r,e,n,a):f;return I&&s===h?[it(ee?.virtual?r._level:l),t().createElement(_s,{key:"expand",record:r,rowKey:i,style:Ye(r)?{}:{visibility:"hidden"}}),g]:c?t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},g),o.cellText&&t().createElement(Xs,{text:o.cellText},t().createElement(we.CopyOutlined,{className:"icon",title:p("qm.table.config.copyText"),onClick:e=>e.stopPropagation()}))):g},tt=(e,t,r,n)=>{const{dataIndex:a,render:i}=e;if([wo.expandableColumn,wo.selectionColumn,wo.operationColumn].includes(a))return"";let l="";const o=Ln(t,a);if("function"==typeof i){const a=i(o,t,e,r,n);l=te(a)?Kn(a).join(""):a}else l=rt(o,e,t).toString();return l},rt=(e,t,r)=>{const{dictItems:n,precision:a,displayPrecision:i,formatType:l,editRender:o}=t,s=n||o?.(r,t)?.items||[],c=s.find((t=>t.value==e));let d=c?.text??e??"";if(Array.isArray(e)&&(d=e.map((e=>{const t=s.find((t=>t.value==e));return t?.text??e})).join(",")),a>=0&&""!==d&&(d=Number.isNaN(Number(d))?d:new(oa())(d).toFixed(a)),i>=0&&""!==d&&(d=nt(d,i)),l){const e=Oe[`${oe(l)}Format`];e?d=e(d):g("Table","字段的格式化类型 `formatType` 配置不正确")}return d},nt=(e,t)=>{const r=e.toString();if(Number.isNaN(Number.parseFloat(r))||0===t)return e;const n=Number.parseFloat(r).toString(),a=n.indexOf(".");if(-1===a)return n+"."+"0".repeat(t);const i=Math.max(0,t-(n.length-a-1));return n+"0".repeat(i)},at=(e,t,r,n)=>{let i=1,l=1;if("function"==typeof de){const o=de({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});if(Array.isArray(o)?(i=o[0],l=o[1]):(0,J.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan),e===a[0]&&0===i){i=1;for(let e=1;e<a.length;e++){const{rowSpan:r}=at(a[e],t,a[e].index,n);if(r>0)break;i++}}}const{mergeCells:o}=c.current;if(o.length>0){const e=o.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},it=e=>e?t().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*wo.treeTable.textIndent+"px"}}):null,lt=e=>{const{backgroundColor:t,color:r}=le.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},ot=e=>{const t=le.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},st=Ce("table"),ct=O?{onMouseDown:Ie}:null;return t().createElement(t().Fragment,null,t().createElement(Pt,{wrapClassName:`${st}--body-wrapper`,wrapStyle:Ae,native:ue,onScroll:e=>{const{elementStore:t,scrollYLoad:r}=c.current,{prevST:n,prevSL:a}=Ne.current,i=x?b.gutterWidth:0,{scrollTop:l,scrollLeft:o}=e;if(o!==a){me&&(t.$header.scrollLeft=o),y&&(t.$footer.scrollLeft=o);const e=o>0,r=Math.ceil(o)+b.tableWidth<b.tableBodyWidth+i;w!==e&&K(e),T!==r&&M(r)}if(r&&l!==n&&B(l),x&&l!==n){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(l)+b.viewportHeight-i>=r&&W({type:"scroll",target:e,preventDefault:ne,stopPropagation:ne})}Ne.current.prevST=l,Ne.current.prevSL=o}},t().createElement("div",{ref:Te,className:"body--y-space"}),t().createElement("div",{className:"body--x-space",style:{width:ke?`${ke}px`:""}}),t().createElement("table",Qs({ref:xe,className:`${st}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},ct,{style:{width:ke?`${ke}px`:""}}),t().createElement("colgroup",null,i.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})}))),fe?t().createElement(Yn.ReactSortable,{itemKey:e=>l(e,e.index),tag:"tbody",animation:200,list:a,setList:e=>{const t=e.map((e=>l(e,e.index))),r=a.map((e=>l(e,e.index)));if((0,J.isEqual)(t,r))return;const n=Gn(e),i=[];c.current.tableFullData.forEach((e=>{a.includes(e)?i.push(n.shift()):i.push(e)})),k(i),j()}},a.map((e=>Ze(e,e.index,l(e,e.index))))):t().createElement("tbody",null,Qe(a)))),O&&Re())}));Zs.displayName="TableBody";const Js=Zs,ec=e=>{const{summationRows:r,flattenColumns:n}=e,{getRowKey:a,tableProps:i,tableRef:l,sorter:o,layout:s,scrollY:c,leftFixedColumns:d,rightFixedColumns:u,setElementStore:m,getStickyLeft:h,getStickyRight:f}=t().useContext(co),{footRender:g}=i,b=t().useRef(null);t().useEffect((()=>{y()}),[]);const y=()=>{m("$footer",b.current)},v=Ce("table"),{tableBodyWidth:x}=s;return t().createElement("div",{ref:b,className:`${v}--footer-wrapper`},g?g(n,l.current.tableFullData):t().createElement("table",{className:`${v}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:x?`${x}px`:""}},(()=>{const{gutterWidth:e}=s;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),c&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("tfoot",null,(()=>{const{isIE:e}=l.current,a=["gutter",{"cell-fix-right":!!u.length}],i=e?null:{right:u.length?0:""};return r.map(((e,r)=>t().createElement("tr",{key:r,className:"footer--row"},n.map(((r,n)=>((e,r,n)=>{const{isIE:a}=l.current,{gutterWidth:i}=s,{dataIndex:m,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!o[m],"cell-fix-left":!a&&"left"===g,"cell-fix-right":!a&&"right"===g,"cell-fix-left-last":!a&&"left"===g&&d[d.length-1].dataIndex===m,"cell-fix-right-first":!a&&"right"===g&&u[0].dataIndex===m}],x=a?null:{left:"left"===g?`${h(m)}px`:"",right:"right"===g?`${f(m)+(c?i:0)}px`:""},E=y?.render?y.render(l.current.tableFullData):Ln(r,`${m}_text`),S=0===n&&""===E?p("qm.table.config.summaryText"):E;return t().createElement("td",{key:m,title:S,className:Se()(v),style:{...x}},t().createElement("div",{className:"cell"},S))})(r,e,n))),c&&t().createElement("td",{className:Se()(a),style:{...i}}))))})())))};var tc=function(e){return e.small="small",e.middle="default",e.large="default",e}(tc||{});const rc=e=>{const{current:r,pageSize:n,total:a,onChange:i}=e,{global:o}=t().useContext(l),{tableProps:s,$size:c,setElementStore:d}=t().useContext(co),{uniqueKey:u,paginationConfig:p,infoBarConfig:m}=s,h=t().useRef(null),f=t().useMemo((()=>u?`tablePager_${u}`:""),[u]);t().useEffect((()=>{g(),x()}),[]);const g=()=>{d("$pager",h.current)},b=p?.showSizeChanger??wo.pagination.showSizeChanger,y=p?.showQuickJumper??wo.pagination.showQuickJumper,v=p?.pageSizeOptions||o?.table?.pagination?.pageSizeOptions||wo.pagination.pageSizeOptions,x=async()=>{if(!f)return;const e=await E(f);e&&e!==n&&(i(r,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=o?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S={[`${Ce("table")}-pager`]:!0};return t().createElement("div",{ref:h,className:Se()(S)},t().createElement("div",{className:"pager-alert"},"bottom"===m?.position&&t().createElement(Fo,{total:a})),t().createElement(O.Pagination,{size:tc[c],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:v,current:r,pageSize:n,total:a,onChange:(e,t)=>{i(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=o?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},nc=()=>{const{layout:e}=t().useContext(co),r=t().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),n=Ce("table");return t().createElement("div",{className:`${n}--empty`,style:r},t().createElement(mt,null))};function ac(){return ac=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ac.apply(this,arguments)}const ic=t().forwardRef(((e,r)=>{const{rowKey:n,columns:a,loading:i,stripe:o,resizable:s,customClass:c,tablePrint:d,exportExcel:u,infoBarConfig:p,topSpaceAlign:m,showTableInfo:h,showFullScreen:f,showRefresh:b,showToolBox:y,showHeader:v}=e,{size:x}=t().useContext(l),E=t().useMemo((()=>e.size??x??""),[e.size,x]),S=t().useRef(null),C=t().useRef(null),w=t().useRef(null),T=t().useRef(null),N=t().useRef(null),I=t().useRef(null),R=ko(),P=t().useCallback(((e,t)=>{const r="function"==typeof n?n(e,t):e[n];return void 0===r?(g("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r}),[n]),{tableRef:O,tableFullData:A,setElementStore:k,setOriginColumns:F,setTableFullData:L,setTableOriginData:H,setAllTableData:$,setDeriveRowKeys:D,setInvalidRowKeys:q,setFieldAuth:_,setMergeCells:j,setColumnsDefined:K,setScrollYStore:M,setScrollYLoad:V,setResizeState:z,setHandleState:U,setSummaries:B,setSelectionRows:W,setShouldToTop:G,setRecordsMap:Y,setUnMounted:X,setHandleChange:Q,clearElementStore:Z,clearRecordsMap:te}=((e,r)=>{let{getRowKey:n,$size:a}=r;const{dynamicThead:i}=e,l=t().useRef({uid:jn(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},mergeCells:[],columnsDefined:!i,scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:wo.rowHeightMaps[a]},store:new Co,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isHandleChange:!0,isIE:!ee&&/MSIE|Trident/.test(navigator.userAgent)}),o=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const l=n(e,e.index),s=r?`${r}#${l}`:`${l}`,c=a?`${a}-${e.index+1}`:`${e.index+1}`,d={level:i,rowKey:l,rowKeyPath:s,indexPath:c};return e.indexPath=c,e._level=i,e.children&&(d.children=o(e.children,l,s,c,i+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},s=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...s(e.children)):t.push(e.rowKey)})),t};return{tableRef:l,...l.current,setElementStore:(e,t)=>{l.current.elementStore[e]=t},setOriginColumns:e=>{l.current.originColumns=e},setTableFullData:e=>{l.current.tableFullData=e},setTableOriginData:e=>{l.current.tableOriginData=e},setAllTableData:e=>{const t=Rn(e);l.current.allTableData=t,l.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{l.current.treeTable=l.current.tableFullData.some((e=>Array.isArray(e.children))),l.current.treeTable&&(l.current.deriveRowKeys=o(e,""),l.current.flattenRowKeys=s(l.current.deriveRowKeys))},setInvalidRowKeys:e=>{l.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{l.current.fieldAuth[e]=t},setMergeCells:e=>{const t=[];e.forEach((e=>{t.push(e);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:e.row+n,col:e.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:e.row+r,col:e.col+n,rowSpan:0,colSpan:0})})),l.current.mergeCells=t},setColumnsDefined:e=>{l.current.columnsDefined=e},setScrollYStore:e=>{l.current.scrollYStore=e},setResizeState:e=>{l.current.resizeState=e},setHandleState:e=>{l.current.handleState=e},setSummaries:e=>{l.current.summaries=e},setScrollYLoad:e=>{l.current.scrollYLoad=e},setShouldToTop:e=>{l.current.shouldToTop=e},setSelectionRows:e=>{l.current.selectionRows=e},setRecordsMap:(e,t)=>{l.current.recordsMap.set(e,t)},setUnMounted:e=>{l.current.unMounted=e},setHandleChange:e=>{l.current.isHandleChange=e},clearElementStore:()=>{for(const e in l.current.elementStore)l.current.elementStore[e]=null},clearRecordsMap:()=>{l.current.recordsMap.clear()}}})(e,{getRowKey:P,$size:E}),{tableData:re,setTableData:ne,filters:ae,setFilters:ie,sorter:le,setSorter:oe,superFilters:se,setSuperFilters:de,pagination:ue,setPagination:pe,selectionKeys:me,setSelectionKeys:he,rowExpandedKeys:fe,setRowExpandedKeys:ge,highlightKey:be,setHighlightKey:ye,layout:ve,setLayout:xe,permission:Ee,setPermission:we,spinning:Te,setSpinning:Ne,scrollX:Ie,setScrollX:Re,scrollY:Pe,setScrollY:Oe,isPingLeft:Ae,setPingLeft:ke,isPingRight:Fe,setPingRight:Le,isFullScreen:He,setFullScreen:$e,updateTableData:De}=(e=>{const{uniqueKey:r,nativeScrollBar:n,initialSorter:a={},initialFilter:i={},paginationConfig:o,rowSelection:s,expandable:c,rowHighlight:d}=e,{global:u}=t().useContext(l),p={current:wo.pagination.current,pageSize:(()=>{if(r)return Number(localStorage.getItem(`tablePager_${r}`))||void 0})()??o?.pageSize??u?.table?.pagination?.pageSize??wo.pagination.pageSize,total:0},m=s?.selectedRowKeys??s?.defaultSelectedRowKeys??[],h=c?.expandedRowKeys??c?.defaultExpandedRowKeys??[],[f,g]=t().useState([]),[b,y]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),i),[v,x]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),a),[E,S]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),[]),[C,w]=t().useState(p),[T,N]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),m),[I,R]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),h),[P,O]=t().useState(d?.currentRowKey??""),[A,k]=t().useState({gutterWidth:n?No():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[F,L]=t().useState({export:!0,import:!0,print:!0}),[H,$]=t().useState(!1),[D,q]=t().useState(!1),[_,j]=t().useState(!1),[K,M]=t().useState(!1),[V,z]=t().useState(!1),[U,B]=t().useState(!1);return{tableData:f,setTableData:g,filters:b,setFilters:y,sorter:v,setSorter:x,superFilters:E,setSuperFilters:S,pagination:C,setPagination:w,selectionKeys:T,setSelectionKeys:N,rowExpandedKeys:I,setRowExpandedKeys:R,highlightKey:P,setHighlightKey:O,layout:A,permission:F,setPermission:L,setLayout:k,spinning:H,setSpinning:$,scrollX:D,setScrollX:q,scrollY:_,setScrollY:j,isPingLeft:K,setPingLeft:M,isPingRight:V,setPingRight:z,isFullScreen:U,setFullScreen:B,updateTableData:()=>{g([...f])}}})(e),{isFetch:qe,isWebPagination:je,isScrollPagination:Ke,showPagination:Me,shouldUpdateHeight:Ve,tableColumns:ze,flattenColumns:Ue,editableColumns:Be,summationColumns:We,leftFixedColumns:Ge,rightFixedColumns:Ye,treeExpandIndex:Xe,showSummary:Qe,showFooter:Ze,isHeadGroup:Je,bordered:et,isHeadSorter:tt,isHeadFilter:rt,isServiceSummation:nt,isSelectCollection:at,isTableImport:it,isTableClipboard:lt,isSuperSearch:ot,isFastSearch:st,isGroupSummary:ct,isGroupSubtotal:dt,isDragMergeCell:ut,isTreeTable:pt,isTableEmpty:mt,summationRows:ht,fetchParams:gt}=Ro(e,{getRowKey:P,tableRef:O,tableFullData:A,tableData:re,sorter:le,filters:ae,superFilters:se,selectionKeys:me,pagination:ue}),{createElementStore:bt,tableStyles:yt,getSpan:vt,getStickyLeft:xt,getStickyRight:Et,scrollXToColumn:St,scrollYToRecord:Ct,rowInViewport:wt,calcTableHeight:Tt,resetTableScroll:Nt,doLayout:It}=Ao(e,{getRowKey:P,tableRef:O,$size:E,tableColumns:ze,flattenColumns:Ue,leftFixedColumns:Ge,layout:ve,scrollY:Pe,tableData:re,showFooter:Ze,showPagination:Me,isWebPagination:je,isFullScreen:He,setLayout:xe,setScrollX:Re,setScrollY:Oe,setElementStore:k,setScrollYStore:M,setShouldToTop:G}),{initialTable:Rt,checkDataIndex:Pt,createTableFullData:Ot,getTableData:At,handleTableData:kt,createTableData:Ft,createGroupData:Lt,createSelectionKeys:Ht,createRowExpandedKeys:$t,setSelectionKeysEffect:Dt,findParentRowKeys:qt,getAllChildRowKeys:_t,doFieldValidate:jt,getTableLog:Kt,dataChange:Mt,tableChange:Vt,toLastPage:zt,toFirstPage:Ut,getPageCount:Bt,pagerChangeHandle:Wt,triggerScrollYEvent:Gt,scrollBottomDebouncer:Yt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:er,clearTableLog:tr,destroy:rr}=Oo(e,{getRowKey:P,tableRef:O,tableElementRef:C,tableBodyRef:w,$size:E,tableColumns:ze,flattenColumns:Ue,tableFullData:A,pagination:ue,layout:ve,filters:ae,sorter:le,superFilters:se,fetchParams:gt,selectionKeys:me,rowExpandedKeys:fe,highlightKey:be,summationColumns:We,shouldUpdateHeight:Ve,isFetch:qe,isTreeTable:pt,isWebPagination:je,isScrollPagination:Ke,isServiceSummation:nt,isGroupSubtotal:dt,doLayout:It,setTableData:ne,setTableFullData:L,setTableOriginData:H,setAllTableData:$,setDeriveRowKeys:D,setPagination:pe,setSpinning:Ne,setSorter:oe,setFilters:ie,setSuperFilters:de,setSelectionKeys:he,setRowExpandedKeys:ge,setHighlightKey:ye,setSelectionRows:W,setScrollYLoad:V,setScrollYStore:M,setFieldAuth:_,setResizeState:z,setSummaries:B,setPermission:we,setRecordsMap:Y,resetTableScroll:Nt,clearElementStore:Z,clearRecordsMap:te});((e,r)=>{const{columns:n,summation:a,rowSelection:i,expandable:l,rowHighlight:o,mergeCells:s=[]}=e,{tableRef:c,topElementRef:d,tableElementRef:u,tableBodyRef:p,resizableBarRef:m,$size:h,scrollX:f,pagination:b,selectionKeys:y,rowExpandedKeys:v,highlightKey:x,summationRows:E,showSummary:S,isWebPagination:C,isScrollPagination:w,isTreeTable:T,checkDataIndex:N,toLastPage:I,toFirstPage:R,getPageCount:P,setHandleState:O,scrollYToRecord:A,setSelectionKeysEffect:k,setOriginColumns:F,setRowExpandedKeys:L,setHighlightKey:H,setResizeState:$,setMergeCells:D,setPingRight:q,setUnMounted:_,setHandleChange:j,calcTableHeight:K,createSelectionKeys:M,createRowExpandedKeys:V,createElementStore:z,triggerScrollYEvent:U,initialTable:B,destroy:W}=r,{elementStore:G,handleState:Y,scrollYLoad:X}=c.current,Q=t().useRef(E);_e((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&p.current.setClickedValues(y.length?[y[0],""]:[]),c.current.isHandleChange&&e?.(y,c.current.selectionRows),j(!0)}),[y]),_e((()=>{if(!l)return;const{allTableData:e,allRowKeys:t}=c.current,{onChange:r}=l;r?.(v,v.map((r=>e[t.findIndex((e=>e===r))])))}),[v]),_e((()=>{const{allTableData:e,allRowKeys:t}=c.current;T&&L(V()),o&&(p.current.setClickedValues(x?[x,""]:[]),o.onChange?.(x,e[t.findIndex((e=>e===x))]??null))}),[x]),_e((()=>{(0,J.isEqual)(E,Q.current)||(Q.current=E,S&&a&&a.onChange?.(E))}),[E]),_e((()=>{const e=M(i.selectedRowKeys);(0,J.isEqual)(e,y)||(k(e),T&&L(V()))}),[i?.selectedRowKeys]),_e((()=>{const e=V(l.expandedRowKeys);(0,J.isEqual)(e,v)||L(e)}),[l?.expandedRowKeys]),_e((()=>{const{currentRowKey:e}=o;e!==x&&H(e??"")}),[o?.currentRowKey]),_e((()=>{const{insert:e,remove:t}=Y;e&&(C&&("after"===e?I():R()),A("","after"===e?1e5:0)),t&&b.current>P()&&I(),(e||t)&&O({insert:null,remove:!1})}),[b.total]),_e((()=>{X&&U(G.$tableBody.parentNode.parentNode.scrollTop)}),[X]),_e((()=>{q(f)}),[f]),_e((()=>{K()}),[h]),_e((()=>{D(s),p.current.forceUpdate()}),[s]),_e((()=>{X&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),w&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[X,w]);const Z=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&($(Object.assign({},e,{winHeight:r})),K())};t().useEffect((()=>(z({$toper:d.current,$table:u.current,$resizableBar:m.current}),F(ce(n)),B(),D(s),window.addEventListener("resize",Z,!1),K(),N(),()=>{W(),window.removeEventListener("resize",Z),_(!0)})),[])})(e,{tableRef:O,topElementRef:S,tableElementRef:C,tableBodyRef:w,resizableBarRef:I,$size:E,scrollX:Ie,pagination:ue,selectionKeys:me,rowExpandedKeys:fe,highlightKey:be,showSummary:Qe,summationRows:ht,isWebPagination:je,isScrollPagination:Ke,isTreeTable:pt,checkDataIndex:Pt,toLastPage:zt,toFirstPage:Ut,getPageCount:Bt,setHandleState:U,scrollYToRecord:Ct,setOriginColumns:F,setSelectionKeysEffect:Dt,setRowExpandedKeys:ge,setHighlightKey:ye,setResizeState:z,setMergeCells:j,setPingRight:Le,setUnMounted:X,setHandleChange:Q,calcTableHeight:Tt,createSelectionKeys:Ht,createRowExpandedKeys:$t,createElementStore:bt,triggerScrollYEvent:Gt,initialTable:Rt,destroy:rr});const nr=t().useMemo((()=>({getRowKey:P,tableProps:e,tableRef:O,tableBodyRef:w,$size:E,flattenColumns:Ue,editableColumns:Be,leftFixedColumns:Ge,rightFixedColumns:Ye,treeExpandIndex:Xe,sorter:le,filters:ae,superFilters:se,layout:ve,bordered:et,showFooter:Ze,showSummary:Qe,summationRows:ht,scrollX:Ie,scrollY:Pe,pagination:ue,fetchParams:gt,selectionKeys:me,rowExpandedKeys:fe,highlightKey:be,isFetch:qe,isPingLeft:Ae,isPingRight:Fe,isHeadSorter:tt,isHeadFilter:rt,isFullScreen:He,isTableEmpty:mt,isHeadGroup:Je,isTreeTable:pt,isGroupSubtotal:dt,isWebPagination:je,isDragMergeCell:ut,dataChange:Mt,tableChange:Vt,getTableData:At,setElementStore:k,createTableFullData:Ot,updateTableData:De,setSorter:oe,setFilters:ie,setSuperFilters:de,setHighlightKey:ye,setRowExpandedKeys:ge,setSelectionRows:W,setSelectionKeysEffect:Dt,setInvalidRowKeys:q,getSpan:vt,getStickyLeft:xt,getStickyRight:Et,scrollXToColumn:St,scrollYToRecord:Ct,rowInViewport:wt,setPagination:pe,setPingLeft:ke,setPingRight:Le,setSpinning:Ne,setFullScreen:$e,setShouldToTop:G,doFieldValidate:jt,createTableData:Ft,createGroupData:Lt,findParentRowKeys:qt,getAllChildRowKeys:_t,triggerScrollYEvent:Gt,scrollBottomDebouncer:Yt,resetTableScroll:Nt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:er})),[e,E,Ue,Be,Ge,Ye,Xe,le,ae,se,ve,et,Ze,Qe,ht,Ie,Pe,ue,gt,me,fe,be,qe,Ae,Fe,tt,rt,He,mt,Je,pt,dt,je,ut]);((e,r)=>{const{getRowKey:n,tableProps:a,tableRef:i,toolBoxRef:l,tableBodyRef:o,columnFilterRef:s,flattenColumns:c,editableColumns:d,pagination:u,fetchParams:p,selectionKeys:m,rowExpandedKeys:h,highlightKey:f,isFetch:b,dataChange:y,getTableData:v,handleTableData:x,createTableData:E,calcTableHeight:S,scrollXToColumn:C,scrollYToRecord:w,doFieldValidate:T,setHandleState:N,setColumnsDefined:I,setSelectionKeysEffect:R,setRowExpandedKeys:P,setHighlightKey:O,setSelectionRows:A,setOriginColumns:k,setHandleChange:F,forceUpdate:L,getTableLog:H,clearRowSelection:$,clearRowHighlight:D,clearTableSorter:q,clearTableFilter:_,clearSuperFilters:j,clearTableLog:K}=r,{columns:M,columnsChange:V}=a,z=(e,t,r)=>{for(let a=0;a<e.length;a++){const i=e[a],l=n(i,i.index);Array.isArray(i.children)&&z(i.children,t,r),t.includes(l)&&(r?.(i,l),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{S()},DO_REFRESH:async e=>{b&&(await v(),e?.())},GET_LOG:()=>H(),GET_FETCH_PARAMS:()=>{const e={};for(const t in p)Object.keys(u).includes(t)||(e[t]=p[t]);return e},CLEAR_TABLE_DATA:()=>{b||($(),D(),q(),_(),j(),K(),E([]))},CLEAR_LOG:()=>{K()},CREATE_FOCUS:(e,t)=>{o.current.createFocus(e,t)},FORCE_UPDATE:()=>{L()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{C(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,J.isEqual)(e,m)&&F(!1),R(e)},SET_HIGHLIGHT:e=>{O(e)},SET_EXPANDABLE:e=>{P(e)},SET_SELECTION_ROWS:e=>{A(e)},SET_TABLE_DATA:e=>{x(e)},DEFINE_INITIAL_COLUMNS:e=>{k(e),I(!0),s.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=Cn(M,e);if(!n)return g("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return g("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,J.set)(n,e,t[e]);r&&(V?V([...M]):g("Table","需要设置 `columnsChange` 参数"))},INSERT_RECORDS:(e,t)=>{const{store:r,tableFullData:a}=i.current,l=(Array.isArray(e)?e:[e]).filter((e=>(0,J.isPlainObject)(e)));if(!l.length)return;l.forEach((e=>{c.forEach((t=>{const{dataIndex:r}=t;[wo.expandableColumn,wo.selectionColumn,wo.operationColumn].includes(r)||Hn(e,r,Ln(e,r))})),r.addToInserted(e)}));const o="before"===t?.mode,s=void 0===t?.parentRowKey;let d=a;if(s)d=o?[...l,...d]:d.concat(l);else{const e=Bn(a,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}E(d),s&&N(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),y()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:r}=i.current,a=(Array.isArray(e)?e:[e]).map((e=>(0,J.isPlainObject)(e)?n(e,e.index):e));if(!a.length)return;let l=!1;z(r,a,((e,r)=>{t.addToRemoved(e),d.forEach((n=>{const{dataIndex:a,editRender:i}=n,l=i?.(e,n);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),l=!0})),l&&(E(r),R(m.filter((e=>!a.includes(e)))),a.includes(f)&&D(),P(h.filter((e=>!a.includes(e)))),N(Object.assign({},i.current.handleState,{remove:!0})),y())},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((r=>{d.forEach((a=>{const{dataIndex:i,editRender:l}=a,o=l?.(r,a);if(!o)return;const s=n(r,r.index);if(e&&!e.includes(s))return;if(t&&!t.includes(i))return;const{rules:c=[],disabled:d}=o;!d&&c.length&&T(c,Ln(r,i),s,i)}))}));const{required:r,validate:a}=H(),l=[...r,...a];return l.length&&w(l[0].rowKey),L(),{required:r,validate:a}}})))})(r,{getRowKey:P,tableProps:e,tableRef:O,toolBoxRef:T,tableBodyRef:w,columnFilterRef:N,flattenColumns:Ue,editableColumns:Be,pagination:ue,fetchParams:gt,selectionKeys:me,rowExpandedKeys:fe,highlightKey:be,isFetch:qe,dataChange:Mt,getTableData:At,handleTableData:kt,createTableData:Ft,calcTableHeight:Tt,scrollXToColumn:St,scrollYToRecord:Ct,doFieldValidate:jt,setHandleState:U,setColumnsDefined:K,setSelectionKeysEffect:Dt,setRowExpandedKeys:ge,setHighlightKey:ye,setSelectionRows:W,setOriginColumns:F,setHandleChange:Q,forceUpdate:R,getTableLog:Kt,clearRowSelection:Jt,clearRowHighlight:er,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearTableLog:tr}),t().useEffect((()=>{Eo.register(O.current.uid,r??{current:null})}),[]);const ar=Ce("table"),ir={[`${ar}--wrapper`]:!0,[`${ar}--lg`]:"large"===E,[`${ar}--sm`]:"small"===E,[`${ar}--maximize`]:He,[c]:!!c},lr={[ar]:!0,"is--border":et,"is--striped":o,"is--fixed":Ge.length||Ye.length,"is--sortable":tt,"is--filterable":rt,"is--head-group":Je,"is--merge-cell":ut,"is--empty":mt,"show--head":v,"show--foot":Ze,"ping--left":Ae,"ping--right":Fe,"scroll--x":Ie,"scroll--y":Pe};return t().createElement(co.Provider,{value:nr},t().createElement("div",{className:Se()(ir)},h&&t().createElement("div",{ref:S,className:`${ar}-top`},t().createElement("div",{className:`${ar}-top__space`},"bottom"!==p?.position&&t().createElement(Fo,{total:ue.total}),t().createElement("div",{className:`${ar}-top__space-slot`,style:{justifyContent:vo[m]}},e.children)),t().createElement("div",{className:`${ar}-top__actions`},t().createElement(Ts,{ref:T,showFullScreen:f,showReload:b&&qe,showPrint:Ee.print&&!!d,showImport:Ee.import&&it,showExport:Ee.export&&!!u,showClipboard:lt,showCollection:at,showFastSearch:st,showSuperSearch:ot,showGroupSummary:ct,showToolBox:y,tableColumns:ze}),t().createElement(Rs,{ref:N,columns:a}))),t().createElement(ft,{spinning:i??Te},t().createElement("div",{ref:C,className:Se()(lr),style:yt},t().createElement("div",{className:`${ar}--main-wrapper`},v&&t().createElement(Ds,{tableColumns:ze,flattenColumns:Ue,sorter:le,filters:ae}),t().createElement(Js,{ref:w,tableData:re,flattenColumns:Ue}),Ze&&t().createElement(ec,{summationRows:ht,flattenColumns:Ue})),et&&t().createElement("div",{className:`${ar}--border-line`}),mt&&t().createElement(nc,null),s&&t().createElement("div",{ref:I,className:`${ar}--resizable-bar`}))),Me&&t().createElement(rc,ac({},ue,{onChange:(e,t)=>Wt({current:e,pageSize:t})}))))}));ic.defaultProps={columns:[],dataSource:[],rowKey:"id",border:!0,resizable:!0,showHeader:!0,ellipsis:!0,multipleSort:!0,topSpaceAlign:"right",showFullScreen:!0,showRefresh:!0,showClipboard:!0,showSelectCollection:!0,showSuperSearch:!0,showFastSearch:!0,showGroupSummary:!0,showColumnDefine:!0,showTableInfo:!0},ic.displayName="QmTable";const lc=ic,oc=lc;function sc(){return sc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sc.apply(this,arguments)}const cc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:d,style:u,onClose:m}=e,{size:h}=t().useContext(l),f=t().useMemo((()=>e.size??h??""),[e.size,h]),g=t().useRef(null),b=t().useRef(null),y=t().useRef(null),v=St(g),[x,E]=t().useState(c),[S,C]=t().useState(),[w,T]=t().useState(o),[N,I]=t().useState(!1),[R,P]=t().useState(300),[O,A]=t().useState(s),[k,F]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[L,H]=t().useState((0,J.merge)({},c.fetch?.params,a)),[$,D]=t().useState([]),q=()=>{const e=g.current,t=e.querySelector(".form-wrap");P(e.offsetHeight-t.offsetHeight-2*fa[f]-30)},_=Ct(q,5);_e((()=>{_()}),[v.width]),_e((()=>{(0,J.isEqual)(s,O)||A(s)}),[s]),t().useEffect((()=>{j()}),[L]),t().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&b.current?.SET_FIELDS_VALUE(a)}),[]);const j=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(L)){I(!0);try{const e=await r(L);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(T([]),await ie(0)),D(t)}}catch(e){}I(!1)}},K=e=>{n||(C(e),m(e))},M=e=>{H(Object.assign({},L,e))},V={[`${Ce("search-helper")}--wrapper`]:!0},z=x.webPagination?{dataSource:$,loading:N,webPagination:!0}:{fetch:{...x.fetch,params:L}};return t().createElement("div",{ref:g,className:Se()(V,d),style:u},t().createElement("div",{className:"form-wrap"},O.length?t().createElement(gl,{ref:b,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>A(e),onCollapse:()=>q(),onFinish:e=>M(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||M(t)}}):null),t().createElement("div",null,t().createElement(oc,sc({ref:y,uniqueKey:r,height:R,columns:k,rowKey:x.rowKey||"pageIndex"},z,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{T(e),C(n?t:t[0])}},columnsChange:e=>F(e),onRowDblclick:K,onRowEnter:K}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${fa[f]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>m(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!S,onClick:()=>m(S,n?w:void 0)},p("qm.dialog.confirm"))))};cc.displayName="SearchHelper";const dc=cc;function uc(){return uc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},uc.apply(this,arguments)}const pc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...pc(e.children)),e.children&&t.push(e.value)})),t},mc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=mc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},hc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&hc(e.children,t),t(e)||e.children&&e.children.length))),fc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},className:u,style:m,onClose:h}=e,{size:f}=t().useContext(l),b=t().useMemo((()=>e.size??f??""),[e.size,f]),y=t().useRef(null),v=t().useRef(null),x=t().useRef(null),E=St(y),[S,C]=t().useState(c),[w,T]=t().useState(),[N,I]=t().useState(o),[R,P]=t().useState(!1),[A,k]=t().useState(300),[F,L]=t().useState(300),[H,$]=t().useState(s),[D,q]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[_,j]=t().useState((0,J.merge)({},c.fetch?.params,a)),[K,M]=t().useState([]),V=()=>{const e=y.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");k(e.offsetHeight-r.offsetHeight-10),L(e.offsetHeight-t.offsetHeight-2*fa[b]-30)},z=Ct(V,5);_e((()=>{z()}),[E.width]),_e((()=>{(0,J.isEqual)(s,H)||$(s)}),[s]),t().useEffect((()=>{U()}),[_]),t().useEffect((()=>{i&&x.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&v.current?.SET_FIELDS_VALUE(a),ne()}),[]);const U=async()=>{const{webPagination:e,fetch:t}=S;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(_)){P(!0);try{const e=await r(_);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(I([]),await ie(0)),M(t)}}catch(e){}P(!1)}},B=e=>{n||(T(e),h(e))},W=e=>{j(Object.assign({},_,e))},[G,Y]=t().useState([]),[X,Q]=t().useState([]),[Z,ee]=t().useState(""),te=t().useRef(G),re=t().useRef([]);_e((()=>{Q(pc(G))}),[G]);const ne=async()=>{if(!d.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=d.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,r)??[],t=Or(e,n,a);Y(t),te.current=t,re.current=e}}catch(e){}},le=e=>`${e}|${Wr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe={[`${Ce("tree-table-helper")}--wrapper`]:!0},se=S.webPagination?{dataSource:K,loading:R,webPagination:!0}:{fetch:{...S.fetch,params:_}};return t().createElement("div",{ref:y,className:Se()(oe,u),style:m},t().createElement(nt,{defaultValue:200,style:{height:"100%"}},t().createElement(nt.Pane,{min:100,style:{overflowY:"auto"}},t().createElement(O.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:p("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=hc(te.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==le(r).indexOf(e)}));ee(e),Y(t)})(e.target.value)}),t().createElement(O.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:A,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==le(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return g("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,r={};for(const n in t)r[n]=(0,J.get)(e,t[n]);W(r)})(mc(re.current,(r=>(0,J.get)(r,t)===e[0]))||{})}})),t().createElement(nt.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},H.length?t().createElement(gl,{ref:v,items:H,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>$(e),onCollapse:()=>V(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await v.current.GET_FORM_DATA();e||W(t)}}):null),t().createElement("div",null,t().createElement(oc,uc({ref:x,uniqueKey:r,height:F,columns:D,rowKey:S.rowKey||"pageIndex"},se,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:N,onChange:(e,t)=>{I(e),T(n?t:t[0])}},columnsChange:e=>q(e),onRowDblclick:B,onRowEnter:B}))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${fa[b]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>h(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!w,onClick:()=>h(w,n?N:void 0)},p("qm.dialog.confirm"))))};fc.displayName="TreeTableHelper";const gc=fc,bc=e=>{const{multiple:r,tree:n={},defaultSelectedKeys:a,className:i,style:o,onClose:s}=e,{size:c}=t().useContext(l),d=t().useMemo((()=>e.size??c??""),[e.size,c]),[u,m]=t().useState(),[h]=t().useState(n.fetch?.params),f={[`${Ce("tree-helper")}--wrapper`]:!0},g=n.fetch?{...Z()(n.fetch,["params","valueKey","textKey"]),params:h}:void 0;return t().createElement("div",{className:Se()(f,i),style:o},t().createElement(so,{multiple:r,fetch:g,fieldsDefine:{valueKey:n.fetch?.valueKey,textKey:n.fetch?.textKey},asyncLoad:n.asyncLoad,checkStrictly:n.checkStrictly,checkStrategy:n.checkStrategy,defaultSelectedKeys:a,defaultExpandAll:n.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${fa[d]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>s(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!u,onClick:()=>s(u)},p("qm.dialog.confirm"))))};bc.displayName="TreeHelper";const yc=bc;function vc(){return vc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vc.apply(this,arguments)}const xc="_startSign",Ec="_endSign",Sc=e=>{const{uniqueKey:r,initialValue:n,filters:a=[],table:i={},onClose:o}=e,{size:s}=t().useContext(l),c=t().useMemo((()=>e.size??s??""),[e.size,s]),d=t().useRef(null),u=t().useRef(null),m=t().useRef(null),h=St(d),[f,g]=t().useState(i),[b,y]=t().useState(!1),[v,x]=t().useState([]),[E,S]=t().useState(300),[C,w]=t().useState(a),[T,N]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},{title:p("qm.form.rangeSearchHelper")[0],dataIndex:xc,width:80,align:"right",render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:Ec,fixed:"right",width:80,render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)}]),[I,R]=t().useState((0,J.merge)({},i.fetch?.params,n)),[P,A]=t().useState([]),k=t().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),F=t().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),L=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*fa[c]-30)},H=Ct(L,5);_e((()=>{H()}),[h.width]),_e((()=>{(0,J.isEqual)(a,C)||w(a)}),[a]),t().useEffect((()=>{$()}),[I]);const $=async()=>{const{webPagination:e,fetch:t}=f;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=ae}=t;if(a(I)){y(!0);try{const e=await r(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[];A(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},q=()=>{v.forEach((e=>{e&&(D(e,xc),D(e,Ec))})),x([])},_=e=>{q(),R(Object.assign({},I,e))},j=Ce("range-helper"),K=f.webPagination?{dataSource:P,loading:b,webPagination:!0}:{fetch:{...f.fetch,params:I}};return t().createElement("div",{ref:d,className:`${j}--wrapper`},t().createElement("div",{className:"form-wrap"},C.length?t().createElement(gl,{ref:u,items:C,initialValues:n,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>L(),onFinish:e=>_(e),onReset:async()=>{const[e,t]=await u.current.GET_FORM_DATA();e||_(t)}}):null),t().createElement("div",null,t().createElement(oc,vc({ref:m,height:E,columns:T,rowKey:f.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},K,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[xc,Ec].includes(r)&&(r===xc&&(e[r]?(D(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?O.message.warning(p("qm.searchHelper.rangeStartTip")):(v[0]&&D(v[0],r),e[r]="[",x([e,v[1]]))),r===Ec&&(e[r]?(D(e,r),x([v[0],void 0])):e.pageIndex<k[0]?O.message.warning(p("qm.searchHelper.rangeEndTip")):(v[1]&&D(v[1],r),e[r]="]",x([v[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[xc]="["),e.pageIndex===k[1]&&(e[Ec]="]")}))}}),t().createElement(he,{type:"primary",icon:t().createElement(we.ClearOutlined,null),title:p("qm.table.alert.clear"),onClick:()=>q()}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${fa[c]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>o(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!F,onClick:()=>o(v.map((e=>(e=>{const t={};for(const r in e)[xc,Ec].includes(r)||(t[r]=e[r]);return t})(e))))},p("qm.dialog.confirm"))))};Sc.displayName="RangeTableHelper";const Cc=Sc,wc=e=>null!=e;function Tc(e,r,n,a){const[i,l]=t().useState(void 0);t().useLayoutEffect((()=>{const t="function"==typeof e?e():e;l(t||null)}));const[o,s]=t().useState(null),c=Po((()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:a,bottom:i,left:l}=e.getBoundingClientRect();return n>=0&&l>=0&&a<=t&&i<=r})(i)&&r&&i.scrollIntoView(a);const{left:e,top:t,width:n,height:l}=i.getBoundingClientRect(),o={left:e,top:t,width:n,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)}));return t().useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[i,r,c]),[t().useMemo((()=>{if(!o)return o;const e=n?.offset||6,t=n?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,n]),i]}const Nc=(t,r)=>{const n=e.useRef(!0);e.useLayoutEffect((()=>t(n.current)),r),e.useLayoutEffect((()=>(n.current=!1,()=>{n.current=!0})),[])};function Ic(e,t){Nc((t=>{if(!t)return e()}),t)}function Rc(e){return void 0!==e}function Pc(t,r){const{defaultValue:n,value:a,onChange:i,postState:l}=r||{},[o,s]=e.useState((()=>Rc(a)?a:Rc(n)?"function"==typeof n?n():n:"function"==typeof t?t():t)),c=Rc(a)?a:o,d=l?l(c):c,u=Po(i),[p,m]=e.useState([c]);return Ic((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),Ic((()=>{Rc(a)||s(a)}),[a]),[d,Po((e=>{s(e),m([c])}))]}const Oc={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},Ac={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},kc=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Fc(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(Oc).forEach((e=>{const c={...n&&Ac[e]||Oc[e],offset:[0,0]};switch(s[e]=c,kc.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-o-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=o+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-o-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=o+a}const d=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{dropdownArrowOffset:n,dropdownArrowOffsetVertical:r?8:n}}({contentRadius:i,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.dropdownArrowOffset-o;break;case"topRight":case"bottomRight":c.offset[0]=d.dropdownArrowOffset+o;break;case"leftTop":case"rightTop":c.offset[1]=-d.dropdownArrowOffset-o;break;case"leftBottom":case"rightBottom":c.offset[1]=d.dropdownArrowOffset+o}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const a=n&&"object"==typeof n?n:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.dropdownArrowOffset+r;break;case"left":case"right":i.shiftY=2*t.dropdownArrowOffsetVertical+r}const l={...i,...a};return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,d,t,r),l&&(c.htmlRegion="visibleFirst")})),s}const Lc=require("@rc-component/portal");var Hc=n.n(Lc);const $c=require("@rc-component/trigger");var Dc=n.n($c);const qc=require("rc-util/lib/hooks/useId");var _c=n.n(qc);function jc(){return jc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jc.apply(this,arguments)}const Kc={fill:"transparent",pointerEvents:"auto"},Mc=e=>{const{prefixCls:r,rootClassName:n,pos:a,showMask:i,style:l={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${r}-mask-${_c()()}`,p="object"==typeof c?c?.placeholder:c;return t().createElement(Hc(),{open:s,autoLock:!0},t().createElement("div",{className:Se()(`${r}-mask`,n),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...l}},i?t().createElement("svg",{style:{width:"100%",height:"100%"}},t().createElement("defs",null,t().createElement("mask",{id:u},t().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),a&&t().createElement("rect",{x:a.left,y:a.top,rx:a.radius,width:a.width,height:a.height,fill:"black",className:p?`${r}-placeholder-animated`:""}))),t().createElement("rect",jc({},a?null:Kc,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),a&&t().createElement(t().Fragment,null,t().createElement("rect",jc({},Kc,{x:"0",y:"0",width:"100%",height:`${a.top}px`})),t().createElement("rect",jc({},Kc,{x:"0",y:"0",width:a.left,height:"100%"})),t().createElement("rect",jc({},Kc,{x:"0",y:a.top+a.height,width:"100%",height:`calc(100vh - ${a.top+a.height}px)`})),t().createElement("rect",jc({},Kc,{x:a.left+a.width,y:"0",width:`calc(100vw - ${a.left+a.width}px)`,height:"100%"})))):null))},Vc=e=>{const{prefixCls:r,zIndex:n,open:a,onPause:i,onPlay:l}=e,[o,s]=Pc(void 0,{value:a,postState:e=>e??!0}),c=t().useRef(!1);return t().createElement(Ke(),{onDrag:()=>{c.current=!0}},t().createElement("div",{className:`${r}-control`,style:{zIndex:n+1},onClick:()=>{c.current?c.current=!1:(s(!o),o?i?.():l?.())}},o?t().createElement(we.PauseOutlined,null):t().createElement(we.CaretRightOutlined,null)))};function zc(){const{locale:t}=e.useContext(l);return{t:p,$locale:t}}const Uc=e=>{const{prefixCls:r,current:n,total:a=0,cover:i,title:l,description:o,onClose:s,onPrev:c,onNext:d,onFinish:u,className:p,indicatorsRender:m}=e,{t:h}=zc(),f=wc(i)?t().createElement("div",{className:`${r}-cover`},i):null,g=wc(o)?t().createElement("div",{className:`${r}-description`},o):null;let b;b=m?m(n,a):[...Array.from({length:a}).keys()].map(((e,a)=>t().createElement("span",{key:e,className:Se()(a===n&&`${r}-indicator-active`,`${r}-indicator`)})));const y=e=>{e.stopPropagation(),e.preventDefault()};return t().createElement("div",{className:Se()(`${r}-content`,p)},t().createElement("div",{className:`${r}-inner`},t().createElement(we.CloseOutlined,{className:`${r}-close`,onClick:s}),f,t().createElement("div",{className:`${r}-header`},t().createElement("div",{className:`${r}-title`},l)),g,t().createElement("div",{className:`${r}-footer`},a>1&&t().createElement("div",{className:`${r}-indicators`},b),t().createElement(xe,{className:`${r}-buttons`},0!==n?t().createElement(he,{className:`${r}-prev-btn`,size:"small",onMouseDown:y,onClick:c},h("qm.tour.prevStep")):null,n===a-1?t().createElement(he,{className:`${r}-finish-btn`,type:"primary",size:"small",onClick:u},h("qm.tour.finish")):t().createElement(he,{className:`${r}-next-btn`,type:"primary",size:"small",onMouseDown:y,onClick:d},h("qm.tour.nextStep"))))))},Bc=e=>{const{current:r,renderPanel:n}=e;return t().createElement(t().Fragment,null,"function"==typeof n?n(e,r):t().createElement(Uc,e))};function Wc(){return Wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wc.apply(this,arguments)}const Gc={left:"50%",top:"50%",width:1,height:1},Yc=t().forwardRef(((e,r)=>{const{steps:n=[],defaultCurrent:a,current:i,onChange:l,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:m=!0,overlayClassName:h,overlayStyle:f,placement:g,renderPanel:b,indicatorsRender:y,gap:v,animated:x=!0,scrollIntoViewOptions:E=!0,zIndex:S,...C}=e,w=t().useRef(),[T,N]=Pc(0,{value:i,defaultValue:a}),[I,R]=Pc(void 0,{value:c,postState:e=>!(T<0||T>=n.length)&&(e??!1)}),[P,O]=Pc(1001,{value:S,defaultValue:S}),[A,k]=t().useState(),F=t().useRef(I);t().useLayoutEffect((()=>{I&&!F.current&&N(0),F.current=I,k(I)}),[I]),t().useImperativeHandle(r,(()=>({OPEN:()=>R(!0),CLOSE:()=>R(!1),SET_ZINDEX:e=>O(e)})));const{target:L,placement:H,style:$,arrow:D,className:q,mask:_,scrollIntoViewOptions:j,zIndex:K,action:M}=n[T]||{},V=K||P,z=I&&(_??u),U=j??E,[B,W]=Tc(L,!!c,v,U),G=((e,t,r)=>r??t??(null===e?"center":"bottom"))(W,g,H),Y=!!W&&(void 0===D?p:D),X="object"==typeof Y&&Y.pointAtCenter;t().useLayoutEffect((()=>{w.current?.forceAlign()}),[X,T]),_e((()=>{I&&M?.(W,T)}),[I,W]);const Q=e=>{N(e),l?.(e)},Z=()=>{R(!1),o?.(T)};if(void 0===W)return null;const J="boolean"==typeof z?z:!!z,ee="boolean"==typeof z?void 0:z,te=Object.assign({},f,$),re=Ce("tour"),ne=[{[`${re}-${d}`]:"primary"===d},h,q],ae=Fc({arrowPointAtCenter:X,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Mc,{zIndex:V,prefixCls:re,pos:B,showMask:J,style:ee?.style,fill:ee?.color,open:A,animated:x,rootClassName:h}),t().createElement(Dc(),Wc({ref:w},C,{zIndex:V,builtinPlacements:ae,popupStyle:te,popupPlacement:G,popupVisible:A,popupClassName:Se()(ne),prefixCls:re,popup:()=>t().createElement(Bc,Wc({key:"content",arrow:Y,prefixCls:re,total:n.length,renderPanel:b,indicatorsRender:y,onPrev:()=>{Q(T-1)},onNext:()=>{Q(T+1)},onClose:Z,current:T,onFinish:()=>{Z(),s?.()}},n[T])),arrow:!!Y,getTriggerDOMNode:e=>e||W||document.body,forceRender:!1,destroyPopupOnHide:!0}),t().createElement(Hc(),{open:A,autoLock:!0},t().createElement("div",{className:Se()(h,`${re}-target-placeholder`),style:{...B||Gc,position:"fixed",pointerEvents:"none"}}))),m&&t().createElement(Hc(),{open:I},t().createElement(Vc,{zIndex:V,prefixCls:re,onPause:()=>k(!1),onPlay:()=>k(!0)})))}));Yc.displayName="QmTour";const Xc=Yc,Qc=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Zc=e=>({_s:e,status:Qc[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Jc=e=>e?6:5,ed=(e,t,r,n,a)=>{clearTimeout(n.current);const i=Zc(e);t(i),r.current=i,a?.({current:i})},td=r=>{const{name:n,in:a,timeout:i,preEnter:l=!0,preExit:o}=r,[s,c]=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:r=!0,exit:n=!0,preEnter:a,preExit:i,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=t||{},[u,p]=(0,e.useState)((()=>Zc(o?2:Jc(s)))),m=(0,e.useRef)(u),h=(0,e.useRef)(),[f,g]=(e=>(0,J.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(l),b=(0,e.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return Jc(t)}})(m.current._s,c);e&&ed(e,p,m,h,d)}),[d,c]),y=(0,e.useCallback)((e=>{const t=e=>{switch(ed(e,p,m,h,d),e){case 1:f>=0&&(h.current=setTimeout(b,f));break;case 4:g>=0&&(h.current=setTimeout(b,g));break;case 0:case 3:h.current=setTimeout((()=>t(e+1)),0)}},l=m.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&t(r?a?0:1:2):l&&t(n?i?3:4:Jc(c))}),[b,d,r,n,a,i,f,g,c]);return(0,e.useEffect)((()=>()=>clearTimeout(h.current)),[]),[u,y,b]}({timeout:i,preEnter:l,preExit:o,initialEntered:a});return Ic((()=>{c()}),[a]),t().createElement(t().Fragment,null,t().Children.map(r.children,(e=>t().isValidElement(e)?Gs(e,{className:Se()(e.props.className,n,s.status)}):e)))},rd={previewWidth:1100,defaultDistance:.45,logoHeight:60},nd=(0,e.createContext)(void 0);var ad=null;function id(){try{var e=navigator.userAgent;if(e.match(/Windows\sPhone/i))return!0;if(e.match(/iPhone|iPod|iPad/i))return!0;if(e.match(/Android/i))return!0;if(e.match(/Edge\D?\d+/i))return!0;var t=e.match(/Trident\D?\d+/i),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!r&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function ld(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(id()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void O.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?r=a?e:t:ad?r=ad:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),ad=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&id(),r}catch(e){O.message.error("getLodop 出错:"+e)}}id();const od=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},sd=t().forwardRef(((e,r)=>{const{templateRender:n,directPrint:a}=e,{global:i}=t().useContext(l),{$$preview:o}=t().useContext(nd),{state:s,isWindowsPrinter:c,pageSize:d}=o,u=t().useRef(null),p=t().useRef({}),m=t().useRef([]),h=t().useRef([]),f=t().useRef([]),[b,y]=t().useState(!0);t().useImperativeHandle(r,(()=>({createPreviewDom:A,createExportHtml:F,createPrintHtml:k,SHOW_PREVIEW:L,DIRECT_PRINT:H}))),_e((()=>{O()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),t().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const v=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*rd.defaultDistance+10*rd.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[s,c,d]),x=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*rd.defaultDistance+10*rd.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return od(v-10*(e.left-rd.defaultDistance)-10*(e.right-rd.defaultDistance))}),[s,v]),S=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return od(x-10*(e.top-rd.defaultDistance)-10*(e.bottom-rd.defaultDistance))}),[s,x]),C=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:od(10*e.left),right:od(10*e.right),top:od(10*e.top),bottom:od(10*e.bottom)}}),[s]),T=t().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:r,top:n,bottom:a}=w,i=E+t+r,l=rd.previewWidth-i<=0?0:(rd.previewWidth-i)/2,o=Math.abs((1-C)*i/2);let c=0;return C>1&&(c=o>l?-1*l:-1*o),C<1&&(c=i-2*o>rd.previewWidth?0:l>0?o:(rd.previewWidth-(i-2*o))/2),{width:`${E}px`,height:"stylus"===e?"auto":S+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${C})`,opacity:b?0:1}}),[s,b,w,C,S,E]),N=(m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=i?.print?.leftLogo??"",t=i?.print?.rightLogo??"";return[`<tr style="height: ${rd.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),I=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},P=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",r.push(a),t.push(e[n].outerHTML)}h.current=r,m.current=t},O=()=>{if(!m.current.length)return;const{form:{setting:e,printerType:t}}=s;if(a)return f.current.push([I(),N(),...m.current]);const r=e.fixedLogo?S-rd.logoHeight:S;let n=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[N()]:[],...m.current]);else{let t=0;for(let a=0,i=h.current.length;a<i;a++){const l=m.current[a],o=h.current[a];e.fixedLogo||0!==a||(t+=rd.logoHeight),t+=o,t<=r?n.push(l):(f.current.push([I(),...e.fixedLogo?[N()]:[],...n]),n=[],t=0,a-=1),a===i-1&&n.length&&f.current.push([I(),...e.fixedLogo?[N()]:[],...n])}}e.fixedLogo||f.current[0]?.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');o.setState({currentPage:1,totalPage:f.current.length}),A()},A=()=>{const{currentPage:e}=s;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},F=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+I()+e.join("")+"</table>"},L=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return $();p.current.previewEl.innerHTML||(R(),await ie(0),P(),O(),y(!1))},H=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return $();R(),await ie(0),P(),O(),y(!1),o.doPrint(k()),await ie(0),o.doClose()},$=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:u,className:Se()(D)},t().createElement(ft,{wrapperClassName:"spin",spinning:b,tip:"Loading..."},t().createElement("div",{className:"preview"},t().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},n?.()),t().createElement("div",{className:"workspace",style:T}))))}));sd.displayName="Container";const cd=sd;function dd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ud extends e.Component{constructor(){super(...arguments),dd(this,"formRef",t().createRef()),dd(this,"createFormList",(()=>[{type:"DIVIDER",fieldName:"_1",label:p("qm.print.setPanel.printParameter")},{type:"SELECT",label:p("qm.print.setPanel.pagerType"),fieldName:"pageSize",options:{itemList:[{text:"A2",value:"420*594"},{text:"A3",value:"420*297"},{text:"A4",value:"210*297"},{text:"A5",value:"210*148"},{text:p("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:p("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:p("qm.print.setPanel.vertical"),value:"vertical"},{text:p("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:p("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:p("qm.print.setPanel.manualDoublePrint"),value:"manual"}]},disabled:!this.props.setting.doubleSide},options:{trueValue:1,falseValue:0},onChange:e=>{const{formList:t}=this.state;t.find((e=>"doubleSide"===e.fieldName)).label.disabled=!e,this.setState({formList:t})}},{type:"CHECKBOX",label:p("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:p("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:rd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:rd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:rd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:rd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),dd(this,"getInitialvalue",(()=>{const{setting:e}=this.props,{distance:t}=e;return Object.assign({},{disleft:t.left,disright:t.right,distop:t.top,disbottom:t.bottom,pageSize:e.pageSize,direction:e.direction,doubleSide:e.doubleSide,doubleSideType:e.doubleSideType,fixedLogo:e.fixedLogo})})),dd(this,"getInitialExtra",(()=>({disleft:p("qm.print.setPanel.sizeUnit"),disright:p("qm.print.setPanel.sizeUnit"),distop:p("qm.print.setPanel.sizeUnit"),disbottom:p("qm.print.setPanel.sizeUnit")}))),dd(this,"state",{formList:this.createFormList()}),dd(this,"confirmHandle",(async()=>{const[e,t]=await this.formRef.current.GET_FORM_DATA();e||(this.props.onChange({distance:{left:t.disleft,right:t.disright,top:t.distop,bottom:t.disbottom},pageSize:t.pageSize,direction:t.direction,doubleSide:t.doubleSide,doubleSideType:t.doubleSideType,fixedLogo:t.fixedLogo}),this.cancelHandle())})),dd(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return t().createElement(t().Fragment,null,t().createElement(gl,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),t().createElement(he,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}dd(ud,"contextType",l);const pd=ud;function md(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class hd extends e.Component{constructor(){super(...arguments),md(this,"provide",{$$preview:this}),md(this,"containRef",t().createRef()),md(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:rd.defaultDistance,right:rd.defaultDistance,top:rd.defaultDistance,bottom:rd.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),md(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),md(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),md(this,"printClickHandle",(async()=>{if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e={...this.state.form,printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text};await ps().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),md(this,"doClose",(()=>{this.props.onClose?.()})),md(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),md(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),md(this,"createStyle",(()=>'\n <style type="text/css">\n table {\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n table-layout: fixed;\n }\n table tr td {\n padding: 2px;\n line-height: 1.2;\n word-wrap: break-word;\n }\n .fs12 {\n font-size: 12px;\n }\n .fs13 {\n font-size: 13px;\n }\n .fs14 {\n font-size: 14px;\n }\n .fw500 {\n font-weight: 500;\n }\n .fw700 {\n font-weight: 700;\n }\n .fl {\n float: left;\n }\n .fr {\n float: right;\n }\n .tc {\n text-align: center;\n }\n .tr {\n text-align: right;\n }\n .bor {\n border: 1px solid #000;\n }\n .bor-t {\n border-top: 1px solid #000;\n }\n .bor-b {\n border-bottom: 1px solid #000;\n }\n .bor-l {\n border-left: 1px solid #000;\n }\n .bor-r {\n border-right: 1px solid #000;\n }\n .no-bor {\n border: none !important;\n }\n </style>\n ')),md(this,"doPrint",(e=>{const t=ld();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=rd,{left:d,right:u,top:m,bottom:h}=a.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),a.doubleSide&&("auto"===a.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===l&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():O.message.error(p("qm.print.printError"))},t.PRINT()})),md(this,"doExport",(e=>{const t=ld();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():O.message.error(p("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===a.direction?1:2),t.SAVE_TO_FILE(`${s()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:p("qm.print.laserPrinter"),value:"laser"},{text:p("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=ld(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){g("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await ps().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(e)&&await ps().setItem(this.printerKey,e)),(0,J.isPlainObject)(e)&&Object.keys(e).length&&(0,J.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:r}=this.props,{visible:n,form:a,currentPage:i,totalPage:l,printPage:o}=this.state,s=Ce("print-preview"),c={visible:n,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?t().createElement(t().Fragment,null,t().createElement("div",{className:Se()(d)},t().createElement("div",{className:"outer"},t().createElement("div",{className:"header"},t().createElement("span",null,p("qm.print.printer"),":",t().createElement(O.Select,{value:a.printerName,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.type"),":",t().createElement(O.Select,{value:a.printerType,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.copies"),":",t().createElement(O.InputNumber,{value:a.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),t().createElement("span",null,p("qm.print.printPage.0"),t().createElement(O.InputNumber,{value:o,min:1,max:l,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),p("qm.print.printPage.1")),t().createElement("span",null,t().createElement(O.Pagination,{size:"small",current:i,pageSize:1,total:l,onChange:this.pageChangeHandle})),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(we.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(we.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),t().createElement("span",null,t().createElement(he,{icon:t().createElement(we.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),t().createElement("div",{className:"main"},t().createElement(nd.Provider,{value:this.provide},t().createElement(cd,{ref:this.containRef,templateRender:r,directPrint:!1}))),t().createElement("div",{className:"footer"},t().createElement("span",null,p("qm.print.scale"),":",t().createElement(O.Slider,{value:a.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{scale:e}})))}}),t().createElement("em",{className:"scale-text"},`${Math.floor(100*a.scale)}%`)),t().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:i,totalPage:l}))))),t().createElement(cr,c,t().createElement(pd,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(nd.Provider,{value:this.provide},t().createElement(cd,{ref:this.containRef,templateRender:r,directPrint:!0}))}}md(hd,"contextType",l);const fd=hd;function gd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class bd extends e.Component{constructor(){super(...arguments),gd(this,"previewRef",t().createRef()),gd(this,"state",{visible:!1,loading:!1}),gd(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),gd(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:r,uniqueKey:n,defaultConfig:a,preview:i,closeAfterPrint:l}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${rd.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:r,uniqueKey:n,defaultConfig:a,preview:i,closeAfterPrint:l,onClose:()=>{this.setState({visible:!1})}};return i?t().createElement(cr,o,t().createElement(fd,s)):e?t().createElement(fd,s):null})),gd(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ie(0),this.setState({visible:!0}),await ie(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:r,icon:n,type:a,disabled:i,shape:l}=this.props,o={size:r||this.context.size||"",type:a,shape:l,icon:n,loading:e,disabled:i,click:this.clickHandle};return t().createElement(t().Fragment,null,this.props.children&&t().createElement(he,o,this.props.children),this.createRender())}}gd(bd,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:i().elementType}),gd(bd,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),gd(bd,"contextType",l);const yd=bd;function vd(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function xd(e){const t=vd(e);return t?t.frameElement:null}function Ed(e){const t=wd(e);return Sd([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Sd(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function Cd(e,t){const r=xd(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=Ed(a);if(n.push(e),a=xd(a),i)break;a&&vd(a)===t&&(i=!0)}return Sd(n)}return e.getBoundingClientRect()}function wd(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function Td(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Nd=Object.assign;class Id{constructor(e,t){Td(this,"node",void 0),Td(this,"border",void 0),Td(this,"padding",void 0),Td(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=Ad.border,this.padding.style.borderColor=Ad.padding,this.content.style.backgroundColor=Ad.background,Nd(this.node.style,{borderColor:Ad.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){Od(t,"margin",this.node),Od(t,"border",this.border),Od(t,"padding",this.padding),Nd(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),Nd(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class Rd{constructor(e,t){Td(this,"tip",void 0),Td(this,"nameSpan",void 0),Td(this,"dimSpan",void 0),this.tip=e.createElement("div"),Nd(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),Nd(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),Nd(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),a=Math.max(r.width,60);let i;i=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let l=e.left+5;return e.left<t.left&&(l=t.left+5),e.left+a>t.left+t.width&&(l=t.left+t.width-a-5),i+="px",l+="px",{style:{top:i,left:l}}}(e,t,{width:r.width,height:r.height});Nd(this.tip.style,n.style)}}class Pd{constructor(){Td(this,"window",void 0),Td(this,"tipBoundsWindow",void 0),Td(this,"container",void 0),Td(this,"tip",void 0),Td(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new Rd(r,this.container),this.rects=[],r.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new Id(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=Cd(e,this.window),a=wd(e);n.top=Math.min(n.top,r.top-a.marginTop),n.right=Math.max(n.right,r.left+r.width+a.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+a.marginBottom),n.left=Math.min(n.left,r.left-a.marginLeft),this.rects[t].update(r,a)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const a=Cd(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function Od(e,t,r){Nd(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const Ad={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let kd=null,Fd=null;function Ld(){null!=window.document&&(kd=null,null!==Fd&&(Fd.remove(),Fd=null))}function Hd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class $d{constructor(e){Hd(this,"_isRunning",void 0),Hd(this,"_selectIgnore",void 0),Hd(this,"_lastHoveredNode",null),Hd(this,"excludeSelectors",void 0),Hd(this,"onSelect",void 0),Hd(this,"iframesListeningTo",new Set),Hd(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Hd(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Hd(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),Hd(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Xe(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Ld();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var r;r=[t],null,!1,null!=window.document?(null!==kd&&clearTimeout(kd),null!=r&&(null===Fd&&(Fd=new Pd),Fd.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),Hd(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Hd(this,"selectFiberForNode",(0,J.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;if(e===t)return"/";const r=[];let n=e;for(;n!==t&&null!==n;){const e=n.tagName.toLowerCase();let t="";if(n.id)t=`[@id="${n.id}"]`;else if(n.getAttribute("name"))t=`[@name="${n.getAttribute("name")}"]`;else{let r=n.previousElementSibling,a=1;for(;null!==r;)r.tagName.toLowerCase()===e&&a++,r=r.previousElementSibling;t=`[${a}]`}n.nodeType!==Node.TEXT_NODE&&r.push(e+t),n=n.parentElement}return"/html/"+r.reverse().join("/")}(e))}),200,{leading:!1})),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){Ld(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function Dd(e){return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}const qd=e=>{const{action:r,onConfirm:n,onCancel:a,onFinish:i}=e,{t:l}=zc();return t().createElement(t().Fragment,null,t().createElement("div",{style:{height:100}},l("qm.table.config.emptyText")),t().createElement(xe,{style:{width:"100%",justifyContent:"flex-end"}},t().createElement(he,{size:"small",onClick:()=>a?.()},l("qm.guideTracker.closeButton")),t().createElement(he,{size:"small",onClick:()=>n?.()},l("add"===r?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t().createElement(he,{size:"small",onClick:()=>i?.()},l("qm.guideTracker.finishButton"))))},_d={left:"50%",top:"50%",width:1,height:1},jd=1001,Kd=t().forwardRef(((e,r)=>{const{open:n,current:a,defaultCurrent:i,steps:l=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,onChange:m,onClose:h,onFinish:f}=e,{t:g}=zc(),b=t().useRef(),y=t().useRef(l.length),[v,x]=Pc(0,{value:a,defaultValue:i}),[E,S]=Pc(void 0,{value:n,postState:e=>e??!1}),[C,w]=t().useState({}),[T,N]=t().useState(!1),[I,R]=t().useState(!1),[P,A]=Tc(C.node,!!n),[k,F]=t().useState(22),L=t().useRef(!1),H=t().useMemo((()=>v>=l.length?"add":"edit"),[v,l]),$=t().useMemo((()=>`${v+1} / ${l.length}`),[v,l]);t().useLayoutEffect((()=>{b.current=new $d({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{w({id:jn(),node:e,path:t}),x(y.current),N(!0),q()}})}),[]),t().useEffect((()=>(E?D():q(),()=>{q()})),[E]),t().useEffect((()=>{y.current=l.length}),[l]);const D=()=>{b.current.startHandle()},q=()=>{b.current.stopHandle()},_=e=>{e.stopPropagation(),e.preventDefault()};t().useImperativeHandle(r,(()=>({OPEN:()=>S(!0),CLOSE:()=>S(!1),GET_CURRENT_STEP:()=>({current:v,nodePath:C.path})})));const j=Ce("guide-tracker"),K=[{[`${j}-primary`]:!0}],M=Fc({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Dc(),{zIndex:jd,builtinPlacements:M,popupPlacement:o,popupVisible:E&&T,popupClassName:Se()(K,c),popupStyle:d,prefixCls:j,popup:()=>{const e=()=>{N(!1),D()};return t().createElement("div",{className:`${j}-content`},t().createElement("div",{className:`${j}-inner`},t().createElement(we.CloseOutlined,{className:`${j}-close`,onClick:()=>{h?.(v),e()}}),t().createElement(O.Dropdown,{open:I,trigger:["click"],dropdownRender:()=>l.length?t().createElement("div",{className:"ant-dropdown-menu step-list"},t().createElement(Yn.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.id)),r=l.map((e=>e.id));if((0,J.isEqual)(t,r))return;const n=t.findIndex((e=>e===C.id)),a=-1!==n?n:v;x(a),m?.(Gn(e),a)}},l.map(((e,r)=>t().createElement("li",{key:r,className:Se()("item",{actived:e.id===C.id})},t().createElement(we.HolderOutlined,{className:"handle",title:g("qm.form.draggable")}),t().createElement("span",{className:"box"},t().createElement("span",{className:"title",title:e.title,onClick:()=>{r!==v&&(w({id:e.id,node:Dd(e.nodePath),path:e.nodePath}),x(r),F(22===k?k+1:k-1),m?.(l,r))}},e.title),t().createElement(O.Popconfirm,{title:g("qm.button.confirmTitle"),zIndex:1051,onConfirm:()=>{const t=l.filter((t=>t.id!==e.id)),n=r===v;let a=r<=v?v-1:v;if(a=a<0?0:a,a=a>t.length?t.length:a,n&&t[a]){const{id:e,nodePath:r}=t[a];w({id:e,node:Dd(r),path:r})}x(a),m?.(t,a)}},t().createElement(we.CloseOutlined,{className:"close-icon"})))))))):t().createElement(t().Fragment,null),overlayClassName:`${j}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180},onOpenChange:e=>R(e)},t().createElement(we.MenuOutlined,{className:Se()(`${j}-close`,"menu-icon"),style:{width:k}})),t().createElement("div",{className:"panel-label"},t().createElement("span",{className:"title"},g("qm.guideTracker.label")),t().createElement("span",{className:"step"},g("qm.guideTracker.currentStep"),$)),p?p({id:C.id,nodePath:C.path,actionStatus:H,DO_CLOSE:e},v):t().createElement(qd,{action:H,onConfirm:()=>{m?.("add"===H?[...l,{id:C.id,nodePath:C.path,title:"Guide Title"}]:[...l],v),e()},onCancel:()=>{h?.(v),e()},onFinish:()=>{e(),h?.(v),f?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t().createElement(Hc(),{open:E&&T,autoLock:!0},t().createElement("div",{className:Se()(`${j}-target-placeholder`),style:{...P||_d,position:"fixed",zIndex:jd,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:_,onClick:_}))),s&&t().createElement(Hc(),{open:E},t().createElement(Vc,{zIndex:jd,prefixCls:j,onPause:()=>{L.current=T,N(!1),q()},onPlay:()=>{L.current?N(!0):D()}})))}));Kd.displayName="QmGuideTracker";const Md=Kd,Vd=r=>{const{content:n,image:a,width:i,height:l,font:o={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:p=1,antiTamper:m=!0,grayscale:h,className:f,style:g}=r,b=t().useRef(null),y=t().useRef(new Map),v=o.fontSize??16,x=o.fontWeight??"normal",E=o.fontStyle??"normal",S=o.fontFamily??"sans-serif",C=o.color??"rgba(0, 0, 0, 0.15)",w=o.textAlign??"center",T=Array.isArray(n)?n:[n],N=s[0],I=s[1],R=N/2,P=I/2,O=c[0]??R,A=c[1]??P,k=t().useMemo((()=>{const e=O-R,t=A-P;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:u}}),[R,P,O,A,u]),F=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const r=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[n,o]=(e=>{let t=120,r=64;if(!a&&e.measureText){e.font=`${v}px ${S}`;const n=T.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...n)),r=v*T.length+3*(T.length-1)}return[i??t,l??r]})(t),s=n*r,c=o*r,u=(N+n)*r,m=(I+o)*r,f=N/2*r,g=I/2*r,R=u/2,P=m/2,O=2*(N+n);e.width=2*u,e.height=2*m,t.globalAlpha=p,t.save(),t.translate(R,P),t.rotate(Math.PI/180*d),t.translate(-R,-P);const A=()=>{t.restore(),t.drawImage(e,0,0,u,m,u,m,u,m),h&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,r]=e;return`${n=t,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${r}`;var n})).join(";"))({...k,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),O)};if(a){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),A()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=a}else{const e=Number(v)*r;t.font=`${E} normal ${x} ${e}px/${o}px ${S}`,t.fillStyle=C,t.textAlign=w,t.textBaseline="top",t.translate(s/2,0),T.forEach(((n,a)=>{t.fillText(n??"",f,g+a*(e+3*r))})),A()}},L=e=>Array.from(y.current.values()).includes(e);t().useEffect((()=>{F()}),[n,a,i,l,o,s,c,d,u,p,m,h]),function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=window&&"MutationObserver"in window,i=e.useRef(),l=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};e.useEffect((()=>(l(),a&&t.current&&(i.current=new MutationObserver(r),i.current.observe(t.current,n)),()=>l())),[t])}(b,(e=>{if(m)for(const t of e){const e=Array.from(t.removedNodes).some((e=>L(e))),r="attributes"===t.type&&L(t.target);if(e||r){F();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const H=Ce("watermark");return t().createElement("div",{ref:b,className:Se()(H,f),style:{position:"relative",...g}},r.children)},zd="1.7.55"})(),a})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={787:t=>{t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{n.r(a),n.d(a,{Affix:()=>O.Affix,Alert:()=>O.Alert,Anchor:()=>O.Anchor,AutoComplete:()=>O.AutoComplete,Avatar:()=>O.Avatar,BackTop:()=>O.BackTop,Badge:()=>O.Badge,Breadcrumb:()=>O.Breadcrumb,Button:()=>O.Button,Calendar:()=>H,Card:()=>O.Card,Carousel:()=>O.Carousel,Cascader:()=>O.Cascader,Checkbox:()=>O.Checkbox,Col:()=>O.Col,Collapse:()=>O.Collapse,Comment:()=>O.Comment,ConfigProvider:()=>O.ConfigProvider,DatePicker:()=>q,DcpAnchor:()=>Wt,DcpButton:()=>he,DcpCollapse:()=>De,DcpConfigProvider:()=>X,DcpCopyToClipboard:()=>Qs,DcpCountup:()=>ct,DcpCropper:()=>Ml,DcpDivider:()=>Ie,DcpDownload:()=>$t,DcpDrawer:()=>nr,DcpEmpty:()=>mt,DcpForm:()=>bl,DcpGuideTracker:()=>Vd,DcpModal:()=>cr,DcpPrint:()=>vd,DcpRangeTableHelper:()=>wc,DcpScrollbar:()=>Pt,DcpSearchHelper:()=>uc,DcpSearchTree:()=>co,DcpSpace:()=>xe,DcpSpin:()=>ft,DcpSplit:()=>nt,DcpTable:()=>sc,DcpTabs:()=>Jt,DcpTinymce:()=>Dl,DcpTour:()=>Qc,DcpTransition:()=>rd,DcpTreeHelper:()=>vc,DcpTreeTableHelper:()=>bc,DcpUploadFile:()=>Bl,DcpUploadImg:()=>Jl,DcpWatermark:()=>zd,Descriptions:()=>O.Descriptions,Divider:()=>O.Divider,Drawer:()=>O.Drawer,Dropdown:()=>O.Dropdown,Empty:()=>O.Empty,Form:()=>O.Form,Grid:()=>O.Grid,Image:()=>O.Image,Input:()=>O.Input,InputNumber:()=>O.InputNumber,Layout:()=>O.Layout,List:()=>O.List,Mentions:()=>O.Mentions,Menu:()=>O.Menu,Modal:()=>O.Modal,PageHeader:()=>O.PageHeader,Pagination:()=>O.Pagination,Popconfirm:()=>O.Popconfirm,Popover:()=>O.Popover,Progress:()=>O.Progress,QmAnchor:()=>Wt,QmButton:()=>he,QmCollapse:()=>De,QmConfigProvider:()=>X,QmCopyToClipboard:()=>Qs,QmCountup:()=>ct,QmCropper:()=>Ml,QmDivider:()=>Ie,QmDownload:()=>$t,QmDrawer:()=>nr,QmEmpty:()=>mt,QmForm:()=>bl,QmGuideTracker:()=>Vd,QmModal:()=>cr,QmPrint:()=>vd,QmRangeTableHelper:()=>wc,QmScrollbar:()=>Pt,QmSearchHelper:()=>uc,QmSearchTree:()=>co,QmSpace:()=>xe,QmSpin:()=>ft,QmSplit:()=>nt,QmTable:()=>sc,QmTabs:()=>Jt,QmTinymce:()=>Dl,QmTour:()=>Qc,QmTransition:()=>rd,QmTreeHelper:()=>vc,QmTreeTableHelper:()=>bc,QmUploadFile:()=>Bl,QmUploadImg:()=>Jl,QmWatermark:()=>zd,Radio:()=>O.Radio,Rate:()=>O.Rate,Result:()=>O.Result,Row:()=>O.Row,Segmented:()=>O.Segmented,Select:()=>O.Select,Skeleton:()=>O.Skeleton,Slider:()=>O.Slider,Space:()=>O.Space,Spin:()=>O.Spin,Statistic:()=>O.Statistic,Steps:()=>O.Steps,Switch:()=>O.Switch,Tabs:()=>O.Tabs,Tag:()=>O.Tag,TimePicker:()=>M,Timeline:()=>O.Timeline,Tooltip:()=>O.Tooltip,Transfer:()=>O.Transfer,Tree:()=>O.Tree,TreeSelect:()=>O.TreeSelect,Typography:()=>O.Typography,Upload:()=>O.Upload,message:()=>O.message,notification:()=>O.notification,pinyin:()=>Wr,version:()=>Ud});var e=n(787),t=n.n(e);const r=require("prop-types");var i=n.n(r);const l=(0,e.createContext)({locale:"zh-cn",size:"middle"}),o=require("dayjs");var s=n.n(o);const c={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传"},uploadCropper:{dragableText:"拖放或点击",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},mergeCell:{cancel:"恢复",confirm:"合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let d=c;function u(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const p=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const[n,a]=t;let i;const l=n.split(".");let o=d;for(let e=0,t=l.length;e<t;e++){if(i=o[l[e]],e===t-1)return u(i,a);if(!i)return"";o=i}return""},m=e=>{d=e||d,d.name&&s().locale(d.name)};class h extends Error{constructor(e){super(e),this.name="QmDesignError"}}function f(e,t){throw new h(`[${e}] ${t}`)}function g(e,t){console.warn(new h(`[${e}] ${t}`))}const b=e=>["","small","middle","large"].includes(e),y=require("dayjs/plugin/localeData");var v=n.n(y);const x=require("dayjs/plugin/advancedFormat");var E=n.n(x);const S=require("dayjs/plugin/customParseFormat");var C=n.n(S);const w=require("dayjs/plugin/quarterOfYear");var T=n.n(w);const N=require("dayjs/plugin/weekOfYear");var I=n.n(N);const R=require("dayjs/plugin/weekday");var P=n.n(R);s().extend(v()),s().extend(E()),s().extend(C()),s().extend(T()),s().extend(I()),s().extend(P());const O=require("antd"),A=require("rc-picker/es/generate/dayjs");var k=n.n(A);const F=require("antd/es/calendar/generateCalendar");var L=n.n(F);require("antd/es/calendar/style");const H=L()(k()),$=require("antd/es/date-picker/generatePicker");var D=n.n($);require("antd/es/date-picker/style/index");const q=D()(k());function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_.apply(this,arguments)}const j=e.forwardRef(((t,r)=>e.createElement(q,_({},t,{picker:"time",mode:void 0,ref:r}))));j.displayName="TimePicker";const K=e.forwardRef(((t,r)=>e.createElement(q.RangePicker,_({},t,{picker:"time",mode:void 0,ref:r}))));K.displayName="RangePicker",j.RangePicker=K;const M=j,V={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload"},uploadCropper:{dragableText:"Drop or click",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},mergeCell:{cancel:"reset",confirm:"merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},z=require("antd/es/locale/zh_CN");var U=n.n(z);const B=require("antd/es/locale/en_GB");function W(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const G={[V.name]:{qm:V,antd:n.n(B)()},[c.name]:{qm:c,antd:U()}};class Y extends e.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},m(Object.assign({},G,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:r,size:n}=t.value,{locale:a,size:i,global:l}=e;return a!==r&&m(Object.assign({},G,l.langPackage)[a].qm),a!==r||i!==n?{value:Object.assign({},t.value,{locale:a,size:i})}:null}render(){const{global:e}=this.props,{value:r}=this.state,n=Object.assign({},G,e.langPackage);return t().createElement(l.Provider,{value:r},t().createElement(O.ConfigProvider,{locale:n[r.locale].antd,componentSize:r.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}W(Y,"propTypes",{locale:i().string,size:(e,t,r)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},theme:i().string,global:i().object}),W(Y,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const X=Y,Q=require("omit.js");var Z=n.n(Q);const J=require("lodash-es"),ee="undefined"==typeof window,te=e=>t().isValidElement(e),re=e=>te(e)&&e.type===t().Fragment,ne=()=>{},ae=()=>!0,ie=async e=>new Promise((t=>setTimeout(t,e))),le=e=>{Promise.resolve().then(e)},oe=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),se=e=>!!(!e&&0!==e||(0,J.isArray)(e)&&!e.length||(0,J.isPlainObject)(e)&&!Object.keys(e).length),ce=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,J.isPlainObject)(e)||(0,J.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const a=r?void 0:Object.keys(e);return function(e,t){let r=-1;const n=e.length;for(;++r<n;)t(e[r],r)}(a||e,((r,i)=>{a&&(i=r),n[i]=ce(e[i],t)})),n}return e},de=e=>(0,J.isNumber)(e)?`${e}px`:e.toString();function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ue.apply(this,arguments)}function pe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class me extends e.Component{constructor(){super(...arguments),pe(this,"state",{isLoading:!1}),pe(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{await(this.props.click?.(e))}catch(e){g("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:r,authConfig:n,click:a,confirm:i}=this.props,{isLoading:l}=this.state,o=e||this.context.size||"",s=(0,J.isFunction)(a)?{onClick:this.clickHandle}:null,c={...Z()(this.props,["authConfig","click","confirm"]),size:o,loading:l||r||!1,...s};if(n){const{visible:e=1,disabled:t}=n||{};if(!e)return null;t&&(c.disabled=!0)}return i?t().createElement(O.Popconfirm,{title:i.title||p("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{i.onConfirm?.(),c.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},t().createElement(O.Button,ue({},c,{onClick:ne}),this.props.children)):t().createElement(O.Button,c,this.props.children)}}pe(me,"propTypes",{click:i().func,confirm:i().shape({title:i().node,onConfirm:i().func,onCancel:i().func})}),pe(me,"contextType",l);const he=me;var fe,ge,be,ye=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ye||{});class ve extends e.Component{render(){const{size:e}=this.props,r=e||this.context.size||"",n=(0,J.isNumber)(e)?e:ye[e||r||"default"],a={...this.props,size:n};return t().createElement(O.Space,a,this.props.children)}}fe=ve,be=l,(ge=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(ge="contextType"))in fe?Object.defineProperty(fe,ge,{value:be,enumerable:!0,configurable:!0,writable:!0}):fe[ge]=be;const xe=ve,Ee=require("classnames");var Se=n.n(Ee);const Ce=e=>`qm-${e}`,we=require("@ant-design/icons");function Te(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ne extends e.Component{constructor(){super(...arguments),Te(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=ne}=this.props;t(!e)}))}render(){const{size:e,label:r,extra:n,collapse:a,bordered:i,disabled:l,id:o,className:s,style:c}=this.props,d=e||this.context.size||"",u=Ce("divider"),m={[u]:!0,[`${u}-borderless`]:!i,[`${u}--lg`]:"large"===d,[`${u}--sm`]:"small"===d};return t().createElement("div",{id:o,className:Se()(m,s),style:c},t().createElement("span",{className:Se()(`${u}__title`)},r),t().createElement("div",{className:Se()(`${u}__extra`)},n),void 0!==a&&t().createElement(O.Button,{type:"link",className:Se()(`${u}__collapse`),disabled:l,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}Te(Ne,"contextType",l),Te(Ne,"propTypes",{label:i().string,size:(e,t,r)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},extra:i().oneOfType([i().element,i().string]),collapse:i().bool,bordered:i().bool}),Te(Ne,"defaultProps",{bordered:!0});const Ie=Ne,Re=()=>({height:0,opacity:0}),Pe=(e,t)=>"height"===t.propertyName,Oe={motionName:"rc-collapse-motion",onEnterStart:Re,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Re,onEnterEnd:Pe,onLeaveEnd:Pe,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},Ae=require("rc-motion");var ke=n.n(Ae);const Fe=t().forwardRef(((e,r)=>{const{forceRender:n,className:a,style:i,boxStyle:l,isActive:o}=e,[s,c]=t().useState(o||n);if(t().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const d=Ce("collapse");return t().createElement("div",{ref:r,className:Se()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},a),style:i},t().createElement("div",{className:`${d}-content-box`,style:l},e.children))}));Fe.displayName="PanelContent";const Le=Fe;function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},He.apply(this,arguments)}const $e=e=>{const{defaultActive:r,label:n,extra:a,className:i,style:l,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[m,h]=t().useState(!!r),f=Ce("collapse"),g=Se()({[`${f}`]:!0,[`${f}-active`]:m,[`${f}-disabled`]:c},i);return t().createElement("div",{className:g,style:l},t().createElement(Ie,{label:n,extra:a,collapse:m,bordered:s,disabled:c,onCollapseChange:e=>{h(e),p?.(e)}}),t().createElement(ke(),He({visible:m},Oe,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),((r,n)=>{let{className:a,style:i}=r;return t().createElement(Le,{ref:n,prefixCls:f,className:a,style:i,boxStyle:o,isActive:m,forceRender:d},e.children)})))};$e.displayName="QmCollapse";const De=$e,qe=t().createContext(void 0);function _e(t,r){((r,n)=>{const a=e.useRef(!0);e.useEffect((()=>(e=>{if(!e)return t()})(a.current)),n),e.useEffect((()=>(a.current=!1,()=>{a.current=!0})),[])})(0,r)}const je=require("react-draggable");var Ke=n.n(je);const Me=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Ve=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},ze=e=>e.stopPropagation(),Ue=e=>e.preventDefault(),Be=(e,t,r)=>{!ee&&e&&t&&((0,J.isPlainObject)(t)?Object.keys(t).forEach((r=>{Be(e,r,t[r])})):(t=oe(t),e.style[t]=r))},We=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},Ge=(e,t)=>Math.abs(We(e)-We(t)),Ye=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},Xe=(e,t)=>{if(ee||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},Qe=e=>{const{minValues:r,onDragChange:n,onDragging:a}=e,{splitRef:i,direction:l}=t().useContext(qe),[o,s]=t().useState(),[c,d]=t().useState(0),u="vertical"===l?"y":"x",m={[`${Ce("split")}__resize-bar`]:!0,vertical:"vertical"===l,horizontal:"horizontal"===l};return t().createElement(Ke(),{bounds:o,axis:u,position:{x:0,y:0},positionOffset:{[u]:-1*c},onStart:()=>{n(!0),(()=>{const e=i.current.children[0];if(!e)return;const t=(()=>{const{w:e,h:t}={w:i.current.offsetWidth,h:i.current.offsetHeight};return[r[0],("vertical"===l?t:e)-r[1]]})(),n=e.offsetWidth,a=e.offsetHeight;s({left:t[0]-n,right:t[1]-n,top:t[0]-a,bottom:t[1]-a})})()},onDrag:(e,t)=>{d(t[u]),a(t[u])},onStop:()=>n(!1)},t().createElement("div",{className:Se()(m),title:p("qm.split.resize")}))};Qe.displayName="ResizeBar";const Ze=Qe,Je=t().forwardRef(((e,r)=>{const{offset:n,className:a,style:i}=e,{direction:l,dragging:o}=t().useContext(qe),s="vertical"===l?"height":"width",c={[Ce("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===l,vertical:"vertical"===l,[a]:!!a},d=void 0!==n?{[s]:de(n)}:{flex:1,[s]:0};return t().createElement("div",{ref:r,className:Se()(c),style:{...d,...i}},e.children)}));Je.displayName="QmSplitPane";const et=Je;function tt(){return tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tt.apply(this,arguments)}const rt=e=>{const{direction:r="horizontal",defaultValue:n="50%",uniqueKey:a,className:i,style:o,onDragStart:s,onDrag:c=ne,onDragEnd:d}=e,{global:u}=t().useContext(l),p=t().useRef(null),m=t().useRef(null),h=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=t().useMemo((()=>a?`split_${a}`:""),[a]),[y,v]=t().useState(!1),[x,E]=t().useState(h(n)),S=t().useRef(0);_e((()=>{y?(S.current="vertical"===r?m.current.offsetHeight:m.current.offsetWidth,s?.(f(x))):(d?.(f(x)),localStorage.setItem(b,x),T(b,x))}),[y]),t().useEffect((()=>{C()}),[]);const C=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(h(e)):w(b).then((e=>{localStorage.setItem(b,h(e||n)),C()})).catch((()=>{}))},w=async e=>{const t=u?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},T=async(e,t)=>{const r=u?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},N=t().useMemo((()=>({splitRef:p,direction:r,dragging:y})),[r,y]),I=[];t().Children.map(e.children,(e=>{te(e)&&!re(e)&&"QmSplitPane"===e.type?.displayName&&I.push(e)}));const[R,P]=I,O=t().useMemo((()=>[g(R),g(P)]),[R,P]),A={[Ce("split")]:!0,vertical:"vertical"===r};return t().createElement(qe.Provider,{value:N},t().createElement("div",{ref:p,className:Se()(A,i),style:o},t().createElement(et,tt({},R.props,{ref:m,offset:x})),t().createElement(Ze,{minValues:O,onDragChange:e=>v(e),onDragging:e=>{const t=S.current+e;E(`${t}px`),c(t)}}),t().createElement(et,P.props)))};rt.Pane=et,rt.displayName="QmSplit";const nt=rt,at=require("react-countup");var it=n.n(at);function lt(){return lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lt.apply(this,arguments)}function ot(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class st extends e.Component{render(){const{size:e,className:r,style:n}=this.props,a=e||this.context.size||"",i=Ce("countup"),l={[i]:!0,[`${i}--lg`]:"large"===a,[`${i}--sm`]:"small"===a};return t().createElement(it(),lt({},this.props,{className:Se()(l,r),style:n}),this.props.children)}}ot(st,"defaultProps",{duration:2}),ot(st,"contextType",l);const ct=st;function dt(){return dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dt.apply(this,arguments)}function ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class pt extends e.Component{render(){const{size:e,className:r}=this.props,n=e||this.context.size||"",a=Ce("empty"),i={...this.props,image:O.Empty.PRESENTED_IMAGE_SIMPLE},l={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return t().createElement(O.Empty,dt({},i,{className:Se()(l,r)}))}}ut(pt,"contextType",l),ut(pt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const mt=pt;class ht extends e.Component{render(){const{fullHeight:e,className:r,style:n={}}=this.props,a={[`${Ce("spin")}-full-height`]:e},i={wrapperClassName:Se()(a,r),...Z()(this.props,["fullHeight"]),style:{...n,maxHeight:"none"}};return t().createElement(O.Spin,i,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ht,"defaultProps",{tip:"Loading...",fullHeight:!1});const ft=ht,gt=t().createContext(void 0),bt=require("resize-observer-polyfill");var yt=n.n(bt);const vt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},xt=function(e,t){!ee&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(yt())(vt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},Et=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function St(t){const[r,n]=e.useState({width:0,height:0});return e.useEffect((()=>{const e=t.current,r=e=>{const{width:t,height:r}=e.contentRect;n({width:t,height:r})};return e&&xt(e,r),()=>{e&&Et(e,r)}}),[t]),r}function Ct(t,r){var n=this;const a=e.useRef(null);return e.useEffect((()=>()=>{clearTimeout(a.current),a.current=null}),[]),function(){for(var e=arguments.length,i=new Array(e),l=0;l<e;l++)i[l]=arguments[l];a.current&&clearTimeout(a.current),a.current=setTimeout((()=>t.apply(n,i)),r)}}const wt=6,Tt={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",reverse:"width",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",reverse:"height",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},Nt=e=>{const{thumb:r,always:n,barSize:a=wt,direction:i="vertical",onDrag:l=ne}=e,{dragging:o,scrollbarElement:s,wrapElement:c}=t().useContext(gt),d=Tt[i],u=t().useRef(r),p=t().useRef(null),m=t().useRef(null),h=t().useRef({}),f=t().useRef(!1),g=t().useRef(!1),b=t().useRef(ee?null:document.onselectstart),[y,v]=t().useState(!1);t().useEffect((()=>{u.current=r}),[r]),t().useEffect((()=>{const e=s.current;return Me(e,"mousemove",C),Me(e,"mouseleave",w),()=>{S(),Ve(document,"mouseup",E),Ve(e,"mousemove",C),Ve(e,"mouseleave",w)}}),[]);const x=e=>{if(!p.current||!m.current)return;if(!f.current)return;const t=h.current[d.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[d.direction]-e[d.client])-(m.current[d.offset]-t))/p.current[d.offset];c.current[d.scroll]=r*c.current[d.scrollSize]/100,l(!0)},E=()=>{f.current=!1,h.current={[d.axis]:0},Ve(document,"mousemove",x),Ve(document,"mouseup",E),S(),g.current&&v(!1),l(!1)},S=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},C=()=>{g.current=!1,v(!!u.current.size)},w=()=>{g.current=!0,v(f.current)},T=Ce("scrollbar"),N={[`${T}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},I={[d.reverse]:a},R={[d.size]:r.size,transform:`translate${d.axis}(${r.offset}%)`};return t().createElement(rd,{name:"fade",in:n||o||y,timeout:300},t().createElement("div",{ref:p,className:Se()(N),style:I},t().createElement("div",{ref:m,className:`${T}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),Me(document,"mousemove",x),Me(document,"mouseup",E),f.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[d.axis]:t[d.offset]-(e[d.client]-t.getBoundingClientRect()[d.direction])})}})))},It=20,Rt=t().forwardRef(((e,r)=>{const{wrapClassName:n,wrapStyle:a,barWidth:i,always:l,native:o,minSize:s=It,onScroll:c}=e,d=t().useRef(null),u=t().useRef(null),p=t().useRef(null),[m,h]=t().useState({size:0,offset:0,ratio:1}),[f,b]=t().useState({size:0,offset:0,ratio:1}),[y,v]=t().useState(!1),x=St(d),E=St(p);_e((()=>{!o&&S()}),[E.width,E.height,x.width,x.height]);const S=Ct((()=>{if(!u.current)return;const e=u.current.offsetHeight-4,t=u.current.offsetWidth-4,r=e**2/u.current.scrollHeight,n=t**2/u.current.scrollWidth,a=Math.max(r,s),i=Math.max(n,s),l=r/(e-r)/(a/(e-a)),o=n/(t-n)/(i/(t-i)),c=a+4<e?a:0,d=i+4<t?i:0,p=100*u.current.scrollTop/e*l,g=100*u.current.scrollLeft/t*o;h(Object.assign({},m,{size:d,ratio:o,offset:g})),b(Object.assign({},f,{size:c,ratio:l,offset:p}))}),5),C=e=>{v(e)},w=e=>{(0,J.isNumber)(e)?u.current.scrollTop=e:g("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=e=>{(0,J.isNumber)(e)?u.current.scrollLeft=e:g("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t().useImperativeHandle(r,(()=>({container:d.current,scrollTop:u.current?.scrollTop||0,scrollLeft:u.current?.scrollLeft||0,SET_SCROLL_TOP:w,SET_SCROLL_LEFT:T})));const N=t().useMemo((()=>({dragging:y,scrollbarElement:d,wrapElement:u})),[y]),I=Ce("scrollbar"),R={[`${I}__wrap`]:!0,[`${I}__wrap--hidden`]:!o};return t().createElement("div",{ref:d,className:Se()(I,e.className),style:e.style},t().createElement("div",{ref:u,className:Se()(R,n),style:a,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!o&&(()=>{if(!u.current)return;const e=u.current.offsetHeight-4,t=u.current.offsetWidth-4,r=100*u.current.scrollTop/e*f.ratio,n=100*u.current.scrollLeft/t*m.ratio;h(Object.assign({},m,{offset:n})),b(Object.assign({},f,{offset:r}))})(),c?.({scrollTop:t,scrollLeft:r})}},t().createElement("div",{ref:p,className:`${I}__view`},e.children)),!o&&t().createElement(gt.Provider,{value:N},t().createElement(Nt,{direction:"horizontal",thumb:m,barSize:i,always:l,onDrag:C}),t().createElement(Nt,{direction:"vertical",thumb:f,barSize:i,always:l,onDrag:C})))}));Rt.displayName="QmScrollbar";const Pt=Rt,Ot=require("axios");var At=n.n(Ot);const kt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Ft(){return Ft=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ft.apply(this,arguments)}function Lt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ht extends e.Component{constructor(){super(...arguments),Lt(this,"state",{loading:!1}),Lt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{const{action:e,beforeDownload:t=ae}=this.props,r=(0,J.isString)(e)?e:await this.getActionUrl();if(!r)return g("Download","参数 `action` 有误!");if(!t(r))return;await this.downloadFile(r),await ie(100),this.props.onSuccess?.(),O.message.success(p("qm.download.success"))}catch(e){this.props.onError?.(e),O.message.error(p("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}async downloadFile(e){const{fileName:t,headers:r,params:n,withCredentials:a}=this.props,i=await At()({url:e,params:n,headers:r,withCredentials:a,responseType:"blob",timeout:0}),l=i.data,o=i.headers["content-disposition"],s=t||(o?o.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));kt(l,s)}render(){const{size:e}=this.props,{loading:r}=this.state,n=e||this.context.size||"",a=Z()(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t().createElement(O.Button,Ft({},a,{size:n,loading:r,onClick:this.downloadHandle}),this.props.children)}}Lt(Ht,"propTypes",{action:i().oneOfType([i().string,i().shape({api:i().func.isRequired,params:i().object})]),size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},fileName:i().string,headers:i().object,withCredentials:i().bool,params:i().object,beforeDownload:i().func,onSuccess:i().func,onError:i().func}),Lt(Ht,"defaultProps",{icon:t().createElement(we.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),Lt(Ht,"contextType",l);const $t=Ht,Dt=require("add-dom-event-listener");var qt=n.n(Dt);const _t=require("scroll-into-view-if-needed");var jt=n.n(_t);class Kt extends e.Component{renderLabel(){const{activeKey:e,labels:r,onTabClick:n}=this.props;return r.map(((r,a)=>{const i={item:!0,actived:a===e};return t().createElement("div",{key:a,className:Se()(i),onClick:e=>n(a,e)},t().createElement("span",null,r))}))}render(){return t().createElement(t().Fragment,null,this.renderLabel())}}const Mt=Kt;class Vt extends e.Component{render(){const{label:e,showDivider:r,className:n,style:a}=this.props,i={[Ce("anchor-item")]:!0};return t().createElement("div",{className:Se()(i,n),style:a},r&&t().createElement(Ie,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Vt,"displayName","QmAnchorItem");const zt=Vt;function Ut(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bt extends e.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(t){super(t),Ut(this,"currentState","ready"),Ut(this,"itemsTotal",void 0),Ut(this,"timer",void 0),Ut(this,"scrollEvent",void 0),Ut(this,"scrollRef",(0,e.createRef)()),Ut(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),Ut(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),jt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),Ut(this,"SCROLL_TO_ITEM",(e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)})),this.state={activeKey:t.defaultActiveIndex||0}}componentDidMount(){this.initialHandle(),this.scrollEvent=qt()(this.scrollRef.current,"scroll",(0,J.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=Ge(this.getTargetElement(e),this.scrollRef.current))}createDistances(){const{labelList:e=[]}=this.props;return(this.__is_conf?e.map((e=>document.getElementById(e.id))):Array.from(this.scrollRef.current?.children||[])).map((e=>Ge(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),r=this.createDistances();let n=-1;for(let e=0;e<r.length;e++){const a=r[e],i=r[e+1]||1e4;t>=a-1&&t<i&&(n=e)}return n}getTargetElement(e){const{labelList:t=[]}=this.props;return this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e]}render(){const{activeKey:e}=this.state,{size:r,labelWidth:n,tabPosition:a,labelList:i=[],onTabClick:l,className:o,style:s}=this.props,c=r||this.context.size||"",d=Ce("anchor"),u={[d]:!0,[`${d}-left`]:"left"===a,[`${d}-top`]:"top"===a,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmAnchorItem"===e.type?.displayName&&p.push(e)}));const m=this.__is_conf?i.map((e=>e.label)):p.map((e=>e.props.label)),h=this.__is_conf?i.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=m.length,t().createElement("div",{className:Se()(u,o),style:s},t().createElement("div",{className:Se()("anchor-nav"),style:{width:n?de(n):""}},t().createElement(Mt,{activeKey:e,labels:m,onTabClick:(e,t)=>{this.onTabClickHandle(e),l?.({label:m[e],id:h[e]},t)}})),t().createElement("div",{ref:this.scrollRef,className:Se()("anchor-container")},this.__is_conf?this.props.children:p))}}Ut(Bt,"Item",zt),Ut(Bt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},labelWidth:(e,t,r)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.");var n},labelList:i().arrayOf(i().shape({id:i().string,label:i().string}))}),Ut(Bt,"defaultProps",{tabPosition:"left"}),Ut(Bt,"contextType",l);const Wt=Bt;class Gt extends e.Component{render(){return t().createElement(O.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Gt,"displayName","QmTabPane");const Yt=Gt;function Xt(){return Xt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xt.apply(this,arguments)}function Qt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Zt extends e.Component{render(){const{items:e,size:r,tabPosition:n,tabBarGutter:a,className:i,authConfig:l}=this.props,o=r||this.context.size||"",s=Ce("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===o,[`${s}--sm`]:"small"===o},d={...Z()(this.props,["items","authConfig"]),size:o,tabBarGutter:a??(["top","bottom"].includes(n)?30:0)},u=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmTabPane"===e.type?.displayName&&u.push(e)}));const p=e?[...e]:u.map((e=>{let{key:t,props:r}=e;return{key:t,label:r.tab,disabled:r.disabled,closable:r.closable,forceRender:r.forceRender,children:r.children}}));if(l){const{fieldList:e=[]}=l||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:a=1,disabled:i}=n||{};a?i&&(r.disabled=!0):(p.splice(t,1),t--)}}return t().createElement(O.Tabs,Xt({},d,{items:p,className:Se()(c,i)}))}}Qt(Zt,"TabPane",Yt),Qt(Zt,"contextType",l),Qt(Zt,"defaultProps",{tabPosition:"top"});const Jt=Zt;function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},er.apply(this,arguments)}function tr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class rr extends e.Component{constructor(){super(...arguments),tr(this,"titleRef",t().createRef()),tr(this,"$drawer",null),tr(this,"opened",!1),tr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),tr(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;e?(this.opened=!0,(0,J.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(this.props.onClosed?.(),this.setState({fullscreen:!1}))})),tr(this,"toggleHandle",(()=>{this.$drawer=Ye(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),tr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),tr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,destroyOnClose:i}=this.props,l=n??r,o=e.open??e.visible,{fullscreen:s}=this.state;l&&l!==o&&(!i&&this.opened||(0,J.isUndefined)(a)&&this.setState({spinning:!0})),this.$drawer&&s!==t.fullscreen&&Be(this.$drawer,s?{width:"100%"}:{width:de(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{showFullScreen:r}=this.props;return t().createElement(t().Fragment,null,t().createElement("span",{ref:this.titleRef,className:Se()("text")},this.props.title),r&&t().createElement("span",{className:Se()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:r}=this.state,{visible:n,open:a,size:i,className:l,loading:o,maskClosable:s,onClose:c}=this.props,d=this.context.global,u=i||this.context.size||"",p=Ce("drawer"),m={[p]:!0,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return t().createElement(O.Drawer,er({},Z()(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??n,maskClosable:s??d?.maskClosable??!1,className:Se()(m,l),title:this.renderTitle(),footer:null,onClose:c,afterOpenChange:this.afterVisibleChange}),this.props.children,(o||r||e)&&t().createElement(ft,{spinning:!0,className:Se()("spinning")}))}}tr(rr,"contextType",l),tr(rr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),tr(rr,"defaultProps",{width:"72%",showFullScreen:!0,destroyOnClose:!0,footer:null});const nr=rr;function ar(){return ar=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ar.apply(this,arguments)}function ir(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const lr="10vh";var or=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e}(or||{});class sr extends e.Component{constructor(){super(...arguments),ir(this,"$event",null),ir(this,"draggleRef",t().createRef()),ir(this,"opened",!1),ir(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),ir(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=qt()(document.body,"mousedown",ze))})),ir(this,"removeMouseDownEvent",(()=>{this.$event&&(this.$event?.remove(),this.$event=null)})),ir(this,"onStart",((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,a=this.draggleRef.current.getBoundingClientRect();a&&this.setState({bounds:{left:-a.left+t.x,right:r-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1}})})),ir(this,"toggleHandle",(e=>{const t=Ye(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body"),{height:n}=this.props,{fullscreen:a}=this.state;a?(Be(t,{width:de(this.props.width||"60%"),height:"auto",top:lr}),Be(r,{height:n?de(n):this.defaultHeight,maxHeight:"auto"===n?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(r,{height:`calc(100vh - ${or[this.$size]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),ir(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),ir(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),ir(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${lr} - ${lr} - ${or[this.$size]}px)`}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,stopMouseDownEvent:i,destroyOnClose:l}=this.props,o=n??r,s=e.open??e.visible,{fullscreen:c}=this.state;if(o&&o!==s){if(!l&&this.opened||(0,J.isUndefined)(a)&&this.setState({spinning:!0}),i&&this.addMouseDownEvent(),!l&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,J.isUndefined)(a)&&this.setState({spinning:!1})}),400)}o||this.removeMouseDownEvent(),c!==t.fullscreen&&(c?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:r}=this.state,{showFullScreen:n}=this.props;return t().createElement("div",{onMouseOver:()=>{r&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},t().createElement("span",{className:Se()("text")},this.props.title),n&&t().createElement("span",{className:Se()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:r,fullscreen:n,disabled:a,bounds:i,position:l}=this.state,{visible:o,open:s,height:c,className:d,loading:u,draggable:p,maskClosable:m,bodyStyle:h,onClose:f}=this.props,g=this.context.global,b=Ce("modal"),y={height:c?de(c):this.defaultHeight,maxHeight:"auto"===c?this.defaultHeight:"",overflow:"auto"},v={[b]:!0,[`${b}--lg`]:"large"===this.$size,[`${b}--sm`]:"small"===this.$size};return t().createElement(O.Modal,ar({},Z()(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:s??o,maskClosable:m??g?.maskClosable??!1,className:Se()(v,d),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},y,h),onCancel:f,afterClose:this.afterVisibleChange,modalRender:e=>t().createElement(Ke(),{disabled:!p||a||n,bounds:i,position:l,onStart:(e,t)=>this.onStart(e,t)},t().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(u||r||e)&&t().createElement(ft,{spinning:!0,className:Se()("spinning")}))}}ir(sr,"contextType",l),ir(sr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),ir(sr,"defaultProps",{width:"60%",showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:lr}});const cr=sr,dr=require("memoize-one");var ur=n.n(dr);const pr=(0,e.createContext)(void 0),mr=80,hr="1",fr="0",gr=400,br=["RANGE_INPUT","RANGE_INPUT_NUMBER","RANGE_SEARCH_HELPER","MULTIPLE_CHECKBOX","MULTIPLE_SELECT","RANGE_DATE","RANGE_TIME","MULTIPLE_TREE_SELECT","MULTIPLE_SEARCH_HELPER","MULTIPLE_TREE_TABLE_HELPER","MULTIPLE_CASCADER","UPLOAD_IMG","UPLOAD_FILE"],yr={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let vr=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),xr=function(e){return e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY",e}({}),Er=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Sr={items:i().arrayOf(i().shape({type:i().string.isRequired,fieldName:i().string.isRequired})),initialValues:i().object,initialExtras:i().object,layout:i().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!b(e[t]||""))return f("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:i().number,customClass:i().string,compactMode:i().bool,labelWidth:i().oneOfType([i().number,i().string]),labelAlign:i().oneOf(["left","right"]),labelWrap:i().bool,formType:i().oneOf(["default","search","onlyShow"]),disabled:i().bool,uniqueKey:i().string,defaultRows:i().number,defaultExpand:i().bool,searchButtonCols:i().number,scrollToFirstError:i().bool,authConfig:i().object,isAutoFocus:i().bool,isCollapse:i().bool,isFieldsDefine:i().bool,isSearchBtn:i().bool,isSubmitBtn:i().bool,fieldsChange:i().func,onValuesChange:i().func,onFieldsChange:i().func,onFinish:i().func,onFinishFailed:i().func,onReset:i().func,onCollapse:i().func},Cr={layout:"horizontal",labelWidth:mr,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:ne,onFieldsChange:ne,onFinish:ne,onFinishFailed:ne,onReset:ne,onCollapse:ne,onFormItemsChange:ne},wr=(e,t)=>{if(!e)return null;if(t===xr.week){const t=e.match(/^(\d{4})-(\d+)/);return t?s()().year(Number(t[1])).week(Number(t[2])):null}if(t===xr.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?s()().year(Number(t[1])).quarter(Number(t[2])):null}return s()(e,t)},Tr=(e,t)=>e?s()(e).format(t):"",Nr=e=>""===e||null==e,Ir=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,a=r.length;t<a;t++)n+=(e[r[t].trim()]??"")+(t===a-1?"":" | ");return n},Rr=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Pr=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Or=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),e.isLeaf&&(n.isLeaf=!0),!(0,J.isUndefined)(e.selectable)&&(n.selectable=e.selectable),Array.isArray(e.children)&&(n.children=Or(e.children,t,r)),n})),Ar=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=Ar(r.children,t);if(e)return e}}return null},kr=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...kr(e.children,t,r+1))})),n},Fr=(e,t,r,n)=>{const a={};return a.filters=e.filters?.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t}))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(a.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Lr={PINYINS:["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],UNIHANS:["阿","哎","安","肮","凹","八","挀","扳","邦","勹","陂","奔","伻","屄","边","灬","憋","汃","冫","癶","峬","嚓","偲","参","仓","撡","冊","嵾","曽","叉","芆","辿","伥","抄","车","抻","阷","吃","充","抽","出","欻","揣","巛","刅","吹","旾","逴","呲","匆","凑","粗","汆","崔","邨","搓","咑","呆","丹","当","刀","嘚","扥","灯","氐","甸","刁","爹","丁","丟","东","吺","厾","耑","垖","吨","多","妸","诶","奀","鞥","儿","发","帆","匚","飞","分","丰","覅","仏","紑","夫","旮","侅","甘","冈","皋","戈","给","根","刯","工","勾","估","瓜","乖","关","光","归","丨","呙","哈","咍","佄","夯","茠","诃","黒","拫","亨","噷","叿","齁","乎","花","怀","欢","巟","灰","昏","吙","丌","加","戋","江","艽","阶","巾","坕","冂","丩","凥","姢","噘","军","咔","开","刊","忼","尻","匼","肎","劥","空","抠","扝","夸","蒯","宽","匡","亏","坤","扩","垃","来","兰","啷","捞","肋","勒","崚","哩","俩","奁","良","撩","毟","拎","伶","溜","囖","龙","瞜","噜","驴","娈","掠","抡","罗","呣","妈","埋","嫚","牤","猫","么","呅","门","甿","咪","宀","喵","乜","民","名","谬","摸","哞","毪","嗯","拏","腉","囡","囔","孬","疒","娞","恁","能","妮","拈","娘","鸟","捏","囜","宁","妞","农","羺","奴","女","奻","疟","黁","挪","喔","讴","妑","拍","眅","乓","抛","呸","喷","匉","丕","囨","剽","氕","姘","乒","钋","剖","仆","七","掐","千","呛","悄","癿","亲","靑","卭","丘","区","峑","缺","夋","呥","穣","娆","惹","人","扔","日","茸","厹","邚","挼","堧","婑","瞤","捼","仨","毢","三","桒","掻","閪","森","僧","杀","筛","山","伤","弰","奢","申","升","尸","収","书","刷","衰","闩","双","脽","吮","说","厶","忪","捜","苏","狻","夊","孙","唆","他","囼","坍","汤","夲","忑","熥","剔","天","旫","帖","厅","囲","偷","凸","湍","推","吞","乇","穵","歪","弯","尣","危","昷","翁","挝","乌","夕","虲","仙","乡","灱","些","心","星","凶","休","吁","吅","削","坃","丫","恹","央","幺","倻","一","囙","应","哟","佣","优","扜","囦","曰","晕","帀","災","兂","匨","傮","则","贼","怎","増","扎","捚","沾","张","佋","蜇","贞","争","之","中","州","朱","抓","拽","专","妆","隹","宒","卓","乲","宗","邹","租","钻","厜","尊","昨","兙"],EXCEPTIONS:{曾:"ZENG",沈:"SHEN",嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬤:"MO",嬷:"MO",蹒:"PAN",蹊:"XI",丬:"PAN",霰:"XIAN",莘:"XIN",豉:"CHI",饧:"XING",筠:"JUN",长:"CHANG",帧:"ZHEN",峙:"SHI",郍:"NA",芎:"XIONG",谁:"SHUI"}},Hr="阿",$r="鿿",Dr=1,qr=2,_r=3;let jr,Kr=null;function Mr(e){return e||null===Kr?("object"==typeof Intl&&Intl.Collator?(jr=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Kr=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Kr=!1,Kr):Kr}function Vr(e){const t=Lr.UNIHANS,r=Lr.PINYINS,n=Lr.EXCEPTIONS,a={source:e};if(e in n)return a.type=qr,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=Dr,a.target=e,a;if(i=jr.compare(e,Hr),i<0)return a.type=_r,a.target=e,a;if(0===i)a.type=qr,l=0;else{if(i=jr.compare(e,$r),i>0)return a.type=_r,a.target=e,a;0===i&&(a.type=qr,l=t.length-1)}if(a.type=qr,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=jr.compare(e,a),0===i)break;i>0?r=l+1:n=l-1}}return i<0&&l--,a.target=r[l],a.target||(a.type=_r,a.target=a.source),a}function zr(e){return"string"==typeof e&&Mr()?e.split("").map((e=>Vr(e))):e}const Ur={isSupported:Mr,parse:zr,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Lr)})))},genToken:Vr,convertToPinyin:(e,t,r)=>zr(e).map((e=>t&&e.type===qr?e.target.toLowerCase():e.target)).join(r||"")},Br={patcher:function(e){e.EXCEPTIONS={嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬷:"MO",蹊:"XI",丬:"PAN",霰:"XIAN",豉:"CHI",饧:"XING",帧:"ZHEN",芎:"XIONG",谁:"SHUI",钶:"KE"},e.UNIHANS[91]="伕",e.UNIHANS[347]="仚",e.UNIHANS[393]="诌",e.UNIHANS[39]="婤",e.UNIHANS[50]="腠",e.UNIHANS[369]="攸",e.UNIHANS[123]="乯",e.UNIHANS[171]="刕",e.UNIHANS[102]="佝",e.UNIHANS[126]="犿",e.UNIHANS[176]="列",e.UNIHANS[178]="刢",e.UNIHANS[252]="娝",e.UNIHANS[330]="偸"},shouldPatch:function(e){return"function"==typeof e&&"FOU"===e("伕").target&&"XIA"===e("仚").target&&"ZHONG"===e("诌").target&&"CHONG"===e("婤").target&&"CONG"===e("腠").target&&"YONG"===e("攸").target&&"HOU"===e("乯").target&&"LENG"===e("刕").target&&"GONG"===e("佝").target&&"HUAI"===e("犿").target&&"LIAO"===e("列").target&&"LIN"===e("刢").target&&"E"===e("钶").target}};Ur.isSupported()&&Br.shouldPatch(Ur.genToken)&&Ur.patchDict(Br);const Wr=Ur,Gr=e=>{const{value:r,bordered:n}=e;return t().createElement(O.Input,{value:r,title:r,bordered:n,readOnly:!0})};Gr.displayName="FormItemView";const Yr=Gr;function Xr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qr(){return Qr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qr.apply(this,arguments)}const{Option:Zr}=O.Select,Jr=e=>{const{$$form:r}=t().useContext(pr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{options:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=e.option,{itemList:b=[],filterable:y=!0,listHeight:v=gr,collapseTags:x,maxTagTextLength:E,openPyt:S=!0}=c,C=se(b)?a:b,w=e=>i?C.filter((t=>e?.includes(t.value))).map((e=>e.text)).join(","):C.find((t=>t.value===e))?.text||"";return r.isOnlyShow?t().createElement(Yr,{value:w(n),bordered:m}):t().createElement(O.Select,Qr({value:n,mode:i?"multiple":void 0,placeholder:u,style:d,loading:l,bordered:m,allowClear:h,disabled:g,showSearch:y,listHeight:v,maxTagCount:x?"responsive":void 0,maxTagTextLength:E},i?{title:w(n)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=Wr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(S?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,w(e),C)})(e)}}),C.map((e=>t().createElement(Zr,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class en extends e.Component{constructor(){super(...arguments),Xr(this,"state",{itemList:[],loading:!1}),Xr(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r,loading:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:m,validateTrigger:h,rules:f=[],onChange:g=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(i),className:Se()(o,u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(f)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(Jr,{option:this.props.option,items:r,loading:n,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(o,r)}}))),m&&t().createElement(O.Col,null,e.renderFormItemButton(o,m)),p&&t().createElement(O.Col,{flex:de(p.labelWidth||mr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Xr(en,"contextType",pr);const tn=en,rn=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:d=r.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=fr,trueValue:h=hr}=o;return t().createElement(O.Checkbox,{checked:n===h,style:s,disabled:d||r.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{a?.(e),i(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(t?h:m)}},u?l:null)};class nn extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option,{labelToCheckbox:h}=o;return t().createElement(O.Form.Item,{label:h?" ":e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(rn,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(nn,"contextType",pr);const an=nn,ln=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],on={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)ln.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,r){return e.split(t).join(r)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},sn=["==","<",">","<=",">=","!=","like","likes","in","nin"],cn=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)sn.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),sn.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},dn=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,un=["string","number","boolean","symbol"],pn=e=>un.includes(typeof e),mn=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),hn=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(dn,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(hn(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(hn(t))));break;case"in":pn(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":pn(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(mn(e)?e.slice(0,10):e)!=r;break;case"<":n=(mn(e)?e.slice(0,10):e)<r;break;case"<=":n=(mn(e)?e.slice(0,10):e)<=r;break;case">":n=(mn(e)?e.slice(0,10):e)>r;break;case">=":n=(mn(e)?e.slice(0,10):e)>=r;break;default:n=(mn(e)?e.slice(0,10):e)==r}return n})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const fn=on.stringify,gn=on.array_format,bn=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},yn=(e,t,r)=>{let n=[];t=on.replace_symbols(t);try{if(r){const r=new Function("record",`return ${cn(t,"record")};`);n=Gn(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${cn(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)r(e,t)&&n.push(e[t])}}catch(t){g("Table","组件 `initialFilter` 参数有误!"),n=e}return n},vn=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...vn(e.children)):t.push(e)})),t},xn=e=>{const t=[];return e.forEach((e=>{let r=e;e.children&&(r={...e},r.children=xn(e.children)),e.hidden||e.noAuth||t.push(r)})),t},En=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...En(e.children))})),t},Sn=(e,t)=>e.map((e=>(e.children&&(e.children=Sn(e.children,t)),t?.(e),e))),Cn=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Cn(r.children,t);if(e)return e}}return null},wn=e=>{const t=e.children;return t?t[0].children?wn(t[0]):t[0]:e},Tn=e=>{const t=e.children;return t?t[t.length-1].children?Tn(t[t.length-1]):t[t.length-1]:e},Nn=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),In=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=In(r.children,t);if(e)return e}}return null},Rn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Rn(e.children))})),t},Pn=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return En(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},On=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return On(e.offsetParent,t,r)}return r},An=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,kn=(e,t)=>(0,J.transform)(e,((e,r,n)=>{(0,J.isEqual)(r,t[n])||(e[n]=(0,J.isPlainObject)(r)&&(0,J.isPlainObject)(t[n])?kn(r,t[n]):r)})),Fn=(e,t)=>(0,J.intersection)(e,t).length===t.length,Ln=(e,t)=>(0,J.get)(e,t)??"",Hn=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,J.set)(e,t,r??"")},$n=(e,t)=>{if(!t.includes("|"))return Ln(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(Ln(e,t))})),r.every((e=>!e))?"":r.join(" | ")},Dn=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},qn=(e,t)=>{const r=e.toString();if(Number.isNaN(Number.parseFloat(r))||0===t)return e;const n=Number.parseFloat(r).toString(),a=n.indexOf(".");if(-1===a)return n+"."+"0".repeat(t);const i=Math.max(0,t-(n.length-a-1));return n+"0".repeat(i)},_n=(e,t)=>e?s()(e,t):null,jn=(e,t)=>e?s()(e).format(t):"",Kn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},Mn=e=>{const t=[];if(te(e)){const{children:r}=e.props;Array.isArray(r)?r.forEach((e=>t.push(...Mn(e)))):r&&t.push(...Mn(r))}else t.push(e);return t},Vn=e=>e.filter((e=>!e._group)),zn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="";if(Array.isArray(e)){let n=0;for(let a=0,i=e.length;a<i;a++){const i=e[a];if(!i.fieldName)continue;const l=Array.isArray(i.condition)?gn(i.condition):fn(i.condition,"^");r+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,n=i.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,i]=n.includes("|")?n.split("|"):[n,""],l=e[n];for(const e in l)r+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?gn(l[e]):fn(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},Un=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((r=>{const n=JSON.stringify((t=>{const r=[];return e.forEach((e=>r.push(Ln(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},Bn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=Bn(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},Wn=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=Wn(r.children,t);if(e)return e}if(t(r))return r}return null},Gn=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Gn(e.children,t),t(e)||e.children&&e.children.length))),Yn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Xn=require("react-sortablejs");function Qn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Zn extends e.Component{constructor(){super(...arguments),Qn(this,"linkRef",t().createRef()),Qn(this,"state",{visible:!1}),Qn(this,"getFormFieldsConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Qn(this,"saveFormFieldsConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}}))}get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}componentDidMount(){this.initLocalfields()}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):this.context.global?.getComponentConfigApi&&this.setLocalFields(this.props.items)})).catch((()=>{})),e?(0,J.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,J.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,J.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,J.isEqual)(t,r)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveFormFieldsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;t?.([...e])}popupRender(){const{items:e}=this.props;return t().createElement(pr.Consumer,null,(r=>{const n=r.$$form;return t().createElement("div",{className:Se()("ant-dropdown-menu","fields-list")},t().createElement(Xn.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const r=t.map((e=>e.fieldName)),a=e.map((e=>e.fieldName));if((0,J.isEqual)(r,a))return;n.setExpandHandle(!0);const i=Yn(t);this.changeHandle(i),this.setLocalFields(i)}},e.map((r=>t().createElement("li",{key:r.fieldName,className:"item",style:r.noAuth?{display:"none"}:void 0},t().createElement(O.Checkbox,{disabled:r.rules?.findIndex((e=>e.required))>-1,checked:!r.hidden,onChange:t=>{const{checked:n}=t.target;r.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),t().createElement(we.HolderOutlined,{className:"handle",title:p("qm.form.draggable")}),t().createElement("span",{className:"title"},n.getFormItemLabel(r.label||"")))))))}))}render(){const{visible:e}=this.state,r=Ce("form-fields-filter");return t().createElement(pr.Consumer,null,(n=>{const{$size:a}=n.$$form,i={[r]:!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a};return t().createElement(O.Dropdown,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:Se()(i),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},t().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},t().createElement(we.UnorderedListOutlined,null)))}))}}Qn(Zn,"contextType",l);const Jn=Zn;function ea(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ta=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(pr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:m,disabled:h,onBlur:f=ne,onEnter:g=ne}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:S,toTrim:C,autoFocus:w,autoComplete:T,secretType:N}=o,I=N&&(m||h),R=t().useRef(),P=e=>{i?.(e),l(e)},A=v?O.Input.Password:O.Input,k=I?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e}(a,N):a;return n.isOnlyShow?t().createElement(Yr,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(k),bordered:d}):t().createElement(A,{ref:e=>{R.current=e,"function"==typeof r&&r(e)},value:k,autoComplete:v?"new-password":T,autoFocus:w,placeholder:c,style:s,title:v?"":k,prefix:b,suffix:y,maxLength:x,bordered:d,allowClear:u,readOnly:m,disabled:h,onBlur:t=>{let r=t.target.value??"";if(C){const e=r.trim();r!==e&&(r=e,P(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),f(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),n.isFilterType&&(n.SUBMIT_FORM(),R.current?.blur())}},onChange:e=>{let t=e.target.value;(0,J.isRegExp)(E)&&(t=E.test(t)?t:a??""),S&&(t=t.toUpperCase()),P(t)}})}));ta.displayName="VInput";class ra extends e.Component{constructor(){super(...arguments),ea(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ta,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),u&&t().createElement(O.Col,null,e.renderFormItemButton(i,u)),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}ea(ra,"contextType",pr);const na=ra,aa=e=>{const{$$form:r}=t().useContext(pr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:m,suffix:h,maxLength:f}=l,g=e=>{const t=e.every((e=>!e))?[]:e;a?.(t),i(t,b(t))},b=e=>e.join(" - ");return r.isOnlyShow?t().createElement(Yr,{value:b(n),bordered:s}):t().createElement(O.Input.Group,null,t().createElement(O.Input,{value:n[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:o[0],prefix:m,suffix:h,maxLength:f,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([t,n[1]])}}),t().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t().createElement(O.Input,{value:n[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:o[1],prefix:m,suffix:h,maxLength:f,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class ia extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,s),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(o)},required:e.getFormItemRequired(u)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(aa,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&t().createElement(O.Col,{flex:de(c.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...c}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ia,"contextType",pr);const la=ia,oa=require("big.js");var sa=n.n(oa);function ca(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const da=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(pr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:m,onBlur:h=ne,onEnter:f=ne}=e.option,{step:g=1,min:b,max:y,precision:v,autoFocus:x,stringMode:E,textAlign:S="left",controls:C=!0,formatter:w,parser:T}=o,N=t().useRef(),I=t().useRef(a),R=e=>{const t=Nr(e)?"":(0,J.isNumber)(e)?e.toFixed(v):new(sa())(e).toFixed(v);return"function"==typeof w?w(t):t},P={[S]:!0,controls:C};return n.isOnlyShow?t().createElement(Yr,{value:R(a),bordered:d}):t().createElement(O.InputNumber,{ref:e=>{N.current=e,"function"==typeof r&&r(e)},value:a,className:Se()(P),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:C,precision:v,autoFocus:x,stringMode:E,formatter:w,parser:T,bordered:d,readOnly:u,disabled:m,onBlur:()=>{le((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(I.current),h(I.current)}))},onKeyUp:e=>{13===e.keyCode&&(f(a),n.isFilterType&&(n.SUBMIT_FORM(),N.current?.blur()))},onChange:e=>{const t=e??"";!E&&t.toString().replace(/^-|\./g,"").length>17||(e=>{I.current=e,i?.(e),l(e,R(e))})(t)}})}));da.displayName="VInputNumber";class ua extends e.Component{constructor(){super(...arguments),ca(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(da,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,null,e.renderFormItemButton(i,u)),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}ca(ua,"contextType",pr);const pa=ua,ma=e=>{const{$$form:r}=t().useContext(pr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:m=1,min:h=0,max:f,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=l,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];a?.(t),i(t,C(t))},C=e=>Nr(e)?"":e.map((e=>Nr(e)?"":Number(e).toFixed(y))),w={[g]:!0,controls:b};return r.isOnlyShow?t().createElement(Yr,{value:C(n),bordered:s}):t().createElement(O.Input.Group,null,t().createElement(O.InputNumber,{value:n[0],className:Se()("site-input-left",w),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:o[0],step:m,min:h,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([e,n[1]])},onBlur:()=>{E(n)}}),t().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t().createElement(O.InputNumber,{value:n[1],className:Se()("site-input-right",w),style:{width:"calc(50% - 5px)"},placeholder:o[1],step:m,min:h,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{S([n[0],e])},onBlur:()=>{E(n)}}))};class ha extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,s),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(o)},required:e.getFormItemRequired(u)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ma,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&t().createElement(O.Col,{flex:de(c.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...c}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ha,"contextType",pr);const fa=ha;let ga=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:ya}=O.Input;class va extends e.Component{constructor(e){var t;super(e),t=this,ba(this,"searchHelper",{}),ba(this,"alias",void 0),ba(this,"extras",void 0),ba(this,"deriveParams",void 0),ba(this,"valueKey",void 0),ba(this,"_is_change",!1),ba(this,"_record",void 0),ba(this,"_prevValue",void 0),ba(this,"state",{visible:!1,loading:!1}),ba(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ba(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t}=this.props.option;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const{fieldAliasMap:r,extraAliasMap:n,fieldsDefine:a}=this.searchHelper;if(r||g("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof r?r():r||{},this.extras="function"==typeof n?n():n||{},a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(t)||g("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),ba(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),ba(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),ba(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,fieldAliasMap:i,extraAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof i?i():i||{},s="function"==typeof l?l():l||{},c=this.getItemValue();if(e&&!se(c)){this.setState({loading:!0});try{const i=await e(r({...t,key:c}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,n)??[];if(e[0]){const t=e[0];o&&Rr(t,this.alias,o),s&&Pr(t,this.extras,s),this._record=t,this.setFieldsValue(t),a?.([t])}}}catch(e){}this.setState({loading:!1})}})),ba(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),ba(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,a=("function"==typeof r?r():r)||[],i={[t]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,J.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i})),ba(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,J.merge)({},this.getLastedSearchHelper().table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(o))return l();this.setState({loading:!0});try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):l()}catch(e){l(e)}finally{le((()=>this.setState({loading:!1})))}}))})),ba(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Ir(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a))}for(const r in this.extras){const n=Ir(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),ba(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,a=e.filter((e=>Ir(e,t.alias[n])?.toString().toLowerCase().includes(r.toLowerCase())));if(1===a.length)return t.closeSearchHelper(a[0]);t.openSearchHelper(r)})),ba(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??ae)(r.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),ba(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Ir(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])});const n=Ir(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),ba(this,"closeButNotSelect",(()=>{const{onlySelect:e=!0}=this.searchHelper;this._is_change&&(e?this.clearSearchHelperValue():this.searchHelperChangeHandle(this.props.value)),this._is_change=!1,this.setVisible(!1)})),ba(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),ba(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),ba(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),ba(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),ba(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemText()}componentDidUpdate(e,t){const{value:r}=e,{value:n}=this.props;if(t.loading!==this.state.loading)return;const a=this.getItemValue();this._prevValue!==a&&a!==this._record?.[this.alias[this.valueKey]]&&r===n&&this.getItemText(),this._prevValue=a}render(){const{$$form:e}=this.context,{visible:r,loading:n}=this.state,{value:a}=this.props,{type:i,fieldName:l,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:r,title:p("qm.searchHelper.text"),width:s.width??"60%",loading:!1,bodyStyle:{paddingBottom:`${ga[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getLastedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Yr,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(ya,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;this.triggerBlur(t),this._is_change&&!r&&(t?n?a?.fetch?.api&&this.getSearchHelperTableData(t).then((e=>this.resetSearchHelperValue(e,t))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(t):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:t}=e.target;!r&&this.openSearchHelper(t)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):le((()=>this.clearSearchHelperValue())))}}),t().createElement(cr,v,t().createElement(uc,x)))}}ba(va,"contextType",pr);class xa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),ba(this,"promiseRef",void 0),ba(this,"searchRef",void 0),ba(this,"state",{searchHelper:{}}),ba(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),ba(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[]}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(va,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(l,t)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}ba(xa,"contextType",pr);const Ea=xa;function Sa(){return Sa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sa.apply(this,arguments)}function Ca(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const wa=r=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,Ca(this,"startClick",void 0),Ca(this,"event1",null),Ca(this,"event2",null),Ca(this,"$el",null),Ca(this,"omitClassNames",[]),Ca(this,"state",{clickOutside:!1}),Ca(this,"mousedownHandler",(e=>{this.startClick=e})),Ca(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Ca(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,a=!r||!n,i=this.$el?.contains(r)||this.$el?.contains(n),l=this.$el===r,o=this.omitClassNames.map((e=>document.querySelector(e))),s=o.some((e=>e?.contains(r)))||o.includes(n);let c;c=!(a||i||l||s),this.setState({clickOutside:c})})),Ca(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Ca(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=qt()(document,"mousedown",this.mousedownHandler),this.event2=qt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:e}=this.props,{clickOutside:n}=this.state;return t().createElement(r,Sa({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Ca(n,"displayName",`OutsideClick(${r.displayName||r.name})`),t().forwardRef(((e,r)=>t().createElement(n,Sa({},e,{forwardedRef:r}))))},Ta=require("rc-trigger");var Na,Ia,Ra=n.n(Ta);function Pa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Oa=wa((Ia=class extends e.Component{constructor(e){var r;super(e),r=this,Pa(this,"searchHelper",{}),Pa(this,"alias",void 0),Pa(this,"_records",[]),Pa(this,"searchRef",t().createRef()),Pa(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Pa(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Pa(this,"getLastedSearchHelper",(()=>{const e=Object.assign({},this.searchHelper,this.props.option.searchHelper);return e.table&&!e.table.rowKey&&(e.table.rowKey=this.alias?.valueKey),e})),Pa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Pa(this,"setItemList",(e=>{this.setState({itemList:e})})),Pa(this,"setRecords",(e=>{this._records=e})),Pa(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Pa(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Pa(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Pa(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=r.alias;r.setRecords((0,J.uniqBy)([...r._records.filter((e=>t.includes(e[n]))),...e],n));const a=r.recordsToDict();r.setItemList(a),r.triggerChange(a.map((e=>e.value)));const{closed:i}=r.searchHelper;r.setVisible(!1,(()=>{setTimeout((()=>i?.(r._records)),200)}))})),Pa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(r,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,callback:l,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r&&!se(c)){this.setState({loading:!0});try{const o=await r(a({...n,keys:c}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,J.get)(o.data,i)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),l?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:r,visible2:n,loading:a,itemList:i}=this.state,{value:l}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:r,title:p("qm.searchHelper.text"),width:c.width??"60%",loading:!1,bodyStyle:{paddingBottom:`${ga[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getLastedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,J.merge)({},c.initialValue),defaultSelectedKeys:l,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>l?.includes(e.value))),S=t().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,w=Ce("form-multiple-search-helper"),{size:T}=e.context,N={[w]:!0,[`${w}--lg`]:"large"===T,[`${w}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${w}`]);const I=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Yr,{value:I,bordered:m}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(Ra(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(N),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:yr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:l,placeholder:u,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(O.Button,{className:"ant-input-search-button",disabled:g,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(cr,v,t().createElement(uc,x)))}},Pa(Ia,"contextType",pr),Na=Ia))||Na;class Aa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Pa(this,"promiseRef",void 0),Pa(this,"state",{searchHelper:{}}),Pa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Pa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Oa,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(l,r)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Pa(Aa,"contextType",pr);const ka=Aa;function Fa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:La}=O.Input;class Ha extends e.Component{constructor(e){super(e),Fa(this,"searchHelper",{}),Fa(this,"alias",void 0),Fa(this,"extras",void 0),Fa(this,"valueKey",void 0),Fa(this,"_record",void 0),Fa(this,"_prevValue",void 0),Fa(this,"state",{visible:!1,loading:!1}),Fa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Fa(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t}=this.props.option;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const{fieldAliasMap:r,extraAliasMap:n,fieldsDefine:a}=this.searchHelper;if(r||g("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof r?r():r||{},this.extras="function"==typeof n?n():n||{},a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(t)||g("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Fa(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Fa(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Fa(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,fieldAliasMap:a,extraAliasMap:i}=this.searchHelper.echoRequest||{},l="function"==typeof a?a():a||{},o="function"==typeof i?i():i||{},s=this.getItemValue();if(e&&!se(s)){this.setState({loading:!0});try{const a=await e(r({...t,key:s}));if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,n)??[];if(e[0]){const t=e[0];l&&Rr(t,this.alias,l),o&&Pr(t,this.extras,o),this._record=t,this.setFieldsValue(t)}}}catch(e){}this.setState({loading:!1})}})),Fa(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Ir(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])})})),Fa(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Fa(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Ir(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])});const n=Ir(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Fa(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),Fa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Fa(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemText()}componentDidUpdate(e,t){const{value:r}=e,{value:n}=this.props;if(t.loading!==this.state.loading)return;const a=this.getItemValue();this._prevValue!==a&&a!==this._record?.[this.alias[this.valueKey]]&&r===n&&this.getItemText(),this._prevValue=a}render(){const{$$form:e}=this.context,{visible:r,loading:n}=this.state,{value:a=""}=this.props,{type:i,fieldName:l,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:r,title:p("qm.searchHelper.text"),width:s.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${ga[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getLastedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?t().createElement(Yr,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(La,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t().createElement(cr,v,t().createElement(bc,x)))}}Fa(Ha,"contextType",pr);class $a extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Fa(this,"promiseRef",void 0),Fa(this,"state",{searchHelper:{}}),Fa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Fa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ha,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(l,t)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Fa($a,"contextType",pr);const Da=$a;var qa,_a;function ja(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Ka=wa((_a=class extends e.Component{constructor(e){var r;super(e),r=this,ja(this,"searchHelper",{}),ja(this,"alias",void 0),ja(this,"_records",[]),ja(this,"searchRef",t().createRef()),ja(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),ja(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),ja(this,"getLastedSearchHelper",(()=>{const e=Object.assign({},this.searchHelper,this.props.option.searchHelper);return e.table&&!e.table.rowKey&&(e.table.rowKey=this.alias?.valueKey),e})),ja(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ja(this,"setItemList",(e=>{this.setState({itemList:e})})),ja(this,"setRecords",(e=>{this._records=e})),ja(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),ja(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),ja(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ja(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=r.alias;r.setRecords((0,J.uniqBy)([...r._records.filter((e=>t.includes(e[n]))),...e],n));const a=r.recordsToDict();r.setItemList(a),r.triggerChange(a.map((e=>e.value)));const{closed:i}=r.searchHelper;r.setVisible(!1,(()=>{setTimeout((()=>i?.(r._records)),200)}))})),ja(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(r,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r&&!se(s)){this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:r,visible2:n,loading:a,itemList:i}=this.state,{value:l}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:r,title:p("qm.searchHelper.text"),width:c.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${ga[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getLastedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,J.merge)({},c.initialValue),defaultSelectedKeys:l,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>l?.includes(e.value))),S=t().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,w=Ce("form-multiple-tree-table-helper"),{size:T}=e.context,N={[w]:!0,[`${w}--lg`]:"large"===T,[`${w}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${w}`]);const I=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Yr,{value:I,bordered:m}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(Ra(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(N),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:yr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:l,placeholder:u,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(O.Button,{className:"ant-input-search-button",disabled:g,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(cr,v,t().createElement(bc,x)))}},ja(_a,"contextType",pr),qa=_a))||qa;class Ma extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),ja(this,"promiseRef",void 0),ja(this,"state",{searchHelper:{}}),ja(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),ja(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ka,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(l,r)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}ja(Ma,"contextType",pr);const Va=Ma;function za(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ua=new Array(2).fill("");class Ba extends e.Component{constructor(e){var t;super(e),t=this,za(this,"searchHelper",{}),za(this,"alias",void 0),za(this,"_is_change",!1),za(this,"_ceho_data",void 0),za(this,"_records",[]),za(this,"_is_clear",!1),za(this,"state",{visible:!1,loading:!1,itemList:[],textValue:Ua}),za(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),za(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),za(this,"setItemList",(e=>{this.setState({itemList:e})})),za(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),za(this,"setTextValue",(e=>{this.setState({textValue:e})})),za(this,"setRecords",(e=>{this._records=e})),za(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),za(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),za(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(Ua),this.triggerChange([])})),za(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),za(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),za(this,"createFilters",(e=>{const{fieldName:t}=this.props.option;return{[t]:se(e)?void 0:e}})),za(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,J.merge)({},this.getLastedSearchHelper().table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(o))return l();this.setState({loading:!0});const e=await t.fetch.api(o);if(le((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}l()}))})),za(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:r}=t.state,{textKey:n}=t.alias,a=e.filter((e=>{const t=e[n]?.toString().toLowerCase();return r.some((e=>t?.includes(e.toLowerCase())))}));if(2===a.length)return t.closeSearchHelper(a);t.openSearchHelper()})),za(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:r=[]}=this.props;(0,J.isEqual)((0,J.intersection)(t,r),r)||(0,J.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,J.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),r.length)){const e=Ua.map(((e,t)=>n[a].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r&&!se(s)){this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:r=[]}=this.props,{visible:n,loading:a,textValue:i}=this.state,{fieldName:l,options:o={},searchHelper:s={},placeholder:c=p("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,f={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${ga[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g={...this.getLastedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Yr,{value:i.join(" - "),bordered:d}):t().createElement(t().Fragment,null,t().createElement(O.Input.Group,null,t().createElement(O.Input,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),t().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),t().createElement(O.Input.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:a,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([i[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t().createElement(cr,f,t().createElement(wc,g)))}}za(Ba,"contextType",pr);class Wa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),za(this,"promiseRef",void 0),za(this,"state",{searchHelper:{}}),za(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),za(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ba,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{h(t,n),e.setViewValue(l,r)}}))),u&&t().createElement(O.Col,null,e.renderFormItemButton(l,u)),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...d}))))}}za(Wa,"contextType",pr);const Ga=Wa;function Ya(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Xa=e=>{const{$$form:r}=t().useContext(pr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return r.isOnlyShow?t().createElement(Yr,{value:h(n),bordered:c}):t().createElement(O.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{i?.(e),l(e,h(e))})(e)}},m.map((e=>t().createElement(O.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Qa extends e.Component{constructor(){super(...arguments),Ya(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Xa,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Ya(Qa,"contextType",pr);const Za=Qa,Ja=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=r.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:m}=l;return t().createElement(O.Rate,{value:n,count:p,style:o,allowHalf:u,allowClear:s,tooltips:m,disabled:d||r.isOnlyShow,onChange:e=>{(e=>{var t;a?.(e),i(e,(t=e,m?m[Math.ceil(t)-1]:t.toString()))})(e)}})};class ei extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Ja,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ei,"contextType",pr);const ti=ei;function ri(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ni=e=>{const{$$form:r}=t().useContext(pr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=r.isFormDisabled}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.find((t=>t.value===e))?.text??"";return r.isOnlyShow?t().createElement(Yr,{value:h(n),bordered:c}):t().createElement(O.Radio.Group,{value:n,style:{width:"100%",...s},disabled:u||r.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{i?.(e),l(e,h(e))})(t)}},m.map((e=>t().createElement(O.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ai extends e.Component{constructor(){super(...arguments),ri(this,"state",{itemList:[]}),ri(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ni,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}ri(ai,"contextType",pr);const ii=ai,li=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:d=r.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=fr,trueValue:h=hr}=o;return t().createElement(t().Fragment,null,t().createElement(O.Switch,{checked:n===h,style:s,disabled:d||r.isOnlyShow,checkedChildren:t().createElement(we.CheckOutlined,null),unCheckedChildren:t().createElement(we.CloseOutlined,null),onChange:e=>{(e=>{a?.(e),i(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:m)}}),u?t().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},l):null)};class oi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option,{labelToSwitch:h}=o;return t().createElement(O.Form.Item,{label:h?" ":e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(li,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(oi,"contextType",pr);const si=oi,ci=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m,onBlur:h=ne,onEnter:f=ne}=e.option,{showCount:g,maxLength:b,autoSize:y}=l,v=Object.assign({},{minRows:1,maxRows:3},y);return t().createElement(O.Input.TextArea,{value:n,placeholder:s,style:o,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:d,readOnly:u||r.isOnlyShow,disabled:m,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;f(t)}},onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e)})(t)}})};class di extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ci,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(di,"contextType",pr);const ui=di,pi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:c=p("qm.form.datePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:m,disabled:h}=e.option,{dateType:f="date",format:g,disabledDate:b,minDateTime:y,maxDateTime:v,shortCuts:x=!0}=l,E=t().createRef(),S=e=>{e&&"date"===f&&(e=e.slice(0,10)+" 00:00:00"),a?.(e),i(e,C(e))},C=e=>Nr(e)?"":["date","exactdate"].includes(f)?e.slice(0,10):e,w=e=>{let t=Tr(s()().subtract(e,"day"),xr[f]);"date"===f&&(t=t.slice(0,10)),S(t),E.current.blur(),E.current.focus()};return r.isOnlyShow?t().createElement(Yr,{value:C(n),bordered:d}):t().createElement(q,{ref:E,style:{width:"100%",...o},picker:vr[f],format:g,bordered:d,showToday:!1,showTime:"datetime"===f&&{defaultValue:s()("00:00:00","HH:mm:ss")},allowClear:u,disabled:h,inputReadOnly:m,disabledDate:b??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[y,v])),renderExtraFooter:x?()=>t().createElement(t().Fragment,null,t().createElement(O.Tag,{color:"processing",onClick:()=>w(0)},p("qm.form.datePickers")[0]),t().createElement(O.Tag,{color:"processing",onClick:()=>w(1)},p("qm.form.datePickers")[1]),t().createElement(O.Tag,{color:"processing",onClick:()=>w(7)},p("qm.form.datePickers")[2]),t().createElement(O.Tag,{color:"processing",onClick:()=>w(30)},p("qm.form.datePickers")[3])):void 0,value:wr(n,xr[f]),onChange:(e,t)=>{S(Tr(e,xr[f]))}})};class mi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(pi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(mi,"contextType",pr);const hi=mi,fi=e=>[s()().subtract(e,"day"),s()()],gi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:c=p("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:m,disabled:h=r.isFormDisabled}=e.option,{dateType:f="date",format:g,disableds:b=[!1,!1],disabledDate:y,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=l,S={[p("qm.form.dateRangePickers")[0]]:fi(7),[p("qm.form.dateRangePickers")[1]]:fi(30),[p("qm.form.dateRangePickers")[2]]:fi(90),[p("qm.form.dateRangePickers")[3]]:fi(180)},C=e=>Nr(e)?"":e.map((e=>["date","exactdate"].includes(f)?e?.slice(0,10):e)).join(" - ");return r.isOnlyShow?t().createElement(Yr,{value:C(n),bordered:d}):t().createElement(q.RangePicker,{style:{width:"100%",...o},picker:vr[f],format:g,bordered:d,showTime:"datetime"===f&&{defaultValue:[s()("00:00:00","HH:mm:ss"),s()("23:59:59","HH:mm:ss")]},allowClear:u,disabled:h?[!0,!0]:b,inputReadOnly:m,disabledDate:y??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[v,x])),ranges:E?S:void 0,value:se(n)?null:[wr(n?.[0],xr[f]),wr(n?.[1],xr[f])],onChange:(e,t)=>{(e=>{"date"===f&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),a?.(e),i(e,C(e))})([Tr(e?.[0],xr[f]),Tr(e?.[1],xr[f])])}})};class bi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(gi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(bi,"contextType",pr);const yi=bi,vi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.timePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=e.option,{timeType:h="hour-minute-second",hourStep:f=1,minuteStep:g=1,secondStep:b=1}=l;return r.isOnlyShow?t().createElement(Yr,{value:n,bordered:c}):t().createElement(M,{style:{width:"100%",...o},bordered:c,showNow:!0,hourStep:f,minuteStep:g,secondStep:b,allowClear:d,disabled:m,inputReadOnly:u,format:Er[h],value:wr(n,Er[h]),onChange:(e,t)=>{(e=>{const t=Tr(e,Er[h]);a?.(t),i(t)})(e)}})};class xi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(vi,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(xi,"contextType",pr);const Ei=xi,Si=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.timerangePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m=r.isFormDisabled}=e.option,{timeType:h="hour-minute-second",disableds:f=[!1,!1],hourStep:g=1,minuteStep:b=1,secondStep:y=1}=l,v=e=>Nr(e)?"":e.join(" - ");return r.isOnlyShow?t().createElement(Yr,{value:v(n),bordered:c}):t().createElement(M.RangePicker,{style:{width:"100%",...o},bordered:c,showNow:!1,hourStep:g,minuteStep:b,secondStep:y,allowClear:d,disabled:m?[!0,!0]:f,inputReadOnly:u,format:Er[h],value:se(n)?null:[wr(n?.[0],Er[h]),wr(n?.[1],Er[h])],onChange:(e,t)=>{(e=>{const t=[Tr(e?.[0],Er[h]),Tr(e?.[1],Er[h])];a?.(t),i(t,v(t))})(e)}})};class Ci extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Si,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ci,"contextType",pr);const wi=Ci;function Ti(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ni extends e.Component{constructor(e){super(e),Ti(this,"searchHelper",{}),Ti(this,"alias",void 0),Ti(this,"extras",void 0),Ti(this,"valueKey",void 0),Ti(this,"_clicking",!1),Ti(this,"_record",void 0),Ti(this,"_prevValue",void 0),Ti(this,"searchRef",t().createRef()),Ti(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),Ti(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t,options:r,searchHelper:n}=this.props.option;this.searchHelper=Object.assign({},e,r,n);const{fieldAliasMap:a,extraAliasMap:i,fieldsDefine:l}=this.searchHelper;if(a||g("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof a?a():a||{},this.extras="function"==typeof i?i():i||{},l){const e=["valueKey","displayKey","extraKey"];for(const t in l)e.includes(t)&&(this[t]=l[t])}Object.keys(this.alias).includes(t)||g("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Ti(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Ti(this,"getLatestRequest",(()=>{const{request:e,searchHelper:t}=this.props.option;return Object.assign({},this.searchHelper.request,e,t?.request)})),Ti(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,fieldAliasMap:a,extraAliasMap:i}=this.searchHelper.echoRequest||{},l="function"==typeof a?a():a||{},o="function"==typeof i?i():i||{},s=this.getItemValue();if(e&&!se(s))try{const a=await e(r({...t,key:s}));if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,n)??[];if(e[0]){const t=e[0];l&&Rr(t,this.alias,l),o&&Pr(t,this.extras,o),this._record=t,this.setFieldsValue(t)}}}catch(e){}})),Ti(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const a=Ir(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])})})),Ti(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),Ti(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ti(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Ti(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Ti(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:Ir(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:Ir(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Ir(e,this.alias[n]);this.triggerChange(a),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}componentDidMount(){this.getItemText()}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList();const{value:n}=e,{value:a}=this.props,i=this.getItemValue();this._prevValue!==i&&i!==this._record?.[this.alias[this.valueKey]]&&n===a&&this.getItemText(),this._prevValue=i}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i}=this.getLatestRequest();if(r){this.setState({loading:!0});try{const l=await r(a({...n,[t]:e}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:r,loading:n,itemList:a,inputText:i}=this.state,{value:o}=this.props,{options:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{listHeight:g=gr}=s,{hideHeader:b,onlySelect:y=!0}=this.searchHelper||s,v=this.searchHelper.columns||[],x=Ce("form-immediate"),E=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,S=t().createElement(O.Spin,{spinning:n},a.length?t().createElement("table",{cellSpacing:0,cellPadding:0,className:Se()("table")},!b&&t().createElement("thead",null,t().createElement("tr",null,v.filter((e=>!e.hidden)).map((e=>t().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t().createElement("tbody",null,a.map(((e,r)=>t().createElement("tr",{key:r,className:this.state.activeIndex===r?"active":"",onMouseEnter:()=>{this.setState({activeIndex:r})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},v.filter((e=>!e.hidden)).map((r=>t().createElement("td",{key:r.dataIndex},(0,J.get)(e,r.dataIndex))))))))):t().createElement(mt,null));return t().createElement(l.Consumer,null,(n=>{const l={[x]:!0,[`${x}--lg`]:"large"===n?.size,[`${x}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Yr,{value:o,bordered:u}):t().createElement(Ra(),{action:f?[]:["click"],popupVisible:!f&&r,popup:S,popupClassName:Se()(l),popupStyle:{minWidth:E,maxHeight:g},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:d,allowClear:m,bordered:u,readOnly:h,disabled:f,style:{width:"100%",...c},value:i??o,title:o,onFocus:()=>{!a.length&&this.fetchHandle(o)},onBlur:e=>{y&&!this._clicking&&i!==o&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(a[this.state.activeIndex],(()=>this.handleVisibleChange(!1))),38===e.keyCode||40===e.keyCode){if(!this.state.visible)return this.handleVisibleChange(!0);let t=this.state.activeIndex;const r=40===e.keyCode?++t%a.length:(--t+a.length)%a.length;this.setState({activeIndex:r})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),y?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}}))}))}}Ti(Ni,"contextType",pr);class Ii extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ti(this,"promiseRef",void 0),Ti(this,"state",{searchHelper:{}}),Ti(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ti(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ni,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(l,t)}}))),p&&t().createElement(O.Col,null,e.renderFormItemButton(l,p)),u&&t().createElement(O.Col,{flex:de(u.labelWidth||mr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Ti(Ii,"contextType",pr);const Ri=Ii;class Pi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,fieldName:a,className:i,style:l={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=ne}=o,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===a))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=d.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${n}${a}`})}))}return t().createElement(O.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},t().createElement(Ie,{id:a,label:n,className:i,extra:p.map((e=>e.text)).join(" | "),style:{...l},collapse:s[a],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[a]:t})}))),u(t)}}))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Pi,"contextType",pr);const Oi=Pi;function Ai(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ki(){return ki=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ki.apply(this,arguments)}const Fi=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Fi(e.children,t,r,n)}:e)),Li=e=>{const{$$form:r}=t().useContext(pr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{options:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,asyncLoad:f,readOnly:g,disabled:b}=e.option,{itemList:y,filterable:v=!0,listHeight:x=gr,checkStrictly:E,checkStrategy:S="SHOW_CHILD",collapseTags:C,openPyt:w=!0}=c,[T,N]=t().useState(se(y)?a:y);_e((()=>{N(se(y)?a:y)}),[y,a]);const I=e=>Ar(T,e)?.text||"",R=e=>i?e.map((e=>I(e))).filter((e=>!!e)).join(","):I(e);return r.isOnlyShow?t().createElement(Yr,{value:R(n),bordered:m}):t().createElement(O.TreeSelect,ki({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:i,treeCheckable:i,treeCheckStrictly:E,showCheckedStrategy:O.TreeSelect[S],placeholder:u,listHeight:x,style:d,loading:l,bordered:m,allowClear:h,disabled:b,treeDefaultExpandAll:!f,showSearch:v,maxTagCount:C?"responsive":void 0,loadData:f?async e=>{let{key:t,children:r}=e;if(!f||r)return;const{fetchApi:n,params:a,dataKey:i,textKey:l="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=f;if(n)try{const e=await n(c({...a,[o]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=Fi(T,t,o,Or(r,o,l));N(n),s?.(r)}}catch(e){}}:void 0,treeData:T},i?{title:R(n)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=Wr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,R(e),T)})(e)}}))};class Hi extends e.Component{constructor(){super(...arguments),Ai(this,"state",{itemList:[],loading:!1}),Ai(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=Or(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r,loading:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(i),className:Se()(o,u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(Li,{option:this.props.option,items:r,loading:n,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&t().createElement(O.Col,{flex:de(p.labelWidth||mr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Ai(Hi,"contextType",pr);const $i=Hi;function Di(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qi(){return qi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qi.apply(this,arguments)}const _i=e=>{const{$$form:r}=t().useContext(pr),{value:n,multiple:a,items:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=e.option,{changeOnSelect:h,checkStrictly:f,checkStrategy:g="SHOW_PARENT",filterable:b=!0,openPyt:y=!0}=l,{itemList:v=[]}=l,x=se(v)?i:v,E=e=>se(e)?"":a?e.map((e=>kr(x,e).map((e=>e.text)).join("/"))).join(","):kr(x,e).map((e=>e.text)).join("/");return r.isOnlyShow?t().createElement(Yr,{value:E(n),bordered:c}):t().createElement(O.Cascader,qi({value:(e=>se(e)?[]:a?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:x,multiple:a,maxTagCount:"responsive",changeOnSelect:h||f,showCheckedStrategy:O.Cascader[g],placeholder:s,style:o,bordered:c,allowClear:d,disabled:m,showSearch:b&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=Wr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(y?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))}},a?{title:E(n)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,E(t),x)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class ji extends e.Component{constructor(){super(...arguments),Di(this,"state",{itemList:[],loading:!1}),Di(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=Or(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:r}=this.props,{itemList:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(i),className:Se()(o,u),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(_i,{option:this.props.option,multiple:r,items:n,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&t().createElement(O.Col,{flex:de(p.labelWidth||mr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Di(ji,"contextType",pr);const Ki=ji,Mi=require("china-area-data");var Vi=n.n(Mi);function zi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ui=["110000","120000","310000","500000"],Bi=["810000","820000"],Wi=[{text:"A",value:"A"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"L",value:"L"},{text:"N",value:"N"},{text:"Q",value:"Q"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],Gi=[{text:"A",value:"A"},{text:"B",value:"B"},{text:"C",value:"C"},{text:"D",value:"D"},{text:"E",value:"E"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"K",value:"K"},{text:"L",value:"L"},{text:"M",value:"M"},{text:"N",value:"N"},{text:"P",value:"P"},{text:"Q",value:"Q"},{text:"R",value:"R"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"W",value:"W"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],Yi=e=>Wr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Xi=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...Ui,...Bi].includes(e))):Object.keys(e[t])).map((n=>({l:Yi(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:Xi(e,n,r+1)})))},Qi=(e,t)=>t.map((t=>({l:Yi(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Zi extends e.Component{constructor(e){super(e),zi(this,"searchRef",t().createRef()),zi(this,"scrollRef",t().createRef()),zi(this,"zxsAndGa",void 0),zi(this,"provinces",void 0),zi(this,"allCities",void 0),zi(this,"letterCities",void 0),zi(this,"state",{visible:!1,select_type:"0",active_key:""}),zi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),zi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)})),this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),jt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Qi(Vi(),Ui)},{l:"Z2",n:"港澳",c:"",p:"",children:Qi(Vi(),Bi)}]}createProvince(){return(Xi(Vi(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Gi.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Ui,...Bi].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t().createElement(O.Radio.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},t().createElement(O.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),t().createElement(O.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:r}=this.state;return("0"===r?Wi:Gi).map((r=>t().createElement("li",{key:r.value,className:Se()({tag:!0,actived:r.value===e}),onClick:()=>this.scrollHandle(r.value.toString())},r.text)))}renderSelect(){const{value:e}=this.props;return t().createElement(O.Select,{size:"small",placeholder:p("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t().createElement(O.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:r}=this.state;return("0"===r?this.provinces:this.letterCities).map(((r,n)=>t().createElement("div",{key:n},t().createElement("dt",{ref:e=>this[`${r.l}Ref`]=e},r.n,":"),t().createElement("dd",null,r.children?.map((r=>t().createElement("li",{key:r.c,className:Se()({actived:r.c===e}),onClick:()=>this.clickHadnle(r.c)},r.n)))))))}render(){const{$$form:e}=this.context,{visible:r}=this.state,{value:n}=this.props,{options:a={},style:i={},placeholder:o=p("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=Ce("form-city-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,f=this.createTextValue(n),g=t().createElement("div",{className:"container",style:{...i}},t().createElement("div",{className:"city-drop"},t().createElement("div",{className:"city-drop-toper"},t().createElement("div",{className:"city-drop-toper__type"},this.renderType()),t().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t().createElement("div",{className:"city-drop-letter"},this.renderLetter()),t().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t().createElement("dl",null,this.renderCity(n)))));return t().createElement(l.Consumer,null,(n=>{const a={[m]:!0,[`${m}--lg`]:"large"===n?.size,[`${m}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Yr,{value:f,bordered:s}):t().createElement(Ra(),{action:u?[]:["click"],popupVisible:!u&&r,popup:g,popupClassName:Se()(a),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:{width:"100%",...i},value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}zi(Zi,"contextType",pr);class Ji extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Zi,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}zi(Ji,"contextType",pr);const el=Ji;function tl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const rl=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:rl(e,r)})))};class nl extends e.Component{constructor(e){super(e),tl(this,"searchRef",t().createRef()),tl(this,"prevText",void 0),tl(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),tl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const r=rl(Vi(),"86")||[];this.state={results:r,visible:!1,values:[],tabs:[r.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get leave(){return this.isFetch?4:3}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.text)).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=Ar(e,t[n]);if(a&&se(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(a?.children)&&(r[n+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,J.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[l],value:e[i]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,r=this.state.tabs.map(((r,n)=>{const a=r.find((t=>t.value===e[n]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return t().createElement(O.Tabs.TabPane,{key:n.toString(),tab:a},t().createElement("div",{className:"region-box"},r.map((r=>t().createElement("span",{key:r.value,className:Se()({"region-box__item":!0,actived:e.includes(r.value.toString())}),title:r.text,onClick:()=>{let{values:e}=this.state;e[n]=r.value.toString(),e=e.slice(0,n+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.leave-1:this.leave;if(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},r.text)))))}));return r.length?t().createElement(O.Tabs,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},r):t().createElement(mt,null)}render(){const{$$form:e}=this.context,{visible:r}=this.state,{value:n}=this.props,{options:a={},style:i={},placeholder:o=p("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=Ce("form-region-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,f=t().createElement("div",{className:"container"},this.renderTabs());let g=this.prevText;if(!r){const e=this.createTextValue(n);(""===e||e.split("/").every((e=>""!==e)))&&(g=e,this.prevText=g)}return t().createElement(l.Consumer,null,(n=>{const a={[m]:!0,[`${m}--lg`]:"large"===n?.size,[`${m}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Yr,{value:g,bordered:s}):t().createElement(Ra(),{action:u?[]:["click"],popupVisible:!u&&r,popup:f,popupClassName:Se()(a),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:{width:"100%",...i},readOnly:d,disabled:u,value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&le((()=>this.initial()))}}))}))}}tl(nl,"contextType",pr);class al extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(nl,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}tl(al,"contextType",pr);const il=al,ll=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:m=1,fileTypes:h,fileSize:f,fileDirection:g,onPreview:b,onRemove:y}=l,{action:v,headers:x,params:E,withCredentials:S=!1,dataKey:C="",fieldAliasMap:w,beforeUpload:T,button:N}=o,I="function"==typeof w?w():w||{};return t().createElement(Bl,{name:"file",action:v,multiple:u,headers:x,data:E,withCredentials:S,beforeUpload:T,maxCount:m,fileTypes:h,fileSize:f,fileDirection:g,disabled:c,readOnly:r.isOnlyShow||d,button:N,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)},fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in I)r[n]=e[n]||t.data?.[I[n]]||"";return e.response&&200!==t.code&&O.message.error(t.message||p("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(C?(0,J.get)(t.data,C):t.data)||"",status:e.status}}));a?.(t.filter((e=>"done"!==e.status||!!e.url))),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onPreview:b,onRemove:y})};class ol extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ll,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ol,"contextType",pr);const sl=ol,cl=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c,readOnly:d}=e.option,{multiple:u=!0,maxCount:m=1,fixedSize:h,quality:f,openCropper:g,fileTypes:b,fileSize:y,onRemove:v}=l,{action:x,headers:E,params:S,withCredentials:C=!1,dataKey:w="",fieldAliasMap:T,beforeUpload:N}=o,I="function"==typeof T?T():T||{};return t().createElement(Jl,{name:"file",action:x,multiple:u,headers:E,data:S,withCredentials:C,beforeUpload:N,maxCount:m,fixedSize:h,quality:f,openCropper:g,fileTypes:b,fileSize:y,disabled:c,readOnly:r.isOnlyShow||d,fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in I)r[n]=e[n]||t.data?.[I[n]]||"";return e.response&&200!==t.code&&O.message.error(t.message||p("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(w?(0,J.get)(t.data,w):t.data)||"",status:e.status}}));a?.(t.filter((e=>"done"!==e.status||!!e.url))),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:v})};class dl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(cl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(dl,"contextType",pr);const ul=dl,pl=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o,style:s={},readOnly:c,disabled:d=r.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p}=l;return t().createElement(Dl,{value:n,tinymce:u,upload:o,thresholdSize:p,style:{width:"100%",...s},disabled:d||c||r.isOnlyShow,onChange:e=>{(e=>{a?.(e),i(e)})(e)}})};class ml extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:Se()(i,c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(pl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ml,"contextType",pr);const hl=ml;function fl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class gl extends e.Component{constructor(e){super(e),fl(this,"provide",{$$form:this,echo_data:{}}),fl(this,"_initialValues",void 0),fl(this,"_initialOthers",void 0),fl(this,"_initialExtras",void 0),fl(this,"_fieldAuth",{}),fl(this,"wrapperRef",t().createRef()),fl(this,"formRef",t().createRef()),fl(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),fl(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),fl(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),fl(this,"getFormItems",ur()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),fl(this,"getFlattenItems",ur()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,J.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),fl(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),fl(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),fl(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),fl(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),fl(this,"openValidateInfo",(e=>{const r=t().createElement("ul",null,e.map((e=>{const{label:r}=this.formItems.find((t=>t.fieldName===e.name[0]));return t().createElement("li",{key:e.name[0],style:{color:"#f5222d"}},"[",("string"==typeof r?`${r}: `:"")+e.errors.join(","),"]")})));O.notification.error({message:p("qm.form.validatePrompt"),description:r,duration:10})})),fl(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&jt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){xt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){Et(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&g("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,J.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,J.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,br.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??fr),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t!==this.getViewValue(e)&&this.setState((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){this.setState({collapse:e},(()=>{this.props.onCollapse?.(this.state.collapse)}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if("string"==typeof e)return e;const{fieldName:t,label:r,options:n={}}=e;if("string"==typeof r)return r;const{itemList:a=[]}=n,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:r}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){const t=n[e],a=this.dividers.find((e=>e.fieldName===t[0].fieldName)),i=a?.collapse?.showLimit??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===r&&e>i)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(Nr(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Nr(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,a]=t.split("|");e[n]=r[0]??"",e[a]=r[1]??""}}if(this.isFilterType)for(const t in e)se(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=Z()(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:a}=e.fetch;try{const e=await r(n);200===e.code&&(t=(a?(0,J.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const{visible:t=1,disabled:a,secretName:i}=n;t||(e.noAuth=!0),a&&(e.disabled=!0),i&&(e.options?e.options.secretType=i:e.options={secretType:i}),this.setFieldAuth(r,{visible:t,disabled:a,secretName:i})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return t().createElement(na,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(la,{option:e})}INPUT_NUMBER(e){return t().createElement(pa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(fa,{option:e})}SEARCH_HELPER(e){return t().createElement(Ea,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t().createElement(ka,{option:e})}TREE_TABLE_HELPER(e){return t().createElement(Da,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t().createElement(Va,{option:e})}RANGE_SEARCH_HELPER(e){return t().createElement(Ga,{option:e})}CHECKBOX(e){return t().createElement(an,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(Za,{option:e})}RATE(e){return t().createElement(ti,{option:e})}RADIO(e){return t().createElement(ii,{option:e})}SWITCH(e){return t().createElement(si,{option:e})}TEXT_AREA(e){return t().createElement(ui,{option:e})}DATE(e){return t().createElement(hi,{option:e})}RANGE_DATE(e){return t().createElement(yi,{option:e})}TIME(e){return t().createElement(Ei,{option:e})}RANGE_TIME(e){return t().createElement(wi,{option:e})}SELECT(e){return t().createElement(tn,{option:e})}MULTIPLE_SELECT(e){return t().createElement(tn,{option:e,multiple:!0})}IMMEDIATE(e){return t().createElement(Ri,{option:e})}DIVIDER(e){return t().createElement(Oi,{option:e})}TREE_SELECT(e){return t().createElement($i,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement($i,{option:e,multiple:!0})}CASCADER(e){return t().createElement(Ki,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(Ki,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(el,{option:e})}REGION_SELECT(e){return t().createElement(il,{option:e})}UPLOAD_FILE(e){return t().createElement(sl,{option:e})}UPLOAD_IMG(e){return t().createElement(ul,{option:e})}TINYMCE(e){return t().createElement(hl,{option:e})}renderFormLabel(e){if(!(0,J.isPlainObject)(e))return e;const{type:r,fieldName:n,label:a,options:i={},onChange:l=ne}=e,{itemList:o=[]}=i;return"SELECT"===r?t().createElement(O.Form.Item,{name:n,noStyle:!0},t().createElement(Jr,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>l(e,t)})):"CHECKBOX"===r?t().createElement(t().Fragment,null,t().createElement("span",{style:{paddingRight:5}},a),t().createElement(O.Form.Item,{name:n,noStyle:!0},t().createElement(rn,{option:e,onValuesChange:e=>l(e)}))):null}renderFormItemExtra(e){const{fieldName:r,isTooltip:n,style:a={},render:i}=e,{extra:l}=this.state;if(n)return t().createElement(O.Tooltip,{className:"extra-tooltip",title:l[r]},t().createElement(we.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===r));return t().createElement("div",{className:"extra-text",title:i?"":l[r],style:a},t().createElement("span",{className:"extra-overflow-cut"},i?i(o,this):l[r]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:r,fieldName:n,invisible:a,tooltip:i,className:l,labelWidth:o=this.props.labelWidth,rules:s=[],style:c={},render:d}=e;return se(this.state.formData)?null:t().createElement(O.Form.Item,{label:this.renderFormLabel(r),name:n,rules:s,tooltip:i,hidden:a,className:Se()(n,l),style:{width:"100%",...c},labelCol:{flex:de(o)}},d?.(e,this))}createFormItem(e){return(0,J.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(g("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:r,defaultRows:n,isFieldsDefine:a}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<r;e++)i.push({})}));const l=24/e,o=[],s=i.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return o.push(n),n}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,d=[],u=i.map(((r,n)=>{let{selfCol:a=1}=r;const{type:i,fieldName:s}=r;a=a>=24||"DIVIDER"===i||"TINYMCE"===i?e:a;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(r);return u&&d.push(o[n]),t().createElement(O.Col,{key:s??n,span:a*l,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},i?this.createFormItem(ce(r)):null)}));return a&&"default"===r&&u.push(t().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:r,collapse:n}=this.state,{searchButtonCols:a,isSearchBtn:i,isFieldsDefine:l=!0}=this.props;if(!this.isFilterType)return null;const o=24/r,s=a||1,c=r-e%r-s;return i?t().createElement(O.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t().createElement(O.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,icon:t().createElement(we.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),t().createElement(he,{size:this.$size,icon:t().createElement(we.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),l?this.createFieldsDefine():null,this.showFilterCollapse&&t().createElement("a",{onClick:()=>this.setExpandHandle(!n)},n?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:r,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const a=24/e;return n&&"default"===r?t().createElement(O.Row,{gutter:0},t().createElement(O.Col,{key:"-",span:a},t().createElement(O.Form.Item,null,t().createElement(O.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),t().createElement(he,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:r,fieldsChange:n}=this.props;return t().createElement(Jn,{uniqueKey:e,items:r,fieldsChange:n})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[p("qm.form.searchHelperTips")],warnings:[]})));r||a.length?t((r||[]).concat(a)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){g("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:a}=this.props,i=n.find((t=>t.fieldName===e));if(!i)return g("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return g("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,J.set)(i,r,t[r]));r&&(a?a([...n]):g("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:r,layout:n,disabled:a,labelWidth:i,labelAlign:l,labelWrap:o,customClass:s}=this.props,c=Ce("form"),d={required:"${label}"+p("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return t().createElement("div",{ref:this.wrapperRef,className:Se()(u,e),style:r},t().createElement(O.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:l,labelWrap:o,colon:!1,disabled:a,labelCol:{flex:this.verticalLayout?"initial":de(i)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t().createElement(pr.Provider,{value:this.provide},t().createElement(O.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}fl(gl,"contextType",l),fl(gl,"propTypes",Sr),fl(gl,"defaultProps",Cr);const bl=gl,yl={onActivate:r.func,onAddUndo:r.func,onBeforeAddUndo:r.func,onBeforeExecCommand:r.func,onBeforeGetContent:r.func,onBeforeRenderUI:r.func,onBeforeSetContent:r.func,onBeforePaste:r.func,onBlur:r.func,onChange:r.func,onClearUndos:r.func,onClick:r.func,onContextMenu:r.func,onCommentChange:r.func,onCopy:r.func,onCut:r.func,onDblclick:r.func,onDeactivate:r.func,onDirty:r.func,onDrag:r.func,onDragDrop:r.func,onDragEnd:r.func,onDragGesture:r.func,onDragOver:r.func,onDrop:r.func,onExecCommand:r.func,onFocus:r.func,onFocusIn:r.func,onFocusOut:r.func,onGetContent:r.func,onHide:r.func,onInit:r.func,onKeyDown:r.func,onKeyPress:r.func,onKeyUp:r.func,onLoadContent:r.func,onMouseDown:r.func,onMouseEnter:r.func,onMouseLeave:r.func,onMouseMove:r.func,onMouseOut:r.func,onMouseOver:r.func,onMouseUp:r.func,onNodeChange:r.func,onObjectResizeStart:r.func,onObjectResized:r.func,onObjectSelected:r.func,onPaste:r.func,onPostProcess:r.func,onPostRender:r.func,onPreProcess:r.func,onProgressState:r.func,onRedo:r.func,onRemove:r.func,onReset:r.func,onSaveContent:r.func,onSelectionChange:r.func,onSetAttrib:r.func,onSetContent:r.func,onShow:r.func,onSubmit:r.func,onUndo:r.func,onVisualAid:r.func,onSkinLoadError:r.func,onThemeLoadError:r.func,onModelLoadError:r.func,onPluginLoadError:r.func,onIconsLoadError:r.func,onLanguageLoadError:r.func},vl={apiKey:r.string,id:r.string,inline:r.bool,init:r.object,initialValue:r.string,onEditorChange:r.func,value:r.string,tagName:r.string,cloudChannel:r.string,plugins:r.oneOfType([r.string,r.array]),toolbar:r.oneOfType([r.string,r.array]),disabled:r.bool,textareaName:r.string,tinymceScriptSrc:r.string,rollback:r.oneOfType([r.number,r.oneOf([!1])]),scriptLoading:r.shape({async:r.bool,defer:r.bool,delay:r.number}),...yl},xl=e=>"function"==typeof e,El=e=>e in yl,Sl=e=>e.substr(2),Cl=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(El),c=Object.keys(l).filter(El),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=Sl(e),r=o[t];n(t,r),delete o[t]})),u.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=Sl(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let wl=0;const Tl=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return wl++,e+"_"+r+wl+String(t)},Nl=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Il=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Rl=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Pl=()=>({listeners:[],scriptId:Tl("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Ol=(()=>{let e=Pl();return{load:(t,r,n,a,i,l)=>{const o=()=>((t,r,n,a,i,l)=>{const o=r.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=n,o.async=a,o.defer=i;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),r.head&&r.head.appendChild(o)})(e.scriptId,t,r,n,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=Pl()}}})(),Al=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function kl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Fl extends e.Component{constructor(t){var r;super(t),r=this,kl(this,"editor",void 0),kl(this,"id",void 0),kl(this,"elementRef",void 0),kl(this,"inline",void 0),kl(this,"currentContent",void 0),kl(this,"boundHandlers",void 0),kl(this,"rollbackTimer",void 0),kl(this,"valueCursor",void 0),kl(this,"rollbackChange",(()=>{const e=this.editor,t=this.props.value;e&&t&&t!==this.currentContent&&e.undoManager.ignore((()=>{if(e.setContent(t),this.valueCursor&&(!this.inline||e.hasFocus()))try{e.selection.moveToBookmark(this.valueCursor)}catch(e){}})),this.rollbackTimer=void 0})),kl(this,"handleBeforeInput",(e=>{if(void 0!==this.props.value&&this.props.value===this.currentContent&&this.editor&&(!this.inline||this.editor.hasFocus()))try{this.valueCursor=this.editor.selection.getBookmark(3)}catch(e){}})),kl(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),kl(this,"handleEditorChange",(e=>{const t=this.editor;if(t&&t.initialized){const e=t.getContent();void 0!==this.props.value&&this.props.value!==e&&!1!==this.props.rollback&&(this.rollbackTimer||(this.rollbackTimer=window.setTimeout(this.rollbackChange,"number"==typeof this.props.rollback?this.props.rollback:200))),e!==this.currentContent&&(this.currentContent=e,"function"==typeof this.props.onEditorChange&&this.props.onEditorChange(e,t))}})),kl(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),kl(this,"initialise",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=r.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(t)){if(0===e)setTimeout((()=>r.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>r.initialise(e+1)),100)}return}const n=Al(r.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const a={...r.props.init,selector:void 0,target:t,readonly:r.props.disabled,inline:r.inline,plugins:(i=r.props.init?.plugins,l=r.props.plugins,Il(i).concat(Il(l))),toolbar:r.props.toolbar??r.props.init?.toolbar,setup:e=>{r.editor=e,r.bindHandlers({}),r.inline&&!Nl(t)&&e.once("PostRender",(t=>{e.setContent(r.getInitialValue(),{no_events:!0})})),r.props.init&&xl(r.props.init.setup)&&r.props.init.setup(e)},init_instance_callback:e=>{const t=r.getInitialValue();r.currentContent=r.currentContent??e.getContent(),r.currentContent!==t&&(r.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=r.props.disabled??!1;Rl(r.editor,n?"readonly":"design"),r.props.init&&xl(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(e)}};var i,l;r.inline||(t.style.visibility=""),Nl(t)&&(t.value=r.getInitialValue()),n.init(a)})),this.id=this.props.id||Tl("tiny-react"),this.elementRef=e.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Rl(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==Al(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Ol.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){const e=Al(this.view)?.Env?.browser?.isIE();return e?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){Cl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):r&&!n&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}function Ll(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}kl(Fl,"propTypes",vl),kl(Fl,"defaultProps",{cloudChannel:"6"});var Hl=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(Hl||{});class $l extends e.Component{constructor(){super(...arguments),Ll(this,"defaultOption",{height:400,plugins:"preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap emoticons",menubar:"file edit view insert format tools table help",toolbar:"undo redo | bold italic underline strikethrough | fontfamily fontsize blocks | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media template link anchor codesample | ltr rtl"})}render(){const{size:e,className:r,style:n,tinymce:a={},upload:i={},thresholdSize:l=.5,tinymceScriptSrc:o,disabled:s,value:c,onChange:d=ne}=this.props,u=this.context.global,m=this.context.locale,h=e||this.context.size||"",f=Ce("tinymce"),g={[f]:!0,[`${f}--lg`]:"large"===h,[`${f}--sm`]:"small"===h},b={init:{height:a.height||this.defaultOption.height,plugins:a.plugins||this.defaultOption.plugins,toolbar:a.toolbar||this.defaultOption.toolbar,menubar:a.menubar||this.defaultOption.menubar,language:Hl[m],skin:"tinymce-5",...Z()(a,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:a,withCredentials:o,dataKey:s}=i,c=`data:image/jpeg;base64,${e.base64()}`,d=new FormData;d.append("file",e.blob(),e.filename());const u=e.blob().size;if(n&&u/1024/1024>l)try{const{data:e}=await At().post(n,d,{headers:a,withCredentials:o});200===e.code&&t(s?(0,J.get)(e.data,s):e.data)}catch(e){O.message.error(p("qm.uploadCropper.uploadError"))}else t(c)}))},value:c,disabled:s,tinymceScriptSrc:o||u?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{d(t.getContent())}};return t().createElement("div",{className:Se()(g,r),style:n},t().createElement(Fl,b))}}Ll($l,"contextType",l),Ll($l,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const Dl=$l,ql=require("cropperjs");var _l=n.n(ql);function jl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Kl extends e.Component{constructor(){super(...arguments),jl(this,"imgRef",t().createRef()),jl(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:r,alt:n,imgStyle:a,...i}=this.props,l={};for(const e in i)void 0!==this.props[e]&&(l[e]=this.props[e]);this.cropper=new(_l())(this.imgRef.current,l)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:r,src:n,alt:a,imgStyle:i}=this.props,l={[Ce("cropper")]:!0};return t().createElement("div",{className:Se()(l,e),style:r},t().createElement("img",{ref:this.imgRef,src:n,alt:a,style:{maxWidth:"100%",...i}}))}}jl(Kl,"defaultProps",{src:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0});const Ml=Kl;function Vl(){return Vl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Vl.apply(this,arguments)}function zl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ul extends e.Component{constructor(){super(...arguments),zl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,maxCount:l,fileList:o=[],beforeUpload:s}=this.props,c=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),d=!i||e.size/1024/1024<i,u=!(l>1)||o.length<l,m=c&&d&&u;if(c||O.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),d||O.message.warning(p("qm.upload.sizeLimit",{size:i})),u||O.message.warning(p("qm.upload.countLimit",{count:l})),!m)return m||O.Upload.LIST_IGNORE;if(s){const a=s(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),zl(this,"doDownload",(async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){O.message.error(p("qm.download.error"))}}))}get $size(){return this.context.size??""}async downloadFile(e,t){const r=await At()({url:e,headers:this.props.headers,responseType:"blob",timeout:0}),n=r.data,a=r.headers["content-disposition"],i=t||(a?a.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));kt(n,i)}render(){const{fileList:e=[],button:r={},fileDirection:n,disabled:a,readOnly:i,className:l,onPreview:o,onChange:s}=this.props,c=Ce("upload-file"),d={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}--horizontal`]:"horizontal"===n};return t().createElement(O.Upload,Vl({className:Se()(d,l)},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:a||i,onChange:s,onPreview:async e=>{if("function"==typeof o)return o(e,(t=>this.doDownload(t||e)));a||await this.doDownload(e)},onDownload:async e=>{await this.doDownload(e)}}),this.props.children||i&&e.length?this.props.children:t().createElement(O.Button,{type:r.type??"default",icon:r.icon??t().createElement(we.UploadOutlined,null),disabled:a||i},r.text||p("qm.upload.text")))}}zl(Ul,"contextType",l),zl(Ul,"defaultProps",{name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}});const Bl=Ul;function Wl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Gl extends e.Component{constructor(){super(...arguments),Wl(this,"cropperRef",t().createRef()),Wl(this,"beforeUploadRef",void 0),Wl(this,"fileRef",void 0),Wl(this,"resolveRef",void 0),Wl(this,"rejectRef",void 0),Wl(this,"state",{src:""}),Wl(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:r,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let a=new File([e],r,{type:t});Object.assign(a,{uid:n});const{fileTypes:i=[],fileSize:l}=this.props;if(i.length&&!i.includes(a.name.slice(a.name.lastIndexOf(".")+1).toLowerCase()))return O.message.warning(p("qm.upload.tooltip",{type:i.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(a);const o=this.beforeUploadRef(a,[a]);if("boolean"==typeof o||o){if(!0===o)return this.resolveRef(a);if(!1===o)return this.rejectRef("not upload");if(o&&"function"==typeof o.then)try{const e=await o,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),this.resolveRef(a)}catch(e){this.rejectRef(e)}}else g("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await ie(100),this.onClose()})),Wl(this,"onOk",(()=>{this.confirmHandle()})),Wl(this,"onClose",(()=>{this.setSrc("")}))}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:r}=this.props,n=Array.isArray(e)?e[0]:e;if(!n)return null;const{beforeUpload:a,...i}=n.props;return this.beforeUploadRef=a,t().createElement(n.type,{...i,beforeUpload:(e,t)=>new Promise((async(n,a)=>{const i=()=>n(O.Upload.LIST_IGNORE);if(r&&!await r(e,t))return void i();this.fileRef=e,this.resolveRef=n,this.rejectRef=i;const l=new FileReader;l.onload=()=>{this.setSrc(l.result),l.onload=null},l.readAsDataURL(e)}))})}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return t().createElement("div",{className:"cropper-preview"},t().createElement("div",{className:"cropper-area"},t().createElement("div",{className:"img-cropper"},t().createElement(Ml,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),t().createElement("div",{className:"actions"},t().createElement(O.Space,{size:"small"},t().createElement(O.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},p("qm.uploadCropper.zoomIn")),t().createElement(O.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},p("qm.uploadCropper.zoomOut")),t().createElement(O.Button,{type:"primary",size:"middle",icon:t().createElement(we.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},p("qm.uploadCropper.rotatePlus")),t().createElement(O.Button,{type:"primary",size:"middle",icon:t().createElement(we.RotateLeftOutlined,null),onClick:()=>this.rotateHandle(-90)},p("qm.uploadCropper.rotateSubtract"))))),t().createElement("div",{className:"preview-area"},t().createElement("div",{className:"preview",style:this.previewSize})))}render(){const{src:e}=this.state,r=Ce("cropper-preview");return t().createElement(t().Fragment,null,this.renderUpload(),e&&t().createElement(O.Modal,{open:!0,wrapClassName:Se()(r),title:p("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}Wl(Gl,"contextType",l);const Yl=Gl;function Xl(){return Xl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xl.apply(this,arguments)}function Ql(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Zl extends e.Component{constructor(){super(...arguments),Ql(this,"state",{previewVisible:!1,currentIndex:0}),Ql(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,beforeUpload:l}=this.props,o=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!i||e.size/1024/1024<i,c=o&&s;if(o||O.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),s||O.message.warning(p("qm.upload.sizeLimit",{size:i})),!c)return c||O.Upload.LIST_IGNORE;if(l){const a=l(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Ql(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})}))}get $size(){return this.context.size??""}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}render(){const{previewVisible:e,currentIndex:r}=this.state,{fileList:n=[],fixedSize:a,quality:i,fileTypes:l,fileSize:o,disabled:s,readOnly:c,className:d,openCropper:u,beforeCrop:m}=this.props,h=Ce("upload-img"),f={[h]:!0,[`${h}--lg`]:"large"===this.$size,[`${h}--sm`]:"small"===this.$size},g=t().createElement(O.Upload,Xl({className:Se()(f,d)},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:s||c,onPreview:this.handlePreview}),!this.showUploadButton||c&&n.length?null:t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("p",null,p("qm.uploadCropper.dragableText"))));return t().createElement(t().Fragment,null,u?t().createElement(Yl,{fixedSize:a,quality:i,fileTypes:l,fileSize:o,beforeCrop:m},g):g,t().createElement("div",{style:{display:"none"}},t().createElement(O.Image.PreviewGroup,{preview:{visible:e,current:r,onVisibleChange:e=>{this.setState({previewVisible:e})}}},n.map((e=>t().createElement(O.Image,{key:e.uid,src:e.url,alt:""}))))))}}Ql(Zl,"contextType",l),Ql(Zl,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const Jl=Zl,eo=(e,t,r)=>{let n;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[r]===t)))n=i[r];else{const e=eo(i.children,t,r);e&&(n=e)}}return n},to=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&to(e.children,t),t(e)||e.children&&e.children.length))),ro=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...ro(e.children,t)),t(e)&&r.push(e)})),r},no=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=no(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},ao=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:ao(e.children,t,r,n)}:e)),io=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...io(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},lo=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const a=lo(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},oo=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...oo(e,t)))),r},so=t().forwardRef(((e,r)=>{const{className:n,style:a,filterable:i=!0,multiple:o,draggable:s,dataSource:c,fetch:d,asyncLoad:u,checkStrictly:m,checkStrategy:h="SHOW_CHILD",placeholder:f=p("qm.form.inputPlaceholder"),fieldsDefine:g,value:b,height:y,defaultSelectedKeys:v=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:S=!0,onSelectChange:C,onCheckChange:w,onDragStart:T,onDragChange:N,onExpand:I}=e,{size:R}=t().useContext(l),P=t().useMemo((()=>e.size??R??""),[e.size,R]),A=g?.valueKey||"value",k=g?.textKey||"text",F=(g?.children,t().useRef(null)),L=St(F),[H,$]=t().useState(y),[D,q]=t().useState(!1),_=Ct((()=>{$(F.current.offsetHeight-Z.current.offsetHeight-10)}),5);_e((()=>{y||_()}),[L.height]);const[j,K]=t().useState([]),[M,V]=t().useState({}),[z,U]=t().useState([]),[B,W]=t().useState([]),[G,Y]=t().useState(""),[X,Q]=t().useState(x),Z=t().useRef(null),ee=t().useRef([]),te=t().useRef([]);t().useEffect((()=>{Array.isArray(c)&&(re(c),U(ne(c)),V({}))}),[c]),t().useEffect((()=>{le()}),[]),_e((()=>{le()}),[d?.params]),_e((()=>{W(ie())}),[M]),t().useImperativeHandle(r,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=no(j,(t=>e===t[A]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],re([...j]))},REMOVE_RECORD:e=>{const t=eo(j,e,A);if(void 0===t&&j.find((t=>t[A]===e)))re(j.filter((t=>t[A]!==e)));else{const r=no(j,(e=>t===e[A]));if(!r)return;const n=r.children?.findIndex((t=>e===t[A]));n>=0&&(r.children.splice(n,1),re([...j]))}},UPDATE_RECORD:(e,t)=>{const r=no(j,(t=>e===t[A]));r&&((0,J.merge)(r,t),re([...j]))}})));const re=e=>{K(e),ee.current=e,te.current=io(e,A)},ne=e=>{if(o)return v;const t=ro(e,(e=>v.includes(e[k])));return 1===t.length?[t[0][A]]:[]},ae=e=>lo(j,e,A)?.slice(0,-1)||[],ie=()=>{if(x)return te.current;const e=[];return z.forEach((t=>{if(o){if("SHOW_ALL"===h&&!te.current.includes(t)&&e.push(...ae(t)),"SHOW_CHILD"===h&&e.push(...ae(t)),"SHOW_PARENT"===h){const r=Ar(j,t);if(r){const n=ae(t),a=oo(r,A);e.push(...n,...[t,...a].filter((e=>te.current.includes(e))))}}}else e.push(...ae(t))})),[...new Set(e)]},le=async()=>{if(!d)return;const{api:e,params:t,dataKey:r,callback:n}=d;try{q(!0);const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,r)??[];re(e),U(ne(e)),V({}),n?.(e)}}catch(e){}q(!1)},oe=e=>`${e}|${Wr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,se=Ce("search-tree"),ce={[se]:!0,[`${se}--lg`]:"large"===P,[`${se}--sm`]:"small"===P};return t().createElement("div",{ref:F,className:Se()(ce,n),style:a},t().createElement("div",{ref:Z,className:"topper"},E&&t().createElement(O.Input.Search,{value:G,size:P,placeholder:f,allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=to(ee.current,(t=>{if(!e)return!0;const r=t[k]||"";return-1!==oe(r).indexOf(e)}));Y(e),K(t),x||e?W(io(t,A)):V({})})(e.target.value)}),S&&t().createElement("a",{className:"trigger",onClick:()=>{Q(!X),W(X?[]:te.current)}},X?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(X?"qm.form.collect":"qm.form.spread"))),t().createElement(ft,{spinning:D},t().createElement(O.Tree,{fieldNames:{title:k,key:A,children:"children"},multiple:o,draggable:s,blockNode:s,checkable:o,selectable:!o,height:H,disabled:e.disabled,checkStrictly:m,selectedKeys:b??z,checkedKeys:b??z,expandedKeys:B,treeData:j,loadData:u?async e=>{let{key:t,children:r}=e;if(!d||r)return;const{api:n,params:a,dataKey:i,formatter:l=(e=>e)}=d;try{const e=await n(l({...a,[A]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=ao(ee.current,t,A,r);re(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!G)return!1;const t=e[k]||"";return-1!==oe(t).indexOf(G)},onDragStart:T,onDragEnter:e=>{W(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),i=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][A]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},l=[...j];let o;if(i(l,r,((e,t,r)=>{r.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,r=[];i(l,t,((t,n,a)=>{r=a,e=n})),-1===a?r.splice(e,0,o):r.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(l)},onDragEnd:e=>{N?.(e,j)},onExpand:(e,t)=>{W(e),I?.(e,t)},onSelect:e=>{U(e);const t=ro(ee.current,(t=>e.includes((0,J.get)(t,A))));C?.(o?t:t[0])},onCheck:e=>{m&&(e=e.checked),U(e),"SHOW_CHILD"===h&&(e=e.filter((e=>!te.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,r)=>!r.includes(eo(j,e,A)))));const t=ro(ee.current,(t=>e.includes((0,J.get)(t,A))));w?.(o?t:t[0])}})))}));so.displayName="QmSearchTree";const co=so,uo=(0,e.createContext)(void 0),po={dataIndex:i().string.isRequired,title:i().string.isRequired,description:i().string,colSpan:i().number,width:i().number,minWidth:i().number,fixed:i().oneOf(["left","right"]),align:i().oneOf(["left","center","right"]),theadAlign:i().oneOf(["left","center","right"]),printFixed:i().bool,hidden:i().bool,noAuth:i().bool,noFixed:i().bool,ellipsis:i().bool,className:i().string,theadClassName:i().string,children:i().array,sorter:i().oneOfType([i().bool,i().func]),filter:i().shape({type:i().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:i().arrayOf(i().shape({text:i().string,value:i().oneOfType([i().string,i().number])})),style:i().object}),precision:i().number,displayPrecision:i().number,formatType:i().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:i().bool,canCopy:i().bool,editRender:i().func,dictItems:i().arrayOf(i().shape({text:i().string,value:i().oneOfType([i().string,i().number])})),summation:i().shape({sumBySelection:i().bool,displayWhenNotSelect:i().bool,dataKey:i().string,unit:i().string,render:i().func}),groupSummary:i().shape({dataKey:i().string,unit:i().string,render:i().func}),headRender:i().func,render:i().func},mo=(i().arrayOf(i().shape(po)).isRequired,i().func,i().array,i().oneOfType([i().string,i().func]).isRequired,i().bool,i().bool,i().shape({api:i().func.isRequired,params:i().object.isRequired,formatter:i().func,beforeFetch:i().func,afterFetch:i().func,stopToFirst:i().bool,dataKey:i().string,callback:i().func}),i().bool,i().bool,i().string,i().string,i().bool,i().bool,i().bool,i().bool,i().oneOfType([i().object,i().func]),i().oneOfType([i().object,i().func]),i().array,i().func,i().bool,i().bool,i().object,i().object,i().shape({type:i().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:i().array,selectedRowKeys:i().array,hideSelectAll:i().bool,checkStrictly:i().bool,filterable:i().bool,selectByClickRow:i().bool,selectFirstRowOnChange:i().bool,clearableAfterFetched:i().bool,selectAllOnCurrentPage:i().bool,fetchSelectedRows:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),fetchAllRowKeys:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),disabled:i().func,onChange:i().func,onSelect:i().func,onSelectAll:i().func}),i().shape({currentRowKey:i().oneOfType([i().number,i().string]),disabled:i().func,onChange:i().func}),i().shape({virtual:i().bool,expandIconColumn:i().string}),i().shape({defaultExpandAllRows:i().bool,defaultExpandedRowKeys:i().array,expandedRowKeys:i().array,hideExpandAll:i().bool,rowExpandable:i().func,expandedRowClassName:i().string,expandedRowRender:i().func,onExpand:i().func,onChange:i().func}),i().shape({groupItems:i().arrayOf(i().shape({dataIndex:i().string.isRequired,titleIndex:i().string,color:i().string,backgroundColor:i().string})),fetch:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),onChange:i().func}),i().func,i().bool,i().bool,i().bool,i().bool,i().shape({current:i().number,pageSize:i().number,pageSizeOptions:i().array,showSizeChanger:i().bool,showQuickJumper:i().bool}),i().shape({fileName:i().string,fetch:i().shape({api:i().func.isRequired,params:i().object}),beforeExport:i().func,cellStyle:i().bool,hideIcon:i().bool}),i().shape({showLogo:i().bool}),i().shape({fetch:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),fieldList:i().arrayOf(i().object)}),i().shape({position:i().oneOf(["top","bottom"]),hideAlert:i().bool,hideClearButton:i().bool}),i().oneOf(["left","right"]),i().func,i().func,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,10),ho="1",fo="0",go="YYYY-MM-DD",bo="YYYY-MM-DD HH:mm:ss",yo="YYYYMMDDHHmmss",vo={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let xo=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Eo=[];const So={getFocusInstance:function(){return Eo[0]??null},getInstance:function(e){return Eo.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Eo.findIndex((e=>e===t))&&(this.deregister(e),Eo=[t,...Eo])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Eo=[{id:e,vm:t},...Eo])},deregister:function(e){e&&(Eo=Eo.filter((t=>t.id!==e)))}};function Co(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const wo=class{constructor(){Co(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),Co(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),Co(this,"removeFromRequired",(e=>{const t=this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.required.splice(t,1)})),Co(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),Co(this,"removeFromValidate",(e=>{const t=this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.validate.splice(t,1)})),Co(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),Co(this,"removeFromEdited",(e=>{const t=this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.edited.splice(t,1)})),Co(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),Co(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),Co(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),Co(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),Co(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),Co(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),Co(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),Co(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},To={defaultColumnWidth:80,selectionColumnWidth:50,rowHeightMaps:{large:42,middle:34,small:26},sortDirections:["ascend","descend"],pagination:{current:1,pageSize:20,pageSizeOptions:[10,20,30,40,50],showSizeChanger:!0,showQuickJumper:!0},groupSummary:{total:{text:"记录数",value:"*"},recordTotalIndex:"nRecordsCount",summaryFieldName:"tsummary",groupbyFieldName:"tgroupby"},highSearch:{showSQL:!1},treeTable:{textIndent:17},dataKey:"records",summationKey:"summation",totalKey:"total",virtualScrollY:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};let No;const Io=()=>{if(ee)return 0;if(void 0!==No)return No;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),No=t-n,No},Ro=e=>e.map((e=>(e.children&&(e.children.forEach((t=>{t.parentDataIndex=e.dataIndex,e.fixed?t.fixed=e.fixed:delete t.fixed})),e.children=Ro(e.children)),e))),Po=(e,r)=>{const{fetch:n,columns:a,height:i,minHeight:l,maxHeight:o,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:m,webPagination:h,scrollPagination:f,dragMergeCell:g,showSuperSearch:b,showFastSearch:y,showGroupSummary:v,showTableImport:x,showClipboard:E,showSelectCollection:S,footRender:C}=e,{tableRef:w,tableFullData:T,tableData:N,selectionKeys:I,sorter:R,filters:P,superFilters:O,pagination:A}=r,{selectionRows:k,summaries:F}=w.current,{expandIconColumn:L=""}=m||{},H=t().useMemo((()=>!!n?.api),[n?.api]),$=t().useMemo((()=>!H&&!!h),[H,h]),D=t().useMemo((()=>H&&!!f),[H,f]),q=t().useMemo((()=>(H||$)&&!D),[H,$,D]),_=t().useMemo((()=>!!(i||l||o)),[i,l,o]),j=t().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?r.push(i):n.push(i)}return[...t,...n,...r]})(Ro(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:To.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:To.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=u,a?.expandedRowRender?{dataIndex:To.expandableColumn,title:"",width:To.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),xn(t)})(a)),[a]),K=t().useMemo((()=>vn(j)),[j]),M=t().useMemo((()=>K.filter((e=>"function"==typeof e.editRender))),[K]),V=t().useMemo((()=>K.filter((e=>!!e.summation))),[K]),z=t().useMemo((()=>K.filter((e=>"left"===e.fixed))),[K]),U=t().useMemo((()=>K.filter((e=>"right"===e.fixed))),[K]),B=t().useMemo((()=>{const e=K.filter((e=>![To.expandableColumn,To.selectionColumn,To.operationColumn].includes(e.dataIndex)));return L&&e.some((e=>e.dataIndex===L))?L:e[0]?.dataIndex??""}),[K,L]),W=t().useMemo((()=>V.length>0),[V]),G=t().useMemo((()=>!!C||W),[C,W]),Y=t().useMemo((()=>Pn(j).length>1),[j]),X=t().useMemo((()=>s||Y),[s,Y]),Q=t().useMemo((()=>K.some((e=>e.sorter))),[K]),Z=t().useMemo((()=>K.some((e=>e.filter))),[K]),J=t().useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),ee=t().useMemo((()=>!H&&!!x),[H,x]),te=t().useMemo((()=>!!E&&M.length>0),[E,M]),re=t().useMemo((()=>!!S&&"checkbox"===c?.type),[S,c]),ne=t().useMemo((()=>!!b&&Z),[b,Z]),ae=t().useMemo((()=>!H&&!!y&&Z),[H,y,Z]),ie=t().useMemo((()=>!!v&&K.some((e=>!!e.groupSummary))),[K]),le=t().useMemo((()=>!!d?.groupItems?.length),[d]),oe=t().useMemo((()=>!!g&&!H&&!h),[g,H,h]),se=t().useMemo((()=>T.some((e=>Array.isArray(e.children)))),[T]),ce=t().useMemo((()=>!N.length),[N]),de=t().useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=le?Vn(w.current.tableFullData):w.current.tableFullData,d=!k.length&&!!o;let u=(!l||d?c:k).reduce(((e,t)=>{if(t?.[To.summaryIgnore])return e;const n=Number(Ln(t,r));return Number.isNaN(n)?e:new(sa())(e).plus(n).toNumber()}),0);!Object.keys(F).includes(r)||l&&!d||(u=Number(Ln(F,r))),Hn(e,r,u);let p=n>=0?u.toFixed(n):u;a>=0&&""!==p&&(p=qn(p,a)),p=Dn(p),Hn(e,`${r}_text`,s?`${p} ${s}`:p)})),[e]})()),[N,I,F]),ue=t().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),pe=t().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=To.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{r.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:To.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(P,O);return{...e?{[To.sorterFieldName]:e}:null,...t.length?{[To.filterFieldName]:t}:null,...ue?{[To.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...n?.params??null,[To.currentPageName]:A.current,[To.pageSizeName]:A.pageSize}}),[n?.params,A.current,A.pageSize,R,P,O,ue]);return{isFetch:H,isWebPagination:$,isScrollPagination:D,showPagination:q,shouldUpdateHeight:_,tableColumns:j,flattenColumns:K,editableColumns:M,summationColumns:V,leftFixedColumns:z,rightFixedColumns:U,treeExpandIndex:B,showSummary:W,showFooter:G,isHeadGroup:Y,bordered:X,isHeadSorter:Q,isHeadFilter:Z,isServiceSummation:J,isSelectCollection:re,isTableImport:ee,isTableClipboard:te,isSuperSearch:ne,isFastSearch:ae,isGroupSummary:ie,isGroupSubtotal:le,isDragMergeCell:oe,isTreeTable:se,isTableEmpty:ce,summationRows:de,fetchParams:pe}};function Oo(t){const r=e.useRef();r.current=t;const n=e.useCallback((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.current?.(...t)}),[]);return n}const Ao=(e,r)=>{const{rowKey:n,dataSource:a,summation:i,fetch:l,initialSorter:o,initialFilter:s,rowSelection:c,expandable:d,treeConfig:u,authConfig:p,ignorePageIndex:m,columnsChange:h,onChange:f,onDataChange:b,onDataLoad:y,onScrollEnd:v,onFetchError:x}=e,{getRowKey:E,tableRef:S,tableElementRef:C,tableBodyRef:w,$size:T,tableColumns:N,flattenColumns:I,tableFullData:R,pagination:P,layout:O,filters:A,sorter:k,superFilters:F,fetchParams:L,selectionKeys:H,rowExpandedKeys:$,highlightKey:D,summationColumns:q,shouldUpdateHeight:_,isFetch:j,isTreeTable:K,isWebPagination:M,isScrollPagination:V,isServiceSummation:z,isGroupSubtotal:U,doLayout:B,setTableData:W,setTableFullData:G,setTableOriginData:Y,setAllTableData:X,setDeriveRowKeys:Q,setPagination:ee,setSpinning:te,setSorter:re,setFilters:ne,setSuperFilters:ie,setSelectionKeys:le,setRowExpandedKeys:oe,setHighlightKey:ce,setSelectionRows:de,setScrollYLoad:ue,setScrollYStore:pe,setFieldAuth:me,setResizeState:he,setSummaries:fe,setPermission:ge,setRecordsMap:be,resetTableScroll:ye,clearElementStore:ve,clearRecordsMap:xe}=r,{store:Ee}=S.current,Se=St(C),Ce=t().useRef({...L}),we=t().useRef(new Map),Te=t().useRef(!1);_e((()=>{B()}),[N,T,O.tableAutoHeight]),_e((()=>{Ne()}),[Se]),_e((()=>{lt(),ot(),st(),j||(M&&Qe(),Ue(a)),o&&re(o),s&&ne(s)}),[a,l?.params]),_e((()=>{const e=Me(L,Ce.current);e||j&&c?.clearableAfterFetched&&ct(),!e&&L[To.currentPageName]>1&&!l?.stopToFirst?Qe():j&&ze(),Ce.current=L}),[L]),_e((()=>{M&&rt(),V||ye(),qe()}),[P.current,P.pageSize]),_e((()=>{j||Ie(R.length),B()}),[R]),_e((()=>{K&&u?.virtual&&(Ze(),rt())}),[$]);const Ne=()=>{const{scrollYLoad:e,resizeState:t}=S.current,{height:r}=t,{width:n,height:a}=Se,i=a!==r;B(),i&&_&&e&&rt(),he(Object.assign({},t,{width:n,height:a}))},Ie=e=>{e!==P.total&&ee((t=>Object.assign({},t,{total:e})))},Re=e=>{Te.current=e},Pe=Ct((e=>{Ge(),v?.(e)})),Oe=e=>U?Ae(ke(e,0)):e,Ae=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ae(e.children)),delete e.children,t.push(e)})),t},ke=(e,t)=>{const r=i.groupItems?.[t];return r?Un(e,[r.dataIndex]).map((e=>{const a={children:ke(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&Hn(a,n.toString(),Kn()),r.titleIndex&&Hn(a,r.titleIndex,Ln(e[0],r.titleIndex)),Hn(a,r.dataIndex,Ln(e[0],r.dataIndex)),q.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[To.summaryIgnore])return e;const n=Number(Ln(r,t));return Number.isNaN(n)?e:e+n}),0);Hn(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Fe=e=>{le(e),de((e=>{const{selectionRows:t,allTableData:r,recordsMap:n}=S.current;if(j)return[...t.filter((t=>e.includes(E(t,t.index)))),...r.filter((r=>{const n=E(r,r.index);return e.includes(n)&&-1===t.findIndex((e=>E(e,e.index)===n))}))];const a=[];for(let t=0,r=e.length;t<r;t++){const r=e[t];n.has(r)&&a.push(n.get(r))}return a})(e))},Le=e=>{const{type:t,checkStrictly:r=!0}=c||{},n=Array.isArray(e)?e:H;let a=[];return S.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{deriveRowKeys:r}=S.current,n=In(r,e);let a=[];if(!n)return a;const i=$e(n?.children||[]),l=Bn(r,e)?.slice(0,-1).reverse()||[];return a=[...new Set([...t,...i])],l.forEach((e=>{const t=In(r,e),n=Fn(a,t?.children?.map((e=>e.rowKey))||[]);a=n?[...a,e]:a.filter((t=>t!==e))})),a})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},He=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:a}=d||{},i=Array.isArray(e)?e:$;if(S.current.treeTable){a&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...H];D&&e.unshift(D);let l=[];return e.forEach((e=>{const t=Bn(S.current.deriveRowKeys,e)||[];l.push(...t.length>1?t.slice(0,-1).reverse():t)})),l=n?t:[...new Set([...i,...l])],l.filter((e=>!r.includes(e)))}return d?n?t.slice(0):[...i]:[]},$e=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...$e(e[r].children)),t.push(e[r].rowKey);return t},De=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...De(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...De(e,r[r.length-1])),r},qe=Ct((()=>{We(),f?.(P,Ke(A),je(k),F,{currentDataSource:et()})})),je=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},Ke=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[To.showFilterType?`${n}|${a}`:n]=e[r]}return t},Me=(e,t)=>{const r=Object.keys(kn(e,t));return 1===r.length&&(r.includes(To.currentPageName)||r.includes(To.pageSizeName))},Ve=Oo((async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=ae,afterFetch:r,callback:n}=l;if(!t(L))return;const a=!!i?.fetch?.api;te(!0);try{const[t,o]=a?await Promise.all([l.api(e(L)),i.fetch.api(e(L))]):[await l.api(e(L))];if(a?200===t.code&&200===o.code:200===t.code){const e=l.dataKey??To.dataKey;let a=(0,J.get)(t.data,e)??[];a="function"==typeof r?await r(a):a;const i=(0,J.get)(t.data,e.replace(/[^.]+$/,To.totalKey))||a.length||0;if(S.current.unMounted)return;Ue(Te.current?S.current.tableFullData.concat(a):a),Ie(i),Be(o?.data||t.data),n?.(t.data,t)}}catch(e){x?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),te(!1),Re(!1)})),ze=Ct(Ve),Ue=e=>{const t=e=>e.map(((e,r)=>(Array.isArray(e.children)&&(e.children=t(e.children)),e.index=r,m||(e.pageIndex=(e=>{const{current:t,pageSize:r}=P;return!j||V?e:(t-1)*r+e})(r)),e))),r=Oe(t(e));nt(r),at(r),it(),Fe(Le()),oe(He()),We(),y?.(r)},Be=e=>{if(!z)return;const t=i?.fetch?.dataKey??To.summationKey,r=(t?(0,J.get)(e,t):e)??{},n={};q.filter((e=>!!e.summation.dataKey)).forEach((e=>{Hn(n,e.dataIndex,Number(Ln(r,e.summation.dataKey)))})),fe(n)},We=()=>{const{type:e,selectFirstRowOnChange:t}=c||{};if("radio"===e&&t){const e=et();if(e.length){const t=E(e[0],e[0].index);Fe([t])}else Fe([])}},Ge=()=>{if(!V)return;const e=Xe();Te.current||P.current>=e||(Re(!0),Ye({...P,current:P.current+1}))},Ye=e=>{let{current:t,pageSize:r}=e;ee((e=>Object.assign({},e,{current:t,pageSize:r})))},Xe=()=>{const{pageSize:e,total:t}=P;return Math.ceil(t/e)||1},Qe=()=>{Ye(Object.assign({},P,{current:1}))},Ze=()=>{if(!S.current.treeTable||!u?.virtual)return;const e=Je(S.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=S.current,{rowExpandable:r}=d||{},n=[];return"function"==typeof r&&e.forEach(((e,a)=>!r(e)&&n.push(t[a]))),n.length?$.filter((e=>!n.includes(e))):$})());we.current.clear(),e.forEach(((e,t)=>we.current.set(e,t)))},Je=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Je(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},et=()=>M?(()=>{const{current:e,pageSize:t}=P;return S.current.tableFullData.slice((e-1)*t,e*t)})():S.current.tableFullData,tt=e=>{const{scrollYLoad:t,scrollYStore:r}=S.current;W(t?e.slice(r.startIndex,r.endIndex):e)},rt=()=>{let e=et();S.current.treeTable&&u?.virtual&&(e=(e=>{const{allTableData:t,allRowKeys:r}=S.current,n=[];for(let e=0,a=r.length;e<a;e++){const a=r[e];we.current.has(a)&&n.push(t[e])}return n})()),ue(e.length>To.virtualScrollY),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=S.current,{startIndex:a,rowHeight:i}=r;let l="",o="";n&&(l=`translateY(${Math.max(0,a*i)+"px"})`,o=e.length*i+"px"),t.$tableBody.style.transform=l,t.$tableYspace.style.height=o})(e),tt(e)},nt=e=>{G(e),X(e),Q(e),Ze(),rt()},at=e=>{Y(e)},it=()=>{const{allTableData:e}=S.current;xe(),e.forEach((e=>be(E(e,e.index),e)))},lt=()=>{re({})},ot=()=>{ne({})},st=()=>{ie([])},ct=()=>{Fe([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=Z()(p,["fetch"]);if(p.fetch){const{api:e,params:r,dataKey:n}=p.fetch;try{const a=await e(r);200===a.code&&(t=(n?(0,J.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;ge((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=S.current,n=Sn(e.columns,(e=>{const{dataIndex:n}=e,a=t.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:t=1,disabled:i,secretName:l}=a,o=Cn(r,n);me(n,{visible:t,disabled:i,secretName:l}),t||(e.noAuth=!0,o.noAuth=!0),l&&(e.formatType=`secret-${l}`,o.formatType=`secret-${l}`)}}));h?.(n)}})(),D&&w.current.setClickedValues([D,""]),"radio"===c?.type&&H.length&&w.current.setClickedValues([H[0],""]),j?Ve():Ue(a)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&g("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:nt,getTableData:Ve,handleTableData:tt,createTableData:Ue,createGroupData:Oe,createSelectionKeys:Le,createRowExpandedKeys:He,setSelectionKeysEffect:Fe,findParentRowKeys:De,getAllChildRowKeys:$e,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return g("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ee.removeFromRequired({x:r,y:n}),Ee.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&se(t)&&Ee.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||Ee.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=Ee.state,i=(0,J.intersection)(r,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:r.filter((e=>!i.includes(e))),updated:n.filter((e=>![...(0,J.intersection)(n,r),...(0,J.intersection)(n,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{b?.(S.current.tableFullData)},tableChange:qe,toLastPage:()=>{const e=Xe();P.current!==e&&Ye(Object.assign({},P,{current:e}))},toFirstPage:Qe,getPageCount:Xe,pagerChangeHandle:Ye,triggerScrollYEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=S.current,{startIndex:r,endIndex:n,offsetSize:a,visibleSize:i,rowHeight:l}=t,o=Math.floor(e/l),s=Math.max(0,o-1-a),c=o+i+a;(o<=r||o>=n-i-1)&&(r===s&&n===c||(pe(Object.assign({},t,{startIndex:s,endIndex:c})),rt()))}(e)},scrollBottomDebouncer:Pe,clearTableSorter:lt,clearTableFilter:ot,clearSuperFilters:st,clearRowSelection:ct,clearRowHighlight:()=>{ce("")},clearTableLog:()=>{Ee.clearAllLog()},destroy:()=>{ve(),Ee.destroy(),So.deregister(S.current.uid)}}},ko=(e,r)=>{const{height:n,minHeight:a,maxHeight:i,resizable:l,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,$size:u,tableColumns:p,flattenColumns:m,leftFixedColumns:h,layout:f,scrollY:g,tableData:b,showFooter:y,showPagination:v,isWebPagination:x,isFullScreen:E,setLayout:S,setScrollX:C,setScrollY:w,setElementStore:T,setScrollYStore:N,setShouldToTop:I}=r,R=t().useRef(g),P=t().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=f,r={};return a&&Object.assign(r,{minHeight:`${An(a)}px`}),i&&Object.assign(r,{maxHeight:`${An(i)}px`}),E?{...r,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...r,height:"auto"!==n?`${An(n)}px`:`${t}px`}:r}),[n,i,a,E,f]),O=(e,t)=>{const{elementStore:r,scrollYStore:n,allTableData:a}=d.current,i=r.$tableBody.parentNode.parentNode;if(void 0!==t&&t>=0)i.scrollTop=t*n.rowHeight;else{const t=(x?Rn(b):a).findIndex((t=>e===c(t,t.index)));i.scrollTop=(t<0?0:t)*n.rowHeight}};return{createElementStore:e=>{Object.keys(e).forEach((t=>{T(t,e[t])}))},tableStyles:P,getSpan:(e,t,r,n,a)=>{let i=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});Array.isArray(o)?(i=o[0],l=o[1]):(0,J.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan)}const{mergeCells:o}=d.current;if(o.length>0){const e=o.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{m.findIndex((t=>t.dataIndex===e))<0&&(e=wn(Cn(p,e)).dataIndex);let t=0;for(let r=0;r<m.length;r++){const n=m[r];if(n.dataIndex===e)break;t+=An(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{m.findIndex((t=>t.dataIndex===e))<0&&(e=Tn(Cn(p,e)).dataIndex);let t=0;for(let r=m.length-1;r>=0;r--){const n=m[r];if(n.dataIndex===e)break;t+=An(n.width||n.renderWidth||0)}return t},scrollXToColumn:(e,t)=>{const{elementStore:r}=d.current,n=void 0===t?m.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=h.map((e=>e.width||e.renderWidth||To.defaultColumnWidth)).reduce(((e,t)=>e+t),0);r.$tableBody.parentNode.parentNode.scrollLeft=r.$tableBody.querySelectorAll("tbody > tr > td")[n].offsetLeft-a},scrollYToRecord:O,rowInViewport:e=>{const{elementStore:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:a}=f,i=e*r.rowHeight,l=t.$tableBody.parentNode.parentNode;return!(i<l.scrollTop||i+r.rowHeight>l.scrollTop+(scrollX?n-a:n))},calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=d.current,r=t.winHeight-e.$table.getBoundingClientRect().top-(v?ga["small"!==u?"middle":u]+mo:0)-mo;S((e=>Object.assign({},e,{tableAutoHeight:r})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&O("",0),I(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=o?e.$header.offsetHeight:f.headerHeight,i=y?e.$footer.offsetHeight:f.footerHeight,l=n-a-i,s=e.$tableBody.offsetHeight,c=t||s>l;let p=0;if(E){const t=e.$toper?e.$toper.offsetHeight+mo:0,n=e.$pager?e.$pager.offsetHeight+mo:0;p=r.winHeight-t-n-20}l!==f.viewportHeight&&(e=>{const{scrollYStore:t,isIE:r}=d.current,{startIndex:n,endIndex:a}=t,i=To.rowHeightMaps[u],l=Math.max(8,Math.ceil(e/i)+2),o=r?5:0;N(Object.assign({},t,{visibleSize:l,offsetSize:o,endIndex:Math.max(n+l+o,a),rowHeight:i}))})(l),R.current=c,w(c),S((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:l,tableBodyHeight:s,tableFullHeight:p})))})(),(()=>{const{elementStore:e}=d.current,t=e.$table.clientWidth,r=R.current?f.gutterWidth:0,{defaultColumnWidth:n}=To,a=m.filter((e=>"number"!=typeof e.width));let i=0;if(m.forEach((e=>{"number"==typeof e.width&&(e.renderWidth=void 0)})),a.length>0){if(m.forEach((e=>{i+=e.width||e.minWidth||n})),i<=t-r){C(!1);const e=t-r-i;if(1===a.length&&l)a[0].renderWidth=(a[0].minWidth||n)+e;else{const t=e/a.reduce(((e,t)=>e+(t.minWidth||n)),0);let r=0;a.forEach(((e,a)=>{if(0===a)return;const i=Math.floor((e.minWidth||n)*t);r+=i,e.renderWidth=(e.minWidth||n)+i})),l&&(a[0].renderWidth=(a[0].minWidth||n)+e-r)}}else C(!0),a.forEach((e=>{e.renderWidth=e.minWidth||n}));S((e=>Object.assign({},e,{tableBodyWidth:Math.max(i,t)})))}else m.forEach((e=>{e.renderWidth=e.width||e.minWidth||n,i+=e.renderWidth})),C(i>t),S((e=>Object.assign({},e,{tableBodyWidth:i})));S((e=>Object.assign({},e,{tableWidth:t})))})()}}};function Fo(){const[,t]=e.useReducer((e=>e+1),0);return t}const Lo=e=>{const{total:r}=e,{tableRef:n,tableProps:a,selectionKeys:i,isHeadSorter:l,isHeadFilter:o,isTreeTable:s,clearTableSorter:c,clearTableFilter:d,clearSuperFilters:u,clearRowSelection:m,clearRowHighlight:h}=t().useContext(uo),{infoBarConfig:f,rowSelection:g,rowHighlight:b}=a,{allTableData:y,invalidRowKeys:v}=n.current,{hideAlert:x,hideClearButton:E}=f||{},S=t().useMemo((()=>!x),[x]),C=t().useMemo((()=>!E&&!!(l||o||g||b)),[E,l,o,g,b]),w={[`${Ce("table")}__alert`]:!0};return S?t().createElement("div",{className:Se()(w)},t().createElement("i",{className:"svgicon icon"},t().createElement(we.InfoCircleFilled,null)),t().createElement("span",null,p("qm.table.alert.total",{total:s?y.length:r}),g?`,${p("qm.table.alert.selected",{total:i.length-v.length})}`:""),C&&t().createElement("em",{onClick:()=>{c(),d(),u(),m(),h()}},p("qm.table.alert.clear"))):null},Ho=t().forwardRef(((e,r)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:i}=t().useContext(uo),l=()=>{i(!n)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table");return a?t().createElement("span",{className:`${o}-full-screen`,title:p(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},n?t().createElement(we.FullscreenExitOutlined,null):t().createElement(we.FullscreenOutlined,null))):null}));Ho.displayName="FullScreen";const $o=Ho,Do=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(uo),i=()=>{a()};t().useImperativeHandle(r,(()=>({clickHandle:i})));const l=Ce("table");return n?t().createElement("span",{className:`${l}-reload`,title:p("qm.table.refresh.text"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ReloadOutlined,null))):null}));Do.displayName="Reload";const qo=Do,_o=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:s,tableProps:c,flattenColumns:d,summationRows:u,showSummary:m,getSpan:h}=t().useContext(uo),{tablePrint:f,showHeader:g}=c,b=i?.print?.leftLogo??"",y=i?.print?.rightLogo??"",v=!(!b&&!y),x=t().useMemo((()=>ce(Nn(n,[To.expandableColumn,To.selectionColumn,To.operationColumn]))),[n]),E=t().useMemo((()=>ce(Nn(d,[To.expandableColumn,To.selectionColumn,To.operationColumn]))),[d]),S=t().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),C=(e,t)=>{const r=Object.assign({},Cn(t,e.parentDataIndex));return r.children=[e],r.level&&r.level>1?C(r,t):r},w=(e,t)=>(0,J.map)((0,J.groupBy)((0,J.flatten)(e),t),(0,J.spread)((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,J.mergeWith)(...r,((e,r)=>{if(Array.isArray(e))return w(e.concat(r),t)}))}))),T=()=>{const{allTableData:e}=o.current,t=(e=>{const t=[];let r=[],n=0,a=0;for(;a<e.length;){const i=e[a];n+=i.width||i.renderWidth||i.minWidth||To.defaultColumnWidth,n<=To.printWidth?(r.push(i),a===e.length-1&&t.push(r),a++):a>0?(e.splice(0,a),S.length&&e.unshift(...S),t.push(r),r=[],n=0,a=0):(i.width=To.printWidth,r.push(i),t.push(r),a++)}return t})([...E]),r=((e,t)=>{const r=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(C(e,t))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:w(r,"dataIndex")[0]})))(n),r.push(Pn(n))})),r})(t,x);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=N(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},N=(e,t,r)=>{const{showLogo:n=!0}=f;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||To.defaultColumnWidth}px">`})).join("")}</colgroup>`,g&&(a+=["<thead>",n&&v?`<tr><th colspan="${t.length}" style="border: 0">${['<table class="no-border" width="100%" border="0" cellspacing="0" cellpadding="0">',"<tr>",'<td width="50%" align="left">',b?`<img src="${b}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',y?`<img src="${y}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(a+=`<tbody>${r.map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:i}=h(e,t,e.index,n,r);return a&&i?`<td rowspan="${a}" colspan="${i}">${((e,t,r,n)=>s.current.renderCellTitle(r,e,t,n))(e,e.index,t,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),m&&u.length&&(a+=["<tfoot>",u.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(r):Ln(e,`${a}_text`);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},I=()=>{((e,t)=>{const{filename:r,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});kt(e,i)}})(0,T())?.then((e=>{let{content:t,blob:r}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),o.current.isIE?(n.contentDocument.write(t),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(r))}))};t().useImperativeHandle(r,(()=>({clickHandle:I})));const R=Ce("table");return a?t().createElement("span",{className:`${R}-print`,title:p("qm.table.print.text"),onClick:()=>I()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PrinterOutlined,null))):null}));_o.displayName="TablePrint";const jo=_o,Ko=require("exceljs");var Mo=n.n(Ko);const Vo="606060",zo="thin",Uo="d4d4d4",Bo=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Wo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Go=()=>({top:{style:zo,color:{argb:Uo}},left:{style:zo,color:{argb:Uo}},bottom:{style:zo,color:{argb:Uo}},right:{style:zo,color:{argb:Uo}}}),Yo=e=>{const{children:t}=e;return t&&t.length?Yo(t[0]):e},Xo=e=>{const{precision:t,formatType:r}=e,n=t>=0?t?`0.${new Array(t).fill("0").join("")}`:"0":"";return n?{numFmt:n}:"percent"===r?{numFmt:t>=0?`${n}%`:"0%"}:"finance"===r?{numFmt:t>=0?`#,##${n}`:"#,##0"}:null},Qo=()=>{const{tableRef:e,tableProps:r,getSpan:n,showSummary:a,isHeadGroup:i}=t().useContext(uo),{spanMethod:l,showHeader:o}=r,s=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(t,r,s,c)=>{const{columns:d,footSummation:u}=t,{scrollYStore:{rowHeight:m}}=e.current,h=vn(d),f=Pn(d),g=[],b=[],y=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,title:r,width:n,minWidth:a,renderWidth:i}=e;E[t]=r,y.push({key:t,width:(n||i||a||To.defaultColumnWidth)/8})})),o&&(i?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Yo(e),l=h.findIndex((e=>{let{dataIndex:t}=e;return t===i.dataIndex}));r[i.dataIndex]=e.title,0!==n&&(n>1||a>1)&&v.push({s:{r:t,c:l},e:{r:t+a-1,c:l+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const S=r.map(((e,t)=>{const a={};return h.forEach(((i,o)=>{if("function"==typeof l){const{rowSpan:a,colSpan:l}=n(e,i,t,o,r);(l>1||a>1)&&v.push({s:{r:t+x,c:o},e:{r:t+x+a-1,c:o+l-1}})}const s=["percent","finance"].includes(i.formatType);a[i.dataIndex]=s?Ln(e,i.dataIndex):c(e,t,i,o)})),a}));x+=S.length,a&&u&&s(h,r).forEach(((e,t)=>{const n={};h.forEach(((t,a)=>{const{dataIndex:i,summation:l}=t,o=l?.render?l.render(r):Ln(e,i);n[i]=0===a&&""===o?p("qm.table.config.summaryText"):te(o)?Mn(o).join(""):o})),b.push(n)}));const{sheetName:C,useStyle:w}=t,T=new(Mo().Workbook),N=T.addWorksheet(C);N.columns=y,o&&N.addRows(g).forEach((e=>{w&&Bo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Cn(d,t.key),{align:n,theadAlign:a}=r;Wo(e,a||n),w&&Object.assign(e,{font:{bold:!0,color:{argb:Vo}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Go()})}))})),N.addRows(S).forEach((e=>{w&&Bo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Cn(d,t.key),{align:n}=r;Wo(e,n),Object.assign(e,Xo(r)),w&&Object.assign(e,{font:{color:{argb:Vo}},border:Go()})}))})),a&&u&&N.addRows(b).forEach((e=>{w&&Bo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Cn(d,t.key),{align:n}=r;Wo(e,n),Object.assign(e,Xo(r)),w&&Object.assign(e,{font:{color:{argb:Vo}},border:Go()})}))})),v.forEach((e=>{let{s:t,e:r}=e;N.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const I=await T.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,i,l="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)i=a.cells[n],l=l+(n?",":"")+r(i.textContent.trim());l+="\r\n"}return l})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),a=[];let i;for(i=0;i<n.length;i+=r){const e=n.slice(i,i+r),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const o=new window.Uint8Array(t);a.push(o)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,a=vn(r),i=new FileReader;i.onerror=()=>{O.message.error(p("qm.table.import.error"))},i.onload=e=>{const r=a.map((e=>e.title)),n=new(Mo().Workbook),i=e.target;i?n.xlsx.load(i.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],o=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,l);if(o){const n=e.slice(i+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;(0,J.isPlainObject)(n)&&(n=e.text),(0,J.isDate)(n)&&(n=jn(e,bo)),t[l[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:l}=a[r];Array.isArray(l)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>s(l,e))).filter((e=>""!==e)):t[e]=s(l,t[e])),Hn(n,i,t[e])})),n}));t?.(n)}else O.message.error(p("qm.table.import.error"))}else O.message.error(p("qm.table.import.error"))})):O.message.error(p("qm.table.import.error"))},i.readAsArrayBuffer(n)}}},Zo=e=>{const{fileType:r,onChange:n}=e;let a,i;const l=Ce("table"),o=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return t().createElement(he,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),i=document.createElement("input"),a.className=`${l}--file-form`,i.name="file",i.type="file",a.appendChild(i),document.body.appendChild(a)),new Promise(((e,r)=>{const n=!t.type;i.multiple=!!t.multiple,i.accept=n?"":`.${t.type}`,i.onchange=l=>{const{files:s}=l.target,c=s[0];let d="";if(!n)for(let e=0;e<s.length;e++){const{type:r}=o(s[e]);if(t.type!==r){d=r;break}}d?(O.message.warning(p("qm.upload.notType",{type:d})),r()):e(c),document.body.removeChild(a),a=null,i=null},a.reset(),i.click()}))})({type:r});n?.(e.name,e)}catch(e){}})()},p("qm.upload.text"))},Jo=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableProps:i,createTableData:l,dataChange:o}=t().useContext(uo),{beforeTableImport:s}=i,{importXLSX:c}=Qo(),d=t().useRef(null),[u,m]=t().useState(!1),[h,f]=t().useState(!0),g=e=>e.filter((e=>![To.expandableColumn,To.selectionColumn,"index","pageIndex",To.operationColumn].includes(e.dataIndex))),[b,y]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName",render:(e,r)=>{const{fileName:n}=r.GET_FIELDS_VALUE(["fileName"]);return t().createElement(t().Fragment,null,n?t().createElement("span",null,n):t().createElement(Zo,{fileType:r.state.formData.fileType,onChange:(e,t)=>{r.SET_FIELDS_VALUE({fileName:e,file:t}),t&&f(!1)}}))}},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:p("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:p("qm.table.import.fillText"),value:"fill"},{text:p("qm.table.import.addText"),value:"add"},{text:p("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{b.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,y([...b])}},{type:"INPUT_NUMBER",label:p("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:a.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),v=Ce("table");return t().createElement("div",{className:`${v}-import__setting`},t().createElement(bl,{ref:d,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:b,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:u,disabled:h,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||(m(!0),c({columns:g(r),file:t.file},(async e=>{const{tableFullData:r,store:i}=a.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=await s(e)}catch(e){}if("fill"===t.importType&&l(e),"add"===t.importType&&l([...r,...e]),"insert"===t.importType){const{tableFullData:r}=a.current,n=t.posIndex,i=r.slice(0,n).concat(e).concat(r.slice(n));l(i)}e.forEach((e=>{i.addToInserted(e)})),o(),O.message.success(p("qm.table.import.success",{total:e.length})),m(!1),n()})))})()},p("qm.table.import.text"))))},es=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:o})));const s={[`${Ce("table")}-import`]:!0},c={visible:i,title:p("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(s),title:p("qm.table.import.textNoSpace"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ImportOutlined,null))),t().createElement(cr,c,t().createElement(Jo,{columns:n,onClose:()=>l(!1)})))}));es.displayName="TableImport";const ts=es,rs=e=>{const{columns:r,onChange:n}=e,{$size:a}=t().useContext(uo),i=t().useRef([]),[l,o]=t().useState(!1),[s,c]=t().useState(r);_e((()=>{u()}),[s]),t().useEffect((()=>{d()}),[r]);const d=()=>{const e=[];r.forEach(((t,n)=>{const a=t.colSpan;a>1&&r.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(r.slice(n,n+a))})),i.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=i.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...i.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=s.find((e=>e.dataIndex===n));return r>0&&void 0!==t.hidden&&(a.hidden=t.hidden),a})))})),n?.(e)},m=Ce("table"),h={[`${m}__popper`]:!0,"column-filter__popper":!0,[`${m}--lg`]:"large"===a,[`${m}--sm`]:"small"===a},f=[`${m}-column-filter`,{selected:l}];return t().createElement(Ra(),{action:["click"],popupVisible:l,popup:t().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"main"},t().createElement(Xn.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),r=s.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||c(Yn(e))}},s.map((e=>((e,r)=>{const{colSpan:n}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=["svgicon","handle","main-handle"];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(O.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,c([...s])}}),t().createElement("i",{className:Se()(a),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title))})(e)))))),popupClassName:Se()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{o(e)},builtinPlacements:vo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()(f),title:p("qm.table.columnFilter.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),t().createElement("span",null,p("qm.table.columnFilter.text"))))},ns=e=>{const{defaultValue:r,onClose:n,onOk:a}=e,{tableProps:i,selectionKeys:l,pagination:o,showSummary:c}=t().useContext(uo),{rowSelection:d}=i,u=t().useRef(null),[m,h]=t().useState(!1),f=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(yo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:l.length?"selected":"all","startIndex|endIndex":[1,o.total],footSummation:c?1:0,useStyle:0},r,{columns:ce(r.columns||[])})),[]),[g,b]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:p("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:p("qm.table.export.all"),value:"all"},{text:p("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==d?.type},{text:p("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:p("qm.table.columnFilter.text"),fieldName:"columns",render:(e,r)=>t().createElement(rs,{columns:r.state.formData.columns,onChange:e=>{r.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:p("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:p("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ce("table");return t().createElement("div",{className:`${y}-export__setting`},t().createElement(bl,{ref:u,initialValues:f,items:g,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:m,onClick:()=>(async()=>{const[e,t]=await u.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);a(t),await ie(1e3),h(!1),n()}})()},p("qm.table.export.text"))))},as=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:c,tableProps:d,flattenColumns:u,pagination:m,fetchParams:h,isFetch:f,isGroupSubtotal:g,showSummary:b,getSpan:y}=t().useContext(uo),{exportExcel:v,fetch:x,showHeader:E}=d,[S,C]=t().useState(!1),[w,T]=t().useState(!1),N=t().useMemo((()=>!!v?.fetch?.api),[v]),I=t().useMemo((()=>!m.total||w),[m.total,w]),R=t().useMemo((()=>Nn(n,[To.expandableColumn,To.selectionColumn,To.operationColumn])),[n]),P=t().useMemo((()=>Nn(u,[To.expandableColumn,To.selectionColumn,To.operationColumn])),[u]),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(g?Vn(t):t).reduce(((e,t)=>{if(t?.[To.summaryIgnore])return e;const r=Number(Ln(t,n));return Number.isNaN(r)?e:e+r}),0);Hn(r,n,a)})),[r]},k=(e,t,r,n)=>{const{precision:a,formatType:i}=r;let l=c.current.renderCellTitle(r,e,t,n);return a>=0&&!i&&""!==l&&(l=Number(l)),l},{exportXLSX:F,exportCSV:L}=Qo(),H=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:a}=x;let i=[];try{T(!0);const l=await t({...r(h),[To.currentPageName]:1,[To.pageSizeName]:e??m.total});if(200===l.code){let e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,a)??[];e="function"==typeof n?await n(e):e,i=Rn(e.map(((e,t)=>{const r={...e,index:t,pageIndex:t};return P.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&Hn(r,n,Ln(r,n))})),r})))}}catch(e){}return T(!1),i},$=e=>{const t=i?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},D=v?.fileName??`${s()().format(yo)}.xlsx`,q=D.slice(D.lastIndexOf(".")+1).toLowerCase(),_=()=>{if(I)return O.message.warning(p("qm.table.export.warnText"));N?(async e=>{T(!0);try{const{api:t,params:r}=v.fetch,n=await t({columns:P.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:r,type:a,hidden:n}})),...h,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[To.currentPageName]:void 0,[To.pageSizeName]:void 0});n.data&&(kt(n.data,e),$(e))}catch(e){}T(!1)})(D):C(!0)};t().useImperativeHandle(r,(()=>({clickHandle:_})));const j={[`${Ce("table")}-export`]:!0},K={visible:S,title:p("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},M={fileName:D.slice(0,D.lastIndexOf(".")),fileType:q,columns:R,useStyle:v?.cellStyle?1:0};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(j),title:p("qm.table.export.textNoSpace"),onClick:()=>_()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.DownloadOutlined,null))),t().createElement(cr,K,t().createElement(ns,{defaultValue:M,onClose:()=>C(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:a=1,endIndex:i}=e,{allTableData:l,selectionRows:s}=o.current;let c=[];if(f?("all"===n&&(c=await H()),"custom"===n&&(c=await H(i),c=c.slice(a-1))):("all"===n&&(c=l.slice(0)),"custom"===n&&(c=l.slice(a-1,i||void 0))),"selected"===n&&(c=s.slice(0)),"function"==typeof v?.beforeExport)try{c=v?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await F(e,c,A,k);kt(r,`${t}.xlsx`),$(`${t}.xlsx`)}if("csv"===r){const r=L(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=Pn(r),i=vn(r);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||To.defaultColumnWidth}px">`})).join("")}</colgroup>`,E&&(l+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${t.map((e=>`<tr>${i.map(((r,n)=>{const{rowSpan:a,colSpan:i}=y(e,r,e.index,n,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${k(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),b&&n&&(l+=["<tfoot>",A(i,t).map((e=>`<tr>${i.map(((r,n)=>{const{dataIndex:a,summation:i}=r,l=i?.render?i.render(t):Ln(e,a);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):te(l)?Mn(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));kt(r,`${t}.csv`),$(`${t}.csv`)}})(Object.assign({},e,{columns:xn(e.columns)}))}})))}));as.displayName="TableExport";const is=as,ls=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableBodyRef:i,tableProps:l,dataChange:o}=t().useContext(uo),{beforeClipboard:s}=l,c=t().useRef(null),[d,u]=t().useState([{type:"INPUT_NUMBER",label:p("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:p("qm.table.clipboard.colIndex"),fieldName:"dataIndex",options:{itemList:r.map(((e,t)=>({value:t,text:e.title})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:p("qm.table.clipboard.content"),fieldName:"content",placeholder:p("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[m,h]=t().useState(!1),f=Ce("table");return t().createElement("div",{className:`${f}-clipboard__setting`},t().createElement("h3",{className:"info"},p("qm.table.clipboard.supportText")),t().createElement(bl,{ref:c,initialValues:{},initialExtras:{rowIndex:"行",dataIndex:"列"},items:d,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:m,onClick:()=>(async()=>{const[e,t]=await c.current.GET_FORM_DATA();if(e)return;const{tableFullData:l,store:d}=a.current;h(!0);const u=t.content.trim().replace(/(\r|\n)$/,"");let m=u.replace(/"[^"]+"/g,"^");(u.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{m=m.replace(/\^/,e)}));let f=m.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{f=await s(f,f[0].map(((e,n)=>r[t.dataIndex+n].dataIndex)))}catch(e){}f.forEach(((e,n)=>{e.forEach(((e,i)=>{const o=l[t.rowIndex-1+n],s=r[t.dataIndex+i];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||e.extra?.disabled||a.current.fieldAuth[s.dataIndex]?.disabled)}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(Hn(o,s.dataIndex,e),d.addToUpdated(o))}}))})),i.current.forceUpdate(),o(),O.message.success(p("qm.table.clipboard.success",{total:f.length})),h(!1),n()})()},p("qm.table.clipboard.text"))))},os=t().forwardRef(((e,r)=>{const{flattenColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![To.expandableColumn,To.selectionColumn,"index","pageIndex",To.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:s})));const c={[`${Ce("table")}-clipboard`]:!0},d={visible:i,title:p("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(c),title:p("qm.table.clipboard.textNoSpace"),onClick:()=>s()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CopyOutlined,null))),t().createElement(cr,d,t().createElement(ls,{columns:o,onClose:()=>l(!1)})))}));os.displayName="TableClipboard";const ss=os,cs=e=>{const{columns:r,onClose:n}=e,{tableProps:a,tableRef:i,$size:l,selectionKeys:o,setSelectionKeysEffect:s}=t().useContext(uo),{rowKey:c}=a,d=t().useRef(null),u=St(d),m=e=>e.map((e=>{const t={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:e.dictItems??[],render:e.render};return Array.isArray(e.children)&&(t.children=m(e.children)),t})),[h,f]=t().useState([{title:p("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...m(r.filter((e=>![To.expandableColumn,To.selectionColumn,"index","pageIndex",To.operationColumn].includes(e.dataIndex))))]),[g]=t().useState(i.current.selectionRows.map((e=>({...e,children:void 0})))),[b,y]=t().useState(300),v=Ct((()=>{const e=d.current;y(e.offsetHeight-2*ga[l]-30)}),5);return _e((()=>{v()}),[u.width]),t().createElement("div",{ref:d,style:{height:"100%"}},t().createElement(oc,{size:l,columns:h,dataSource:g,rowKey:c,height:b,rowSelection:{type:"checkbox",selectedRowKeys:o,onChange:e=>s(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),t().createElement("div",{style:{height:10}}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n()},p("qm.table.selectCollection.closeButton"))))},ds=t().forwardRef(((e,r)=>{const{columns:n,open:a=!0}=e,{tableProps:i,getRowKey:l,selectionKeys:o,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=t().useContext(uo),{rowSelection:m}=i,[h,f]=t().useState(!1),g=t().useRef(!1);_e((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=m;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:o},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),d(n.map(((e,t)=>l(e,t)))),u(n),g.current=!0}}catch(e){}},y=()=>{f(!0)};t().useImperativeHandle(r,(()=>({clickHandle:y})));const v=Ce("table"),x={visible:h,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>f(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:`${v}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>y()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CheckSquareOutlined,null))),t().createElement(cr,x,t().createElement(cs,{columns:n,onClose:()=>f(!1)})))}));ds.displayName="SelectCollection";const us=ds,ps=require("localforage");var ms=n.n(ps);const hs=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),fs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,tableRef:i,getRowKey:o,$size:s,flattenColumns:c,pagination:d,setPagination:u,scrollYToRecord:m,setHighlightKey:h,setShouldToTop:f,isTreeTable:b,isWebPagination:y}=t().useContext(uo),{uniqueKey:v}=a,x=t().useRef(null),E=t().useRef(null),S=t().useRef([]),C=t().useRef(""),w=t().useRef(-1),T=t().useRef("stop");_e((()=>{const{current:e,pageSize:t}=d,r=i.current.tableFullData.slice((e-1)*t,e*t),n=Rn(r).findIndex((e=>o(e,e.index)===C.current));m("",n)}),[d.current]);const N=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},I=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:N(e.filter.type),fieldName:e.dataIndex,label:e.title,tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await x.current.GET_FORM_DATA(),[r,n]=await E.current.GET_FORM_DATA(),a=(0,J.omitBy)(Object.assign({},t,n),se);k(a)}}))),R={case:0,fullchar:0},P=t().useMemo((()=>c.filter((e=>![To.expandableColumn,To.selectionColumn,"index","pageIndex",To.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[A,k]=t().useState({}),[F,L]=t().useState(R),[H]=t().useState(I([P[0]])),[$]=t().useState(I(P.slice(1))),[D,q]=t().useState(0),_=t().useMemo((()=>!Object.keys(A).length),[A]);_e((()=>{T.current="ready"}),[A,F]);const j=e=>{L(Object.assign({},F,e))},K=(e,t,r)=>new Promise(((n,a)=>{O.Modal.confirm({title:p("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),M=async e=>{if(!Object.keys(A).length)return O.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.queryCondition")});if("ready"===T.current&&(T.current="stop",S.current=(e=>{const{allTableData:t}=i.current,r=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];let i=!0;for(const t in e){const{type:r}=P.find((e=>e.dataIndex===t)).filter;let n=Ln(a,t),l=!0;if("text"===r||"textarea"===r?l=new RegExp(F.fullchar?`^${e[t]}$`:e[t],F.case?"":"i").test(n):(n=hs(n)?n.slice(0,10):n,l=n==e[t]),!l){i=!1;break}}i&&r.push(a)}return r})(A),q(S.current.length)),!S.current.length)return h(""),O.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>S.current.length-1&&await K(p("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=S.current.length-1))),"prev"===e&&(w.current=w.current<0?S.current.length-1:w.current-1,w.current<0&&await K(p("qm.table.fastSearch.toStart"),(()=>w.current=S.current.length-1),(()=>w.current=0)));const t=S.current[w.current],r=o(t,t.index);let n=t.index;if(b&&y){const e=Bn(i.current.deriveRowKeys,r)[0];n=i.current.tableFullData.findIndex((t=>o(t,t.index)===e))}((e,t)=>{if(C.current=e,y){const{pageSize:e}=d,r=Math.ceil((t+1)/e);f(!1),u(Object.assign({},d,{current:r}))}else m(e)})(r,n),h(r)},V=()=>{x.current.RESET_FORM(),E.current.RESET_FORM()},z=t().useMemo((()=>v?`fastSearch_${v}`:""),[v]),[U,B]=t().useState([]),[W,G]=t().useState(""),[Y,X]=t().useState("");_e((()=>{if(Y){const{filters:e,config:t}=U.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(Z()(e,$.map((e=>e.fieldName)))),E.current.SET_FIELDS_VALUE(Z()(e,H.map((e=>e.fieldName)))),k(e),L(t)}else V(),k({}),L(R)}),[Y]),t().useEffect((()=>{Q()}),[]);const Q=async()=>{if(!z)return;let e=await ms().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await ms().setItem(z,e)),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))},ee=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},te=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},re=Ce("table");return t().createElement("div",{className:`${re}-fast-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"top"},t().createElement("div",{className:"container"},t().createElement(Jt,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t().createElement("span",null,p("qm.table.alert.total",{total:D}))},t().createElement(Jt.TabPane,{tab:p("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t().createElement(bl,{ref:x,items:H,cols:1,labelWidth:110})),t().createElement(Jt.TabPane,{tab:p("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t().createElement(bl,{ref:E,items:$,cols:1,labelWidth:110})))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(O.Input,{size:s,value:W,placeholder:p("qm.table.highSearch.configText"),disabled:_,onChange:e=>{const{value:t}=e.target;G(t)}}),t().createElement(he,{type:"primary",disabled:!W||_,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Kn(),t=[...U,{text:W,value:e,list:{filters:A,config:F}}];B(t),X(e),G(""),await ms().setItem(z,t),await te(z,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${To.rowHeightMaps[s]}px`}},t().createElement("span",null,p("qm.table.fastSearch.savedSetting"))),t().createElement("ul",null,U.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===Y}),title:e.text,onClick:()=>(e=>{X(e!==Y?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=U.filter((t=>t.value!==e));B(t),e===Y&&X(""),await ms().setItem(z,t),await te(z,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!U.length&&t().createElement("div",{style:{padding:mo}},t().createElement(mt,null)))))),t().createElement("div",{className:"bottom"},t().createElement("div",null,t().createElement(O.Checkbox,{checked:!!F.case,onChange:e=>j({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t().createElement(O.Checkbox,{checked:!!F.fullchar,onChange:e=>j({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t().createElement("div",null,t().createElement(he,{onClick:()=>V()},p("qm.table.fastSearch.clear"))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${ga[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.fastSearch.closeButton")),t().createElement(he,{type:"primary",style:{marginRight:8},onClick:()=>M("prev")},p("qm.table.fastSearch.queryPrev")),t().createElement(he,{type:"primary",onClick:()=>M("next")},p("qm.table.fastSearch.queryNext"))))},gs=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{$size:a}=t().useContext(uo),[i,l]=t().useState(!1),o=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:o})));const s=Ce("table"),c={visible:i,title:p("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${ga[a]+20}px`},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${s}-super-search`,title:p("qm.table.fastSearch.text"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.MonitorOutlined,null))),t().createElement(cr,c,t().createElement(fs,{onClose:()=>l(!1)})))}));gs.displayName="FastSearch";const bs=gs,ys=e=>{const{columns:r,group:n,summary:a}=e,{tableRef:i,tableProps:l,$size:o,pagination:c,fetchParams:d,isFetch:u}=t().useContext(uo),{fetch:m}=l,h=e=>{const t=r.find((t=>t.dataIndex===e));return{title:t.title,precision:t.precision,dictItems:t.dictItems??[]}},f=n.map((e=>({dataIndex:e.group,...h(e.group)}))),g=a.map((e=>e.summary===To.groupSummary.total.value?{dataIndex:e.summary,title:To.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...h(e.summary),formula:e.formula})),b=t().useMemo((()=>Object.assign({},d,{[To.sorterFieldName]:void 0,[To.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[To.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[To.currentPageName]:1})),[d,n,a]),[y,v]=t().useState(((e,t)=>[{title:p("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{const t=r.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=t?{summation:t}:null;return e.dataIndex===To.groupSummary.total.value&&(n={dataIndex:To.groupSummary.recordTotalIndex,summation:{render:()=>c.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(f,g)),[x]=t().useState(u?[]:(e=>{const t=Un(e,n.map((e=>e.group))),r=[];return t.forEach((e=>{const t={};y.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&Hn(t,n,Ln(e[0],n))})),a.forEach((r=>{const n=r.summary!==To.groupSummary.total.value?r.summary:To.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&Hn(t,n,e.length),"sum"===a&&Hn(t,n,(0,J.sumBy)(e,n)),"max"===a&&Hn(t,n,(0,J.maxBy)(e,n)[n]),"min"===a&&Hn(t,n,(0,J.minBy)(e,n)[n]),"avg"===a&&Hn(t,n,((0,J.sumBy)(e,n)/e.length).toFixed(2))})),r.push(t)})),r})(i.current.tableFullData)),E={size:o,height:400,...u?{fetch:{api:m.api,params:b,dataKey:m?.dataKey}}:{dataSource:x},columns:y,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${s()().format("YYYYMMDDHHmmss")}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>v(e)};return t().createElement(oc,E)},vs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o}=t().useContext(uo),{uniqueKey:s}=a,c=t().useRef(null),d=t().useRef(null),[u,m]=t().useState(!1),[h,f]=t().useState([]),[b,y]=t().useState(""),[v,x]=t().useState("");_e((()=>{if(v){const{group:e,summary:t}=h.find((e=>e.value===v)).list;I(e),k(t)}else{const e=$();I(e?.group||[]),k(e?.summary||[])}}),[v]),t().useEffect((()=>{D()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),S=t().useMemo((()=>o.filter((e=>![To.expandableColumn,To.selectionColumn,"index","pageIndex",To.operationColumn].includes(e.dataIndex)))),[o]),C=S.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[To.groupSummary.total,...S.filter((e=>!!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex})))],T=[{text:p("qm.table.groupSummary.sumText"),value:"sum"},{text:p("qm.table.groupSummary.maxText"),value:"max"},{text:p("qm.table.groupSummary.minText"),value:"min"},{text:p("qm.table.groupSummary.avgText"),value:"avg"},{text:p("qm.table.groupSummary.countText"),value:"count"}],[N,I]=t().useState([]),[R,P]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{c.current.REMOVE_RECORDS(r)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:p("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:C.map((e=>({...e,disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[A,k]=t().useState([]),[F,L]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(r)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:p("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:w.map((e=>({...e,disabled:A.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:p("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===To.groupSummary.total.value?T.slice(T.length-1):T})}]),H=t().useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=A.length&&A.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,A]),$=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},D=async()=>{if(!E)return;const e=$();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await ms().getItem(E);t||(t=await q(E),Array.isArray(t)&&await ms().setItem(E,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},_=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},j=Ce("table"),K={visible:u,title:p("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>m(!1)};return t().createElement("div",{className:`${j}-group-summary__setting`},t().createElement("div",{className:"main"},t().createElement("div",{style:{width:"30%"}},t().createElement(oc,{ref:c,size:i,columns:R,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{I(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{c.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"container line"},t().createElement(oc,{ref:d,size:i,columns:F,dataSource:A,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>L(e),onDataChange:e=>{k(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(O.Input,{size:i,value:b,placeholder:p("qm.table.groupSummary.configText"),disabled:H,onChange:e=>{const{value:t}=e.target;y(t)}}),t().createElement(he,{type:"primary",disabled:!b||H,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Kn(),t=[...h,{text:b,value:e,list:{group:N.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))}}];f(t),x(e),y(""),await ms().setItem(E,t),await _(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${To.rowHeightMaps[i]}px`}},t().createElement("span",null,p("qm.table.groupSummary.savedSetting"))),t().createElement("ul",null,h.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===v}),title:e.text,onClick:()=>(e=>{x(e!==v?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));f(t),e===v&&x(""),await ms().setItem(E,t),await _(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!h.length&&t().createElement("div",{style:{padding:mo}},t().createElement(mt,null)))))),t().createElement(cr,K,t().createElement(ys,{columns:S,group:N,summary:A})),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.groupSummary.closeButton")),t().createElement(he,{type:"primary",disabled:H,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:N.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))})),void m(!0))},p("qm.table.groupSummary.confirmButton"))))},xs=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-group-summary`,title:p("qm.table.groupSummary.text"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PieChartOutlined,null))),t().createElement(cr,s,t().createElement(vs,{onClose:()=>i(!1)})))}));xs.displayName="GroupSummary";const Es=xs,Ss=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(uo),{uniqueKey:d}=a,u=t().useRef(null),[m,h]=t().useState([]),[f,b]=t().useState([]),[y,v]=t().useState(""),[x,E]=t().useState("");_e((()=>{h(x?f.find((e=>e.value===x)).list:$()||[])}),[x]),t().useEffect((()=>{D()}),[]);const S=t().useMemo((()=>d?`superSearch_${d}`:""),[d]),C=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=zn(m),T=t().useMemo((()=>!(w&&bn(w))),[w]),N=t().useMemo((()=>!!m.length&&T),[m,T]),I=[{value:"and",text:p("qm.table.highSearch.andText")},{value:"or",text:p("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:e.title}))),P=e=>["in","nin"].includes(e),A=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:p("qm.table.highSearch.gtText")},{value:"<",text:p("qm.table.highSearch.ltText")},{value:">=",text:p("qm.table.highSearch.gteText")},{value:"<=",text:p("qm.table.highSearch.lteText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:p("qm.table.highSearch.inText")},{value:"nin",text:p("qm.table.highSearch.ninText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:p("qm.table.highSearch.likeText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}]}return t},[F,L]=t().useState([{title:p("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(r)}},p("qm.table.highSearch.removeText")))},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,r)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:p("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=C.find((e=>e.dataIndex===r))?.filter.type,a=k(n);e.fieldType=n,e.expression=r?a[0]?.value:"",e.condition=P(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:p("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:p("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=P(e.expression)?[]:""}}}},{title:p("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:A(r,P(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,r)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:I,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),H=()=>{S&&sessionStorage.setItem(S,JSON.stringify(m.filter((e=>!!e.fieldName))))},$=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},D=async()=>{if(!S)return;const e=$();e&&h(e);let t=await ms().getItem(S);t||(t=await q(S),Array.isArray(t)&&await ms().setItem(S,t)),Array.isArray(t)&&t.length&&(b(t),!e&&E(t[0].value))},q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},_=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},j=Ce("table");return t().createElement("div",{className:`${j}-super-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"container"},t().createElement(oc,{ref:u,size:i,columns:F,dataSource:m,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>L(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...m]))},onDataChange:e=>{h(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),To.highSearch.showSQL&&w&&t().createElement("code",{className:"lang-js"},w)),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(O.Input,{size:i,value:y,placeholder:p("qm.table.highSearch.configText"),disabled:T,onChange:e=>{const{value:t}=e.target;v(t)}}),t().createElement(he,{type:"primary",disabled:!y||T,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!S)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Kn(),t=[...f,{text:y,value:e,list:m.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await ms().setItem(S,t),await _(S,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${To.rowHeightMaps[i]}px`}},t().createElement("span",null,p("qm.table.highSearch.savedSetting"))),t().createElement("ul",null,f.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));b(t),e===x&&E(""),await ms().setItem(S,t),await _(S,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:mo}},t().createElement(mt,null)))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.highSearch.closeButton")),t().createElement(he,{type:"primary",disabled:N,onClick:()=>(c(),s(m.map((e=>Z()(e,["index","pageIndex"])))),H(),void r())},p("qm.table.highSearch.searchButton"))))},Cs=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-super-search`,title:p("qm.table.highSearch.text"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.FunnelPlotOutlined,null))),t().createElement(cr,s,t().createElement(Ss,{onClose:()=>i(!1)})))}));Cs.displayName="SuperSearch";const ws=Cs,Ts=t().forwardRef(((e,r)=>{const{tableColumns:n,showFullScreen:a,showReload:i,showPrint:o,showImport:s,showExport:c,showClipboard:d,showCollection:u,showFastSearch:m,showSuperSearch:h,showGroupSummary:f,showToolBox:b}=e,{global:y}=t().useContext(l),{tableProps:v,flattenColumns:x,isFullScreen:E,$size:S}=t().useContext(uo),{uniqueKey:C,exportExcel:w}=v,T=t().useRef(null),N=t().useRef(null),I=t().useRef(null),R=t().useRef(null),P=t().useRef(null),A=t().useRef(null),k=t().useRef(null),F=t().useRef(null),L=t().useRef(null),H=t().useRef(null),$=t().useRef(!1),D=t().useMemo((()=>C?`toolBox_${C}`:""),[C]),[q,_]=t().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),j={fullScreen:a,reload:i,print:o,import:s,export:c&&!w?.hideIcon,clipboard:d,collection:u,fastSearch:m,superSearch:h,groupSummary:f},[K,M]=t().useState(!1);_e((()=>{$.current&&(z(),$.current=!1)}),[q]),t().useEffect((()=>{V()}),[]),t().useImperativeHandle(r,(()=>({exportHandle:()=>{if(!P.current)return g("Table","执行导出需要配置 `exportExcel` 参数");P.current.clickHandle()}})));const V=()=>{if(!D||!b)return;const e=JSON.parse(localStorage.getItem(D));e||U(D).then((e=>{e&&(_(Object.assign({},q,e)),localStorage.setItem(D,JSON.stringify(e)))})).catch((()=>{})),e&&_(Object.assign({},q,e))},z=()=>{if(!D||!b)return;const e={};for(const t in q)q[t]&&(e[t]=q[t]);localStorage.setItem(D,JSON.stringify(e)),B(D,e)},U=async e=>{const t=y?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},B=async(e,t)=>{const r=y?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},W=async e=>{M(!1),await ie(100),e.current.clickHandle()},G=(e,t)=>{$.current=!0,_(Object.assign({},q,{[t]:e}))},Y=Ce("table"),X={"top-toolbox__popper":!0,[`${Y}--lg`]:"large"===S,[`${Y}--sm`]:"small"===S};return t().createElement(t().Fragment,null,a&&t().createElement($o,{ref:T,isFullScreen:E,open:!b||q.fullScreen}),i&&t().createElement(qo,{ref:N,open:!b||q.reload}),o&&t().createElement(jo,{ref:I,tableColumns:n,open:!b||q.print}),s&&t().createElement(ts,{ref:R,tableColumns:n,open:!b||q.import}),c&&t().createElement(is,{ref:P,tableColumns:n,open:(!b||q.export)&&!w?.hideIcon}),d&&t().createElement(ss,{ref:A,flattenColumns:x,open:!b||q.clipboard}),u&&t().createElement(us,{ref:k,columns:n,open:!b||q.collection}),m&&t().createElement(bs,{ref:F,open:!b||q.fastSearch}),f&&t().createElement(Es,{ref:L,open:!b||q.groupSummary}),h&&t().createElement(ws,{ref:H,open:!b||q.superSearch}),b&&t().createElement(O.Dropdown,{open:K,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.fullScreen,style:{marginRight:6},onChange:e=>G(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.screen.full"))),onClick:()=>W(T)},{key:"reload",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.reload,style:{marginRight:6},onChange:e=>G(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.refresh.text"))),onClick:()=>W(N)},{key:"print",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.print,style:{marginRight:6},onChange:e=>G(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.print.text"))),onClick:()=>W(I)},{key:"import",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.import,style:{marginRight:6},onChange:e=>G(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.import.textNoSpace"))),onClick:()=>W(R)},{key:"export",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.export,style:{marginRight:6},onChange:e=>G(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.export.textNoSpace"))),onClick:()=>W(P)},{key:"clipboard",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.clipboard,style:{marginRight:6},onChange:e=>G(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.clipboard.textNoSpace"))),onClick:()=>W(A)},{key:"collection",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.collection,style:{marginRight:6},onChange:e=>G(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.selectCollection.text"))),onClick:()=>W(k)},{key:"fastSearch",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.fastSearch,style:{marginRight:6},onChange:e=>G(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.fastSearch.text"))),onClick:()=>W(F)},{key:"groupSummary",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.groupSummary,style:{marginRight:6},onChange:e=>G(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.groupSummary.text"))),onClick:()=>W(L)},{key:"superSearch",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:q.superSearch,style:{marginRight:6},onChange:e=>G(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.highSearch.text"))),onClick:()=>W(H)}];return t().createElement(O.Menu,{items:e.filter((e=>j[e.key]))})})(),overlayClassName:Se()(X),overlayStyle:{minWidth:120},onOpenChange:e=>{M(e)}},t().createElement("span",{className:`${Y}-toolbox`,title:p("qm.table.toolbox.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.AppstoreAddOutlined,null)))))}));Ts.displayName="ToolBox";const Ns=Ts,Is=(e,t)=>e.map((e=>(e.children&&(e.children=Is(e.children,t)),t(e)))),Rs=t().forwardRef(((e,r)=>{const{columns:n}=e,{global:a}=t().useContext(l),{tableProps:i,tableRef:o,$size:s}=t().useContext(uo),{showColumnDefine:c,uniqueKey:d,onlyShowIcon:u,columnsChange:m}=i,h=t().useRef([]),f=e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)),g=e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)),b=e=>e.filter((e=>!e.noAuth&&!e.fixed)),[y,v]=t().useState(!1),[x,E]=t().useState(f(n)),[S,C]=t().useState(g(n)),[w,T]=t().useState(b(n)),N=t().useMemo((()=>d?`table_${d}`:""),[d]),I=t().useMemo((()=>[...x,...w,...S]),[x,w,S]);_e((()=>{F(n),k(n),P(n)}),[n]),t().useLayoutEffect((()=>{A()}),[]),t().useImperativeHandle(r,(()=>({initialHandler:A})));const R=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=R(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),P=e=>{if(!N)return;const t=R(e),r=JSON.parse(localStorage.getItem(N));o.current.columnsDefined&&!(0,J.isEqual)(t,r)&&(localStorage.setItem(N,JSON.stringify(t)),(async(e,t)=>{const r=a?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(N,t))},A=()=>{const e=(()=>{if(!N)return;const e=JSON.parse(localStorage.getItem(N));return e||(async e=>{const t=a?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(N).then((e=>{e?(localStorage.setItem(N,JSON.stringify(e)),A()):a?.getComponentConfigApi&&P(n)})).catch((()=>{})),e?(0,J.xor)(En(e).map((e=>e.dataIndex)),En(n).map((e=>e.dataIndex))).length>0?Is(n,(t=>{const r=Cn(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):Is(e,(e=>{const t=Cn(n,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();e&&m?.(e)},k=e=>{const t=f(e),r=g(e),n=b(e);return E(t),C(r),T(n),[...t,...n,...r]},F=e=>{const t=[];e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const a=r.colSpan;a>1&&e.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+a))})),h.current=t},L=()=>{const e=[];I.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...h.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=I.find((e=>e.dataIndex===n));return r>0&&(void 0!==t.hidden&&(a.hidden=t.hidden),void 0!==t.fixed?a.fixed=t.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((t,r)=>{t.noAuth&&e.findIndex((e=>e.dataIndex===t.dataIndex))<0&&e.splice(r,0,t)})),m?.(e)},H=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const r=k(n);m?.(r)},$=(e,r)=>{const{colSpan:n,noFixed:a}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${r}-handle`],l=t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(O.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,L()}}),t().createElement("i",{className:Se()(i),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title),"main"===r?t().createElement("span",{className:Se()("fixed",a?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>H(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>H(e,"right")},t().createElement(we.StepForwardOutlined,null))):"sub"!==r?t().createElement("span",{className:Se()("fixed",a?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>H(e)},t().createElement(we.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?t().createElement(O.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:D(e.children,e.dataIndex)},l):l},D=(e,r)=>t().createElement("div",{className:"column-filter--wrap"},t().createElement(Xn.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const a=t.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,J.isEqual)(a,i)||((e,t)=>{Cn(n,t).children=e,m?.([...n])})(Yn(t),r)}},e.map((e=>$(e,"sub"))))),q=Ce("table"),_={[`${q}__popper`]:!0,"column-filter__popper":!0,[`${q}--lg`]:"large"===s,[`${q}--sm`]:"small"===s},j=[`${q}-column-filter`,{selected:y}];return c?t().createElement(Ra(),{action:["click"],popupVisible:y,popup:t().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"reset"},t().createElement(he,{type:"text",size:"small",onClick:()=>{m?.(ce(o.current.originColumns))}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement(Xn.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:x,setList:e=>{const t=e.map((e=>e.dataIndex)),r=x.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||E(Yn(e))},onEnd:()=>L()},x.map((e=>$(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement(Xn.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:w,setList:e=>{const t=e.map((e=>e.dataIndex)),r=w.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||T(Yn(e))},onEnd:()=>L()},w.map((e=>$(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement(Xn.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:S,setList:e=>{const t=e.map((e=>e.dataIndex)),r=S.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||C(Yn(e))},onEnd:()=>L()},S.map((e=>$(e,"right")))))),popupClassName:Se()(_),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{v(e)},builtinPlacements:vo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()(j),title:u?p("qm.table.columnFilter.text"):void 0},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),!u&&t().createElement("span",null,p("qm.table.columnFilter.text")))):null}));Rs.displayName="ColumnFilter";const Ps=Rs,Os=()=>t().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}));function As(){return As=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},As.apply(this,arguments)}const ks=e=>{const{column:r,filters:n}=e,{$size:a,setFilters:i,clearSuperFilters:l}=t().useContext(uo),o=t().useRef(null),s=t().useRef(null),c=t().useRef(null),[d,u]=t().useState(!1),[m,h]=t().useState(!1),[f,b]=t().useState({}),y=t().useMemo((()=>{const{dataIndex:e,filter:t}=r;return`${e}|${t.type}`}),[r]),v=t().useMemo((()=>{let e=!1;for(const t in n[y])if(!se(n[y][t])||m){e=!0;break}return e}),[y,n,m]);t().useEffect((()=>{d&&setTimeout((()=>x()),50)}),[d]),t().useEffect((()=>{(0,J.isEqual)(f[y],n[y])||b({[y]:n[y]||{}}),h(""===n[y]?.["=="])}),[n]);const x=()=>{switch(r.filter.type){case"text":o.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},E=e=>{e&&b(e),l(),i((e=>{for(const t in e){for(const r in e[t])if(se(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...n,...f,...e})),u(!1)},S={text:e=>{const{title:r}=e;return t().createElement(t().Fragment,null,t().createElement(O.Input,{ref:o,size:a,placeholder:p("qm.table.filter.searchText",{text:r}),style:{width:"180px"},value:f[y]?.like??"",disabled:m,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(O.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":r,like:null}}))),h(t)}},p("qm.table.filter.nullValue"))))},textarea:e=>{const{title:r}=e;return t().createElement(t().Fragment,null,t().createElement(O.Input.TextArea,{ref:c,size:a,placeholder:p("qm.table.filter.searchAreaText",{text:r}),style:{width:"220px"},value:f[y]?.likes??"",disabled:m,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{likes:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(O.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":r,like:null}}))),h(t)}},p("qm.table.filter.nullValue"))))},number:e=>{const r=e=>({value:f[y]?.[e]??"",size:a,onChange:t=>{t?.toString().replace(/^-|\./g,"").length>17||b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(O.InputNumber,As({ref:s},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(O.InputNumber,As({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(O.InputNumber,As({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(O.InputNumber,As({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const r=e=>({value:_n(f[y]?.[e],go),format:go,size:a,onChange:t=>{b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:jn(t,go)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(q,As({},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(q,As({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(q,As({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(q,As({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("ul",null,t().createElement(O.Radio.Group,{style:{width:"100%"},value:f[y]?.["=="],onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{"==":t}})))}},a.map((e=>t().createElement("li",{key:e.value},t().createElement(O.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("ul",null,t().createElement(O.Checkbox.Group,{style:{width:"100%"},value:f[y]?.in,onChange:e=>{b((t=>Object.assign({},t,{[y]:{in:e}})))}},a.map((e=>t().createElement("li",{key:e.value},t().createElement(O.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("div",{style:{height:200,...r.style}},t().createElement(co,{multiple:!0,value:f[y]?.in||[],dataSource:a,onCheckChange:e=>{const t=e.map((e=>e.value));b((e=>Object.assign({},e,{[y]:{in:t}})))}}))}},C=Ce("table"),w={"head-filter__popper":!0,[`${C}--lg`]:"large"===a,[`${C}--sm`]:"small"===a},T=["cell--filter",{selected:d,actived:v}];return t().createElement(Ra(),{action:["click"],popupVisible:d,popup:(()=>{const e=r.filter.type,n=S[e];return n?t().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t().createElement("div",null,n(r)),t().createElement(O.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t().createElement(he,{size:a,onClick:()=>{E({[y]:{}})}},p("qm.table.filter.reset")),t().createElement(he,{type:"primary",size:a,onClick:()=>E()},p("qm.table.filter.search")))):(g("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Se()(w),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:vo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("div",{className:Se()(T),title:p("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t().createElement("span",{className:"svgicon icon"},t().createElement(Os,null))))},Fs=e=>{const{column:r}=e,{tableProps:n,tableRef:a,bordered:i}=t().useContext(uo),{columns:l,resizable:o,columnsChange:s=ne}=n,c=t().useMemo((()=>Tn(r)),[r]),d={resizable:!0,"is--line":o&&!i};return t().createElement("div",{className:Se()(d),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:r}=a.current,n=r.$resizableBar,i=t.offsetWidth/2,o=e.clientX,d=On(t,r.$table).left-r.$tableBody.parentNode.parentNode.scrollLeft+i;r.$table.classList.add("c--resize"),n.style.left=`${d}px`,n.style.display="block";const u=c.width||c.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-o,r=u+t;r<(c.minWidth||To.defaultColumnWidth)||(p=Math.floor(r),n.style.left=`${t+d}px`)},document.onmouseup=function(){r.$table.classList.remove("c--resize"),n.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Cn(l,c.dataIndex).width=p,s([...l]))},!1}})},Ls=e=>{const{selectionKeys:r}=e,{tableRef:n,tableProps:a,getRowKey:i,pagination:l,fetchParams:o,setSelectionKeysEffect:s,setInvalidRowKeys:c,setSpinning:d,isFetch:u,isWebPagination:m}=t().useContext(uo),{rowSelection:h}=a,{fetchAllRowKeys:f,selectAllOnCurrentPage:g,filterable:b,onSelectAll:y}=h,v=t().useRef([]),x=t().useMemo((()=>u&&!!f),[u,f]),E=t().useMemo((()=>!x&&!!g),[x,g]),S=t().useMemo((()=>(b??!0)&&!E),[b,E]),C=()=>{const{tableFullData:e}=n.current,{current:t,pageSize:r}=l;return m?e.slice((t-1)*r,t*r):e},w=(()=>{const{allTableData:e,allRowKeys:t,selectionRows:r}=n.current,{disabled:a}=h;if(x)return v.current.length?v.current:(0,J.union)(t,r.map((e=>i(e,e.index))));if(!E)return a?t.filter(((t,r)=>!a(e[r]))):t;const l=a?C().filter((e=>!a(e))).map((e=>i(e,e.index))):C().map((e=>i(e,e.index)));return(0,J.union)(l,r.map((e=>i(e,e.index))))})(),T=r.filter((e=>!w.includes(e))),N=r.length-T.length,I=N>0&&N<w.length,R=!!N&&N===w.length;c(T);const P=async()=>{const e=f;let t=[];d(!0);try{const r=await e.api(o);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[];const{disabled:n}=h;n&&(t=(0,J.xor)(t,C().filter((e=>n(e))).map((e=>i(e,e.index))))),v.current=t}}catch(e){}return d(!1),t},A=async e=>{let t=[];t=x?e?await P():[]:e?w.slice(0):[],t=[...new Set([...t,...T])],s(t),y?.(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(O.Checkbox,{checked:R,indeterminate:I,disabled:!w.length,onChange:e=>A(e.target.checked)}),S&&t().createElement(O.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{A(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=x?(0,J.xor)(r,await P()):(0,J.xor)(r,w),e=[...new Set([...e,...T])],s(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{A(!1)}}];return t().createElement(O.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),E&&t().createElement(O.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},Hs=e=>{const{style:r}=e,{tableProps:n,tableRef:a,isTreeTable:i,setRowExpandedKeys:l}=t().useContext(uo),{expandable:o}=n,[s,c]=t().useState(o?.defaultExpandAllRows||!1);_e((()=>{const{allRowKeys:e,flattenRowKeys:t}=a.current;l(s?e.filter((e=>!(i&&t.includes(e)))):[])}),[s]);const d={[`${Ce("expand")}--icon`]:!0,expanded:s,collapsed:!s};return t().createElement("span",{className:Se()(d),title:"",onClick:e=>{e.stopPropagation(),c(!s)},style:r})},$s=()=>t().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"})),Ds=()=>t().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})),qs=e=>{const{tableColumns:r,flattenColumns:n,sorter:a,filters:i}=e,{getRowKey:l,tableProps:o,tableRef:s,layout:c,scrollY:d,superFilters:u,selectionKeys:m,rightFixedColumns:h,treeExpandIndex:f,isFetch:g,isTreeTable:b,isGroupSubtotal:y,tableChange:v,setSorter:x,setElementStore:E,resetTableScroll:S,getStickyLeft:C,getStickyRight:w,createGroupData:T,createTableFullData:N}=t().useContext(uo),{ellipsis:I,resizable:R,multipleSort:P,rowSelection:A,expandable:k}=o,[F,L]=To.sortDirections,H=t().useRef(null),$=t().useMemo((()=>!g),[g]),D=t().useMemo((()=>!g),[g]),q=t().useMemo((()=>!k?.hideExpandAll),[k]),_=t().useMemo((()=>!(!A||(g?!A.selectAllOnCurrentPage&&!A.fetchAllRowKeys:A.hideSelectAll))),[g,A]);_e((()=>{U(),v(),S()}),[a]),_e((()=>{G(),v(),S()}),[i]),_e((()=>{G(),v(),S()}),[u]),t().useEffect((()=>{j(),!se(a)&&le((()=>U())),!se(i)&&le((()=>G()))}),[]);const j=()=>{E("$header",H.current)},K=e=>{const{dataIndex:r,type:n,sorter:i,title:l,description:o}=e;if(r===To.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},_?t().createElement(Ls,{selectionKeys:m}):p("qm.table.config.selectionText"));if("radio"===n)return t().createElement("div",{className:"cell"},l)}const s=[];return s.push(t().createElement("div",{key:0,className:"cell",title:l},b&&r===f&&q?t().createElement(Hs,null):null,r===To.expandableColumn&&q?t().createElement(Hs,null):l)),o&&s.push(t().createElement(O.Tooltip,{key:1,placement:"top",title:o},t().createElement(we.InfoCircleOutlined,{className:"tip"}))),i&&s.push(M(a[r])),s},M=e=>{const r=["svgicon cell--sorter__asc",{actived:e===F}],n=["svgicon cell--sorter__desc",{actived:e===L}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Se()(r)},t().createElement($s,null)),t().createElement("span",{className:Se()(n)},t().createElement(Ds,null)))},V=e=>t().createElement(ks,{column:e,filters:i}),z=(e,t)=>{const{sorter:r,dataIndex:n}=t;if(r){const e=a[n],t=e?e===L?null:L:F;P?(delete a[n],x(Object.assign({},a,{[n]:t}))):x(Object.assign({},{[n]:t}))}},U=()=>{$&&B()},B=e=>{const t=(0,J.pickBy)(a,(e=>null!==e));for(const e in t){const r=n.find((t=>t.dataIndex===e));r?W(r,t[e]):delete t[e]}e||Object.keys(t).length||W({dataIndex:"index"},F)},W=(e,t)=>{const{tableFullData:r}=s.current,{dataIndex:n,sorter:a}=e,i=(e,r)=>{const a=Ln(e,n),i=Ln(r,n);return Number.isNaN(a-i)?t===F?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===F?a-i:i-a},l=y?T(Vn(r).sort("function"==typeof a?a:i)):r.sort("function"==typeof a?a:i).slice(0);N(l)},G=()=>{D&&Y()},Y=()=>{const{tableOriginData:e}=s.current,t=u.length?zn(u):zn(i),r=""!==t?y?T(yn(Vn(e),t,b)):yn(e,t,b):e;N(r),B(!0)},X=Pn(r),Q=Ce("table"),{tableBodyWidth:Z}=c;return t().createElement("div",{ref:H,className:`${Q}--header-wrapper`},t().createElement("table",{className:`${Q}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},(()=>{const{gutterWidth:e}=c;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),d&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("thead",null,(e=>{const{isIE:r}=s.current,n=["gutter",{"cell-fix-right":!!h.length}],i=r?null:{right:h.length?0:""};return e.map(((e,r)=>t().createElement("tr",{key:r,className:"header--row"},e.map(((r,n)=>((e,r,n)=>{const{isIE:i}=s.current,{gutterWidth:l}=c,{dataIndex:o,colSpan:u,rowSpan:p,fixed:m,align:h,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===u)return null;const E=f||h,S=["header--column",{"col--ellipsis":e.ellipsis??I,"col--center":"center"===E,"col--right":"right"===E,"column--required":!!v,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!a[o],"cell-fix-left":!i&&"left"===m,"cell-fix-right":!i&&"right"===m,"cell-fix-left-last":!i&&"left"===m&&!n[r+1]?.fixed,"cell-fix-right-first":!i&&"right"===m&&!n[r-1]?.fixed,[g]:!!g}],T=i?null:{left:"left"===m?`${C(o)}px`:"",right:"right"===m?`${w(o)+(d?l:0)}px`:""},N=R&&![To.expandableColumn,To.selectionColumn].includes(o);return t().createElement("th",{key:o,className:Se()(S),colSpan:u,rowSpan:p,style:{...T},onClick:t=>z(t,e)},t().createElement("div",{className:"cell--wrapper"},x?t().createElement("div",{className:"cell--text cell"},x(e,s.current.tableFullData)):t().createElement(t().Fragment,null,t().createElement("div",{className:"cell--text"},K(e)),y?V(e):null)),N&&t().createElement(Fs,{column:e}))})(r,n,e))),d&&t().createElement("th",{className:Se()(n),style:{...i}}))))})(X))))};const _s=e=>{const{selectionKeys:r,column:n,record:a,rowKey:i}=e,{tableProps:l,tableRef:o,isTreeTable:s,getAllChildRowKeys:c}=t().useContext(uo),{rowSelection:d}=l,u=t().useMemo((()=>n.type||""),[n.type]),p=e=>{const t=d.checkStrictly??!0;if(!s||t)return!1;const n=In(o.current.deriveRowKeys,e),a=c(n?.children??[]);return!(!Array.isArray(n?.children)||Fn(r,n?.children.map((e=>e.rowKey))||[]))&&a.some((e=>r.includes(e)))};return"radio"===u?(()=>{const e=d.disabled,n=e?.(a),l=!n&&r[0]===i;return t().createElement(O.Radio,{checked:l,disabled:n})})():(()=>{const e=d.disabled,n=e?.(a),l=!!r.includes(i);return t().createElement(O.Checkbox,{checked:l,indeterminate:p(i),disabled:n})})()},js=e=>{const{record:r,rowKey:n,style:a}=e,{tableProps:i,rowExpandedKeys:l,setRowExpandedKeys:o}=t().useContext(uo),{expandable:s={}}=i,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(r)),d=t().useMemo((()=>l.includes(n)),[l,n]);_e((()=>{s.onExpand?.(d,r)}),[d]);const u={[`${Ce("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t().createElement("span",{className:Se()(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?l.filter((e=>e!==n)):[...l,n];o(t)},style:a})},Ks=t().forwardRef(((e,r)=>{const{size:n,defaultValue:a,value:i,min:l,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:m,allowClear:h,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<l&&(t=l.toString()),p>=0&&""!==t&&(t=new(sa())(t).toFixed(p)),t},E=void 0!==i,[S,C]=t().useState(a??""),w=b(E?i:S),T=y(w);return _e((()=>{e.onChange?.(T)}),[S]),t().createElement(O.Input,{ref:r,size:n,value:w,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value);let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),l>=0&&r.startsWith("-")&&(n=!1),n){if(!m&&r.replace(/^-|\./g,"").length>17)return;(t=>{E?e.onChange?.(t):C(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(T);e.onBlur?.(t,T)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(T),T)}})}));Ks.displayName="InputNumber";const Ms=Ks;function Vs(){return Vs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Vs.apply(this,arguments)}const{Search:zs}=O.Input,Us=t().forwardRef(((e,r)=>{const{column:n,record:a,rowKey:i,columnKey:l,clicked:o,text:s,cellBgColor:c}=e,{tableRef:d,tableBodyRef:u,$size:m,flattenColumns:h,updateTableData:f,doFieldValidate:b,dataChange:y}=t().useContext(uo),v=Fo(),{store:x,fieldAuth:E}=d.current,S=n.editRender?.(a,n)||{},C=t().useRef(null),w=t().useRef(null),T=t().useRef(null),N=t().useRef(null),I=t().useRef(null),R=t().useRef(null),P=t().useRef(!1),A=t().useRef({}),k=t().useRef({}),F=t().useRef([]),[L,H]=t().useState(!1),[$,D]=t().useState(!1),[_,j]=t().useState(!1),[K,V]=t().useState(S.items||[]),[z,U]=t().useState(),B=(S.editable||(0,J.isEqual)(o,[i,l]))&&!S.disabled&&!E[l]?.disabled,W=`${i}|${l}`,G=2===o.length?`${o[0]}|${o[1]}`:"",Y=![...x.state.required,...x.state.validate].some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),X=x.state.required.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",Q=x.state.validate.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",Z=x.state.edited.some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),ee=B||!Y||L||_||$,te=!!S.helper?.combinedDataIndex&&("search-helper"===S.type||"tree-helper"===S.type),re=S.type?.endsWith("multiple");t().useEffect((()=>{ee&&G===W&&se()}),[o]),t().useLayoutEffect((()=>{const{items:e}=S;re&&e&&oe(e.map((e=>({[k.current.valueKey]:e.value,[k.current.textKey]:e.text}))))}),[]),t().useLayoutEffect((()=>{const{extra:e={}}=S,t=w.current||C.current;!(0,J.isUndefined)(e.disabledBackgroundColor)&&t&&(t.parentNode.parentNode.style.backgroundColor=e.disabledBackgroundColor||c)}),[S.extra?.disabledBackgroundColor]);const ne=()=>{f(),y()},ie=(e,t)=>{H(e),t?.()},oe=e=>{F.current=e},se=()=>{const{type:e}=S;switch(e){case"text":T.current?.focus();break;case"number":N.current?.select();break;case"search-helper":I.current?.focus();break;case"tree-helper":R.current?.focus()}};t().useImperativeHandle(r,(()=>({focus:se})));const ce=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0}))},de=(e,t,r)=>{const{cornerSign:n=!0}=S.extra||{};x.addToUpdated(e),n&&x.addToEdited({x:t,y:r})},ue=e=>""!==e?Number(e):"",pe={text:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:c=[],onInput:d,onChange:u,onEnter:h,onBlur:f}=S,g=Ln(e,a),y=Object.assign({},{minRows:1,maxRows:4},s.autoSize),x=n?{rows:y.minRows,autoSize:y}:null,E=s.password?O.Input.Password:n?O.Input.TextArea:O.Input;return t().createElement(E,Vs({ref:T,size:m,value:g,maxLength:s.maxLength,showCount:s.showCount},x,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||p("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";Hn(e,a,r),b(c,r,i,l),v(),d?.({[W]:r}),P.current=!0},onFocus:()=>D(!0),onBlur:t=>{D(!1);const r=t.target.value??"";P.current&&(P.current=!1,de(e,i,l),u?.({[W]:r},e),f?.({[W]:r},e),ne())},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";h?.({[W]:r},e)}},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||e.preventDefault()}}))},textarea:(e,t)=>pe.text(e,t,!0),number:(e,r)=>{const{dataIndex:n,precision:a,formatType:o}=r,{type:s,extra:c={},rules:d=[],onInput:u,onChange:h,onEnter:f,onBlur:g}=S,y=Ln(e,n);let x,E;return"finance"===o&&(x=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},E=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(x=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(sa())(e).times(100).toNumber()}`,E=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(sa())(e).times(.01).toString()),t().createElement(Ms,{ref:N,size:m,value:y,min:c.min,max:c.max,precision:a,stringMode:c.stringMode,prefix:c.prefix,suffix:c.suffix??("percent"===o?"%":void 0),placeholder:c.placeholder||p("qm.table.editable.inputPlaceholder"),maxLength:c.maxLength,allowClear:c.allowClear,readOnly:c.readOnly,disabled:c.disabled,formatter:x,parser:E,onChange:t=>{Hn(e,n,t),b(d,t,i,l),v(),u?.({[W]:t}),P.current=!0},onFocus:()=>D(!0),onBlur:(t,r)=>{if(D(!1),!P.current)return;P.current=!1;let a=c.stringMode?t:ue(t);"percent"===o&&"."===r.charAt(r.length-1)&&(a=Number(t)/100),Hn(e,n,a),de(e,i,l),h?.({[W]:a},e),g?.({[W]:a},e),ne()},onEnter:(t,r)=>{let n=c.stringMode?t:ue(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),f?.({[W]:n},e)}})},select:(e,r,n)=>{const{dataIndex:a,dictItems:o=[]}=r,{type:s,extra:c={},rules:u=[],items:h,onChange:f,onEnter:g}=S,{elementStore:y}=d.current,v=h||o,x=Ln(e,a);let E=x;return t().createElement(O.Select,{mode:n?"multiple":void 0,size:m,popupClassName:"table-editable__popper",value:x||void 0,placeholder:c.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:c.allowClear,listHeight:c.listHeight,maxTagCount:c.collapseTags?"responsive":void 0,maxTagTextLength:c.maxTagTextLength,disabled:c.disabled,style:{width:"100%"},showSearch:c.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${Wr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{Hn(e,a,t),b(u,t,i,l),de(e,i,l),f?.({[W]:t},e),ne()},onSelect:e=>{E=e},onInputKeyDown:t=>{13===t.keyCode&&le((()=>g?.({[W]:E},e)))}},v.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>pe.select(e,t,!0),date:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:c=[],onChange:d}=S,u=n||"exactdate",p=Ln(e,a);return t().createElement(q,{size:m,popupClassName:"table-editable__popper",value:_n(p,xr[u])??void 0,picker:vr[u],format:s.format,showTime:"datetime"===u,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=jn(t,xr[u]);Hn(e,a,r),b(c,r,i,l),de(e,i,l),d?.({[W]:r},e),ne()}})},datetime:(e,t)=>pe.date(e,t,"datetime"),month:(e,t)=>pe.date(e,t,"month"),year:(e,t)=>pe.date(e,t,"year"),time:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},rules:s=[],onChange:c}=S,d="HH:mm:ss",u=Ln(e,n);return t().createElement(M,{size:m,popupClassName:"table-editable__popper",value:_n(u,d)??void 0,format:o.format||d,placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=jn(t,d);Hn(e,n,r),b(s,r,i,l),de(e,i,l),c?.({[W]:r},e),ne()}})},checkbox:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=S,{trueValue:c=ho,falseValue:d=fo,disabled:u}=o,p=Ln(e,n);return t().createElement(O.Checkbox,{checked:p===c,disabled:u,onChange:t=>{const r=t.target.checked?c:d;Hn(e,n,r),de(e,i,l),s?.({[W]:r},e),ne()}})},switch:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=S,{trueValue:c=ho,falseValue:d=fo,disabled:u}=o,p=Ln(e,n);return t().createElement(O.Switch,{checked:p===c,disabled:u,onChange:t=>{const r=t?c:d;Hn(e,n,r),de(e,i,l),s?.({[W]:r},e),ne()}})},"search-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:c=[],helper:d={},onInput:u,onChange:f,onEnter:y}=S,v=$n(e,te?d.combinedDataIndex:n),x=d.fieldAliasMap;x||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),te&&(d.combinedDataIndex.split("|").every((e=>Object.keys(E).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),E[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=e=>{const{filterAliasMap:t}=d,r=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[n]:r};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,J.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i},T=e=>{const{autoQueryAssign:t=!0}=d;t&&(A.current=w(e)),H(!0)},N=(t,n)=>{const{beforeOpen:a}=d,i=(a??ae)({[W]:v},e,r);i?.then?i.then((()=>{T(t),n?.()})).catch((()=>{})):!1!==i&&(T(t),n?.())},R=e=>{const t={};for(const r in E){const a=E[r];r!==n&&(t[r]=$n(e,a))}const r=E[n]?$n(e,E[n]):"";k(r,t);const{closed:a}=d;ie(!1,(()=>ce(C.current))),se(),a?.(e)},O=()=>{const{onlySelect:e=!0}=d;P.current&&k(e?"":v),ie(!1,(()=>ce(C.current)))},k=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(r)&&Object.keys(r).length)for(const t in r){const n=r[t],a=h.find((e=>e.dataIndex===t));if(a){Hn(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&b(r.rules,n,i,t)}else Hn(e,t,n)}te&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return Hn(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&Hn(e,t,a[r]?.trim())}))})(e,d.combinedDataIndex),Hn(e,n,t,a),b(c,t,i,l),de(e,i,l),f?.({[W]:t},e),ne(),A.current={},P.current=!1,U(void 0)},F={visible:L,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ga[m]+20}px`},onClose:()=>{O()}},$={...d,size:m,initialValue:Object.assign({},A.current,d.initialValue),onClose:e=>{e?R(e):O()}};return t().createElement(t().Fragment,null,t().createElement(zs,{ref:I,value:z??v,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:r=!0,table:a}=d;if(P.current&&!L)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=d,{beforeFetch:n=ae}=t.fetch;return new Promise((async(a,i)=>{const l=(0,J.merge)({},t.fetch.params,{...r,...w(e)},{currentPage:1,pageSize:500});if(!n(l))return i();j(!0);try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{le((()=>j(!1)))}}))})(t).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>$n(t,E[n]).toString().includes(e)));if(1===t.length)return R(t[0]);N(e)}(e,t))).catch((()=>k(""))):void k(t)},onChange:e=>{const{value:t}=e.target;u?.({[W]:t}),P.current=!0,U(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";y?.({[W]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;N(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&N(e)}}),t().createElement(cr,F,t().createElement(uc,$)))},"search-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,items:o=[],extra:s={},rules:c=[],helper:d={},onInput:u,onChange:h,onEnter:f}=S,y=Ln(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof v?v():v||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),k.current=x;const E=t=>{const{beforeOpen:n}=d,a=(n??ae)({[W]:y},e,r);a?.then?a.then((()=>{H(!0),t?.()})).catch((()=>{})):!1!==a&&(H(!0),t?.())},w=()=>{ie(!1,(()=>ce(C.current)))},T=t=>{Hn(e,n,t),b(c,t,i,l),de(e,i,l),h?.({[W]:t},e,F.current),ne()},N={visible:L,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ga[m]+20}px`},onClose:()=>{w()}},I={...d,size:m,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=x;oe((0,J.uniqBy)([...F.current.filter((e=>t.includes(e[n]))),...e],n));const a=F.current.map((e=>({text:e[r],value:e[n]}))),i=(0,J.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));V(i),T(i.map((e=>e.value)));const{closed:l}=d;ie(!1,(()=>ce(C.current))),l?.(F.current)})(e,t):w()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(O.Select,{mode:"multiple",open:!1,value:y,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&f?.({[W]:y},e)},onDoubleClick:()=>{s.disabled||E()},onChange:e=>{const{valueKey:t}=x;oe(F.current.filter((r=>e.includes(r[t])))),T(e)}},K.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(O.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{E()}})))),t().createElement(cr,N,t().createElement(uc,I)))},"tree-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:c=[],helper:d={},onChange:u,onEnter:f}=S,y=$n(e,te?d.combinedDataIndex:n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof v?v():v||{};Object.keys(x).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),te&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=t=>{const{beforeOpen:n}=d,a=(n??ae)({[W]:y},e,r);a?.then?a.then((()=>{H(!0),t?.()})).catch((()=>{})):!1!==a&&(H(!0),t?.())},w=()=>{ie(!1,(()=>ce(C.current)))},T=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(r)&&Object.keys(r).length)for(const t in r){const n=r[t],a=h.find((e=>e.dataIndex===t));if(a){Hn(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&b(r.rules,n,i,t)}else Hn(e,t,n)}Hn(e,n,t,a),b(c,t,i,l),de(e,i,l),u?.({[W]:t},e),ne()},N={visible:L,title:p("qm.searchHelper.text"),width:d.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ga[m]+20}px`},onClose:()=>{w()}},I={...d,defaultSelectedKeys:[y],size:m,onClose:e=>{e?(e=>{const t={};for(const r in x){const a=x[r];r!==n&&(t[r]=$n(e,a))}const r=x[n]?$n(e,x[n]):"";T(r,t);const{closed:a}=d;ie(!1,(()=>ce(C.current))),se(),a?.(e)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement(zs,{ref:R,value:y,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";f?.({[W]:r},e)}},onDoubleClick:()=>{E()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?E():T(""))}}),t().createElement(cr,N,t().createElement(vc,I)))},"tree-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},items:s=[],rules:c=[],helper:d={},onInput:u,onChange:h,onEnter:f}=S,y=Ln(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof v?v():v||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),k.current=x;const E=t=>{const{beforeOpen:n}=d,a=(n??ae)({[W]:y},e,r);a?.then?a.then((()=>{H(!0),t?.()})).catch((()=>{})):!1!==a&&(H(!0),t?.())},w=()=>{ie(!1,(()=>ce(C.current)))},T=t=>{Hn(e,n,t),b(c,t,i,l),de(e,i,l),h?.({[W]:t},e,F.current),ne()},N={visible:L,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ga[m]+20}px`},onClose:()=>{w()}},I={...d,size:m,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=x;oe(e);const n=F.current.map((e=>({text:e[t],value:e[r]})));V(n),T(n.map((e=>e.value)));const{closed:a}=d;ie(!1,(()=>ce(C.current))),a?.(F.current)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(O.Select,{mode:"multiple",open:!1,value:y,placeholder:o.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&f?.({[W]:y},e)},onDoubleClick:()=>{o.disabled||E()},onChange:e=>{const{valueKey:t}=x;oe(F.current.filter((r=>e.includes(r[t])))),T(e)}},K.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(O.Button,{className:"ant-input-search-button",disabled:o.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{E()}})))),t().createElement(cr,N,t().createElement(vc,I)))}};return t().createElement(t().Fragment,null,ee?(()=>{const{type:e}=S,r=pe[e];if(!r)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!Y}];return t().createElement("div",{ref:C,className:Se()(i)},r(a,n),!Y&&t().createElement("div",{className:"cell-error"},X||Q))})():(()=>{const{extra:e={}}=S,r=te?$n(a,S.helper.combinedDataIndex):s;return t().createElement("span",{ref:w,style:{color:e.disabledColor}},r)})(),Z&&t().createElement("i",{className:"cell--sign"}))}));Us.displayName="CellEdit";const Bs=Us,Ws=require("copy-to-clipboard");var Gs=n.n(Ws);const Ys=function(e){if(!t().isValidElement(e))return null;for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return t().cloneElement(e,...n)},Xs=e=>{const{text:r,options:n,showMessage:a=!0,onCopy:i}=e;return Ys(e.children,{onClick:l=>{const o=t().Children.only(e.children),s=Gs()(r,n);i?.(r,s),s&&a&&O.message.success(p("qm.clipboard.success")),o&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(l)}})};Xs.displayName="QmCopyToClipboard";const Qs=Xs;function Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zs.apply(this,arguments)}const Js=t().forwardRef(((r,n)=>{const{tableData:a,flattenColumns:i}=r,{getRowKey:l,tableProps:o,tableRef:c,editableColumns:d,leftFixedColumns:u,rightFixedColumns:m,treeExpandIndex:h,sorter:f,layout:b,showFooter:y,scrollX:v,scrollY:x,selectionKeys:E,rowExpandedKeys:S,highlightKey:C,isPingLeft:w,isPingRight:T,isTableEmpty:N,isTreeTable:I,isGroupSubtotal:R,isWebPagination:P,isDragMergeCell:O,setElementStore:A,createTableFullData:k,setSelectionKeysEffect:F,setHighlightKey:L,getStickyLeft:H,getStickyRight:$,scrollXToColumn:D,scrollYToRecord:q,rowInViewport:_,dataChange:j,setPingLeft:K,setPingRight:M,setFullScreen:V,findParentRowKeys:z,getAllChildRowKeys:U,triggerScrollYEvent:B,scrollBottomDebouncer:W}=t().useContext(uo),{height:G,minHeight:Y,maxHeight:X,rowSelection:Q,rowHighlight:Z,treeConfig:ee,expandable:re,stripe:ie,summation:le,rowStyle:se,cellStyle:ce,spanMethod:de,nativeScrollBar:ue,ellipsis:pe,showHeader:me,rowDraggable:fe,onRowClick:ge,onRowDblclick:be,onRowContextmenu:ye,onRowEnter:ve}=o,xe=t().useRef(null),Ee=t().useRef({}),Te=t().useRef(null),Ne=t().useRef({prevST:0,prevSL:0}),{dragStart:Ie,renderDragPanel:Re,closeDragPanel:Pe}=(()=>{const{tableProps:e,tableRef:r,layout:n,flattenColumns:a,isDragMergeCell:i}=t().useContext(uo),{mergeCells:l=[],onMergeChange:o}=e,[s,c]=t().useState(!1),d=t().useRef(null),u=t().useRef(null),m=t().useRef({x:0,y:0,disX:0,disY:0}),h=Ce("table");_e((()=>{i||E()}),[i]);const f=()=>{E(),Be(d.current,{display:"none"})},g=e=>{const t=[];for(let r=0;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push([e.row+r,e.col+n]);return t},b=()=>{m.current={x:0,y:0,disX:0,disY:0},u.current&&!S(u.current)||(u.current=null,f()),c(!0),document.removeEventListener("mousemove",y)},y=e=>{const{pageX:t,pageY:r}=e,{x:a,y:i,disX:l,disY:o}=m.current;let s=l,c=o,u=t-a,p=r-i;return u<0&&(u=Math.abs(u),s=l-u,Be(d.current,{left:`${s}px`})),p<0&&(p=Math.abs(p),c=o-p,Be(d.current,{top:`${c+n.headerHeight}px`})),Be(d.current,{width:`${u}px`,height:`${p}px`}),v(s,c,u,p),!1},v=Ct(((e,t,n,i)=>{const{allTableData:l,scrollYStore:o}=r.current;let s=-1,c=-1,d=-1,p=-1;for(let e=0;e<l.length;e++)t>o.rowHeight*e&&t<o.rowHeight*(e+1)&&(s=e),t+i>o.rowHeight*e&&t+i<o.rowHeight*(e+1)&&(c=e);let m=0;for(let t=0;t<a.length;t++)e>m&&e<m+C(a[t])&&(d=t),e+n>m&&e+n<m+C(a[t])&&(p=t),m+=C(a[t]);const h={row:s,col:d,rowSpan:c-s+1,colSpan:p-d+1};(0,J.isEqual)(u,h)||(u.current=h,x(s,c,d,p))}),5),x=(e,t,n,a)=>{const{elementStore:i,scrollYStore:l}=r.current,o=i.$tableBody.querySelectorAll("tbody > tr");for(let r=0;r<o.length;r++){const i=o[r].children;for(let o=0;o<i.length;o++)if(i[o].classList.remove("selected"),(e!==t||n!==a)&&r+l.startIndex>=e&&r+l.startIndex<=t){const e=Number(i[o].getAttribute("colspan")),t=Number(i[o].getAttribute("data-index")),r=e>1?t+e-1:t;r>=n&&r<=a&&i[o].classList.add("selected")}}},E=()=>{const{elementStore:e}=r.current,t=e.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<t.length;e++){const r=t[e].children;for(let e=0;e<r.length;e++)r[e].classList.remove("selected")}},S=e=>1===e.rowSpan&&1===e.colSpan,C=e=>e.width||e.renderWidth||e.minWidth||To.defaultColumnWidth;return{dragStart:e=>{const{pageX:t,pageY:a}=e,{elementStore:i}=r.current,{x:l,y:o}=(e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}})(i.$table),{scrollLeft:s,scrollTop:p}=i.$tableBody.parentNode.parentNode;u.current=null,m.current={x:t,y:a,disX:t+s-l,disY:a+p-(o+n.headerHeight)},Be(d.current,{width:0,height:0,left:t-l+"px",top:a-o+"px",display:"block"}),E(),c(!1),document.addEventListener("mousemove",y,{passive:!0}),document.addEventListener("mouseup",b,{passive:!0,once:!0})},renderDragPanel:()=>t().createElement("div",{ref:d,className:`${h}--merge-cell`,onMouseDown:e=>e.stopPropagation()},s&&t().createElement(t().Fragment,null,t().createElement(he,{size:"small",className:"btn cancel",onClick:()=>{if(u.current&&!S(u.current)){const e=g(u.current),t=l.findIndex((t=>{const r=g(t);return(0,J.intersectionWith)(r,e,J.isEqual).length===r.length}));-1!==t&&o?.(l.filter(((e,r)=>r!==t)))}f()}},p("qm.table.mergeCell.cancel")),t().createElement(he,{size:"small",type:"primary",className:"btn confirm",onClick:()=>{if(u.current&&!S(u.current)){const e=g(u.current);let t=!1;for(let r=0;r<l.length;r++)(0,J.intersectionWith)(g(l[r]),e,J.isEqual).length&&(t=!0);t||o?.([...l,u.current])}f()}},p("qm.table.mergeCell.confirm")))),closeDragPanel:f}})(),Oe={dateFormat:e=>{const t=e?s()(e).format(go):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(bo):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(bo.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(Number(e))?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>Dn(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},Ae=t().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:a}=b,i={};return N&&Object.assign(i,{minHeight:"100px"}),Y&&Object.assign(i,{minHeight:An(Y)-e-r+"px"}),X&&Object.assign(i,{maxHeight:An(X)-e-r+"px"}),G||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[G,X,Y,N,b]),ke=t().useMemo((()=>{const{tableBodyWidth:e,gutterWidth:t}=b;return e&&x?e-t:e}),[b,x]),Fe=t().useMemo((()=>{const{scrollYStore:e}=c.current,{viewportHeight:t,gutterWidth:r}=b;return Math.floor((v?t-r:t)/e.rowHeight)}),[b,v]),[Le,He]=t().useState([]),$e=Fo(),De=function(t,r){const[n,a]=e.useState(!1);return e.useEffect((()=>{let e;const n=t.current,i=t=>{e=t},l=t=>{((e,t)=>{const i=e.target,l=t?.target,o=!i||!l,s=n?.contains(i)||n?.contains(l),c=n===i,d=r?.map((e=>document.querySelector(e))),u=d?.some((e=>e?.contains(i)))||d?.includes(l);a(!(o||s||c||u))})(t,e)};return n&&(Me(document,"mousedown",i),Me(document,"mouseup",l)),()=>{n&&(Ve(document,"mousedown",i),Ve(document,"mouseup",l))}}),[t]),n}(xe,[".table-editable__popper"]);t().useImperativeHandle(n,(()=>({renderCellTitle:tt,setClickedValues:ze,createFocus:Ke,forceUpdate:$e}))),_e((()=>{De&&(ze([]),O&&Pe())}),[De]),_e((()=>{Le.length&&So.focus(c.current.uid)}),[Le]),t().useEffect((()=>{je()}),[]);const qe=t().useCallback((e=>{const{keyCode:t}=e;if(c.current.uid===So.getFocusInstance()?.id&&(27===t&&(ze([]),L(""),V(!1)),Le.length&&(Xe(document.activeElement,xe.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===Q?.type||Z)){const t=E[0]??C??null,r=a.find((e=>l(e,e.index)===t))??null;r&&ve?.(r,e)}if(38===t||40===t){Ue(e);const{allTableData:r}=c.current,n=P?Rn(a):r,i=n.length;let o=n.findIndex((e=>l(e,e.index)===Le[0]));const s=38===t?(--o+i)%i:++o%i,d=n[s],u=l(d,d.index);"radio"!==Q?.type||Q.disabled?.(d)||F([u]),Z&&!Z.disabled?.(d)&&L(u),_(s)||(38===t&&q(u,s),40===t&&q(u,Fe>s+1?0:s+1-Fe)),ze([u,Le[1]])}if(9===t){if(Ue(e),!d.length)return ze([]);const t=d.length;let r=d.findIndex((e=>e.dataIndex===Le[1]));const n=++r%t,a=d[n].dataIndex;ze([Le[0],a]),D(a)}}}),[Le,a,E,d,Fe]);t().useEffect((()=>{const e=qt()(document,"keydown",qe);return()=>e.remove()}),[qe]);const je=()=>{A("$tableBody",xe.current),A("$tableYspace",Te.current)},Ke=(e,t)=>{Ee.current[`${e}-${t}`]?.focus()},ze=e=>{(0,J.isEqual)(e,Le)||He(e)},We=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),Ge=(e,t,r)=>{const{deriveRowKeys:n}=c.current,a=In(n,e);let i=[];const l=U(a?.children||[]),o=Bn(n,e)?.slice(0,-1).reverse()||[];return i=r?[...new Set([...t,e,...l])]:t.filter((t=>![e,...l].includes(t))),o.forEach((e=>{const t=In(n,e),r=Fn(i,t?.children?.map((e=>e.rowKey))||[]);i=r?[...i,e]:i.filter((t=>t!==e))})),i},Ye=e=>Array.isArray(e.children),Qe=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];return e.forEach((e=>{const a=e.index,o=l(e,e.index);if(n.push(Ze(e,a,o,r)),re?.expandedRowRender){const{expandedRowClassName:r,rowExpandable:l=ae}=re;S.includes(o)&&l(e)&&n.push(t().createElement("tr",{key:`expand_${o}`,className:"body--row-expanded"},t().createElement("td",{colSpan:i.length,className:"body--column",style:{paddingLeft:Q?2*To.selectionColumnWidth:To.selectionColumnWidth}},t().createElement("div",{className:Se()("cell",r)},re.expandedRowRender(e,a)))))}if(!ee?.virtual&&Ye(e)){const t="function"!=typeof re?.rowExpandable||re.rowExpandable(e);S.includes(o)&&t&&n.push(...Qe(e.children,r+1))}})),n},Ze=function(e,r,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const l=["body--row",{"body--row-striped":ie&&r%2!=0,"body--row-selected":E.includes(n),"body--row-current":C===n,...R?lt(e._group):null}];return t().createElement("tr",{key:n,className:Se()(l)},i.map(((t,i)=>Je(t,i,e,r,n,a))))},Je=(e,r,n,a,i,o)=>{const{isIE:s}=c.current,{dataIndex:d,fixed:p,align:h,className:g=""}=e,{rowSpan:b,colSpan:y}=nt(n,e,a,r);if(!b||!y)return null;const v=e.ellipsis??pe,x=!s&&"left"===p,S=!s&&"right"===p,C=["body--column",{"col--ellipsis":v,"col--center":"center"===h,"col--right":"right"===h,"column--sort":!!f[d],"cell-fix-left":x,"cell-fix-right":S,"cell-fix-left-last":x&&u[u.length-1].dataIndex===d,"cell-fix-right-first":S&&m[0].dataIndex===d,[g]:!!g}],w=s?null:{left:x?`${H(d)}px`:"",right:S?`${$(d)}px`:""},T=se?"function"==typeof se?se(n,a):se:null,N=ce?"function"==typeof ce?ce(n,e,a,r):ce:null,P=R?it(n._group):null,O=Object.assign({},w,P,T,N),A=tt(e,n,a,r);let k="";for(const e in O)e.startsWith("background")&&(k=O[e]??"");return t().createElement("td",{key:d,title:v?A:void 0,rowSpan:b>1?b:void 0,colSpan:y>1?y:void 0,"data-index":r,className:Se()(C),style:O,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([To.expandableColumn,To.operationColumn].includes(n))return;const a=l(t,t.index);ze([a,n]);const i=r.editRender?.(t,r),o=i&&!i.disabled,{type:s,selectByClickRow:c=!0,disabled:d=ne}=Q||{};!s||d(t)||o||(c||n===To.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=Q||{};if("radio"===r&&F([e]),"checkbox"===r){const r=!E.includes(e),i=I&&!n?Ge(e,E,r):We(e,E,r);F(i),a?.(r,t,i)}})(a,t),[To.selectionColumn].includes(n)||(!Z||Z.disabled?.(t)||o||L(a),ge?.(t,r,e))})(t,n,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[To.expandableColumn,To.selectionColumn,To.operationColumn].includes(n)||be?.(t,r,e)})(t,n,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[To.expandableColumn,To.selectionColumn,To.operationColumn].includes(n)||ye?.(t,r,e)})(t,n,e)},t().createElement("div",{className:"cell"},et(e,n,a,r,i,o,{cellText:A,cellBgColor:k})))},et=(e,r,n,a,i,l,o)=>{const{dataIndex:s,canCopy:c,editRender:d,render:u}=e,m=Ln(r,s);if(s===To.expandableColumn)return t().createElement(js,{record:r,rowKey:i});if(s===To.selectionColumn)return t().createElement(_s,{selectionKeys:E,column:e,record:r,rowKey:i});const f=rt(m,e,r);if(d)return t().createElement(Bs,{ref:e=>Ee.current[`${i}-${s}`]=e,column:e,record:r,rowKey:i,columnKey:s,clicked:Le,text:f,cellBgColor:o.cellBgColor});const g=u?u(m,r,e,n,a):f;return I&&s===h?[at(ee?.virtual?r._level:l),t().createElement(js,{key:"expand",record:r,rowKey:i,style:Ye(r)?{}:{visibility:"hidden"}}),g]:c?t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},g),o.cellText&&t().createElement(Qs,{text:o.cellText},t().createElement(we.CopyOutlined,{className:"icon",title:p("qm.table.config.copyText"),onClick:e=>e.stopPropagation()}))):g},tt=(e,t,r,n)=>{const{dataIndex:a,render:i}=e;if([To.expandableColumn,To.selectionColumn,To.operationColumn].includes(a))return"";let l="";const o=Ln(t,a);if("function"==typeof i){const a=i(o,t,e,r,n);l=te(a)?Mn(a).join(""):a}else l=rt(o,e,t).toString();return l},rt=(e,t,r)=>{const{dictItems:n,precision:a,displayPrecision:i,formatType:l,editRender:o}=t,s=n||o?.(r,t)?.items||[],c=s.find((t=>t.value==e));let d=c?.text??e??"";if(Array.isArray(e)&&(d=e.map((e=>{const t=s.find((t=>t.value==e));return t?.text??e})).join(",")),a>=0&&""!==d&&(d=Number.isNaN(Number(d))?d:new(sa())(d).toFixed(a)),i>=0&&""!==d&&(d=qn(d,i)),l){const e=Oe[`${oe(l)}Format`];e?d=e(d):g("Table","字段的格式化类型 `formatType` 配置不正确")}return d},nt=(e,t,r,n)=>{let i=1,l=1;if("function"==typeof de){const o=de({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});if(Array.isArray(o)?(i=o[0],l=o[1]):(0,J.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan),e===a[0]&&0===i){i=1;for(let e=1;e<a.length;e++){const{rowSpan:r}=nt(a[e],t,a[e].index,n);if(r>0)break;i++}}}const{mergeCells:o}=c.current;if(o.length>0){const e=o.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},at=e=>e?t().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*To.treeTable.textIndent+"px"}}):null,it=e=>{const{backgroundColor:t,color:r}=le.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},lt=e=>{const t=le.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},ot=Ce("table"),st=O?{onMouseDown:Ie}:null;return t().createElement(t().Fragment,null,t().createElement(Pt,{wrapClassName:`${ot}--body-wrapper`,wrapStyle:Ae,native:ue,onScroll:e=>{const{elementStore:t,scrollYLoad:r}=c.current,{prevST:n,prevSL:a}=Ne.current,i=x?b.gutterWidth:0,{scrollTop:l,scrollLeft:o}=e;if(o!==a){me&&(t.$header.scrollLeft=o),y&&(t.$footer.scrollLeft=o);const e=o>0,r=Math.ceil(o)+b.tableWidth<b.tableBodyWidth+i;w!==e&&K(e),T!==r&&M(r)}if(r&&l!==n&&B(l),x&&l!==n){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(l)+b.viewportHeight-i>=r&&W({type:"scroll",target:e,preventDefault:ne,stopPropagation:ne})}Ne.current.prevST=l,Ne.current.prevSL=o}},t().createElement("div",{ref:Te,className:"body--y-space"}),t().createElement("div",{className:"body--x-space",style:{width:ke?`${ke}px`:""}}),t().createElement("table",Zs({ref:xe,className:`${ot}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},st,{style:{width:ke?`${ke}px`:""}}),t().createElement("colgroup",null,i.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})}))),fe?t().createElement(Xn.ReactSortable,{itemKey:e=>l(e,e.index),tag:"tbody",animation:200,list:a,setList:e=>{const t=e.map((e=>l(e,e.index))),r=a.map((e=>l(e,e.index)));if((0,J.isEqual)(t,r))return;const n=Yn(e),i=[];c.current.tableFullData.forEach((e=>{a.includes(e)?i.push(n.shift()):i.push(e)})),k(i),j()}},a.map((e=>Ze(e,e.index,l(e,e.index))))):t().createElement("tbody",null,Qe(a)))),O&&Re())}));Js.displayName="TableBody";const ec=Js,tc=e=>{const{summationRows:r,flattenColumns:n}=e,{getRowKey:a,tableProps:i,tableRef:l,sorter:o,layout:s,scrollY:c,leftFixedColumns:d,rightFixedColumns:u,setElementStore:m,getStickyLeft:h,getStickyRight:f}=t().useContext(uo),{footRender:g}=i,b=t().useRef(null);t().useEffect((()=>{y()}),[]);const y=()=>{m("$footer",b.current)},v=Ce("table"),{tableBodyWidth:x}=s;return t().createElement("div",{ref:b,className:`${v}--footer-wrapper`},g?g(n,l.current.tableFullData):t().createElement("table",{className:`${v}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:x?`${x}px`:""}},(()=>{const{gutterWidth:e}=s;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),c&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("tfoot",null,(()=>{const{isIE:e}=l.current,a=["gutter",{"cell-fix-right":!!u.length}],i=e?null:{right:u.length?0:""};return r.map(((e,r)=>t().createElement("tr",{key:r,className:"footer--row"},n.map(((r,n)=>((e,r,n)=>{const{isIE:a}=l.current,{gutterWidth:i}=s,{dataIndex:m,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!o[m],"cell-fix-left":!a&&"left"===g,"cell-fix-right":!a&&"right"===g,"cell-fix-left-last":!a&&"left"===g&&d[d.length-1].dataIndex===m,"cell-fix-right-first":!a&&"right"===g&&u[0].dataIndex===m}],x=a?null:{left:"left"===g?`${h(m)}px`:"",right:"right"===g?`${f(m)+(c?i:0)}px`:""},E=y?.render?y.render(l.current.tableFullData):Ln(r,`${m}_text`),S=0===n&&""===E?p("qm.table.config.summaryText"):E;return t().createElement("td",{key:m,title:S,className:Se()(v),style:{...x}},t().createElement("div",{className:"cell"},S))})(r,e,n))),c&&t().createElement("td",{className:Se()(a),style:{...i}}))))})())))};var rc=function(e){return e.small="small",e.middle="default",e.large="default",e}(rc||{});const nc=e=>{const{current:r,pageSize:n,total:a,onChange:i}=e,{global:o}=t().useContext(l),{tableProps:s,$size:c,setElementStore:d}=t().useContext(uo),{uniqueKey:u,paginationConfig:p,infoBarConfig:m}=s,h=t().useRef(null),f=t().useMemo((()=>u?`tablePager_${u}`:""),[u]);t().useEffect((()=>{g(),x()}),[]);const g=()=>{d("$pager",h.current)},b=p?.showSizeChanger??To.pagination.showSizeChanger,y=p?.showQuickJumper??To.pagination.showQuickJumper,v=p?.pageSizeOptions||o?.table?.pagination?.pageSizeOptions||To.pagination.pageSizeOptions,x=async()=>{if(!f)return;const e=await E(f);e&&e!==n&&(i(r,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=o?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S={[`${Ce("table")}-pager`]:!0};return t().createElement("div",{ref:h,className:Se()(S)},t().createElement("div",{className:"pager-alert"},"bottom"===m?.position&&t().createElement(Lo,{total:a})),t().createElement(O.Pagination,{size:rc[c],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:v,current:r,pageSize:n,total:a,onChange:(e,t)=>{i(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=o?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},ac=()=>{const{layout:e}=t().useContext(uo),r=t().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),n=Ce("table");return t().createElement("div",{className:`${n}--empty`,style:r},t().createElement(mt,null))};function ic(){return ic=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ic.apply(this,arguments)}const lc=t().forwardRef(((e,r)=>{const{rowKey:n,columns:a,loading:i,stripe:o,resizable:s,customClass:c,tablePrint:d,exportExcel:u,infoBarConfig:p,topSpaceAlign:m,showTableInfo:h,showFullScreen:f,showRefresh:b,showToolBox:y,showHeader:v}=e,{size:x}=t().useContext(l),E=t().useMemo((()=>e.size??x??""),[e.size,x]),S=t().useRef(null),C=t().useRef(null),w=t().useRef(null),T=t().useRef(null),N=t().useRef(null),I=t().useRef(null),R=Fo(),P=t().useCallback(((e,t)=>{const r="function"==typeof n?n(e,t):e[n];return void 0===r?(g("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r}),[n]),{tableRef:O,tableFullData:A,setElementStore:k,setOriginColumns:F,setTableFullData:L,setTableOriginData:H,setAllTableData:$,setDeriveRowKeys:D,setInvalidRowKeys:q,setFieldAuth:_,setMergeCells:j,setColumnsDefined:K,setScrollYStore:M,setScrollYLoad:V,setResizeState:z,setHandleState:U,setSummaries:B,setSelectionRows:W,setShouldToTop:G,setRecordsMap:Y,setUnMounted:X,setHandleChange:Q,clearElementStore:Z,clearRecordsMap:te}=((e,r)=>{let{getRowKey:n,$size:a}=r;const{dynamicThead:i}=e,l=t().useRef({uid:Kn(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},mergeCells:[],columnsDefined:!i,scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:To.rowHeightMaps[a]},store:new wo,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isHandleChange:!0,isIE:!ee&&/MSIE|Trident/.test(navigator.userAgent)}),o=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const l=n(e,e.index),s=r?`${r}#${l}`:`${l}`,c=a?`${a}-${e.index+1}`:`${e.index+1}`,d={level:i,rowKey:l,rowKeyPath:s,indexPath:c};return e.indexPath=c,e._level=i,e.children&&(d.children=o(e.children,l,s,c,i+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},s=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...s(e.children)):t.push(e.rowKey)})),t};return{tableRef:l,...l.current,setElementStore:(e,t)=>{l.current.elementStore[e]=t},setOriginColumns:e=>{l.current.originColumns=e},setTableFullData:e=>{l.current.tableFullData=e},setTableOriginData:e=>{l.current.tableOriginData=e},setAllTableData:e=>{const t=Rn(e);l.current.allTableData=t,l.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{l.current.treeTable=l.current.tableFullData.some((e=>Array.isArray(e.children))),l.current.treeTable&&(l.current.deriveRowKeys=o(e,""),l.current.flattenRowKeys=s(l.current.deriveRowKeys))},setInvalidRowKeys:e=>{l.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{l.current.fieldAuth[e]=t},setMergeCells:e=>{const t=[];e.forEach((e=>{t.push(e);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:e.row+n,col:e.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:e.row+r,col:e.col+n,rowSpan:0,colSpan:0})})),l.current.mergeCells=t},setColumnsDefined:e=>{l.current.columnsDefined=e},setScrollYStore:e=>{l.current.scrollYStore=e},setResizeState:e=>{l.current.resizeState=e},setHandleState:e=>{l.current.handleState=e},setSummaries:e=>{l.current.summaries=e},setScrollYLoad:e=>{l.current.scrollYLoad=e},setShouldToTop:e=>{l.current.shouldToTop=e},setSelectionRows:e=>{l.current.selectionRows=e},setRecordsMap:(e,t)=>{l.current.recordsMap.set(e,t)},setUnMounted:e=>{l.current.unMounted=e},setHandleChange:e=>{l.current.isHandleChange=e},clearElementStore:()=>{for(const e in l.current.elementStore)l.current.elementStore[e]=null},clearRecordsMap:()=>{l.current.recordsMap.clear()}}})(e,{getRowKey:P,$size:E}),{tableData:re,setTableData:ne,filters:ae,setFilters:ie,sorter:le,setSorter:oe,superFilters:se,setSuperFilters:de,pagination:ue,setPagination:pe,selectionKeys:me,setSelectionKeys:he,rowExpandedKeys:fe,setRowExpandedKeys:ge,highlightKey:be,setHighlightKey:ye,layout:ve,setLayout:xe,permission:Ee,setPermission:we,spinning:Te,setSpinning:Ne,scrollX:Ie,setScrollX:Re,scrollY:Pe,setScrollY:Oe,isPingLeft:Ae,setPingLeft:ke,isPingRight:Fe,setPingRight:Le,isFullScreen:He,setFullScreen:$e,updateTableData:De}=(e=>{const{uniqueKey:r,nativeScrollBar:n,initialSorter:a={},initialFilter:i={},paginationConfig:o,rowSelection:s,expandable:c,rowHighlight:d}=e,{global:u}=t().useContext(l),p={current:To.pagination.current,pageSize:(()=>{if(r)return Number(localStorage.getItem(`tablePager_${r}`))||void 0})()??o?.pageSize??u?.table?.pagination?.pageSize??To.pagination.pageSize,total:0},m=s?.selectedRowKeys??s?.defaultSelectedRowKeys??[],h=c?.expandedRowKeys??c?.defaultExpandedRowKeys??[],[f,g]=t().useState([]),[b,y]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),i),[v,x]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),a),[E,S]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),[]),[C,w]=t().useState(p),[T,N]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),m),[I,R]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),h),[P,O]=t().useState(d?.currentRowKey??""),[A,k]=t().useState({gutterWidth:n?Io():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[F,L]=t().useState({export:!0,import:!0,print:!0}),[H,$]=t().useState(!1),[D,q]=t().useState(!1),[_,j]=t().useState(!1),[K,M]=t().useState(!1),[V,z]=t().useState(!1),[U,B]=t().useState(!1);return{tableData:f,setTableData:g,filters:b,setFilters:y,sorter:v,setSorter:x,superFilters:E,setSuperFilters:S,pagination:C,setPagination:w,selectionKeys:T,setSelectionKeys:N,rowExpandedKeys:I,setRowExpandedKeys:R,highlightKey:P,setHighlightKey:O,layout:A,permission:F,setPermission:L,setLayout:k,spinning:H,setSpinning:$,scrollX:D,setScrollX:q,scrollY:_,setScrollY:j,isPingLeft:K,setPingLeft:M,isPingRight:V,setPingRight:z,isFullScreen:U,setFullScreen:B,updateTableData:()=>{g([...f])}}})(e),{isFetch:qe,isWebPagination:je,isScrollPagination:Ke,showPagination:Me,shouldUpdateHeight:Ve,tableColumns:ze,flattenColumns:Ue,editableColumns:Be,summationColumns:We,leftFixedColumns:Ge,rightFixedColumns:Ye,treeExpandIndex:Xe,showSummary:Qe,showFooter:Ze,isHeadGroup:Je,bordered:et,isHeadSorter:tt,isHeadFilter:rt,isServiceSummation:nt,isSelectCollection:at,isTableImport:it,isTableClipboard:lt,isSuperSearch:ot,isFastSearch:st,isGroupSummary:ct,isGroupSubtotal:dt,isDragMergeCell:ut,isTreeTable:pt,isTableEmpty:mt,summationRows:ht,fetchParams:gt}=Po(e,{getRowKey:P,tableRef:O,tableFullData:A,tableData:re,sorter:le,filters:ae,superFilters:se,selectionKeys:me,pagination:ue}),{createElementStore:bt,tableStyles:yt,getSpan:vt,getStickyLeft:xt,getStickyRight:Et,scrollXToColumn:St,scrollYToRecord:Ct,rowInViewport:wt,calcTableHeight:Tt,resetTableScroll:Nt,doLayout:It}=ko(e,{getRowKey:P,tableRef:O,$size:E,tableColumns:ze,flattenColumns:Ue,leftFixedColumns:Ge,layout:ve,scrollY:Pe,tableData:re,showFooter:Ze,showPagination:Me,isWebPagination:je,isFullScreen:He,setLayout:xe,setScrollX:Re,setScrollY:Oe,setElementStore:k,setScrollYStore:M,setShouldToTop:G}),{initialTable:Rt,checkDataIndex:Pt,createTableFullData:Ot,getTableData:At,handleTableData:kt,createTableData:Ft,createGroupData:Lt,createSelectionKeys:Ht,createRowExpandedKeys:$t,setSelectionKeysEffect:Dt,findParentRowKeys:qt,getAllChildRowKeys:_t,doFieldValidate:jt,getTableLog:Kt,dataChange:Mt,tableChange:Vt,toLastPage:zt,toFirstPage:Ut,getPageCount:Bt,pagerChangeHandle:Wt,triggerScrollYEvent:Gt,scrollBottomDebouncer:Yt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:er,clearTableLog:tr,destroy:rr}=Ao(e,{getRowKey:P,tableRef:O,tableElementRef:C,tableBodyRef:w,$size:E,tableColumns:ze,flattenColumns:Ue,tableFullData:A,pagination:ue,layout:ve,filters:ae,sorter:le,superFilters:se,fetchParams:gt,selectionKeys:me,rowExpandedKeys:fe,highlightKey:be,summationColumns:We,shouldUpdateHeight:Ve,isFetch:qe,isTreeTable:pt,isWebPagination:je,isScrollPagination:Ke,isServiceSummation:nt,isGroupSubtotal:dt,doLayout:It,setTableData:ne,setTableFullData:L,setTableOriginData:H,setAllTableData:$,setDeriveRowKeys:D,setPagination:pe,setSpinning:Ne,setSorter:oe,setFilters:ie,setSuperFilters:de,setSelectionKeys:he,setRowExpandedKeys:ge,setHighlightKey:ye,setSelectionRows:W,setScrollYLoad:V,setScrollYStore:M,setFieldAuth:_,setResizeState:z,setSummaries:B,setPermission:we,setRecordsMap:Y,resetTableScroll:Nt,clearElementStore:Z,clearRecordsMap:te});((e,r)=>{const{columns:n,summation:a,rowSelection:i,expandable:l,rowHighlight:o,mergeCells:s=[]}=e,{tableRef:c,topElementRef:d,tableElementRef:u,tableBodyRef:p,resizableBarRef:m,$size:h,scrollX:f,pagination:b,selectionKeys:y,rowExpandedKeys:v,highlightKey:x,summationRows:E,showSummary:S,isWebPagination:C,isScrollPagination:w,isTreeTable:T,checkDataIndex:N,toLastPage:I,toFirstPage:R,getPageCount:P,setHandleState:O,scrollYToRecord:A,setSelectionKeysEffect:k,setOriginColumns:F,setRowExpandedKeys:L,setHighlightKey:H,setResizeState:$,setMergeCells:D,setPingRight:q,setUnMounted:_,setHandleChange:j,calcTableHeight:K,createSelectionKeys:M,createRowExpandedKeys:V,createElementStore:z,triggerScrollYEvent:U,initialTable:B,destroy:W}=r,{elementStore:G,handleState:Y,scrollYLoad:X}=c.current,Q=t().useRef(E);_e((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&p.current.setClickedValues(y.length?[y[0],""]:[]),c.current.isHandleChange&&e?.(y,c.current.selectionRows),j(!0)}),[y]),_e((()=>{if(!l)return;const{allTableData:e,allRowKeys:t}=c.current,{onChange:r}=l;r?.(v,v.map((r=>e[t.findIndex((e=>e===r))])))}),[v]),_e((()=>{const{allTableData:e,allRowKeys:t}=c.current;T&&L(V()),o&&(p.current.setClickedValues(x?[x,""]:[]),o.onChange?.(x,e[t.findIndex((e=>e===x))]??null))}),[x]),_e((()=>{(0,J.isEqual)(E,Q.current)||(Q.current=E,S&&a&&a.onChange?.(E))}),[E]),_e((()=>{const e=M(i.selectedRowKeys);(0,J.isEqual)(e,y)||(k(e),T&&L(V()))}),[i?.selectedRowKeys]),_e((()=>{const e=V(l.expandedRowKeys);(0,J.isEqual)(e,v)||L(e)}),[l?.expandedRowKeys]),_e((()=>{const{currentRowKey:e}=o;e!==x&&H(e??"")}),[o?.currentRowKey]),_e((()=>{const{insert:e,remove:t}=Y;e&&(C&&("after"===e?I():R()),A("","after"===e?1e5:0)),t&&b.current>P()&&I(),(e||t)&&O({insert:null,remove:!1})}),[b.total]),_e((()=>{X&&U(G.$tableBody.parentNode.parentNode.scrollTop)}),[X]),_e((()=>{q(f)}),[f]),_e((()=>{K()}),[h]),_e((()=>{D(s),p.current.forceUpdate()}),[s]),_e((()=>{X&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),w&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[X,w]);const Z=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&($(Object.assign({},e,{winHeight:r})),K())};t().useEffect((()=>(z({$toper:d.current,$table:u.current,$resizableBar:m.current}),F(ce(n)),B(),D(s),window.addEventListener("resize",Z,!1),K(),N(),()=>{W(),window.removeEventListener("resize",Z),_(!0)})),[])})(e,{tableRef:O,topElementRef:S,tableElementRef:C,tableBodyRef:w,resizableBarRef:I,$size:E,scrollX:Ie,pagination:ue,selectionKeys:me,rowExpandedKeys:fe,highlightKey:be,showSummary:Qe,summationRows:ht,isWebPagination:je,isScrollPagination:Ke,isTreeTable:pt,checkDataIndex:Pt,toLastPage:zt,toFirstPage:Ut,getPageCount:Bt,setHandleState:U,scrollYToRecord:Ct,setOriginColumns:F,setSelectionKeysEffect:Dt,setRowExpandedKeys:ge,setHighlightKey:ye,setResizeState:z,setMergeCells:j,setPingRight:Le,setUnMounted:X,setHandleChange:Q,calcTableHeight:Tt,createSelectionKeys:Ht,createRowExpandedKeys:$t,createElementStore:bt,triggerScrollYEvent:Gt,initialTable:Rt,destroy:rr});const nr=t().useMemo((()=>({getRowKey:P,tableProps:e,tableRef:O,tableBodyRef:w,$size:E,flattenColumns:Ue,editableColumns:Be,leftFixedColumns:Ge,rightFixedColumns:Ye,treeExpandIndex:Xe,sorter:le,filters:ae,superFilters:se,layout:ve,bordered:et,showFooter:Ze,showSummary:Qe,summationRows:ht,scrollX:Ie,scrollY:Pe,pagination:ue,fetchParams:gt,selectionKeys:me,rowExpandedKeys:fe,highlightKey:be,isFetch:qe,isPingLeft:Ae,isPingRight:Fe,isHeadSorter:tt,isHeadFilter:rt,isFullScreen:He,isTableEmpty:mt,isHeadGroup:Je,isTreeTable:pt,isGroupSubtotal:dt,isWebPagination:je,isDragMergeCell:ut,dataChange:Mt,tableChange:Vt,getTableData:At,setElementStore:k,createTableFullData:Ot,updateTableData:De,setSorter:oe,setFilters:ie,setSuperFilters:de,setHighlightKey:ye,setRowExpandedKeys:ge,setSelectionRows:W,setSelectionKeysEffect:Dt,setInvalidRowKeys:q,getSpan:vt,getStickyLeft:xt,getStickyRight:Et,scrollXToColumn:St,scrollYToRecord:Ct,rowInViewport:wt,setPagination:pe,setPingLeft:ke,setPingRight:Le,setSpinning:Ne,setFullScreen:$e,setShouldToTop:G,doFieldValidate:jt,createTableData:Ft,createGroupData:Lt,findParentRowKeys:qt,getAllChildRowKeys:_t,triggerScrollYEvent:Gt,scrollBottomDebouncer:Yt,resetTableScroll:Nt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:er})),[e,E,Ue,Be,Ge,Ye,Xe,le,ae,se,ve,et,Ze,Qe,ht,Ie,Pe,ue,gt,me,fe,be,qe,Ae,Fe,tt,rt,He,mt,Je,pt,dt,je,ut]);((e,r)=>{const{getRowKey:n,tableProps:a,tableRef:i,toolBoxRef:l,tableBodyRef:o,columnFilterRef:s,flattenColumns:c,editableColumns:d,pagination:u,fetchParams:p,selectionKeys:m,rowExpandedKeys:h,highlightKey:f,isFetch:b,dataChange:y,getTableData:v,handleTableData:x,createTableData:E,calcTableHeight:S,scrollXToColumn:C,scrollYToRecord:w,doFieldValidate:T,setHandleState:N,setColumnsDefined:I,setSelectionKeysEffect:R,setRowExpandedKeys:P,setHighlightKey:O,setSelectionRows:A,setOriginColumns:k,setHandleChange:F,forceUpdate:L,getTableLog:H,clearRowSelection:$,clearRowHighlight:D,clearTableSorter:q,clearTableFilter:_,clearSuperFilters:j,clearTableLog:K}=r,{columns:M,columnsChange:V}=a,z=(e,t,r)=>{for(let a=0;a<e.length;a++){const i=e[a],l=n(i,i.index);Array.isArray(i.children)&&z(i.children,t,r),t.includes(l)&&(r?.(i,l),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{S()},DO_REFRESH:async e=>{b&&(await v(),e?.())},GET_LOG:()=>H(),GET_FETCH_PARAMS:()=>{const e={};for(const t in p)Object.keys(u).includes(t)||(e[t]=p[t]);return e},CLEAR_TABLE_DATA:()=>{b||($(),D(),q(),_(),j(),K(),E([]))},CLEAR_LOG:()=>{K()},CREATE_FOCUS:(e,t)=>{o.current.createFocus(e,t)},FORCE_UPDATE:()=>{L()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{C(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,J.isEqual)(e,m)&&F(!1),R(e)},SET_HIGHLIGHT:e=>{O(e)},SET_EXPANDABLE:e=>{P(e)},SET_SELECTION_ROWS:e=>{A(e)},SET_TABLE_DATA:e=>{x(e)},DEFINE_INITIAL_COLUMNS:e=>{k(e),I(!0),s.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=Cn(M,e);if(!n)return g("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return g("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,J.set)(n,e,t[e]);r&&(V?V([...M]):g("Table","需要设置 `columnsChange` 参数"))},INSERT_RECORDS:(e,t)=>{const{store:r,tableFullData:a}=i.current,l=(Array.isArray(e)?e:[e]).filter((e=>(0,J.isPlainObject)(e)));if(!l.length)return;l.forEach((e=>{c.forEach((t=>{const{dataIndex:r}=t;[To.expandableColumn,To.selectionColumn,To.operationColumn].includes(r)||Hn(e,r,Ln(e,r))})),r.addToInserted(e)}));const o="before"===t?.mode,s=void 0===t?.parentRowKey;let d=a;if(s)d=o?[...l,...d]:d.concat(l);else{const e=Wn(a,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}E(d),s&&N(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),y()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:r}=i.current,a=(Array.isArray(e)?e:[e]).map((e=>(0,J.isPlainObject)(e)?n(e,e.index):e));if(!a.length)return;let l=!1;z(r,a,((e,r)=>{t.addToRemoved(e),d.forEach((n=>{const{dataIndex:a,editRender:i}=n,l=i?.(e,n);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),l=!0})),l&&(E(r),R(m.filter((e=>!a.includes(e)))),a.includes(f)&&D(),P(h.filter((e=>!a.includes(e)))),N(Object.assign({},i.current.handleState,{remove:!0})),y())},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((r=>{d.forEach((a=>{const{dataIndex:i,editRender:l}=a,o=l?.(r,a);if(!o)return;const s=n(r,r.index);if(e&&!e.includes(s))return;if(t&&!t.includes(i))return;const{rules:c=[],disabled:d}=o;!d&&c.length&&T(c,Ln(r,i),s,i)}))}));const{required:r,validate:a}=H(),l=[...r,...a];return l.length&&w(l[0].rowKey),L(),{required:r,validate:a}}})))})(r,{getRowKey:P,tableProps:e,tableRef:O,toolBoxRef:T,tableBodyRef:w,columnFilterRef:N,flattenColumns:Ue,editableColumns:Be,pagination:ue,fetchParams:gt,selectionKeys:me,rowExpandedKeys:fe,highlightKey:be,isFetch:qe,dataChange:Mt,getTableData:At,handleTableData:kt,createTableData:Ft,calcTableHeight:Tt,scrollXToColumn:St,scrollYToRecord:Ct,doFieldValidate:jt,setHandleState:U,setColumnsDefined:K,setSelectionKeysEffect:Dt,setRowExpandedKeys:ge,setHighlightKey:ye,setSelectionRows:W,setOriginColumns:F,setHandleChange:Q,forceUpdate:R,getTableLog:Kt,clearRowSelection:Jt,clearRowHighlight:er,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearTableLog:tr}),t().useEffect((()=>{So.register(O.current.uid,r??{current:null})}),[]);const ar=Ce("table"),ir={[`${ar}--wrapper`]:!0,[`${ar}--lg`]:"large"===E,[`${ar}--sm`]:"small"===E,[`${ar}--maximize`]:He,[c]:!!c},lr={[ar]:!0,"is--border":et,"is--striped":o,"is--fixed":Ge.length||Ye.length,"is--sortable":tt,"is--filterable":rt,"is--head-group":Je,"is--merge-cell":ut,"is--empty":mt,"show--head":v,"show--foot":Ze,"ping--left":Ae,"ping--right":Fe,"scroll--x":Ie,"scroll--y":Pe};return t().createElement(uo.Provider,{value:nr},t().createElement("div",{className:Se()(ir)},h&&t().createElement("div",{ref:S,className:`${ar}-top`},t().createElement("div",{className:`${ar}-top__space`},"bottom"!==p?.position&&t().createElement(Lo,{total:ue.total}),t().createElement("div",{className:`${ar}-top__space-slot`,style:{justifyContent:xo[m]}},e.children)),t().createElement("div",{className:`${ar}-top__actions`},t().createElement(Ns,{ref:T,showFullScreen:f,showReload:b&&qe,showPrint:Ee.print&&!!d,showImport:Ee.import&&it,showExport:Ee.export&&!!u,showClipboard:lt,showCollection:at,showFastSearch:st,showSuperSearch:ot,showGroupSummary:ct,showToolBox:y,tableColumns:ze}),t().createElement(Ps,{ref:N,columns:a}))),t().createElement(ft,{spinning:i??Te},t().createElement("div",{ref:C,className:Se()(lr),style:yt},t().createElement("div",{className:`${ar}--main-wrapper`},v&&t().createElement(qs,{tableColumns:ze,flattenColumns:Ue,sorter:le,filters:ae}),t().createElement(ec,{ref:w,tableData:re,flattenColumns:Ue}),Ze&&t().createElement(tc,{summationRows:ht,flattenColumns:Ue})),et&&t().createElement("div",{className:`${ar}--border-line`}),mt&&t().createElement(ac,null),s&&t().createElement("div",{ref:I,className:`${ar}--resizable-bar`}))),Me&&t().createElement(nc,ic({},ue,{onChange:(e,t)=>Wt({current:e,pageSize:t})}))))}));lc.defaultProps={columns:[],dataSource:[],rowKey:"id",border:!0,resizable:!0,showHeader:!0,ellipsis:!0,multipleSort:!0,topSpaceAlign:"right",showFullScreen:!0,showRefresh:!0,showClipboard:!0,showSelectCollection:!0,showSuperSearch:!0,showFastSearch:!0,showGroupSummary:!0,showColumnDefine:!0,showTableInfo:!0},lc.displayName="QmTable";const oc=lc,sc=oc;function cc(){return cc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},cc.apply(this,arguments)}const dc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:d,style:u,onClose:m}=e,{size:h}=t().useContext(l),f=t().useMemo((()=>e.size??h??""),[e.size,h]),g=t().useRef(null),b=t().useRef(null),y=t().useRef(null),v=St(g),[x,E]=t().useState(c),[S,C]=t().useState(),[w,T]=t().useState(o),[N,I]=t().useState(!1),[R,P]=t().useState(300),[O,A]=t().useState(s),[k,F]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[L,H]=t().useState((0,J.merge)({},c.fetch?.params,a)),[$,D]=t().useState([]),q=()=>{const e=g.current,t=e.querySelector(".form-wrap");P(e.offsetHeight-t.offsetHeight-2*ga[f]-30)},_=Ct(q,5);_e((()=>{_()}),[v.width]),_e((()=>{(0,J.isEqual)(s,O)||A(s)}),[s]),t().useEffect((()=>{j()}),[L]),t().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&b.current?.SET_FIELDS_VALUE(a)}),[]);const j=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(L)){I(!0);try{const e=await r(L);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(T([]),await ie(0)),D(t)}}catch(e){}I(!1)}},K=e=>{n||(C(e),m(e))},M=e=>{H(Object.assign({},L,e))},V={[`${Ce("search-helper")}--wrapper`]:!0},z=x.webPagination?{dataSource:$,loading:N,webPagination:!0}:{fetch:{...x.fetch,params:L}};return t().createElement("div",{ref:g,className:Se()(V,d),style:u},t().createElement("div",{className:"form-wrap"},O.length?t().createElement(bl,{ref:b,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>A(e),onCollapse:()=>q(),onFinish:e=>M(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||M(t)}}):null),t().createElement("div",null,t().createElement(sc,cc({ref:y,uniqueKey:r,height:R,columns:k,rowKey:x.rowKey||"pageIndex"},z,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{T(e),C(n?t:t[0])}},columnsChange:e=>F(e),onRowDblclick:K,onRowEnter:K}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ga[f]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>m(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!S,onClick:()=>m(S,n?w:void 0)},p("qm.dialog.confirm"))))};dc.displayName="SearchHelper";const uc=dc;function pc(){return pc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pc.apply(this,arguments)}const mc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...mc(e.children)),e.children&&t.push(e.value)})),t},hc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=hc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},fc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&fc(e.children,t),t(e)||e.children&&e.children.length))),gc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},className:u,style:m,onClose:h}=e,{size:f}=t().useContext(l),b=t().useMemo((()=>e.size??f??""),[e.size,f]),y=t().useRef(null),v=t().useRef(null),x=t().useRef(null),E=St(y),[S,C]=t().useState(c),[w,T]=t().useState(),[N,I]=t().useState(o),[R,P]=t().useState(!1),[A,k]=t().useState(300),[F,L]=t().useState(300),[H,$]=t().useState(s),[D,q]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[_,j]=t().useState((0,J.merge)({},c.fetch?.params,a)),[K,M]=t().useState([]),V=()=>{const e=y.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");k(e.offsetHeight-r.offsetHeight-10),L(e.offsetHeight-t.offsetHeight-2*ga[b]-30)},z=Ct(V,5);_e((()=>{z()}),[E.width]),_e((()=>{(0,J.isEqual)(s,H)||$(s)}),[s]),t().useEffect((()=>{U()}),[_]),t().useEffect((()=>{i&&x.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&v.current?.SET_FIELDS_VALUE(a),ne()}),[]);const U=async()=>{const{webPagination:e,fetch:t}=S;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(_)){P(!0);try{const e=await r(_);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(I([]),await ie(0)),M(t)}}catch(e){}P(!1)}},B=e=>{n||(T(e),h(e))},W=e=>{j(Object.assign({},_,e))},[G,Y]=t().useState([]),[X,Q]=t().useState([]),[Z,ee]=t().useState(""),te=t().useRef(G),re=t().useRef([]);_e((()=>{Q(mc(G))}),[G]);const ne=async()=>{if(!d.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=d.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,r)??[],t=Or(e,n,a);Y(t),te.current=t,re.current=e}}catch(e){}},le=e=>`${e}|${Wr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe={[`${Ce("tree-table-helper")}--wrapper`]:!0},se=S.webPagination?{dataSource:K,loading:R,webPagination:!0}:{fetch:{...S.fetch,params:_}};return t().createElement("div",{ref:y,className:Se()(oe,u),style:m},t().createElement(nt,{defaultValue:200,style:{height:"100%"}},t().createElement(nt.Pane,{min:100,style:{overflowY:"auto"}},t().createElement(O.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:p("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=fc(te.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==le(r).indexOf(e)}));ee(e),Y(t)})(e.target.value)}),t().createElement(O.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:A,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==le(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return g("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,r={};for(const n in t)r[n]=(0,J.get)(e,t[n]);W(r)})(hc(re.current,(r=>(0,J.get)(r,t)===e[0]))||{})}})),t().createElement(nt.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},H.length?t().createElement(bl,{ref:v,items:H,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>$(e),onCollapse:()=>V(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await v.current.GET_FORM_DATA();e||W(t)}}):null),t().createElement("div",null,t().createElement(sc,pc({ref:x,uniqueKey:r,height:F,columns:D,rowKey:S.rowKey||"pageIndex"},se,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:N,onChange:(e,t)=>{I(e),T(n?t:t[0])}},columnsChange:e=>q(e),onRowDblclick:B,onRowEnter:B}))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ga[b]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>h(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!w,onClick:()=>h(w,n?N:void 0)},p("qm.dialog.confirm"))))};gc.displayName="TreeTableHelper";const bc=gc,yc=e=>{const{multiple:r,tree:n={},defaultSelectedKeys:a,className:i,style:o,onClose:s}=e,{size:c}=t().useContext(l),d=t().useMemo((()=>e.size??c??""),[e.size,c]),[u,m]=t().useState(),[h]=t().useState(n.fetch?.params),f={[`${Ce("tree-helper")}--wrapper`]:!0},g=n.fetch?{...Z()(n.fetch,["params","valueKey","textKey"]),params:h}:void 0;return t().createElement("div",{className:Se()(f,i),style:o},t().createElement(co,{multiple:r,fetch:g,fieldsDefine:{valueKey:n.fetch?.valueKey,textKey:n.fetch?.textKey},asyncLoad:n.asyncLoad,checkStrictly:n.checkStrictly,checkStrategy:n.checkStrategy,defaultSelectedKeys:a,defaultExpandAll:n.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ga[d]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>s(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!u,onClick:()=>s(u)},p("qm.dialog.confirm"))))};yc.displayName="TreeHelper";const vc=yc;function xc(){return xc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xc.apply(this,arguments)}const Ec="_startSign",Sc="_endSign",Cc=e=>{const{uniqueKey:r,initialValue:n,filters:a=[],table:i={},onClose:o}=e,{size:s}=t().useContext(l),c=t().useMemo((()=>e.size??s??""),[e.size,s]),d=t().useRef(null),u=t().useRef(null),m=t().useRef(null),h=St(d),[f,g]=t().useState(i),[b,y]=t().useState(!1),[v,x]=t().useState([]),[E,S]=t().useState(300),[C,w]=t().useState(a),[T,N]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},{title:p("qm.form.rangeSearchHelper")[0],dataIndex:Ec,width:80,align:"right",render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:Sc,fixed:"right",width:80,render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)}]),[I,R]=t().useState((0,J.merge)({},i.fetch?.params,n)),[P,A]=t().useState([]),k=t().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),F=t().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),L=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*ga[c]-30)},H=Ct(L,5);_e((()=>{H()}),[h.width]),_e((()=>{(0,J.isEqual)(a,C)||w(a)}),[a]),t().useEffect((()=>{$()}),[I]);const $=async()=>{const{webPagination:e,fetch:t}=f;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=ae}=t;if(a(I)){y(!0);try{const e=await r(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[];A(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},q=()=>{v.forEach((e=>{e&&(D(e,Ec),D(e,Sc))})),x([])},_=e=>{q(),R(Object.assign({},I,e))},j=Ce("range-helper"),K=f.webPagination?{dataSource:P,loading:b,webPagination:!0}:{fetch:{...f.fetch,params:I}};return t().createElement("div",{ref:d,className:`${j}--wrapper`},t().createElement("div",{className:"form-wrap"},C.length?t().createElement(bl,{ref:u,items:C,initialValues:n,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>L(),onFinish:e=>_(e),onReset:async()=>{const[e,t]=await u.current.GET_FORM_DATA();e||_(t)}}):null),t().createElement("div",null,t().createElement(sc,xc({ref:m,height:E,columns:T,rowKey:f.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},K,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[Ec,Sc].includes(r)&&(r===Ec&&(e[r]?(D(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?O.message.warning(p("qm.searchHelper.rangeStartTip")):(v[0]&&D(v[0],r),e[r]="[",x([e,v[1]]))),r===Sc&&(e[r]?(D(e,r),x([v[0],void 0])):e.pageIndex<k[0]?O.message.warning(p("qm.searchHelper.rangeEndTip")):(v[1]&&D(v[1],r),e[r]="]",x([v[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[Ec]="["),e.pageIndex===k[1]&&(e[Sc]="]")}))}}),t().createElement(he,{type:"primary",icon:t().createElement(we.ClearOutlined,null),title:p("qm.table.alert.clear"),onClick:()=>q()}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ga[c]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>o(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!F,onClick:()=>o(v.map((e=>(e=>{const t={};for(const r in e)[Ec,Sc].includes(r)||(t[r]=e[r]);return t})(e))))},p("qm.dialog.confirm"))))};Cc.displayName="RangeTableHelper";const wc=Cc,Tc=e=>null!=e;function Nc(e,r,n,a){const[i,l]=t().useState(void 0);t().useLayoutEffect((()=>{const t="function"==typeof e?e():e;l(t||null)}));const[o,s]=t().useState(null),c=Oo((()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:a,bottom:i,left:l}=e.getBoundingClientRect();return n>=0&&l>=0&&a<=t&&i<=r})(i)&&r&&i.scrollIntoView(a);const{left:e,top:t,width:n,height:l}=i.getBoundingClientRect(),o={left:e,top:t,width:n,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)}));return t().useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[i,r,c]),[t().useMemo((()=>{if(!o)return o;const e=n?.offset||6,t=n?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,n]),i]}const Ic=(t,r)=>{const n=e.useRef(!0);e.useLayoutEffect((()=>t(n.current)),r),e.useLayoutEffect((()=>(n.current=!1,()=>{n.current=!0})),[])};function Rc(e,t){Ic((t=>{if(!t)return e()}),t)}function Pc(e){return void 0!==e}function Oc(t,r){const{defaultValue:n,value:a,onChange:i,postState:l}=r||{},[o,s]=e.useState((()=>Pc(a)?a:Pc(n)?"function"==typeof n?n():n:"function"==typeof t?t():t)),c=Pc(a)?a:o,d=l?l(c):c,u=Oo(i),[p,m]=e.useState([c]);return Rc((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),Rc((()=>{Pc(a)||s(a)}),[a]),[d,Oo((e=>{s(e),m([c])}))]}const Ac={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},kc={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},Fc=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Lc(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(Ac).forEach((e=>{const c={...n&&kc[e]||Ac[e],offset:[0,0]};switch(s[e]=c,Fc.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-o-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=o+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-o-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=o+a}const d=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{dropdownArrowOffset:n,dropdownArrowOffsetVertical:r?8:n}}({contentRadius:i,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.dropdownArrowOffset-o;break;case"topRight":case"bottomRight":c.offset[0]=d.dropdownArrowOffset+o;break;case"leftTop":case"rightTop":c.offset[1]=-d.dropdownArrowOffset-o;break;case"leftBottom":case"rightBottom":c.offset[1]=d.dropdownArrowOffset+o}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const a=n&&"object"==typeof n?n:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.dropdownArrowOffset+r;break;case"left":case"right":i.shiftY=2*t.dropdownArrowOffsetVertical+r}const l={...i,...a};return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,d,t,r),l&&(c.htmlRegion="visibleFirst")})),s}const Hc=require("@rc-component/portal");var $c=n.n(Hc);const Dc=require("@rc-component/trigger");var qc=n.n(Dc);const _c=require("rc-util/lib/hooks/useId");var jc=n.n(_c);function Kc(){return Kc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kc.apply(this,arguments)}const Mc={fill:"transparent",pointerEvents:"auto"},Vc=e=>{const{prefixCls:r,rootClassName:n,pos:a,showMask:i,style:l={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${r}-mask-${jc()()}`,p="object"==typeof c?c?.placeholder:c;return t().createElement($c(),{open:s,autoLock:!0},t().createElement("div",{className:Se()(`${r}-mask`,n),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...l}},i?t().createElement("svg",{style:{width:"100%",height:"100%"}},t().createElement("defs",null,t().createElement("mask",{id:u},t().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),a&&t().createElement("rect",{x:a.left,y:a.top,rx:a.radius,width:a.width,height:a.height,fill:"black",className:p?`${r}-placeholder-animated`:""}))),t().createElement("rect",Kc({},a?null:Mc,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),a&&t().createElement(t().Fragment,null,t().createElement("rect",Kc({},Mc,{x:"0",y:"0",width:"100%",height:`${a.top}px`})),t().createElement("rect",Kc({},Mc,{x:"0",y:"0",width:a.left,height:"100%"})),t().createElement("rect",Kc({},Mc,{x:"0",y:a.top+a.height,width:"100%",height:`calc(100vh - ${a.top+a.height}px)`})),t().createElement("rect",Kc({},Mc,{x:a.left+a.width,y:"0",width:`calc(100vw - ${a.left+a.width}px)`,height:"100%"})))):null))},zc=e=>{const{prefixCls:r,zIndex:n,open:a,onPause:i,onPlay:l}=e,[o,s]=Oc(void 0,{value:a,postState:e=>e??!0}),c=t().useRef(!1);return t().createElement(Ke(),{onDrag:()=>{c.current=!0}},t().createElement("div",{className:`${r}-control`,style:{zIndex:n+1},onClick:()=>{c.current?c.current=!1:(s(!o),o?i?.():l?.())}},o?t().createElement(we.PauseOutlined,null):t().createElement(we.CaretRightOutlined,null)))};function Uc(){const{locale:t}=e.useContext(l);return{t:p,$locale:t}}const Bc=e=>{const{prefixCls:r,current:n,total:a=0,cover:i,title:l,description:o,onClose:s,onPrev:c,onNext:d,onFinish:u,className:p,indicatorsRender:m}=e,{t:h}=Uc(),f=Tc(i)?t().createElement("div",{className:`${r}-cover`},i):null,g=Tc(o)?t().createElement("div",{className:`${r}-description`},o):null;let b;b=m?m(n,a):[...Array.from({length:a}).keys()].map(((e,a)=>t().createElement("span",{key:e,className:Se()(a===n&&`${r}-indicator-active`,`${r}-indicator`)})));const y=e=>{e.stopPropagation(),e.preventDefault()};return t().createElement("div",{className:Se()(`${r}-content`,p)},t().createElement("div",{className:`${r}-inner`},t().createElement(we.CloseOutlined,{className:`${r}-close`,onClick:s}),f,t().createElement("div",{className:`${r}-header`},t().createElement("div",{className:`${r}-title`},l)),g,t().createElement("div",{className:`${r}-footer`},a>1&&t().createElement("div",{className:`${r}-indicators`},b),t().createElement(xe,{className:`${r}-buttons`},0!==n?t().createElement(he,{className:`${r}-prev-btn`,size:"small",onMouseDown:y,onClick:c},h("qm.tour.prevStep")):null,n===a-1?t().createElement(he,{className:`${r}-finish-btn`,type:"primary",size:"small",onClick:u},h("qm.tour.finish")):t().createElement(he,{className:`${r}-next-btn`,type:"primary",size:"small",onMouseDown:y,onClick:d},h("qm.tour.nextStep"))))))},Wc=e=>{const{current:r,renderPanel:n}=e;return t().createElement(t().Fragment,null,"function"==typeof n?n(e,r):t().createElement(Bc,e))};function Gc(){return Gc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gc.apply(this,arguments)}const Yc={left:"50%",top:"50%",width:1,height:1},Xc=t().forwardRef(((e,r)=>{const{steps:n=[],defaultCurrent:a,current:i,onChange:l,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:m=!0,overlayClassName:h,overlayStyle:f,placement:g,renderPanel:b,indicatorsRender:y,gap:v,animated:x=!0,scrollIntoViewOptions:E=!0,zIndex:S,...C}=e,w=t().useRef(),[T,N]=Oc(0,{value:i,defaultValue:a}),[I,R]=Oc(void 0,{value:c,postState:e=>!(T<0||T>=n.length)&&(e??!1)}),[P,O]=Oc(1001,{value:S,defaultValue:S}),[A,k]=t().useState(),F=t().useRef(I);t().useLayoutEffect((()=>{I&&!F.current&&N(0),F.current=I,k(I)}),[I]),t().useImperativeHandle(r,(()=>({OPEN:()=>R(!0),CLOSE:()=>R(!1),SET_ZINDEX:e=>O(e)})));const{target:L,placement:H,style:$,arrow:D,className:q,mask:_,scrollIntoViewOptions:j,zIndex:K,action:M}=n[T]||{},V=K||P,z=I&&(_??u),U=j??E,[B,W]=Nc(L,!!c,v,U),G=((e,t,r)=>r??t??(null===e?"center":"bottom"))(W,g,H),Y=!!W&&(void 0===D?p:D),X="object"==typeof Y&&Y.pointAtCenter;t().useLayoutEffect((()=>{w.current?.forceAlign()}),[X,T]),_e((()=>{I&&M?.(W,T)}),[I,W]);const Q=e=>{N(e),l?.(e)},Z=()=>{R(!1),o?.(T)};if(void 0===W)return null;const J="boolean"==typeof z?z:!!z,ee="boolean"==typeof z?void 0:z,te=Object.assign({},f,$),re=Ce("tour"),ne=[{[`${re}-${d}`]:"primary"===d},h,q],ae=Lc({arrowPointAtCenter:X,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Vc,{zIndex:V,prefixCls:re,pos:B,showMask:J,style:ee?.style,fill:ee?.color,open:A,animated:x,rootClassName:h}),t().createElement(qc(),Gc({ref:w},C,{zIndex:V,builtinPlacements:ae,popupStyle:te,popupPlacement:G,popupVisible:A,popupClassName:Se()(ne),prefixCls:re,popup:()=>t().createElement(Wc,Gc({key:"content",arrow:Y,prefixCls:re,total:n.length,renderPanel:b,indicatorsRender:y,onPrev:()=>{Q(T-1)},onNext:()=>{Q(T+1)},onClose:Z,current:T,onFinish:()=>{Z(),s?.()}},n[T])),arrow:!!Y,getTriggerDOMNode:e=>e||W||document.body,forceRender:!1,destroyPopupOnHide:!0}),t().createElement($c(),{open:A,autoLock:!0},t().createElement("div",{className:Se()(h,`${re}-target-placeholder`),style:{...B||Yc,position:"fixed",pointerEvents:"none"}}))),m&&t().createElement($c(),{open:I},t().createElement(zc,{zIndex:V,prefixCls:re,onPause:()=>k(!1),onPlay:()=>k(!0)})))}));Xc.displayName="QmTour";const Qc=Xc,Zc=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Jc=e=>({_s:e,status:Zc[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),ed=e=>e?6:5,td=(e,t,r,n,a)=>{clearTimeout(n.current);const i=Jc(e);t(i),r.current=i,a?.({current:i})},rd=r=>{const{name:n,in:a,timeout:i,preEnter:l=!0,preExit:o}=r,[s,c]=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:r=!0,exit:n=!0,preEnter:a,preExit:i,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=t||{},[u,p]=(0,e.useState)((()=>Jc(o?2:ed(s)))),m=(0,e.useRef)(u),h=(0,e.useRef)(),[f,g]=(e=>(0,J.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(l),b=(0,e.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return ed(t)}})(m.current._s,c);e&&td(e,p,m,h,d)}),[d,c]),y=(0,e.useCallback)((e=>{const t=e=>{switch(td(e,p,m,h,d),e){case 1:f>=0&&(h.current=setTimeout(b,f));break;case 4:g>=0&&(h.current=setTimeout(b,g));break;case 0:case 3:h.current=setTimeout((()=>t(e+1)),0)}},l=m.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&t(r?a?0:1:2):l&&t(n?i?3:4:ed(c))}),[b,d,r,n,a,i,f,g,c]);return(0,e.useEffect)((()=>()=>clearTimeout(h.current)),[]),[u,y,b]}({timeout:i,preEnter:l,preExit:o,initialEntered:a});return Rc((()=>{c()}),[a]),t().createElement(t().Fragment,null,t().Children.map(r.children,(e=>t().isValidElement(e)?Ys(e,{className:Se()(e.props.className,n,s.status)}):e)))},nd={previewWidth:1100,defaultDistance:.45,logoHeight:60},ad=(0,e.createContext)(void 0);var id=null;function ld(){try{var e=navigator.userAgent;if(e.match(/Windows\sPhone/i))return!0;if(e.match(/iPhone|iPod|iPad/i))return!0;if(e.match(/Android/i))return!0;if(e.match(/Edge\D?\d+/i))return!0;var t=e.match(/Trident\D?\d+/i),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!r&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function od(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(ld()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void O.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?r=a?e:t:id?r=id:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),id=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&ld(),r}catch(e){O.message.error("getLodop 出错:"+e)}}ld();const sd=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},cd=t().forwardRef(((e,r)=>{const{templateRender:n,directPrint:a}=e,{global:i}=t().useContext(l),{$$preview:o}=t().useContext(ad),{state:s,isWindowsPrinter:c,pageSize:d}=o,u=t().useRef(null),p=t().useRef({}),m=t().useRef([]),h=t().useRef([]),f=t().useRef([]),[b,y]=t().useState(!0);t().useImperativeHandle(r,(()=>({createPreviewDom:A,createExportHtml:F,createPrintHtml:k,SHOW_PREVIEW:L,DIRECT_PRINT:H}))),_e((()=>{O()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),t().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const v=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*nd.defaultDistance+10*nd.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[s,c,d]),x=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*nd.defaultDistance+10*nd.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return sd(v-10*(e.left-nd.defaultDistance)-10*(e.right-nd.defaultDistance))}),[s,v]),S=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return sd(x-10*(e.top-nd.defaultDistance)-10*(e.bottom-nd.defaultDistance))}),[s,x]),C=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:sd(10*e.left),right:sd(10*e.right),top:sd(10*e.top),bottom:sd(10*e.bottom)}}),[s]),T=t().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:r,top:n,bottom:a}=w,i=E+t+r,l=nd.previewWidth-i<=0?0:(nd.previewWidth-i)/2,o=Math.abs((1-C)*i/2);let c=0;return C>1&&(c=o>l?-1*l:-1*o),C<1&&(c=i-2*o>nd.previewWidth?0:l>0?o:(nd.previewWidth-(i-2*o))/2),{width:`${E}px`,height:"stylus"===e?"auto":S+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${C})`,opacity:b?0:1}}),[s,b,w,C,S,E]),N=(m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=i?.print?.leftLogo??"",t=i?.print?.rightLogo??"";return[`<tr style="height: ${nd.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),I=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},P=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",r.push(a),t.push(e[n].outerHTML)}h.current=r,m.current=t},O=()=>{if(!m.current.length)return;const{form:{setting:e,printerType:t}}=s;if(a)return f.current.push([I(),N(),...m.current]);const r=e.fixedLogo?S-nd.logoHeight:S;let n=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[N()]:[],...m.current]);else{let t=0;for(let a=0,i=h.current.length;a<i;a++){const l=m.current[a],o=h.current[a];e.fixedLogo||0!==a||(t+=nd.logoHeight),t+=o,t<=r?n.push(l):(f.current.push([I(),...e.fixedLogo?[N()]:[],...n]),n=[],t=0,a-=1),a===i-1&&n.length&&f.current.push([I(),...e.fixedLogo?[N()]:[],...n])}}e.fixedLogo||f.current[0]?.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');o.setState({currentPage:1,totalPage:f.current.length}),A()},A=()=>{const{currentPage:e}=s;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},F=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+I()+e.join("")+"</table>"},L=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return $();p.current.previewEl.innerHTML||(R(),await ie(0),P(),O(),y(!1))},H=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return $();R(),await ie(0),P(),O(),y(!1),o.doPrint(k()),await ie(0),o.doClose()},$=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:u,className:Se()(D)},t().createElement(ft,{wrapperClassName:"spin",spinning:b,tip:"Loading..."},t().createElement("div",{className:"preview"},t().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},n?.()),t().createElement("div",{className:"workspace",style:T}))))}));cd.displayName="Container";const dd=cd;function ud(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class pd extends e.Component{constructor(){super(...arguments),ud(this,"formRef",t().createRef()),ud(this,"createFormList",(()=>[{type:"DIVIDER",fieldName:"_1",label:p("qm.print.setPanel.printParameter")},{type:"SELECT",label:p("qm.print.setPanel.pagerType"),fieldName:"pageSize",options:{itemList:[{text:"A2",value:"420*594"},{text:"A3",value:"420*297"},{text:"A4",value:"210*297"},{text:"A5",value:"210*148"},{text:p("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:p("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:p("qm.print.setPanel.vertical"),value:"vertical"},{text:p("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:p("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:p("qm.print.setPanel.manualDoublePrint"),value:"manual"}]},disabled:!this.props.setting.doubleSide},options:{trueValue:1,falseValue:0},onChange:e=>{const{formList:t}=this.state;t.find((e=>"doubleSide"===e.fieldName)).label.disabled=!e,this.setState({formList:t})}},{type:"CHECKBOX",label:p("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:p("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:nd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:nd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:nd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:nd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),ud(this,"getInitialvalue",(()=>{const{setting:e}=this.props,{distance:t}=e;return Object.assign({},{disleft:t.left,disright:t.right,distop:t.top,disbottom:t.bottom,pageSize:e.pageSize,direction:e.direction,doubleSide:e.doubleSide,doubleSideType:e.doubleSideType,fixedLogo:e.fixedLogo})})),ud(this,"getInitialExtra",(()=>({disleft:p("qm.print.setPanel.sizeUnit"),disright:p("qm.print.setPanel.sizeUnit"),distop:p("qm.print.setPanel.sizeUnit"),disbottom:p("qm.print.setPanel.sizeUnit")}))),ud(this,"state",{formList:this.createFormList()}),ud(this,"confirmHandle",(async()=>{const[e,t]=await this.formRef.current.GET_FORM_DATA();e||(this.props.onChange({distance:{left:t.disleft,right:t.disright,top:t.distop,bottom:t.disbottom},pageSize:t.pageSize,direction:t.direction,doubleSide:t.doubleSide,doubleSideType:t.doubleSideType,fixedLogo:t.fixedLogo}),this.cancelHandle())})),ud(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return t().createElement(t().Fragment,null,t().createElement(bl,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),t().createElement(he,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}ud(pd,"contextType",l);const md=pd;function hd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fd extends e.Component{constructor(){super(...arguments),hd(this,"provide",{$$preview:this}),hd(this,"containRef",t().createRef()),hd(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:nd.defaultDistance,right:nd.defaultDistance,top:nd.defaultDistance,bottom:nd.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),hd(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),hd(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),hd(this,"printClickHandle",(async()=>{if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e={...this.state.form,printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text};await ms().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),hd(this,"doClose",(()=>{this.props.onClose?.()})),hd(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),hd(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),hd(this,"createStyle",(()=>'\n <style type="text/css">\n table {\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n table-layout: fixed;\n }\n table tr td {\n padding: 2px;\n line-height: 1.2;\n word-wrap: break-word;\n }\n .fs12 {\n font-size: 12px;\n }\n .fs13 {\n font-size: 13px;\n }\n .fs14 {\n font-size: 14px;\n }\n .fw500 {\n font-weight: 500;\n }\n .fw700 {\n font-weight: 700;\n }\n .fl {\n float: left;\n }\n .fr {\n float: right;\n }\n .tc {\n text-align: center;\n }\n .tr {\n text-align: right;\n }\n .bor {\n border: 1px solid #000;\n }\n .bor-t {\n border-top: 1px solid #000;\n }\n .bor-b {\n border-bottom: 1px solid #000;\n }\n .bor-l {\n border-left: 1px solid #000;\n }\n .bor-r {\n border-right: 1px solid #000;\n }\n .no-bor {\n border: none !important;\n }\n </style>\n ')),hd(this,"doPrint",(e=>{const t=od();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=nd,{left:d,right:u,top:m,bottom:h}=a.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),a.doubleSide&&("auto"===a.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===l&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():O.message.error(p("qm.print.printError"))},t.PRINT()})),hd(this,"doExport",(e=>{const t=od();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():O.message.error(p("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===a.direction?1:2),t.SAVE_TO_FILE(`${s()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:p("qm.print.laserPrinter"),value:"laser"},{text:p("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=od(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){g("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await ms().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(e)&&await ms().setItem(this.printerKey,e)),(0,J.isPlainObject)(e)&&Object.keys(e).length&&(0,J.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:r}=this.props,{visible:n,form:a,currentPage:i,totalPage:l,printPage:o}=this.state,s=Ce("print-preview"),c={visible:n,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?t().createElement(t().Fragment,null,t().createElement("div",{className:Se()(d)},t().createElement("div",{className:"outer"},t().createElement("div",{className:"header"},t().createElement("span",null,p("qm.print.printer"),":",t().createElement(O.Select,{value:a.printerName,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.type"),":",t().createElement(O.Select,{value:a.printerType,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.copies"),":",t().createElement(O.InputNumber,{value:a.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),t().createElement("span",null,p("qm.print.printPage.0"),t().createElement(O.InputNumber,{value:o,min:1,max:l,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),p("qm.print.printPage.1")),t().createElement("span",null,t().createElement(O.Pagination,{size:"small",current:i,pageSize:1,total:l,onChange:this.pageChangeHandle})),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(we.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(we.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),t().createElement("span",null,t().createElement(he,{icon:t().createElement(we.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),t().createElement("div",{className:"main"},t().createElement(ad.Provider,{value:this.provide},t().createElement(dd,{ref:this.containRef,templateRender:r,directPrint:!1}))),t().createElement("div",{className:"footer"},t().createElement("span",null,p("qm.print.scale"),":",t().createElement(O.Slider,{value:a.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{scale:e}})))}}),t().createElement("em",{className:"scale-text"},`${Math.floor(100*a.scale)}%`)),t().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:i,totalPage:l}))))),t().createElement(cr,c,t().createElement(md,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(ad.Provider,{value:this.provide},t().createElement(dd,{ref:this.containRef,templateRender:r,directPrint:!0}))}}hd(fd,"contextType",l);const gd=fd;function bd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class yd extends e.Component{constructor(){super(...arguments),bd(this,"previewRef",t().createRef()),bd(this,"state",{visible:!1,loading:!1}),bd(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),bd(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:r,uniqueKey:n,defaultConfig:a,preview:i,closeAfterPrint:l}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${nd.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:r,uniqueKey:n,defaultConfig:a,preview:i,closeAfterPrint:l,onClose:()=>{this.setState({visible:!1})}};return i?t().createElement(cr,o,t().createElement(gd,s)):e?t().createElement(gd,s):null})),bd(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ie(0),this.setState({visible:!0}),await ie(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:r,icon:n,type:a,disabled:i,shape:l}=this.props,o={size:r||this.context.size||"",type:a,shape:l,icon:n,loading:e,disabled:i,click:this.clickHandle};return t().createElement(t().Fragment,null,this.props.children&&t().createElement(he,o,this.props.children),this.createRender())}}bd(yd,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:i().elementType}),bd(yd,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),bd(yd,"contextType",l);const vd=yd;function xd(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function Ed(e){const t=xd(e);return t?t.frameElement:null}function Sd(e){const t=Td(e);return Cd([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Cd(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function wd(e,t){const r=Ed(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=Sd(a);if(n.push(e),a=Ed(a),i)break;a&&xd(a)===t&&(i=!0)}return Cd(n)}return e.getBoundingClientRect()}function Td(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function Nd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Id=Object.assign;class Rd{constructor(e,t){Nd(this,"node",void 0),Nd(this,"border",void 0),Nd(this,"padding",void 0),Nd(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=kd.border,this.padding.style.borderColor=kd.padding,this.content.style.backgroundColor=kd.background,Id(this.node.style,{borderColor:kd.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){Ad(t,"margin",this.node),Ad(t,"border",this.border),Ad(t,"padding",this.padding),Id(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),Id(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class Pd{constructor(e,t){Nd(this,"tip",void 0),Nd(this,"nameSpan",void 0),Nd(this,"dimSpan",void 0),this.tip=e.createElement("div"),Id(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),Id(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),Id(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),a=Math.max(r.width,60);let i;i=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let l=e.left+5;return e.left<t.left&&(l=t.left+5),e.left+a>t.left+t.width&&(l=t.left+t.width-a-5),i+="px",l+="px",{style:{top:i,left:l}}}(e,t,{width:r.width,height:r.height});Id(this.tip.style,n.style)}}class Od{constructor(){Nd(this,"window",void 0),Nd(this,"tipBoundsWindow",void 0),Nd(this,"container",void 0),Nd(this,"tip",void 0),Nd(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new Pd(r,this.container),this.rects=[],r.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new Rd(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=wd(e,this.window),a=Td(e);n.top=Math.min(n.top,r.top-a.marginTop),n.right=Math.max(n.right,r.left+r.width+a.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+a.marginBottom),n.left=Math.min(n.left,r.left-a.marginLeft),this.rects[t].update(r,a)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const a=wd(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function Ad(e,t,r){Id(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const kd={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let Fd=null,Ld=null;function Hd(){null!=window.document&&(Fd=null,null!==Ld&&(Ld.remove(),Ld=null))}function $d(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Dd{constructor(e){$d(this,"_isRunning",void 0),$d(this,"_selectIgnore",void 0),$d(this,"_lastHoveredNode",null),$d(this,"excludeSelectors",void 0),$d(this,"onSelect",void 0),$d(this,"iframesListeningTo",new Set),$d(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),$d(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),$d(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),$d(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Xe(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Hd();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var r;r=[t],null,!1,null!=window.document?(null!==Fd&&clearTimeout(Fd),null!=r&&(null===Ld&&(Ld=new Od),Ld.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),$d(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),$d(this,"selectFiberForNode",(0,J.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;if(e===t)return"/";const r=[];let n=e;for(;n!==t&&null!==n;){const e=n.tagName.toLowerCase();let t="";if(n.id)t=`[@id="${n.id}"]`;else if(n.getAttribute("name"))t=`[@name="${n.getAttribute("name")}"]`;else{let r=n.previousElementSibling,a=1;for(;null!==r;)r.tagName.toLowerCase()===e&&a++,r=r.previousElementSibling;t=`[${a}]`}n.nodeType!==Node.TEXT_NODE&&r.push(e+t),n=n.parentElement}return"/html/"+r.reverse().join("/")}(e))}),200,{leading:!1})),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){Hd(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function qd(e){return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}const _d=e=>{const{action:r,onConfirm:n,onCancel:a,onFinish:i}=e,{t:l}=Uc();return t().createElement(t().Fragment,null,t().createElement("div",{style:{height:100}},l("qm.table.config.emptyText")),t().createElement(xe,{style:{width:"100%",justifyContent:"flex-end"}},t().createElement(he,{size:"small",onClick:()=>a?.()},l("qm.guideTracker.closeButton")),t().createElement(he,{size:"small",onClick:()=>n?.()},l("add"===r?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t().createElement(he,{size:"small",onClick:()=>i?.()},l("qm.guideTracker.finishButton"))))},jd={left:"50%",top:"50%",width:1,height:1},Kd=1001,Md=t().forwardRef(((e,r)=>{const{open:n,current:a,defaultCurrent:i,steps:l=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,onChange:m,onClose:h,onFinish:f}=e,{t:g}=Uc(),b=t().useRef(),y=t().useRef(l.length),[v,x]=Oc(0,{value:a,defaultValue:i}),[E,S]=Oc(void 0,{value:n,postState:e=>e??!1}),[C,w]=t().useState({}),[T,N]=t().useState(!1),[I,R]=t().useState(!1),[P,A]=Nc(C.node,!!n),[k,F]=t().useState(22),L=t().useRef(!1),H=t().useMemo((()=>v>=l.length?"add":"edit"),[v,l]),$=t().useMemo((()=>`${v+1} / ${l.length}`),[v,l]);t().useLayoutEffect((()=>{b.current=new Dd({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{w({id:Kn(),node:e,path:t}),x(y.current),N(!0),q()}})}),[]),t().useEffect((()=>(E?D():q(),()=>{q()})),[E]),t().useEffect((()=>{y.current=l.length}),[l]);const D=()=>{b.current.startHandle()},q=()=>{b.current.stopHandle()},_=e=>{e.stopPropagation(),e.preventDefault()};t().useImperativeHandle(r,(()=>({OPEN:()=>S(!0),CLOSE:()=>S(!1),GET_CURRENT_STEP:()=>({current:v,nodePath:C.path})})));const j=Ce("guide-tracker"),K=[{[`${j}-primary`]:!0}],M=Lc({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(qc(),{zIndex:Kd,builtinPlacements:M,popupPlacement:o,popupVisible:E&&T,popupClassName:Se()(K,c),popupStyle:d,prefixCls:j,popup:()=>{const e=()=>{N(!1),D()};return t().createElement("div",{className:`${j}-content`},t().createElement("div",{className:`${j}-inner`},t().createElement(we.CloseOutlined,{className:`${j}-close`,onClick:()=>{h?.(v),e()}}),t().createElement(O.Dropdown,{open:I,trigger:["click"],dropdownRender:()=>l.length?t().createElement("div",{className:"ant-dropdown-menu step-list"},t().createElement(Xn.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.id)),r=l.map((e=>e.id));if((0,J.isEqual)(t,r))return;const n=t.findIndex((e=>e===C.id)),a=-1!==n?n:v;x(a),m?.(Yn(e),a)}},l.map(((e,r)=>t().createElement("li",{key:r,className:Se()("item",{actived:e.id===C.id})},t().createElement(we.HolderOutlined,{className:"handle",title:g("qm.form.draggable")}),t().createElement("span",{className:"box"},t().createElement("span",{className:"title",title:e.title,onClick:()=>{r!==v&&(w({id:e.id,node:qd(e.nodePath),path:e.nodePath}),x(r),F(22===k?k+1:k-1),m?.(l,r))}},e.title),t().createElement(O.Popconfirm,{title:g("qm.button.confirmTitle"),zIndex:1051,onConfirm:()=>{const t=l.filter((t=>t.id!==e.id)),n=r===v;let a=r<=v?v-1:v;if(a=a<0?0:a,a=a>t.length?t.length:a,n&&t[a]){const{id:e,nodePath:r}=t[a];w({id:e,node:qd(r),path:r})}x(a),m?.(t,a)}},t().createElement(we.CloseOutlined,{className:"close-icon"})))))))):t().createElement(t().Fragment,null),overlayClassName:`${j}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180},onOpenChange:e=>R(e)},t().createElement(we.MenuOutlined,{className:Se()(`${j}-close`,"menu-icon"),style:{width:k}})),t().createElement("div",{className:"panel-label"},t().createElement("span",{className:"title"},g("qm.guideTracker.label")),t().createElement("span",{className:"step"},g("qm.guideTracker.currentStep"),$)),p?p({id:C.id,nodePath:C.path,actionStatus:H,DO_CLOSE:e},v):t().createElement(_d,{action:H,onConfirm:()=>{m?.("add"===H?[...l,{id:C.id,nodePath:C.path,title:"Guide Title"}]:[...l],v),e()},onCancel:()=>{h?.(v),e()},onFinish:()=>{e(),h?.(v),f?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t().createElement($c(),{open:E&&T,autoLock:!0},t().createElement("div",{className:Se()(`${j}-target-placeholder`),style:{...P||jd,position:"fixed",zIndex:Kd,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:_,onClick:_}))),s&&t().createElement($c(),{open:E},t().createElement(zc,{zIndex:Kd,prefixCls:j,onPause:()=>{L.current=T,N(!1),q()},onPlay:()=>{L.current?N(!0):D()}})))}));Md.displayName="QmGuideTracker";const Vd=Md,zd=r=>{const{content:n,image:a,width:i,height:l,font:o={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:p=1,antiTamper:m=!0,grayscale:h,className:f,style:g}=r,b=t().useRef(null),y=t().useRef(new Map),v=o.fontSize??16,x=o.fontWeight??"normal",E=o.fontStyle??"normal",S=o.fontFamily??"sans-serif",C=o.color??"rgba(0, 0, 0, 0.15)",w=o.textAlign??"center",T=Array.isArray(n)?n:[n],N=s[0],I=s[1],R=N/2,P=I/2,O=c[0]??R,A=c[1]??P,k=t().useMemo((()=>{const e=O-R,t=A-P;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:u}}),[R,P,O,A,u]),F=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const r=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[n,o]=(e=>{let t=120,r=64;if(!a&&e.measureText){e.font=`${v}px ${S}`;const n=T.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...n)),r=v*T.length+3*(T.length-1)}return[i??t,l??r]})(t),s=n*r,c=o*r,u=(N+n)*r,m=(I+o)*r,f=N/2*r,g=I/2*r,R=u/2,P=m/2,O=2*(N+n);e.width=2*u,e.height=2*m,t.globalAlpha=p,t.save(),t.translate(R,P),t.rotate(Math.PI/180*d),t.translate(-R,-P);const A=()=>{t.restore(),t.drawImage(e,0,0,u,m,u,m,u,m),h&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,r]=e;return`${n=t,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${r}`;var n})).join(";"))({...k,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),O)};if(a){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),A()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=a}else{const e=Number(v)*r;t.font=`${E} normal ${x} ${e}px/${o}px ${S}`,t.fillStyle=C,t.textAlign=w,t.textBaseline="top",t.translate(s/2,0),T.forEach(((n,a)=>{t.fillText(n??"",f,g+a*(e+3*r))})),A()}},L=e=>Array.from(y.current.values()).includes(e);t().useEffect((()=>{F()}),[n,a,i,l,o,s,c,d,u,p,m,h]),function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=window&&"MutationObserver"in window,i=e.useRef(),l=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};e.useEffect((()=>(l(),a&&t.current&&(i.current=new MutationObserver(r),i.current.observe(t.current,n)),()=>l())),[t])}(b,(e=>{if(m)for(const t of e){const e=Array.from(t.removedNodes).some((e=>L(e))),r="attributes"===t.type&&L(t.target);if(e||r){F();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const H=Ce("watermark");return t().createElement("div",{ref:b,className:Se()(H,f),style:{position:"relative",...g}},r.children)},Ud="1.7.56"})(),a})()));