@jiaozhiye/qm-design-react 2.0.1 → 2.0.3
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/form/src/types.d.ts +3 -0
- package/lib/index.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/lib/style/index.css +12 -5
- package/lib/style/index.min.css +1 -1
- package/lib/table/style/body.less +77 -77
- package/lib/upload-file/src/upload-file.d.ts +1 -0
- package/lib/upload-file/style/index.less +7 -1
- package/lib/upload-img/style/index.less +6 -1
- package/package.json +1 -1
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:()=>L,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:()=>_,DcpAnchor:()=>Wt,DcpButton:()=>he,DcpCollapse:()=>$e,DcpConfigProvider:()=>X,DcpCopyToClipboard:()=>Bs,DcpCountup:()=>ct,DcpCropper:()=>Zi,DcpDivider:()=>Ie,DcpDownload:()=>qt,DcpDrawer:()=>nr,DcpEmpty:()=>mt,DcpForm:()=>Ii,DcpGuideTracker:()=>Dd,DcpModal:()=>cr,DcpPrint:()=>fd,DcpRangeTableHelper:()=>vc,DcpScrollbar:()=>Pt,DcpSearchHelper:()=>lc,DcpSearchTree:()=>vl,DcpSpace:()=>xe,DcpSpin:()=>ft,DcpSplit:()=>nt,DcpTable:()=>nc,DcpTabs:()=>Jt,DcpTinymce:()=>Wi,DcpTour:()=>Wc,DcpTransition:()=>Zc,DcpTreeHelper:()=>hc,DcpTreeTableHelper:()=>pc,DcpUploadFile:()=>rl,DcpUploadImg:()=>cl,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:()=>$e,QmConfigProvider:()=>X,QmCopyToClipboard:()=>Bs,QmCountup:()=>ct,QmCropper:()=>Zi,QmDivider:()=>Ie,QmDownload:()=>qt,QmDrawer:()=>nr,QmEmpty:()=>mt,QmForm:()=>Ii,QmGuideTracker:()=>Dd,QmModal:()=>cr,QmPrint:()=>fd,QmRangeTableHelper:()=>vc,QmScrollbar:()=>Pt,QmSearchHelper:()=>lc,QmSearchTree:()=>vl,QmSpace:()=>xe,QmSpin:()=>ft,QmSplit:()=>nt,QmTable:()=>nc,QmTabs:()=>Jt,QmTinymce:()=>Wi,QmTour:()=>Wc,QmTransition:()=>Zc,QmTreeHelper:()=>hc,QmTreeTableHelper:()=>pc,QmUploadFile:()=>rl,QmUploadImg:()=>cl,Radio:()=>O.Radio,Rate:()=>O.Rate,Result:()=>O.Result,Row:()=>O.Row,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:()=>Ra,version:()=>jd});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",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 H=n.n(F);require("antd/es/calendar/style");const L=H()(k()),q=require("antd/es/date-picker/generatePicker");var $=n.n(q);require("antd/es/date-picker/style/index");const _=$()(k());function D(){return D=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},D.apply(this,arguments)}const j=e.forwardRef(((t,r)=>e.createElement(_,D({},t,{picker:"time",mode:void 0,ref:r}))));j.displayName="TimePicker";const K=e.forwardRef(((t,r)=>e.createElement(_.RangePicker,D({},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",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,disabled:i,className:l,style:o,id:s}=this.props,c=e||this.context.size||"",d=Ce("divider"),u={[d]:!0,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c};return t().createElement("div",{id:s,className:Se()(u,l),style:o},t().createElement("span",{className:Se()(`${d}__title`)},r),t().createElement("div",{className:Se()(`${d}__extra`)},n),void 0!==a&&t().createElement(O.Button,{type:"link",className:Se()(`${d}__collapse`),disabled:i,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}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}),Te(Ne,"contextType",l);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 He=Fe;function Le(){return Le=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},Le.apply(this,arguments)}const qe=e=>{const{defaultActive:r,label:n,extra:a,className:i,style:l,containerStyle:o,disabled:s,forceRender:c,destroyOnClose:d=!1,onChange:u}=e,[p,m]=t().useState(!!r),h=Ce("collapse"),f=Se()({[`${h}`]:!0,[`${h}-active`]:p,[`${h}-disabled`]:s},i);return t().createElement("div",{className:f,style:l},t().createElement(Ie,{label:n,extra:a,collapse:p,disabled:s,onCollapseChange:e=>{m(e),u?.(e)}}),t().createElement(ke(),Le({visible:p},Oe,{leavedClassName:`${h}-content-hidden`,forceRender:c,removeOnLeave:d}),((r,n)=>{let{className:a,style:i}=r;return t().createElement(He,{ref:n,prefixCls:h,className:a,style:i,boxStyle:o,isActive:p,forceRender:c},e.children)})))};qe.displayName="QmCollapse";const $e=qe,_e=t().createContext(void 0);function De(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(_e),[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(_e),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);De((()=>{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(_e.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,style:r={}}=this.props,n={[`${Ce("spin")}-full-height`]:e},a={wrapperClassName:Se()(n),...Z()(this.props,["fullHeight"]),style:{...r,maxHeight:"none"}};return t().createElement(O.Spin,a,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(Zc,{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);De((()=>{!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,(()=>({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 Ht(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 Lt extends e.Component{constructor(){super(...arguments),Ht(this,"state",{loading:!1}),Ht(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)}}Ht(Lt,"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}),Ht(Lt,"defaultProps",{icon:t().createElement(we.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),Ht(Lt,"contextType",l);const qt=Lt,$t=require("add-dom-event-listener");var _t=n.n($t);const Dt=require("scroll-into-view-if-needed");var jt=n.n(Dt);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=_t()(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=_t()(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},Hr=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},disabled:s}=e.option,{falseValue:c=fr,trueValue:d=hr}=l;return t().createElement(O.Checkbox,{checked:n===d,style:o,disabled:s||r.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{a?.(e),i(e,p(e===d?"am.form.trueText":"am.form.falseText"))})(t?d:c)}})};class Lr 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(Hr,{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}(Lr,"contextType",pr);const qr=Lr,$r=require("react-sortablejs");function _r(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 Dr extends e.Component{get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}constructor(e){super(e),_r(this,"linkRef",t().createRef()),_r(this,"state",{visible:!1}),this.initLocalfields()}async getTableFieldsConfig(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){}}async saveTableColumnsConfig(e,t){const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getTableFieldsConfig(this.formUniqueKey).then((e=>{if(!e)return this.setLocalFields(this.props.items);localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()})).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.saveTableColumnsConfig(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($r.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));(0,J.isEqual)(r,a)||(n.setExpandHandle(!0),this.changeHandle(t),this.setLocalFields(t))}},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)))}))}}_r(Dr,"contextType",l);const jr=Dr,Kr=e=>{const{value:r,bordered:n}=e;return t().createElement(O.Input,{value:r,title:r,bordered:n,readOnly:!0})};Kr.displayName="FormItemView";const Mr=Kr;function Vr(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 zr=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(Mr,{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)}})}));zr.displayName="VInput";class Ur extends e.Component{constructor(){super(...arguments),Vr(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(zr,{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}))))}}Vr(Ur,"contextType",pr);const Br=Ur,Wr=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(Mr,{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 Gr 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(Wr,{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}(Gr,"contextType",pr);const Yr=Gr,Xr=require("big.js");var Qr=n.n(Xr);function Zr(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 Jr=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(Qr())(e).toFixed(v);return"function"==typeof w?w(t):t},P={[S]:!0,controls:C};return n.isOnlyShow?t().createElement(Mr,{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)}})}));Jr.displayName="VInputNumber";class en extends e.Component{constructor(){super(...arguments),Zr(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(Jr,{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}))))}}Zr(en,"contextType",pr);const tn=en,rn=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(Mr,{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 nn 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(rn,{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}(nn,"contextType",pr);const an=nn;let ln=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function on(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:sn}=O.Input;class cn extends e.Component{constructor(e){var t;super(e),t=this,on(this,"searchHelper",{}),on(this,"alias",void 0),on(this,"extras",void 0),on(this,"deriveParams",void 0),on(this,"valueKey",void 0),on(this,"_is_change",!1),on(this,"_record",void 0),on(this,"_prevValue",void 0),on(this,"state",{visible:!1,loading:!1}),on(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),on(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` 一起使用")})),on(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),on(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),on(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})}})),on(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),on(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 a.forEach((e=>i[e]=n)),i})),on(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()}))})),on(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})}})),on(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)})),on(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?.())})),on(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;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])});this._record=e;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)}))})),on(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)})),on(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("")}})),on(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),on(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),on(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),on(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:`${ln[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(Mr,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(sn,{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(lc,x)))}}on(cn,"contextType",pr);class dn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),on(this,"promiseRef",void 0),on(this,"searchRef",void 0),on(this,"state",{searchHelper:{}}),on(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),on(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(cn,{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}))))}}on(dn,"contextType",pr);const un=dn;function pn(){return pn=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},pn.apply(this,arguments)}function mn(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 hn=r=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,mn(this,"startClick",void 0),mn(this,"event1",null),mn(this,"event2",null),mn(this,"$el",null),mn(this,"omitClassNames",[]),mn(this,"state",{clickOutside:!1}),mn(this,"mousedownHandler",(e=>{this.startClick=e})),mn(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),mn(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})})),mn(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),mn(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=_t()(document,"mousedown",this.mousedownHandler),this.event2=_t()(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,pn({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return mn(n,"displayName",`OutsideClick(${r.displayName||r.name})`),t().forwardRef(((e,r)=>t().createElement(n,pn({},e,{forwardedRef:r}))))},fn=require("rc-trigger");var gn,bn,yn=n.n(fn);function vn(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 xn=hn((bn=class extends e.Component{constructor(e){var r;super(e),r=this,vn(this,"searchHelper",{}),vn(this,"alias",void 0),vn(this,"_records",[]),vn(this,"searchRef",t().createRef()),vn(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),vn(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`")})),vn(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})),vn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),vn(this,"setItemList",(e=>{this.setState({itemList:e})})),vn(this,"setRecords",(e=>{this._records=e})),vn(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),vn(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),vn(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?.())})),vn(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)}))})),vn(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:`${ln[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(Mr,{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(yn(),{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(lc,x)))}},vn(bn,"contextType",pr),gn=bn))||gn;class En extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),vn(this,"promiseRef",void 0),vn(this,"state",{searchHelper:{}}),vn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),vn(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(xn,{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}))))}}vn(En,"contextType",pr);const Sn=En;function Cn(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:wn}=O.Input;class Tn extends e.Component{constructor(e){super(e),Cn(this,"searchHelper",{}),Cn(this,"alias",void 0),Cn(this,"extras",void 0),Cn(this,"valueKey",void 0),Cn(this,"_record",void 0),Cn(this,"_prevValue",void 0),Cn(this,"state",{visible:!1,loading:!1}),Cn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Cn(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` 一起使用")})),Cn(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),Cn(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Cn(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})}})),Cn(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])})})),Cn(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?.())})),Cn(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;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])});this._record=e;const n=Ir(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Cn(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("")})),Cn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Cn(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:`${ln[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(Mr,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(wn,{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(pc,x)))}}Cn(Tn,"contextType",pr);class Nn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Cn(this,"promiseRef",void 0),Cn(this,"state",{searchHelper:{}}),Cn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Cn(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(Tn,{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}))))}}Cn(Nn,"contextType",pr);const In=Nn;var Rn,Pn;function On(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 An=hn((Pn=class extends e.Component{constructor(e){var r;super(e),r=this,On(this,"searchHelper",{}),On(this,"alias",void 0),On(this,"_records",[]),On(this,"searchRef",t().createRef()),On(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),On(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`")})),On(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})),On(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),On(this,"setItemList",(e=>{this.setState({itemList:e})})),On(this,"setRecords",(e=>{this._records=e})),On(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),On(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),On(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?.())})),On(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)}))})),On(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:`${ln[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(Mr,{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(yn(),{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(pc,x)))}},On(Pn,"contextType",pr),Rn=Pn))||Rn;class kn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),On(this,"promiseRef",void 0),On(this,"state",{searchHelper:{}}),On(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),On(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(An,{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}))))}}On(kn,"contextType",pr);const Fn=kn;function Hn(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 Ln=new Array(2).fill("");class qn extends e.Component{constructor(e){var t;super(e),t=this,Hn(this,"searchHelper",{}),Hn(this,"alias",void 0),Hn(this,"_is_change",!1),Hn(this,"_ceho_data",void 0),Hn(this,"_records",[]),Hn(this,"_is_clear",!1),Hn(this,"state",{visible:!1,loading:!1,itemList:[],textValue:Ln}),Hn(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`")})),Hn(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Hn(this,"setItemList",(e=>{this.setState({itemList:e})})),Hn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Hn(this,"setTextValue",(e=>{this.setState({textValue:e})})),Hn(this,"setRecords",(e=>{this._records=e})),Hn(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),Hn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),Hn(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(Ln),this.triggerChange([])})),Hn(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)}))})),Hn(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?.())})),Hn(this,"createFilters",(e=>{const{fieldName:t}=this.props.option;return{[t]:se(e)?void 0:e}})),Hn(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()}))})),Hn(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()})),Hn(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=Ln.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:`${ln[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(Mr,{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(vc,g)))}}Hn(qn,"contextType",pr);class $n extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Hn(this,"promiseRef",void 0),Hn(this,"state",{searchHelper:{}}),Hn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Hn(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(qn,{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}))))}}Hn($n,"contextType",pr);const _n=$n;function Dn(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 jn=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(Mr,{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 Kn extends e.Component{constructor(){super(...arguments),Dn(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(jn,{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}))))}}Dn(Kn,"contextType",pr);const Mn=Kn,Vn=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}=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 zn 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(Vn,{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}(zn,"contextType",pr);const Un=zn;function Bn(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 Wn=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.find((t=>t.value===e))?.text??"";return r.isOnlyShow?t().createElement(Mr,{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 Gn extends e.Component{constructor(){super(...arguments),Bn(this,"state",{itemList:[]}),Bn(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(Wn,{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}))))}}Bn(Gn,"contextType",pr);const Yn=Gn,Xn=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},disabled:s}=e.option,{falseValue:c=fr,trueValue:d=hr}=l;return t().createElement(O.Switch,{checked:n===d,style:o,disabled:s||r.isOnlyShow,checkedChildren:t().createElement(we.CheckOutlined,null),unCheckedChildren:t().createElement(we.CloseOutlined,null),onChange:e=>{(e=>{a?.(e),i(e,p(e===d?"am.form.trueText":"am.form.falseText"))})(e?d:c)}})};class Qn 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(Xn,{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}(Qn,"contextType",pr);const Zn=Qn,Jn=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 ea 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(Jn,{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}(ea,"contextType",pr);const ta=ea,ra=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(Mr,{value:C(n),bordered:d}):t().createElement(_,{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 na 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(ra,{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}(na,"contextType",pr);const aa=na,ia=e=>[s()().subtract(e,"day"),s()()],la=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}=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]]:ia(7),[p("qm.form.dateRangePickers")[1]]:ia(30),[p("qm.form.dateRangePickers")[2]]:ia(90),[p("qm.form.dateRangePickers")[3]]:ia(180)},C=e=>Nr(e)?"":e.map((e=>["date","exactdate"].includes(f)?e?.slice(0,10):e)).join(" - ");return r.isOnlyShow?t().createElement(Mr,{value:C(n),bordered:d}):t().createElement(_.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 oa 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(la,{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}(oa,"contextType",pr);const sa=oa,ca=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(Mr,{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 da 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(ca,{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}(da,"contextType",pr);const ua=da,pa=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}=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(Mr,{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 ma 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(pa,{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}(ma,"contextType",pr);const ha=ma,fa={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"}},ga="阿",ba="鿿",ya=1,va=2,xa=3;let Ea,Sa=null;function Ca(e){return e||null===Sa?("object"==typeof Intl&&Intl.Collator?(Ea=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Sa=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Sa=!1,Sa):Sa}function wa(e){const t=fa.UNIHANS,r=fa.PINYINS,n=fa.EXCEPTIONS,a={source:e};if(e in n)return a.type=va,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=ya,a.target=e,a;if(i=Ea.compare(e,ga),i<0)return a.type=xa,a.target=e,a;if(0===i)a.type=va,l=0;else{if(i=Ea.compare(e,ba),i>0)return a.type=xa,a.target=e,a;0===i&&(a.type=va,l=t.length-1)}if(a.type=va,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=Ea.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=xa,a.target=a.source),a}function Ta(e){return"string"==typeof e&&Ca()?e.split("").map((e=>wa(e))):e}const Na={isSupported:Ca,parse:Ta,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(fa)})))},genToken:wa,convertToPinyin:(e,t,r)=>Ta(e).map((e=>t&&e.type===va?e.target.toLowerCase():e.target)).join(r||"")},Ia={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}};Na.isSupported()&&Ia.shouldPatch(Na.genToken)&&Na.patchDict(Ia);const Ra=Na;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}function Oa(){return Oa=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},Oa.apply(this,arguments)}const{Option:Aa}=O.Select,ka=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(Mr,{value:w(n),bordered:m}):t().createElement(O.Select,Oa({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=Ra.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(Aa,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Fa extends e.Component{constructor(){super(...arguments),Pa(this,"state",{itemList:[],loading:!1}),Pa(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(ka,{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}))))}}Pa(Fa,"contextType",pr);const Ha=Fa;function La(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 qa extends e.Component{constructor(e){super(e),La(this,"searchHelper",{}),La(this,"alias",void 0),La(this,"extras",void 0),La(this,"valueKey",void 0),La(this,"_clicking",!1),La(this,"_record",void 0),La(this,"_prevValue",void 0),La(this,"searchRef",t().createRef()),La(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),La(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` 一起使用")})),La(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),La(this,"getLatestRequest",(()=>{const{request:e,searchHelper:t}=this.props.option;return Object.assign({},this.searchHelper.request,e,t?.request)})),La(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){}})),La(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])});this._record=e})),La(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),La(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),La(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),La(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),La(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(Mr,{value:o,bordered:u}):t().createElement(yn(),{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)}}))}))}}La(qa,"contextType",pr);class $a extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),La(this,"promiseRef",void 0),La(this,"state",{searchHelper:{}}),La(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),La(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(qa,{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}))))}}La($a,"contextType",pr);const _a=$a;class Da 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}(Da,"contextType",pr);const ja=Da;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}function Ma(){return Ma=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},Ma.apply(this,arguments)}const Va=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Va(e.children,t,r,n)}:e)),za=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);De((()=>{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(Mr,{value:R(n),bordered:m}):t().createElement(O.TreeSelect,Ma({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=Va(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=Ra.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 Ua extends e.Component{constructor(){super(...arguments),Ka(this,"state",{itemList:[],loading:!1}),Ka(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(za,{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}))))}}Ka(Ua,"contextType",pr);const Ba=Ua;function Wa(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 Ga(){return Ga=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},Ga.apply(this,arguments)}const Ya=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(Mr,{value:E(n),bordered:c}):t().createElement(O.Cascader,Ga({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=Ra.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 Xa extends e.Component{constructor(){super(...arguments),Wa(this,"state",{itemList:[],loading:!1}),Wa(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(Ya,{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}))))}}Wa(Xa,"contextType",pr);const Qa=Xa,Za=require("china-area-data");var Ja=n.n(Za);function ei(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 ti=["110000","120000","310000","500000"],ri=["810000","820000"],ni=[{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"}],ai=[{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"}],ii=e=>Ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),li=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=>![...ti,...ri].includes(e))):Object.keys(e[t])).map((n=>({l:ii(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:li(e,n,r+1)})))},oi=(e,t)=>t.map((t=>({l:ii(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class si extends e.Component{constructor(e){super(e),ei(this,"searchRef",t().createRef()),ei(this,"scrollRef",t().createRef()),ei(this,"zxsAndGa",void 0),ei(this,"provinces",void 0),ei(this,"allCities",void 0),ei(this,"letterCities",void 0),ei(this,"state",{visible:!1,select_type:"0",active_key:""}),ei(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ei(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:oi(Ja(),ti)},{l:"Z2",n:"港澳",c:"",p:"",children:oi(Ja(),ri)}]}createProvince(){return(li(Ja(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return ai.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...ti,...ri].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?ni:ai).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(Mr,{value:f,bordered:s}):t().createElement(yn(),{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)}}))}))}}ei(si,"contextType",pr);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,r),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}ei(ci,"contextType",pr);const di=ci;function ui(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 pi=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:pi(e,r)})))};class mi extends e.Component{constructor(e){super(e),ui(this,"searchRef",t().createRef()),ui(this,"prevText",void 0),ui(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ui(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const r=pi(Ja(),"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(Mr,{value:g,bordered:s}):t().createElement(yn(),{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()))}}))}))}}ui(mi,"contextType",pr);class hi 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(mi,{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}))))}}ui(hi,"contextType",pr);const fi=hi,gi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:h,onRemove:f}=l,{action:g,headers:b,params:y,withCredentials:v=!1,dataKey:x="",fieldAliasMap:E,beforeUpload:S,button:C}=o,w="function"==typeof E?E():E||{};return t().createElement(rl,{name:"file",action:g,multiple:d,headers:b,data:y,withCredentials:v,beforeUpload:S,maxCount:u,fileTypes:m,fileSize:h,disabled:c||r.isOnlyShow,button:C,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 w)r[n]=e[n]||t.data?.[w[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||(x?(0,J.get)(t.data,x):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: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=>{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}(bi,"contextType",pr);const yi=bi,vi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:h,openCropper:f,fileTypes:g,fileSize:b,onRemove:y}=l,{action:v,headers:x,params:E,withCredentials:S=!1,dataKey:C="",fieldAliasMap:w,beforeUpload:T}=o,N="function"==typeof w?w():w||{};return t().createElement(cl,{name:"file",action:v,multiple:d,headers:x,data:E,withCredentials:S,beforeUpload:T,maxCount:u,fixedSize:m,quality:h,openCropper:f,fileTypes:g,fileSize:b,disabled:c||r.isOnlyShow,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 N)r[n]=e[n]||t.data?.[N[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)},onRemove:y})};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,"")}}))),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={},upload:o,style:s={},placeholder:c=p("qm.form.inputPlaceholder"),readOnly:d,disabled:u}=e.option,{tinymce:m,thresholdSize:h}=l;return t().createElement(Wi,{value:n,tinymce:m,upload:o,thresholdSize:h,style:{width:"100%",...s},disabled:d||u||r.isOnlyShow,onChange:e=>{(e=>{a?.(e),i(e)})(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=>{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 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,"provide",{$$form:this,echo_data:{}}),Ti(this,"_initialValues",void 0),Ti(this,"_initialOthers",void 0),Ti(this,"_initialExtras",void 0),Ti(this,"_fieldAuth",{}),Ti(this,"wrapperRef",t().createRef()),Ti(this,"formRef",t().createRef()),Ti(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Ti(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})})),Ti(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),Ti(this,"getFormItems",ur()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Ti(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}))),Ti(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Ti(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Ti(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Ti(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),Ti(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})})),Ti(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 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(Br,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(Yr,{option:e})}INPUT_NUMBER(e){return t().createElement(tn,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(an,{option:e})}SEARCH_HELPER(e){return t().createElement(un,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t().createElement(Sn,{option:e})}TREE_TABLE_HELPER(e){return t().createElement(In,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t().createElement(Fn,{option:e})}RANGE_SEARCH_HELPER(e){return t().createElement(_n,{option:e})}CHECKBOX(e){return t().createElement(qr,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(Mn,{option:e})}RATE(e){return t().createElement(Un,{option:e})}RADIO(e){return t().createElement(Yn,{option:e})}SWITCH(e){return t().createElement(Zn,{option:e})}TEXT_AREA(e){return t().createElement(ta,{option:e})}DATE(e){return t().createElement(aa,{option:e})}RANGE_DATE(e){return t().createElement(sa,{option:e})}TIME(e){return t().createElement(ua,{option:e})}RANGE_TIME(e){return t().createElement(ha,{option:e})}SELECT(e){return t().createElement(Ha,{option:e})}MULTIPLE_SELECT(e){return t().createElement(Ha,{option:e,multiple:!0})}IMMEDIATE(e){return t().createElement(_a,{option:e})}DIVIDER(e){return t().createElement(ja,{option:e})}TREE_SELECT(e){return t().createElement(Ba,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(Ba,{option:e,multiple:!0})}CASCADER(e){return t().createElement(Qa,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(Qa,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(di,{option:e})}REGION_SELECT(e){return t().createElement(fi,{option:e})}UPLOAD_FILE(e){return t().createElement(yi,{option:e})}UPLOAD_IMG(e){return t().createElement(Ei,{option:e})}TINYMCE(e){return t().createElement(wi,{option:e})}renderFormLabel(e){if(!(0,J.isPlainObject)(e))return e;const{type:r,fieldName:n,label:a,options:i={},placeholder:l,disabled:o,onChange:s=ne}=e,{itemList:c=[]}=i;return"SELECT"===r?t().createElement(O.Form.Item,{name:n,noStyle:!0},t().createElement(O.Select,{placeholder:l,disabled:o,onChange:e=>s(e,c.find((t=>t.value===e)).text)},c.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))):"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(Hr,{option:e,onValuesChange:e=>s(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(jr,{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(){let e=[];const t=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName));t.length&&(e=this.flattenItems.map((e=>e.fieldName)).filter((e=>!t.includes(e)))),this.formRef.current.resetFields(e.length?e:void 0),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())))}}Ti(Ni,"contextType",l),Ti(Ni,"propTypes",Sr),Ti(Ni,"defaultProps",Cr);const Ii=Ni,Ri={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},Pi={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}),...Ri},Oi=e=>"function"==typeof e,Ai=e=>e in Ri,ki=e=>e.substr(2),Fi=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(Ai),c=Object.keys(l).filter(Ai),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=ki(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=ki(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Hi=0;const Li=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Hi++,e+"_"+r+Hi+String(t)},qi=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),$i=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),_i=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Di=()=>({listeners:[],scriptId:Li("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),ji=(()=>{let e=Di();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=Di()}}})(),Ki=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Mi(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 Vi extends e.Component{constructor(t){var r;super(t),r=this,Mi(this,"editor",void 0),Mi(this,"id",void 0),Mi(this,"elementRef",void 0),Mi(this,"inline",void 0),Mi(this,"currentContent",void 0),Mi(this,"boundHandlers",void 0),Mi(this,"rollbackTimer",void 0),Mi(this,"valueCursor",void 0),Mi(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})),Mi(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){}})),Mi(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Mi(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))}})),Mi(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Mi(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=Ki(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,$i(i).concat($i(l))),toolbar:r.props.toolbar??r.props.init?.toolbar,setup:e=>{r.editor=e,r.bindHandlers({}),r.inline&&!qi(t)&&e.once("PostRender",(t=>{e.setContent(r.getInitialValue(),{no_events:!0})})),r.props.init&&Oi(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;_i(r.editor,n?"readonly":"design"),r.props.init&&Oi(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(e)}};var i,l;r.inline||(t.style.visibility=""),qi(t)&&(t.value=r.getInitialValue()),n.init(a)})),this.id=this.props.id||Li("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;_i(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==Ki(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&ji.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=Ki(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){Fi(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 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}Mi(Vi,"propTypes",Pi),Mi(Vi,"defaultProps",{cloudChannel:"6"});var Ui=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(Ui||{});class Bi extends e.Component{constructor(){super(...arguments),zi(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:Ui[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(Vi,b))}}zi(Bi,"contextType",l),zi(Bi,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const Wi=Bi,Gi=require("cropperjs");var Yi=n.n(Gi);function Xi(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 Qi extends e.Component{constructor(){super(...arguments),Xi(this,"imgRef",t().createRef()),Xi(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(Yi())(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}}))}}Xi(Qi,"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 Zi=Qi;function Ji(){return Ji=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},Ji.apply(this,arguments)}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}class tl extends e.Component{constructor(){super(...arguments),el(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)}))))}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{button:e={},disabled:r,onChange:n}=this.props,a=Ce("upload-file");return t().createElement(O.Upload,Ji({className:a},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,onChange:n,onPreview:async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){O.message.error(p("qm.download.error"))}},onDownload:async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){O.message.error(p("qm.download.error"))}}}),this.props.children?this.props.children:t().createElement(O.Button,{type:e.type??"default",icon:e.icon??t().createElement(we.UploadOutlined,null),disabled:r},e.text||p("qm.upload.text")))}}el(tl,"defaultProps",{name:"file",multiple:!0,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)}});const rl=tl;function nl(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 al extends e.Component{constructor(){super(...arguments),nl(this,"cropperRef",t().createRef()),nl(this,"beforeUploadRef",void 0),nl(this,"fileRef",void 0),nl(this,"resolveRef",void 0),nl(this,"rejectRef",void 0),nl(this,"state",{src:""}),nl(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()})),nl(this,"onOk",(()=>{this.confirmHandle()})),nl(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(Zi,{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()))}}nl(al,"contextType",l);const il=al;function ll(){return ll=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},ll.apply(this,arguments)}function ol(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 sl extends e.Component{constructor(){super(...arguments),ol(this,"state",{previewVisible:!1,currentIndex:0}),ol(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)})))),ol(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})}))}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,openCropper:s,beforeCrop:c}=this.props,d=Ce("upload-img"),u=t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("div",{style:{marginTop:8}},p("qm.uploadCropper.dragableText"))),m=t().createElement(O.Upload,ll({className:d},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,onPreview:this.handlePreview}),this.showUploadButton?u:null);return t().createElement(t().Fragment,null,s?t().createElement(il,{fixedSize:a,quality:i,fileTypes:l,fileSize:o,beforeCrop:c},m):m,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:""}))))))}}ol(sl,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const cl=sl,dl=(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=dl(i.children,t,r);e&&(n=e)}}return n},ul=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&ul(e.children,t),t(e)||e.children&&e.children.length))),pl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...pl(e.children,t)),t(e)&&r.push(e)})),r},ml=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=ml(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},hl=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:hl(e.children,t,r,n)}:e)),fl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...fl(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},gl=(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=gl(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},bl=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...bl(e,t)))),r},yl=t().forwardRef(((e,r)=>{const{filterable:n=!0,multiple:a,draggable:i,dataSource:o,fetch:s,asyncLoad:c,checkStrictly:d,checkStrategy:u="SHOW_CHILD",placeholder:m=p("qm.form.inputPlaceholder"),fieldsDefine:h,value:f,height:g,defaultSelectedKeys:b=[],defaultExpandAll:y=!0,showSearchBar:v=!0,showCollapse:x=!0,onSelectChange:E,onCheckChange:S,onDragChange:C,onExpand:w}=e,{size:T}=t().useContext(l),N=t().useMemo((()=>e.size??T??""),[e.size,T]),I=h?.valueKey||"value",R=h?.textKey||"text",P=(h?.children,t().useRef(null)),A=St(P),[k,F]=t().useState(g),[H,L]=t().useState(!1),q=Ct((()=>{F(P.current.offsetHeight-Y.current.offsetHeight-10)}),5);De((()=>{g||q()}),[A.height]);const[$,_]=t().useState([]),[D,j]=t().useState({}),[K,M]=t().useState([]),[V,z]=t().useState([]),[U,B]=t().useState(""),[W,G]=t().useState(y),Y=t().useRef(null),X=t().useRef([]),Q=t().useRef([]);t().useEffect((()=>{Array.isArray(o)&&(Z(o),M(ee(o)),j({}))}),[o]),t().useEffect((()=>{ne()}),[]),De((()=>{ne()}),[s?.params]),De((()=>{z(re())}),[D]),t().useImperativeHandle(r,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=ml($,(t=>e===t[I]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],Z([...$]))},REMOVE_RECORD:e=>{const t=dl($,e,I);if(void 0===t&&$.find((t=>t[I]===e)))Z($.filter((t=>t[I]!==e)));else{const r=ml($,(e=>t===e[I]));if(!r)return;const n=r.children?.findIndex((t=>e===t[I]));n>=0&&(r.children.splice(n,1),Z([...$]))}},UPDATE_RECORD:(e,t)=>{const r=ml($,(t=>e===t[I]));r&&((0,J.merge)(r,t),Z([...$]))}})));const Z=e=>{_(e),X.current=e,Q.current=fl(e,I)},ee=e=>{if(a)return b;const t=pl(e,(e=>b.includes(e[R])));return 1===t.length?[t[0][I]]:[]},te=e=>gl($,e,I)?.slice(0,-1)||[],re=()=>{if(y)return Q.current;const e=[];return K.forEach((t=>{if(a){if("SHOW_ALL"===u&&!Q.current.includes(t)&&e.push(...te(t)),"SHOW_CHILD"===u&&e.push(...te(t)),"SHOW_PARENT"===u){const r=Ar($,t);if(r){const n=te(t),a=bl(r,I);e.push(...n,...[t,...a].filter((e=>Q.current.includes(e))))}}}else e.push(...te(t))})),[...new Set(e)]},ne=async()=>{if(!s)return;const{api:e,params:t,dataKey:r,callback:n}=s;try{L(!0);const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,r)??[];Z(e),M(ee(e)),j({}),n?.(e)}}catch(e){}L(!1)},ae=e=>`${e}|${Ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ie=Ce("search-tree"),le={[ie]:!0,[`${ie}--lg`]:"large"===N,[`${ie}--sm`]:"small"===N};return t().createElement("div",{ref:P,className:Se()(le)},t().createElement("div",{ref:Y,className:"topper"},v&&t().createElement(O.Input.Search,{value:U,size:N,placeholder:m,allowClear:!0,onChange:e=>(e=>{if(!n)return;const t=ul(X.current,(t=>{if(!e)return!0;const r=t[R]||"";return-1!==ae(r).indexOf(e)}));B(e),_(t),y||e?z(fl(t,I)):j({})})(e.target.value)}),x&&t().createElement("a",{className:"trigger",onClick:()=>{G(!W),z(W?[]:Q.current)}},W?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(W?"qm.form.collect":"qm.form.spread"))),t().createElement(ft,{spinning:H},t().createElement(O.Tree,{fieldNames:{title:R,key:I,children:"children"},multiple:a,draggable:i,blockNode:i,checkable:a,selectable:!a,height:k,disabled:e.disabled,checkStrictly:d,selectedKeys:f??K,checkedKeys:f??K,expandedKeys:V,treeData:$,loadData:c?async e=>{let{key:t,children:r}=e;if(!s||r)return;const{api:n,params:a,dataKey:i,formatter:l=(e=>e)}=s;try{const e=await n(l({...a,[I]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=hl(X.current,t,I,r);Z(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!U)return!1;const t=e[R]||"";return-1!==ae(t).indexOf(U)},onDragEnter:e=>{z(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][I]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},l=[...$];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)}));Z(l)},onDragEnd:e=>{C?.(e,$)},onExpand:(e,t)=>{z(e),w?.(e,t)},onSelect:e=>{M(e);const t=pl(X.current,(t=>e.includes((0,J.get)(t,I))));E?.(a?t:t[0])},onCheck:e=>{d&&(e=e.checked),M(e),"SHOW_CHILD"===u&&(e=e.filter((e=>!Q.current.includes(e)))),"SHOW_PARENT"===u&&(e=e.filter(((e,t,r)=>!r.includes(dl($,e,I)))));const t=pl(X.current,(t=>e.includes((0,J.get)(t,I))));S?.(a?t:t[0])}})))}));yl.displayName="QmSearchTree";const vl=yl,xl=(0,e.createContext)(void 0),El={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},Sl=(i().arrayOf(i().shape(El)).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().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),Cl="1",wl="0",Tl="YYYY-MM-DD",Nl="YYYY-MM-DD HH:mm:ss",Il="YYYYMMDDHHmmss",Rl={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 Pl=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Ol=[];const Al={getFocusInstance:function(){return Ol[0]??null},getInstance:function(e){return Ol.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Ol.findIndex((e=>e===t))&&(this.deregister(e),Ol=[t,...Ol])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Ol=[{id:e,vm:t},...Ol])},deregister:function(e){e&&(Ol=Ol.filter((t=>t.id!==e)))}},kl=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],Fl={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)kl.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 ")}},Hl=["==","<",">","<=",">=","!=","like","likes","in","nin"],Ll=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++)Hl.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),Hl.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},ql=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,$l=["string","number","boolean","symbol"],_l=e=>$l.includes(typeof e),Dl=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),jl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(ql,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(jl(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(jl(t))));break;case"in":_l(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":_l(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(Dl(e)?e.slice(0,10):e)!=r;break;case"<":n=(Dl(e)?e.slice(0,10):e)<r;break;case"<=":n=(Dl(e)?e.slice(0,10):e)<=r;break;case">":n=(Dl(e)?e.slice(0,10):e)>r;break;case">=":n=(Dl(e)?e.slice(0,10):e)>=r;break;default:n=(Dl(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 Kl=Fl.stringify,Ml=Fl.array_format,Vl=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},zl=(e,t,r)=>{let n=[];t=Fl.replace_symbols(t);try{if(r){const r=new Function("record",`return ${Ll(t,"record")};`);n=xo(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${Ll(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},Ul=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Ul(e.children)):t.push(e)})),t},Bl=e=>{const t=[];return e.forEach((e=>{let r=e;e.children&&(r={...e},r.children=Bl(e.children)),e.hidden||e.noAuth||t.push(r)})),t},Wl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Wl(e.children))})),t},Gl=(e,t)=>e.map((e=>(e.children&&(e.children=Gl(e.children,t)),t?.(e),e))),Yl=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Yl(r.children,t);if(e)return e}}return null},Xl=e=>{const t=e.children;return t?t[0].children?Xl(t[0]):t[0]:e},Ql=e=>{const t=e.children;return t?t[t.length-1].children?Ql(t[t.length-1]):t[t.length-1]:e},Zl=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Jl=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Jl(r.children,t);if(e)return e}}return null},eo=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...eo(e.children))})),t},to=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 Wl(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},ro=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 ro(e.offsetParent,t,r)}return r},no=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ao=(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])?ao(r,t[n]):r)})),io=(e,t)=>(0,J.intersection)(e,t).length===t.length,lo=(e,t)=>(0,J.get)(e,t)??"",oo=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,J.set)(e,t,r??"")},so=(e,t)=>{if(!t.includes("|"))return lo(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(lo(e,t))})),r.every((e=>!e))?"":r.join(" | ")},co=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),uo=(e,t)=>e?s()(e,t):null,po=(e,t)=>e?s()(e).format(t):"",mo=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)}))},ho=e=>{const t=[];if(te(e)){const{children:r}=e.props;Array.isArray(r)?r.forEach((e=>t.push(...ho(e)))):r&&t.push(...ho(r))}else t.push(e);return t},fo=e=>e.filter((e=>!e._group)),go=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)?Ml(i.condition):Kl(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])?Ml(l[e]):Kl(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},bo=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(lo(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},yo=(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=yo(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},vo=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=vo(r.children,t);if(e)return e}if(t(r))return r}return null},xo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&xo(e.children,t),t(e)||e.children&&e.children.length)));function Eo(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 So=class{constructor(){Eo(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),Eo(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),Eo(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)})),Eo(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),Eo(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)})),Eo(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),Eo(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)})),Eo(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),Eo(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),Eo(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),Eo(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),Eo(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),Eo(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),Eo(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),Eo(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},Co={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 wo;const To=()=>{if(ee)return 0;if(void 0!==wo)return wo;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),wo=t-n,wo},No=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=No(e.children)),e))),Io=(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:H=""}=m||{},L=t().useMemo((()=>!!n?.api),[n?.api]),q=t().useMemo((()=>!L&&!!h),[L,h]),$=t().useMemo((()=>L&&!!f),[L,f]),_=t().useMemo((()=>(L||q)&&!$),[L,q,$]),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]})(No(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Co.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:Co.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=u,a?.expandedRowRender?{dataIndex:Co.expandableColumn,title:"",width:Co.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),Bl(t)})(a)),[a]),K=t().useMemo((()=>Ul(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=>![Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(e.dataIndex)));return H&&e.some((e=>e.dataIndex===H))?H:e[0]?.dataIndex??""}),[K,H]),W=t().useMemo((()=>V.length>0),[V]),G=t().useMemo((()=>!!C||W),[C,W]),Y=t().useMemo((()=>to(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((()=>!L&&!!x),[L,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((()=>!L&&!!y&&Z),[L,y,Z]),ie=t().useMemo((()=>!!v&&K.some((e=>!!e.groupSummary))),[K]),le=t().useMemo((()=>!!d?.groupItems?.length),[d]),oe=t().useMemo((()=>!!g&&!L&&!h),[g,L,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?fo(w.current.tableFullData):w.current.tableFullData,c=!k.length&&!!l;let d=(!i||c?s:k).reduce(((e,t)=>{if(t?.[Co.summaryIgnore])return e;const n=Number(lo(t,r));return Number.isNaN(n)?e:new(Qr())(e).plus(n).toNumber()}),0);!Object.keys(F).includes(r)||i&&!c||(d=Number(lo(F,r))),oo(e,r,d);let u=n>=0?d.toFixed(n):d;u=co(u),oo(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]=Co.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:Co.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?{[Co.sorterFieldName]:e}:null,...t.length?{[Co.filterFieldName]:t}:null,...ue?{[Co.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...n?.params??null,[Co.currentPageName]:A.current,[Co.pageSizeName]:A.pageSize}}),[n?.params,A.current,A.pageSize,R,P,O,ue]);return{isFetch:L,isWebPagination:q,isScrollPagination:$,showPagination:_,shouldUpdateHeight:D,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}},Ro=(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,tableFullData:I,pagination:R,layout:P,filters:O,sorter:A,superFilters:k,fetchParams:F,selectionKeys:H,rowExpandedKeys:L,highlightKey:q,summationColumns:$,shouldUpdateHeight:_,isFetch:D,isTreeTable:j,isWebPagination:K,isScrollPagination:M,isServiceSummation:V,isGroupSubtotal:z,doLayout:U,setTableData:B,setTableFullData:W,setTableOriginData:G,setAllTableData:Y,setDeriveRowKeys:X,setPagination:Q,setSpinning:ee,setSorter:te,setFilters:re,setSuperFilters:ne,setSelectionKeys:ie,setRowExpandedKeys:le,setHighlightKey:oe,setSelectionRows:ce,setScrollYLoad:de,setScrollYStore:ue,setFieldAuth:pe,setResizeState:me,setSummaries:he,setPermission:fe,setRecordsMap:ge,resetTableScroll:be,clearElementStore:ye,clearRecordsMap:ve}=r,{store:xe}=S.current,Ee=St(C),Se=t().useRef({...F}),Ce=t().useRef(new Map);De((()=>{U()}),[N,T,P.tableAutoHeight]),De((()=>{we()}),[Ee]),De((()=>{nt(),at(),it(),D||(K&&Ge(),Me(a)),o&&te(o),s&&re(s)}),[a,l?.params]),De((()=>{const e=_e(F,Se.current);e||D&&c?.clearableAfterFetched&<(),!e&&F[Co.currentPageName]>1&&!l?.stopToFirst?Ge():D&&Ke(),Se.current=F}),[F]),De((()=>{K&&Je(),M||be(),Le()}),[R.current,R.pageSize]),De((()=>{D||Te(I.length),U()}),[I]),De((()=>{j&&u?.virtual&&(Ye(),Je())}),[L]);const we=()=>{const{scrollYLoad:e,resizeState:t}=S.current,{height:r}=t,{width:n,height:a}=Ee,i=a!==r;U(),i&&_&&e&&Je(),me(Object.assign({},t,{width:n,height:a}))},Te=e=>{e!==R.total&&Q((t=>Object.assign({},t,{total:e})))},Ne=Ct((e=>{Ue(),v?.(e)})),Ie=e=>z?Re(Pe(e,0)):e,Re=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Re(e.children)),delete e.children,t.push(e)})),t},Pe=(e,t)=>{const r=i.groupItems?.[t];return r?bo(e,[r.dataIndex]).map((e=>{const a={children:Pe(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&oo(a,n.toString(),mo()),r.titleIndex&&oo(a,r.titleIndex,lo(e[0],r.titleIndex)),oo(a,r.dataIndex,lo(e[0],r.dataIndex)),$.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[Co.summaryIgnore])return e;const n=Number(lo(r,t));return Number.isNaN(n)?e:e+n}),0);oo(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Oe=e=>{ie(e),ce((e=>{const{selectionRows:t,allTableData:r,recordsMap:n}=S.current;if(D)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))},Ae=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=Jl(r,e);let a=[];if(!n)return a;const i=Fe(n?.children||[]),l=yo(r,e)?.slice(0,-1).reverse()||[];return a=[...new Set([...t,...i])],l.forEach((e=>{const t=Jl(r,e),n=io(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},ke=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:a}=d||{},i=Array.isArray(e)?e:L;if(S.current.treeTable){a&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...H];q&&e.unshift(q);let l=[];return e.forEach((e=>{const t=yo(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]:[]},Fe=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...Fe(e[r].children)),t.push(e[r].rowKey);return t},He=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...He(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...He(e,r[r.length-1])),r},Le=Ct((()=>{ze(),f?.(R,$e(O),qe(A),k,{currentDataSource:Qe()})})),qe=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},$e=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[Co.showFilterType?`${n}|${a}`:n]=e[r]}return t},_e=(e,t)=>{const r=Object.keys(ao(e,t));return 1===r.length&&(r.includes(Co.currentPageName)||r.includes(Co.pageSizeName))},je=async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=ae,afterFetch:r,callback:n}=l;if(!t(F))return;const a=M&&F[Co.currentPageName]>Se.current[Co.currentPageName]&&_e(F,Se.current),o=!!i?.fetch?.api;ee(!0);try{const[t,s]=o?await Promise.all([l.api(e(F)),i.fetch.api(e(F))]):[await l.api(e(F))];if(o?200===t.code&&200===s.code:200===t.code){const e=l.dataKey??Co.dataKey;let i=(0,J.get)(t.data,e)??[];i="function"==typeof r?await r(i):i;const o=(0,J.get)(t.data,e.replace(/[^.]+$/,Co.totalKey))||i.length||0;if(S.current.unMounted)return;Me(a?S.current.tableFullData.concat(i):i),Te(o),Ve(s?.data||t.data),n?.(t.data,t)}}catch(e){x?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),ee(!1)},Ke=Ct(je),Me=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}=R;return!D||M?e:(t-1)*r+e})(r)),e))),r=Ie(t(e));et(r),tt(r),rt(),Oe(Ae()),le(ke()),ze(),y?.(r)},Ve=e=>{if(!V)return;const t=i?.fetch?.dataKey??Co.summationKey,r=(t?(0,J.get)(e,t):e)??{},n={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{oo(n,e.dataIndex,Number(lo(r,e.summation.dataKey)))})),he(n)},ze=()=>{const{type:e,selectFirstRowOnChange:t}=c||{};if("radio"===e&&t){const e=Qe();if(e.length){const t=E(e[0],e[0].index);Oe([t])}else Oe([])}},Ue=()=>{if(!M)return;const e=We();R.current>=e||Be({...R,current:R.current+1})},Be=e=>{let{current:t,pageSize:r}=e;Q((e=>Object.assign({},e,{current:t,pageSize:r})))},We=()=>{const{pageSize:e,total:t}=R;return Math.ceil(t/e)||1},Ge=()=>{Be(Object.assign({},R,{current:1}))},Ye=()=>{if(!S.current.treeTable||!u?.virtual)return;const e=Xe(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?L.filter((e=>!n.includes(e))):L})());Ce.current.clear(),e.forEach(((e,t)=>Ce.current.set(e,t)))},Xe=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Xe(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},Qe=()=>K?(()=>{const{current:e,pageSize:t}=R;return S.current.tableFullData.slice((e-1)*t,e*t)})():S.current.tableFullData,Ze=e=>{const{scrollYLoad:t,scrollYStore:r}=S.current;B(t?e.slice(r.startIndex,r.endIndex):e)},Je=()=>{let e=Qe();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];Ce.current.has(a)&&n.push(t[e])}return n})()),de(e.length>Co.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),Ze(e)},et=e=>{W(e),Y(e),X(e),Ye(),Je()},tt=e=>{G(e)},rt=()=>{const{allTableData:e}=S.current;ve(),e.forEach((e=>ge(E(e,e.index),e)))},nt=()=>{te({})},at=()=>{re({})},it=()=>{ne([])},lt=()=>{Oe([])};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;fe((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=S.current,n=Gl(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=Yl(r,n);pe(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)}})(),q&&w.current.setClickedValues([q,""]),"radio"===c?.type&&H.length&&w.current.setClickedValues([H[0],""]),D?je():Me(a)},createTableFullData:et,getTableData:je,handleTableData:Ze,createTableData:Me,createGroupData:Ie,createSelectionKeys:Ae,createRowExpandedKeys:ke,setSelectionKeysEffect:Oe,findParentRowKeys:He,getAllChildRowKeys:Fe,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return g("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(xe.removeFromRequired({x:r,y:n}),xe.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&se(t)&&xe.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||xe.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=xe.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:Le,toLastPage:()=>{const e=We();R.current!==e&&Be(Object.assign({},R,{current:e}))},toFirstPage:Ge,getPageCount:We,pagerChangeHandle:Be,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||(ue(Object.assign({},t,{startIndex:s,endIndex:c})),Je()))}(e)},scrollBottomDebouncer:Ne,clearTableSorter:nt,clearTableFilter:at,clearSuperFilters:it,clearRowSelection:lt,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{xe.clearAllLog()},destroy:()=>{ye(),xe.destroy(),Al.deregister(S.current.uid)}}},Po=(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:`${no(a)}px`}),i&&Object.assign(r,{maxHeight:`${no(i)}px`}),E?{...r,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...r,height:"auto"!==n?`${no(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?eo(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=Xl(Yl(p,e)).dataIndex);let t=0;for(let r=0;r<m.length;r++){const n=m[r];if(n.dataIndex===e)break;t+=no(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{m.findIndex((t=>t.dataIndex===e))<0&&(e=Ql(Yl(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+=no(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||Co.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?ln["small"!==u?"middle":u]+Sl:0)-Sl;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+Sl:0,n=e.$pager?e.$pager.offsetHeight+Sl:0;p=r.winHeight-t-n-20}l!==f.viewportHeight&&(e=>{const{scrollYStore:t,isIE:r}=d.current,{startIndex:n,endIndex:a}=t,i=Co.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}=Co,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 Oo(){const[,t]=e.useReducer((e=>e+1),0);return t}const Ao=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(xl),{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},ko=t().forwardRef(((e,r)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:i}=t().useContext(xl),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}));ko.displayName="FullScreen";const Fo=ko,Ho=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(xl),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}));Ho.displayName="Reload";const Lo=Ho,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(xl),{tablePrint:f,showHeader:g}=c,b=i?.print?.leftLogo??"",y=i?.print?.rightLogo??"",v=!(!b&&!y),x=t().useMemo((()=>ce(Zl(n,[Co.expandableColumn,Co.selectionColumn,Co.operationColumn]))),[n]),E=t().useMemo((()=>ce(Zl(d,[Co.expandableColumn,Co.selectionColumn,Co.operationColumn]))),[d]),S=t().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),C=(e,t)=>{const r=Object.assign({},Yl(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||Co.defaultColumnWidth,n<=Co.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=Co.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(to(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||Co.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):lo(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,_o=require("exceljs");var Do=n.n(_o);const jo="606060",Ko="thin",Mo="d4d4d4",Vo=(e,t)=>{t&&(e.height=Math.floor(.75*t))},zo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Uo=()=>({top:{style:Ko,color:{argb:Mo}},left:{style:Ko,color:{argb:Mo}},bottom:{style:Ko,color:{argb:Mo}},right:{style:Ko,color:{argb:Mo}}}),Bo=e=>{const{children:t}=e;return t&&t.length?Bo(t[0]):e},Wo=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},Go=()=>{const{tableRef:e,tableProps:r,getSpan:n,showSummary:a,isHeadGroup:i}=t().useContext(xl),{spanMethod:l,showHeader:o}=r,s=(e,t)=>e.find((e=>e.text==t))?.value??"";return{exportXLSX:async(t,r,s,c)=>{const{columns:d,footSummation:u}=t,{scrollYStore:{rowHeight:m}}=e.current,h=Ul(d),f=to(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||Co.defaultColumnWidth)/8})})),o&&(i?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Bo(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?lo(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):lo(e,i);n[i]=0===a&&""===o?p("qm.table.config.summaryText"):te(o)?ho(o).join(""):o})),b.push(n)}));const{sheetName:C,useStyle:w}=t,T=new(Do().Workbook),N=T.addWorksheet(C);N.columns=y,o&&N.addRows(g).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Yl(d,t.key),{align:n,theadAlign:a}=r;zo(e,a||n),w&&Object.assign(e,{font:{bold:!0,color:{argb:jo}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Uo()})}))})),N.addRows(S).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Yl(d,t.key),{align:n}=r;zo(e,n),Object.assign(e,Wo(r)),w&&Object.assign(e,{font:{color:{argb:jo}},border:Uo()})}))})),a&&u&&N.addRows(b).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Yl(d,t.key),{align:n}=r;zo(e,n),Object.assign(e,Wo(r)),w&&Object.assign(e,{font:{color:{argb:jo}},border:Uo()})}))})),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=Ul(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(Do().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=po(e,Nl)),t[l[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:l}=a[r];Array.isArray(l)&&(t[e]?.includes(",")?t[e]=t[e].split(",").map((e=>s(l,e))).filter((e=>""!==e)):t[e]=s(l,t[e])),oo(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)}}},Yo=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"))},Xo=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableProps:i,createTableData:l,dataChange:o}=t().useContext(xl),{beforeTableImport:s}=i,{importXLSX:c}=Go(),d=t().useRef(null),[u,m]=t().useState(!1),[h,f]=t().useState(!0),g=e=>e.filter((e=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.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(Yo,{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(Ii,{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"))))},Qo=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(Xo,{columns:n,onClose:()=>l(!1)})))}));Qo.displayName="TableImport";const Zo=Qo,Jo=e=>{const{columns:r,onChange:n}=e,{$size:a}=t().useContext(xl),i=t().useRef([]),[l,o]=t().useState(!1),[s,c]=t().useState(r);De((()=>{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(yn(),{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($r.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(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:Rl,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"))))},es=e=>{const{defaultValue:r,onClose:n,onOk:a}=e,{tableProps:i,selectionKeys:l,pagination:o,showSummary:c}=t().useContext(xl),{rowSelection:d}=i,u=t().useRef(null),[m,h]=t().useState(!1),f=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(Il)}.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(Jo,{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(Ii,{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"))))},ts=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(xl),{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((()=>Zl(n,[Co.expandableColumn,Co.selectionColumn,Co.operationColumn])),[n]),P=t().useMemo((()=>Zl(u,[Co.expandableColumn,Co.selectionColumn,Co.operationColumn])),[u]),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(g?fo(t):t).reduce(((e,t)=>{if(t?.[Co.summaryIgnore])return e;const r=Number(lo(t,n));return Number.isNaN(r)?e:e+r}),0);oo(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:H}=Go(),L=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),[Co.currentPageName]:1,[Co.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=eo(e.map(((e,t)=>{const r={...e,index:t,pageIndex:t};return P.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&oo(r,n,lo(r,n))})),r})))}}catch(e){}return T(!1),i},q=e=>{const t=i?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},$=v?.fileName??`${s()().format(Il)}.xlsx`,_=$.slice($.lastIndexOf(".")+1).toLowerCase(),D=()=>{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,[Co.currentPageName]:void 0,[Co.pageSizeName]:void 0});n.data&&(kt(n.data,e),q(e))}catch(e){}T(!1)})($):C(!0)};t().useImperativeHandle(r,(()=>({clickHandle:D})));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:$.slice(0,$.lastIndexOf(".")),fileType:_,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:()=>D()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.DownloadOutlined,null))),t().createElement(cr,K,t().createElement(es,{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 L()),"custom"===n&&(c=await L(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`),q(`${t}.xlsx`)}if("csv"===r){const r=H(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=to(r),i=Ul(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||Co.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):lo(e,a);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):te(l)?ho(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));kt(r,`${t}.csv`),q(`${t}.csv`)}})(Object.assign({},e,{columns:Bl(e.columns)}))}})))}));ts.displayName="TableExport";const rs=ts,ns=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableBodyRef:i,tableProps:l,dataChange:o}=t().useContext(xl),{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(Ii,{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&&(oo(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"))))},as=t().forwardRef(((e,r)=>{const{flattenColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.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(ns,{columns:o,onClose:()=>l(!1)})))}));as.displayName="TableClipboard";const is=as,ls=e=>{const{columns:r,onClose:n}=e,{tableProps:a,tableRef:i,$size:l,selectionKeys:o,setSelectionKeysEffect:s}=t().useContext(xl),{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=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.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*ln[l]-30)}),5);return De((()=>{v()}),[u.width]),t().createElement("div",{ref:d,style:{height:"100%"}},t().createElement(rc,{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"))))},os=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(xl),{rowSelection:m}=i,[h,f]=t().useState(!1),g=t().useRef(!1);De((()=>{!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(ls,{columns:n,onClose:()=>f(!1)})))}));os.displayName="SelectCollection";const ss=os,cs=require("localforage");var ds=n.n(cs);const us=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),ps=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(xl),{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");De((()=>{const{current:e,pageSize:t}=d,r=i.current.tableFullData.slice((e-1)*t,e*t),n=eo(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=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[A,k]=t().useState({}),[F,H]=t().useState(R),[L]=t().useState(I([P[0]])),[q]=t().useState(I(P.slice(1))),[$,_]=t().useState(0),D=t().useMemo((()=>!Object.keys(A).length),[A]);De((()=>{T.current="ready"}),[A,F]);const j=e=>{H(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=lo(a,t),l=!0;if("text"===r||"textarea"===r?l=new RegExp(F.fullchar?`^${e[t]}$`:e[t],F.case?"":"i").test(n):(n=us(n)?n.slice(0,10):n,l=n==e[t]),!l){i=!1;break}}i&&r.push(a)}return r})(A),_(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=yo(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("");De((()=>{if(Y){const{filters:e,config:t}=U.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(Z()(e,q.map((e=>e.fieldName)))),E.current.SET_FIELDS_VALUE(Z()(e,L.map((e=>e.fieldName)))),k(e),H(t)}else V(),k({}),H(R)}),[Y]),t().useEffect((()=>{Q()}),[]);const Q=async()=>{if(!z)return;let e=await ds().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await ds().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:$}))},t().createElement(Jt.TabPane,{tab:p("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t().createElement(Ii,{ref:x,items:L,cols:1,labelWidth:110})),t().createElement(Jt.TabPane,{tab:p("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t().createElement(Ii,{ref:E,items:q,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:D,onChange:e=>{const{value:t}=e.target;G(t)}}),t().createElement(he,{type:"primary",disabled:!W||D,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=mo(),t=[...U,{text:W,value:e,list:{filters:A,config:F}}];B(t),X(e),G(""),await ds().setItem(z,t),await te(z,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Co.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 ds().setItem(z,t),await te(z,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!U.length&&t().createElement("div",{style:{padding:Sl}},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:`${ln[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"))))},ms=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{$size:a}=t().useContext(xl),[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:`${ln[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(ps,{onClose:()=>l(!1)})))}));ms.displayName="FastSearch";const hs=ms,fs=e=>{const{columns:r,group:n,summary:a}=e,{tableRef:i,tableProps:l,$size:o,pagination:c,fetchParams:d,isFetch:u}=t().useContext(xl),{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===Co.groupSummary.total.value?{dataIndex:e.summary,title:Co.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...h(e.summary),formula:e.formula})),b=t().useMemo((()=>Object.assign({},d,{[Co.sorterFieldName]:void 0,[Co.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[Co.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[Co.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===Co.groupSummary.total.value&&(n={dataIndex:Co.groupSummary.recordTotalIndex,summation:{render:()=>c.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(f,g)),[x]=t().useState(u?[]:(e=>{const t=bo(e,n.map((e=>e.group))),r=[];return t.forEach((e=>{const t={};y.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&oo(t,n,lo(e[0],n))})),a.forEach((r=>{const n=r.summary!==Co.groupSummary.total.value?r.summary:Co.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&oo(t,n,e.length),"sum"===a&&oo(t,n,(0,J.sumBy)(e,n)),"max"===a&&oo(t,n,(0,J.maxBy)(e,n)[n]),"min"===a&&oo(t,n,(0,J.minBy)(e,n)[n]),"avg"===a&&oo(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(rc,E)},gs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o}=t().useContext(xl),{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("");De((()=>{if(v){const{group:e,summary:t}=h.find((e=>e.value===v)).list;I(e),k(t)}else{const e=q();I(e?.group||[]),k(e?.summary||[])}}),[v]),t().useEffect((()=>{$()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),S=t().useMemo((()=>o.filter((e=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.operationColumn].includes(e.dataIndex)))),[o]),C=S.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[Co.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,H]=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===Co.groupSummary.total.value?T.slice(T.length-1):T})}]),L=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]),q=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},$=async()=>{if(!E)return;const e=q();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await ds().getItem(E);t||(t=await _(E),Array.isArray(t)&&await ds().setItem(E,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},_=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},D=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(rc,{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(rc,{ref:d,size:i,columns:F,dataSource:A,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>H(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:L,onChange:e=>{const{value:t}=e.target;y(t)}}),t().createElement(he,{type:"primary",disabled:!b||L,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=mo(),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 ds().setItem(E,t),await D(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Co.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 ds().setItem(E,t),await D(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!h.length&&t().createElement("div",{style:{padding:Sl}},t().createElement(mt,null)))))),t().createElement(cr,K,t().createElement(fs,{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:L,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"))))},bs=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(gs,{onClose:()=>i(!1)})))}));bs.displayName="GroupSummary";const ys=bs,vs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(xl),{uniqueKey:d}=a,u=t().useRef(null),[m,h]=t().useState([]),[f,b]=t().useState([]),[y,v]=t().useState(""),[x,E]=t().useState("");De((()=>{h(x?f.find((e=>e.value===x)).list:q()||[])}),[x]),t().useEffect((()=>{$()}),[]);const S=t().useMemo((()=>d?`superSearch_${d}`:""),[d]),C=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=go(m),T=t().useMemo((()=>!(w&&Vl(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,H]=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}})}]),L=()=>{S&&sessionStorage.setItem(S,JSON.stringify(m.filter((e=>!!e.fieldName))))},q=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},$=async()=>{if(!S)return;const e=q();e&&h(e);let t=await ds().getItem(S);t||(t=await _(S),Array.isArray(t)&&await ds().setItem(S,t)),Array.isArray(t)&&t.length&&(b(t),!e&&E(t[0].value))},_=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},D=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(rc,{ref:u,size:i,columns:F,dataSource:m,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>H(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}})),Co.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=mo(),t=[...f,{text:y,value:e,list:m.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await ds().setItem(S,t),await D(S,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Co.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 ds().setItem(S,t),await D(S,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:Sl}},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"])))),L(),void r())},p("qm.table.highSearch.searchButton"))))},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.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(vs,{onClose:()=>i(!1)})))}));xs.displayName="SuperSearch";const Es=xs,Ss=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(xl),{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),H=t().useRef(null),L=t().useRef(null),q=t().useRef(!1),$=t().useMemo((()=>C?`toolBox_${C}`:""),[C]),[_,D]=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);De((()=>{q.current&&(z(),q.current=!1)}),[_]),t().useEffect((()=>{V()}),[]),t().useImperativeHandle(r,(()=>({exportHandle:()=>{if(!P.current)return g("Table","执行导出需要配置 `exportExcel` 参数");P.current.clickHandle()}})));const V=()=>{if(!$||!b)return;const e=JSON.parse(localStorage.getItem($));e||U($).then((e=>{e&&(D(Object.assign({},_,e)),localStorage.setItem($,JSON.stringify(e)))})).catch((()=>{})),e&&D(Object.assign({},_,e))},z=()=>{if(!$||!b)return;const e={};for(const t in _)_[t]&&(e[t]=_[t]);localStorage.setItem($,JSON.stringify(e)),B($,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)=>{q.current=!0,D(Object.assign({},_,{[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(Fo,{ref:T,isFullScreen:E,open:!b||_.fullScreen}),i&&t().createElement(Lo,{ref:N,open:!b||_.reload}),o&&t().createElement($o,{ref:I,tableColumns:n,open:!b||_.print}),s&&t().createElement(Zo,{ref:R,tableColumns:n,open:!b||_.import}),c&&t().createElement(rs,{ref:P,tableColumns:n,open:(!b||_.export)&&!w?.hideIcon}),d&&t().createElement(is,{ref:A,flattenColumns:x,open:!b||_.clipboard}),u&&t().createElement(ss,{ref:k,columns:n,open:!b||_.collection}),m&&t().createElement(hs,{ref:F,open:!b||_.fastSearch}),f&&t().createElement(ys,{ref:H,open:!b||_.groupSummary}),h&&t().createElement(Es,{ref:L,open:!b||_.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:_.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:_.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:_.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:_.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:_.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:_.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:_.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:_.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:_.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(H)},{key:"superSearch",label:t().createElement(t().Fragment,null,t().createElement(O.Checkbox,{checked:_.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(L)}];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)))))}));Ss.displayName="ToolBox";const Cs=Ss,ws=e=>{const{columns:r}=e,{global:n}=t().useContext(l),{tableProps:a,tableRef:i,$size:o}=t().useContext(xl),{uniqueKey:s,onlyShowIcon:c,columnsChange:d}=a,u=t().useRef([]),m=e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)),h=e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)),f=e=>e.filter((e=>!e.noAuth&&!e.fixed)),[g,b]=t().useState(!1),[y,v]=t().useState(m(r)),[x,E]=t().useState(h(r)),[S,C]=t().useState(f(r)),w=t().useMemo((()=>s?`table_${s}`:""),[s]),T=t().useMemo((()=>[...y,...S,...x]),[y,S,x]);De((()=>{A(r),P(r),I(r)}),[r]),t().useEffect((()=>{R()}),[]);const N=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=N(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}})),I=e=>{if(!w)return;const t=N(e),r=JSON.parse(localStorage.getItem(w));(0,J.isEqual)(t,r)||(localStorage.setItem(w,JSON.stringify(t)),(async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(w,t))},R=()=>{const e=(()=>{if(!w)return;const e=JSON.parse(localStorage.getItem(w));return e||(async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(w).then((e=>{if(!e)return I(r);localStorage.setItem(w,JSON.stringify(e)),R()})).catch((()=>{})),e?(0,J.xor)(e.map((e=>e.dataIndex)),r.map((e=>e.dataIndex))).length>0?Gl(r,(t=>{const r=Yl(e,t.dataIndex);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))})):e.map((e=>{const t=r.find((t=>t.dataIndex===e.dataIndex));return void 0===e.fixed&&delete t.fixed,(0,J.merge)({},t,e)})):void 0})();e&&(P(e),d?.(e))},P=e=>{const t=m(e),r=h(e),n=f(e);return v(t),E(r),C(n),[...t,...n,...r]},A=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))})),u.current=t},k=()=>{const e=[];T.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=u.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...u.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=T.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})))})),r.forEach(((t,r)=>{t.noAuth&&e.findIndex((e=>e.dataIndex===t.dataIndex))<0&&e.splice(r,0,t)})),d?.(e)},F=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const n=P(r);d?.(n)},H=(e,n)=>{const{colSpan:a,noFixed:i}=e;if(0===a)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const l=["svgicon","handle",`${n}-handle`];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(O.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,P(r),k()}}),t().createElement("i",{className:Se()(l),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title),"main"===n?t().createElement("span",{className:Se()("fixed",i?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>F(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>F(e,"right")},t().createElement(we.StepForwardOutlined,null))):t().createElement("span",{className:Se()("fixed",i?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>F(e)},t().createElement(we.CloseCircleOutlined,null))))},L=Ce("table"),q={[`${L}__popper`]:!0,"column-filter__popper":!0,[`${L}--lg`]:"large"===o,[`${L}--sm`]:"small"===o},$=[`${L}-column-filter`,{selected:g}];return t().createElement(yn(),{action:["click"],popupVisible:g,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:()=>{const e=ce(i.current.originColumns);P(e),d?.(e)}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement($r.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),r=y.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||v(e)},onEnd:()=>k()},y.map((e=>H(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement($r.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(e)},onEnd:()=>k()},S.map((e=>H(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement($r.ReactSortable,{itemKey:"dataIndex",handle:".right-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(e)},onEnd:()=>k()},x.map((e=>H(e,"right")))))),popupClassName:Se()(q),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{b(e)},builtinPlacements:Rl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()($),title:c?p("qm.table.columnFilter.text"):void 0},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),!c&&t().createElement("span",null,p("qm.table.columnFilter.text"))))},Ts=()=>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 Ns(){return Ns=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},Ns.apply(this,arguments)}const Is=e=>{const{column:r,filters:n}=e,{$size:a,setFilters:i,clearSuperFilters:l}=t().useContext(xl),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,Ns({ref:s},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(O.InputNumber,Ns({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(O.InputNumber,Ns({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(O.InputNumber,Ns({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const r=e=>({value:uo(f[y]?.[e],Tl),format:Tl,size:a,onChange:t=>{b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:po(t,Tl)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(_,Ns({},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(_,Ns({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(_,Ns({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(_,Ns({},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(vl,{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(yn(),{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:Rl,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(Ts,null))))},Rs=e=>{const{column:r}=e,{tableProps:n,tableRef:a,bordered:i}=t().useContext(xl),{columns:l,resizable:o,columnsChange:s=ne}=n,c={resizable:!0,"is--line":o&&!i};return t().createElement("div",{className:Se()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=a.current,i=n.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=ro(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+o;n.$table.classList.add("c--resize"),i.style.left=`${d}px`,i.style.display="block";const u=r.width||r.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,n=u+t;n<(r.minWidth||Co.defaultColumnWidth)||(p=Math.floor(n),i.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),i.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Yl(l,r.dataIndex).width=p,s([...l]))},!1}})},Ps=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(xl),{rowSelection:h}=a,{fetchAllRowKeys:f,onSelectAll:g}=h,b=t().useRef([]),y=t().useMemo((()=>h.selectAllOnCurrentPage??!1),[h]),v=t().useMemo((()=>(h.filterable??!0)&&!y),[h,y]),x=()=>{const{tableFullData:e}=n.current,{current:t,pageSize:r}=l;return m?e.slice((t-1)*r,t*r):e},E=(()=>{const{allTableData:e,allRowKeys:t,selectionRows:r}=n.current,{disabled:a}=h;if(u)return b.current.length?b.current:(0,J.union)(t,r.map((e=>i(e,e.index))));if(!y)return a?t.filter(((t,r)=>!a(e[r]))):t;const l=a?x().filter((e=>!a(e))).map((e=>i(e,e.index))):x().map((e=>i(e,e.index)));return(0,J.union)(l,r.map((e=>i(e,e.index))))})(),S=r.filter((e=>!E.includes(e))),C=r.length-S.length,w=C>0&&C<E.length,T=!!C&&C===E.length;c(S);const N=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,x().filter((e=>n(e))).map((e=>i(e,e.index))))),b.current=t}}catch(e){}return d(!1),t},I=async e=>{let t=[];t=f?e?await N():[]:e?E.slice(0):[],t=[...new Set([...t,...S])],s(t),g?.(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(O.Checkbox,{checked:T,indeterminate:w,disabled:!E.length,onChange:e=>I(e.target.checked)}),v&&t().createElement(O.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{I(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=f?(0,J.xor)(r,await N()):(0,J.xor)(r,E),e=[...new Set([...e,...S])],s(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{I(!1)}}];return t().createElement(O.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),y&&t().createElement(O.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},Os=e=>{const{style:r}=e,{tableProps:n,tableRef:a,isTreeTable:i,setRowExpandedKeys:l}=t().useContext(xl),{expandable:o}=n,[s,c]=t().useState(o?.defaultExpandAllRows||!1);De((()=>{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})},As=()=>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"})),ks=()=>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"})),Fs=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(xl),{ellipsis:I,resizable:R,multipleSort:P,rowSelection:A,expandable:k}=o,[F,H]=Co.sortDirections,L=t().useRef(null),q=t().useMemo((()=>!g),[g]),$=t().useMemo((()=>!g),[g]),_=t().useMemo((()=>!k?.hideExpandAll),[k]),D=t().useMemo((()=>!(!A||(g?!A.selectAllOnCurrentPage&&!A.fetchAllRowKeys:A.hideSelectAll))),[g,A]);De((()=>{U(),v(),S()}),[a]),De((()=>{G(),v(),S()}),[i]),De((()=>{G(),v(),S()}),[u]),t().useEffect((()=>{j(),!se(a)&&le((()=>U())),!se(i)&&le((()=>G()))}),[]);const j=()=>{E("$header",L.current)},K=e=>{const{dataIndex:r,type:n,sorter:i,title:l,description:o}=e;if(r===Co.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},D?t().createElement(Ps,{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&&_?t().createElement(Os,null):null,r===Co.expandableColumn&&_?t().createElement(Os,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===H}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Se()(r)},t().createElement(As,null)),t().createElement("span",{className:Se()(n)},t().createElement(ks,null)))},V=e=>t().createElement(Is,{column:e,filters:i}),z=(e,t)=>{const{sorter:r,dataIndex:n}=t;if(r){const e=a[n],t=e?e===H?null:H:F;P?(delete a[n],x(Object.assign({},a,{[n]:t}))):x(Object.assign({},{[n]:t}))}},U=()=>{q&&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=lo(e,n),i=lo(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(fo(r).sort("function"==typeof a?a:i)):r.sort("function"==typeof a?a:i).slice(0);N(l)},G=()=>{$&&Y()},Y=()=>{const{tableOriginData:e}=s.current,t=u.length?go(u):go(i),r=""!==t?y?T(zl(fo(e),t,b)):zl(e,t,b):e;N(r),B(!0)},X=to(r),Q=Ce("table"),{tableBodyWidth:Z}=c;return t().createElement("div",{ref:L,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&&![Co.expandableColumn,Co.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(Rs,{column:e}))})(r,n,e))),d&&t().createElement("th",{className:Se()(n),style:{...i}}))))})(X))))};const Hs=e=>{const{selectionKeys:r,column:n,record:a,rowKey:i}=e,{tableProps:l,tableRef:o,isTreeTable:s,getAllChildRowKeys:c}=t().useContext(xl),{rowSelection:d}=l,u=t().useMemo((()=>n.type||""),[n.type]),p=e=>{const t=d.checkStrictly??!0;if(!s||t)return!1;const n=Jl(o.current.deriveRowKeys,e),a=c(n?.children??[]);return!(!Array.isArray(n?.children)||io(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})})()},Ls=e=>{const{record:r,rowKey:n,style:a}=e,{tableProps:i,rowExpandedKeys:l,setRowExpandedKeys:o}=t().useContext(xl),{expandable:s={}}=i,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(r)),d=t().useMemo((()=>l.includes(n)),[l,n]);De((()=>{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})},qs=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(Qr())(t).toFixed(p)),t},E=void 0!==i,[S,C]=t().useState(a??""),w=b(E?i:S),T=y(w);return De((()=>{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)}})}));qs.displayName="InputNumber";const $s=qs;function _s(){return _s=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},_s.apply(this,arguments)}const{Search:Ds}=O.Input,js=t().forwardRef(((e,r)=>{const{column:n,record:a,rowKey:i,columnKey:l,clicked:o,text:s}=e,{tableRef:c,tableBodyRef:d,$size:u,flattenColumns:m,updateTableData:h,doFieldValidate:f,dataChange:b}=t().useContext(xl),y=Oo(),{store:v,fieldAuth:x}=c.current,E=n.editRender?.(a,n)||{},S=t().useRef(null),C=t().useRef(null),w=t().useRef(null),T=t().useRef(null),N=t().useRef(null),I=t().useRef(!1),R=t().useRef({}),P=t().useRef({}),A=t().useRef([]),[k,F]=t().useState(!1),[H,L]=t().useState(!1),[q,$]=t().useState(!1),[D,j]=t().useState(E.items||[]),[K,V]=t().useState(),z=(E.editable||(0,J.isEqual)(o,[i,l]))&&!E.disabled&&!x[l]?.disabled,U=`${i}|${l}`,B=2===o.length?`${o[0]}|${o[1]}`:"",W=![...v.state.required,...v.state.validate].some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),G=v.state.required.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",Y=v.state.validate.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",X=v.state.edited.some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),Q=z||!W||k||q||H,Z=!!E.helper?.combinedDataIndex&&("search-helper"===E.type||"tree-helper"===E.type),ee=E.type.endsWith("multiple"),te=()=>{h(),b()};t().useEffect((()=>{Q&&B===U&&ie()}),[o]),t().useEffect((()=>{ee&&E.items&&ne(E.items.map((e=>({[P.current.valueKey]:e.value,[P.current.textKey]:e.text}))))}),[]);const re=(e,t)=>{F(e),t?.()},ne=e=>{A.current=e},ie=()=>{const{type:e}=E;switch(e){case"text":C.current?.focus();break;case"number":w.current?.select();break;case"search-helper":T.current?.focus();break;case"tree-helper":N.current?.focus()}};t().useImperativeHandle(r,(()=>({focus:ie})));const oe=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0}))},se=(e,t,r)=>{const{cornerSign:n=!0}=E.extra||{};v.addToUpdated(e),n&&v.addToEdited({x:t,y:r})},ce=e=>""!==e?Number(e):"",de={text:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:c=[],onInput:d,onChange:m,onEnter:h,onBlur:g}=E,b=lo(e,a),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),x=n?{rows:v.minRows,autoSize:v}:null,S=s.password?O.Input.Password:n?O.Input.TextArea:O.Input;return t().createElement(S,_s({ref:C,size:u,value:b,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??"";oo(e,a,r),f(c,r,i,l),y(),d?.({[U]:r}),I.current=!0},onFocus:()=>L(!0),onBlur:t=>{L(!1);const r=t.target.value??"";I.current&&(I.current=!1,se(e,i,l),m?.({[U]:r},e),g?.({[U]:r},e),te())},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";h?.({[U]:r},e)}},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||e.preventDefault()}}))},textarea:(e,t)=>de.text(e,t,!0),number:(e,r)=>{const{dataIndex:n,precision:a,formatType:o}=r,{type:s,extra:c={},rules:d=[],onInput:m,onChange:h,onEnter:g,onBlur:b}=E,v=lo(e,n);let x,S;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]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(x=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Qr())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Qr())(e).times(.01).toString()),t().createElement($s,{ref:w,size:u,value:v,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:S,onChange:t=>{oo(e,n,t),f(d,t,i,l),y(),m?.({[U]:t}),I.current=!0},onFocus:()=>L(!0),onBlur:(t,r)=>{if(L(!1),!I.current)return;I.current=!1;let a=c.stringMode?t:ce(t);"percent"===o&&"."===r.charAt(r.length-1)&&(a=Number(t)/100),oo(e,n,a),se(e,i,l),h?.({[U]:a},e),b?.({[U]:a},e),te()},onEnter:(t,r)=>{let n=c.stringMode?t:ce(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),g?.({[U]:n},e)}})},select:(e,r,n)=>{const{dataIndex:a,dictItems:o=[]}=r,{type:s,extra:d={},rules:m=[],items:h,onChange:g,onEnter:b}=E,{elementStore:y}=c.current,v=h||o,x=lo(e,a);let S=x;return t().createElement(O.Select,{mode:n?"multiple":void 0,size:u,popupClassName:"table-editable__popper",value:x||void 0,placeholder:d.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:d.allowClear,listHeight:d.listHeight,maxTagCount:d.collapseTags?"responsive":void 0,maxTagTextLength:d.maxTagTextLength,disabled:d.disabled,style:{width:"100%"},showSearch:d.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${Ra.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{oo(e,a,t),f(m,t,i,l),se(e,i,l),g?.({[U]:t},e),te()},onSelect:e=>{S=e},onInputKeyDown:t=>{13===t.keyCode&&le((()=>b?.({[U]:S},e)))}},v.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>de.select(e,t,!0),date:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:c=[],onChange:d}=E,m=n?Nl:Tl,h=lo(e,a);return t().createElement(_,{showTime:n,size:u,popupClassName:"table-editable__popper",value:uo(h,m)??void 0,format:s.format||m,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=po(t,m);oo(e,a,r),f(c,r,i,l),se(e,i,l),d?.({[U]:r},e),te()}})},datetime:(e,t)=>de.date(e,t,!0),time:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},rules:s=[],onChange:c}=E,d="HH:mm:ss",m=lo(e,n);return t().createElement(M,{size:u,popupClassName:"table-editable__popper",value:uo(m,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=po(t,d);oo(e,n,r),f(s,r,i,l),se(e,i,l),c?.({[U]:r},e),te()}})},checkbox:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=E,{trueValue:c=Cl,falseValue:d=wl,disabled:u}=o,p=lo(e,n);return t().createElement(O.Checkbox,{checked:p===c,disabled:u,onChange:t=>{const r=t.target.checked?c:d;oo(e,n,r),se(e,i,l),s?.({[U]:r},e),te()}})},switch:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=E,{trueValue:c=Cl,falseValue:d=wl,disabled:u}=o,p=lo(e,n);return t().createElement(O.Switch,{checked:p===c,disabled:u,onChange:t=>{const r=t?c:d;oo(e,n,r),se(e,i,l),s?.({[U]:r},e),te()}})},"search-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:c=[],helper:d={},onInput:h,onChange:b,onEnter:y}=E,v=so(e,Z?d.combinedDataIndex:n),x=d.fieldAliasMap;x||g("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof x?x():x||{};Object.keys(C).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Z&&(d.combinedDataIndex.split("|").every((e=>Object.keys(C).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),C[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 a.forEach((e=>i[e]=r)),i},N=e=>{const{autoQueryAssign:t=!0}=d;t&&(R.current=w(e)),F(!0)},P=(t,n)=>{const{beforeOpen:a}=d,i=(a??ae)({[U]:v},e,r);i?.then?i.then((()=>{N(t),n?.()})).catch((()=>{})):!1!==i&&(N(t),n?.())},O=e=>{const t={};for(const r in C){const a=C[r];r!==n&&(t[r]=so(e,a))}const r=C[n]?so(e,C[n]):"";H(r,t);const{closed:a}=d;re(!1,(()=>oe(S.current))),ie(),a?.(e)},A=()=>{const{onlySelect:e=!0}=d;I.current&&H(e?"":v),re(!1,(()=>oe(S.current)))},H=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=m.find((e=>e.dataIndex===t));if(a){oo(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&f(r.rules,n,i,t)}else oo(e,t,n)}Z&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return oo(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&oo(e,t,a[r]?.trim())}))})(e,d.combinedDataIndex),oo(e,n,t,a),f(c,t,i,l),se(e,i,l),b?.({[U]:t},e),te(),R.current={},I.current=!1,V(void 0)},L={visible:k,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ln[u]+20}px`},onClose:()=>{A()}},q={...d,size:u,initialValue:Object.assign({},R.current,d.initialValue),onClose:e=>{e?O(e):A()}};return t().createElement(t().Fragment,null,t().createElement(Ds,{ref:T,value:K??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(I.current&&!k)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=d,{beforeFetch:n=ae}=t.fetch;return $(!0),new Promise((async(a,i)=>{const l=(0,J.merge)({},t.fetch.params,{...r,...w(e)},{currentPage:1,pageSize:500});try{if(n(l)){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()}else i()}catch(e){i()}$(!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=>so(t,C[n]).toString().includes(e)));if(1===t.length)return O(t[0]);P(e)}(e,t))).catch((()=>H(""))):void H(t)},onChange:e=>{const{value:t}=e.target;h?.({[U]:t}),I.current=!0,V(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";y?.({[U]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;P(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&P(e)}}),t().createElement(cr,L,t().createElement(lc,q)))},"search-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,items:o=[],extra:s={},rules:c=[],helper:d={},onInput:m,onChange:h,onEnter:b}=E,y=lo(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`"),P.current=x;const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[U]:y},e,r);a?.then?a.then((()=>{F(!0),t?.()})).catch((()=>{})):!1!==a&&(F(!0),t?.())},w=()=>{re(!1,(()=>oe(S.current)))},T=t=>{oo(e,n,t),f(c,t,i,l),se(e,i,l),h?.({[U]:t},e,A.current),te()},N={visible:k,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ln[u]+20}px`},onClose:()=>{w()}},I={...d,size:u,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=x;ne((0,J.uniqBy)([...A.current.filter((e=>t.includes(e[n]))),...e],n));const a=A.current.map((e=>({text:e[r],value:e[n]}))),i=(0,J.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));j(i),T(i.map((e=>e.value)));const{closed:l}=d;re(!1,(()=>oe(S.current))),l?.(A.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&&b?.({[U]:y},e)},onDoubleClick:()=>{s.disabled||C()},onChange:e=>{const{valueKey:t}=x;ne(A.current.filter((r=>e.includes(r[t])))),T(e)}},D.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:()=>{C()}})))),t().createElement(cr,N,t().createElement(lc,I)))},"tree-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:c=[],helper:d={},onChange:h,onEnter:b}=E,y=so(e,Z?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` 值"),Z&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[U]:y},e,r);a?.then?a.then((()=>{F(!0),t?.()})).catch((()=>{})):!1!==a&&(F(!0),t?.())},w=()=>{re(!1,(()=>oe(S.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=m.find((e=>e.dataIndex===t));if(a){oo(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&f(r.rules,n,i,t)}else oo(e,t,n)}oo(e,n,t,a),f(c,t,i,l),se(e,i,l),h?.({[U]:t},e),te()},I={visible:k,title:p("qm.searchHelper.text"),width:d.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ln[u]+20}px`},onClose:()=>{w()}},R={...d,defaultSelectedKeys:[y],size:u,onClose:e=>{e?(e=>{const t={};for(const r in x){const a=x[r];r!==n&&(t[r]=so(e,a))}const r=x[n]?so(e,x[n]):"";T(r,t);const{closed:a}=d;re(!1,(()=>oe(S.current))),ie(),a?.(e)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement(Ds,{ref:N,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??"";b?.({[U]:r},e)}},onDoubleClick:()=>{C()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?C():T(""))}}),t().createElement(cr,I,t().createElement(hc,R)))},"tree-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},items:s=[],rules:c=[],helper:d={},onInput:m,onChange:h,onEnter:b}=E,y=lo(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`"),P.current=x;const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[U]:y},e,r);a?.then?a.then((()=>{F(!0),t?.()})).catch((()=>{})):!1!==a&&(F(!0),t?.())},w=()=>{re(!1,(()=>oe(S.current)))},T=t=>{oo(e,n,t),f(c,t,i,l),se(e,i,l),h?.({[U]:t},e,A.current),te()},N={visible:k,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ln[u]+20}px`},onClose:()=>{w()}},I={...d,size:u,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=x;ne(e);const n=A.current.map((e=>({text:e[t],value:e[r]})));j(n),T(n.map((e=>e.value)));const{closed:a}=d;re(!1,(()=>oe(S.current))),a?.(A.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&&b?.({[U]:y},e)},onDoubleClick:()=>{o.disabled||C()},onChange:e=>{const{valueKey:t}=x;ne(A.current.filter((r=>e.includes(r[t])))),T(e)}},D.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:()=>{C()}})))),t().createElement(cr,N,t().createElement(hc,I)))}};return t().createElement(t().Fragment,null,Q?(()=>{const{type:e}=E,r=de[e];if(!r)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!W}];return t().createElement("div",{ref:S,className:Se()(i)},r(a,n),!W&&t().createElement("div",{className:"cell-error"},G||Y))})():(()=>{const{extra:e={}}=E,r=Z?so(a,E.helper.combinedDataIndex):s;return e.disabledColor?t().createElement("span",{style:{color:e.disabledColor}},r):t().createElement(t().Fragment,null,r)})(),X&&t().createElement("i",{className:"cell--sign"}))}));js.displayName="CellEdit";const Ks=js,Ms=require("copy-to-clipboard");var Vs=n.n(Ms);const zs=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)},Us=e=>{const{text:r,options:n,showMessage:a=!0,onCopy:i}=e;return zs(e.children,{onClick:l=>{const o=t().Children.only(e.children),s=Vs()(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)}})};Us.displayName="QmCopyToClipboard";const Bs=Us;function Ws(){return Ws=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},Ws.apply(this,arguments)}const Gs=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:H,getStickyLeft:L,getStickyRight:q,scrollXToColumn:$,scrollYToRecord:_,rowInViewport:D,dataChange:j,setPingLeft:K,setPingRight:M,setFullScreen:V,findParentRowKeys:z,getAllChildRowKeys:U,triggerScrollYEvent:B,scrollBottomDebouncer:W}=t().useContext(xl),{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(xl),{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");De((()=>{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||Co.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(Tl):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(Nl):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(Nl.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(Number(e))?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>co(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:no(Y)-e-r+"px"}),X&&Object.assign(i,{maxHeight:no(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]),[He,Le]=t().useState([]),qe=Oo(),$e=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:qe}))),De((()=>{$e&&(ze([]),O&&Pe())}),[$e]),De((()=>{He.length&&Al.focus(c.current.uid)}),[He]),t().useEffect((()=>{je()}),[]);const _e=t().useCallback((e=>{const{keyCode:t}=e;if(c.current.uid===Al.getFocusInstance()?.id&&(27===t&&(ze([]),H(""),V(!1)),He.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?eo(a):r,i=n.length;let o=n.findIndex((e=>l(e,e.index)===He[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)&&H(u),D(s)||(38===t&&_(u,s),40===t&&_(u,Fe>s+1?0:s+1-Fe)),ze([u,He[1]])}if(9===t){if(Ue(e),!d.length)return ze([]);const t=d.length;let r=d.findIndex((e=>e.dataIndex===He[1]));const n=++r%t,a=d[n].dataIndex;ze([He[0],a]),$(a)}}}),[He,a,E,d,Fe]);t().useEffect((()=>{const e=_t()(document,"keydown",_e);return()=>e.remove()}),[_e]);const je=()=>{A("$tableBody",xe.current),A("$tableYspace",Te.current)},Ke=(e,t)=>{Ee.current[`${e}-${t}`]?.focus()},ze=e=>{(0,J.isEqual)(e,He)||Le(e)},We=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),Ge=(e,t,r)=>{const{deriveRowKeys:n}=c.current,a=Jl(n,e);let i=[];const l=U(a?.children||[]),o=yo(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=Jl(n,e),r=io(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*Co.selectionColumnWidth:Co.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?`${L(d)}px`:"",right:S?`${q(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=tt(e,n,a,r);return t().createElement("td",{key:d,title:v?O:void 0,rowSpan:b>1?b:void 0,colSpan:y>1?y:void 0,"data-index":r,className:Se()(C),style:{...w,...P,...T,...N},onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([Co.expandableColumn,Co.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===Co.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),[Co.selectionColumn].includes(n)||(!Z||Z.disabled?.(t)||o||H(a),ge?.(t,r,e))})(t,n,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(n)||be?.(t,r,e)})(t,n,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(n)||ye?.(t,r,e)})(t,n,e)},t().createElement("div",{className:"cell"},et(e,n,a,r,O,i,o)))},et=(e,r,n,a,i,l,o)=>{const{dataIndex:s,canCopy:c,editRender:d,render:u}=e,m=lo(r,s);if(s===Co.expandableColumn)return t().createElement(Ls,{record:r,rowKey:l});if(s===Co.selectionColumn)return t().createElement(Hs,{selectionKeys:E,column:e,record:r,rowKey:l});const f=rt(m,e,r);if(d)return t().createElement(Ks,{ref:e=>Ee.current[`${l}-${s}`]=e,column:e,record:r,rowKey:l,columnKey:s,clicked:He,text:f});const g=u?u(m,r,e,n,a):f;return I&&s===h?[it(ee?.virtual?r._level:o),t().createElement(Ls,{key:"expand",record:r,rowKey:l,style:Ye(r)?{}:{visibility:"hidden"}}),g]:c?t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},g),i&&t().createElement(Bs,{text:i},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([Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(a))return"";let l="";const o=lo(t,a);if("function"==typeof i){const a=i(o,t,e,r,n);l=te(a)?ho(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(Qr())(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*Co.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",Ws({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($r.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=[];c.current.tableFullData.forEach((t=>{a.includes(t)?n.push(e.shift()):n.push(t)})),k(n),j()}},a.map((e=>Ze(e,e.index,l(e,e.index))))):t().createElement("tbody",null,Qe(a)))),O&&Re())}));Gs.displayName="TableBody";const Ys=Gs,Xs=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(xl),{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):lo(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 Qs=function(e){return e.small="small",e.middle="default",e.large="default",e}(Qs||{});const Zs=e=>{const{current:r,pageSize:n,total:a,onChange:i}=e,{global:o}=t().useContext(l),{tableProps:s,$size:c,setElementStore:d}=t().useContext(xl),{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??Co.pagination.showSizeChanger,y=p?.showQuickJumper??Co.pagination.showQuickJumper,v=p?.pageSizeOptions||o?.table?.pagination?.pageSizeOptions||Co.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)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(Ao,{total:a})),t().createElement(O.Pagination,{size:Qs[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}`))}}))},Js=()=>{const{layout:e}=t().useContext(xl),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 ec(){return ec=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},ec.apply(this,arguments)}const tc=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,showColumnDefine:v,showHeader:x}=e,{size:E}=t().useContext(l),S=t().useMemo((()=>e.size??E??""),[e.size,E]),C=t().useRef(null),w=t().useRef(null),T=t().useRef(null),N=t().useRef(null),I=t().useRef(null),R=Oo(),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:H,setTableOriginData:L,setAllTableData:q,setDeriveRowKeys:$,setInvalidRowKeys:_,setFieldAuth:D,setMergeCells:j,setScrollYStore:K,setScrollYLoad:M,setResizeState:V,setHandleState:z,setSummaries:U,setSelectionRows:B,setShouldToTop:W,setRecordsMap:G,setUnMounted:Y,setHandleChange:X,clearElementStore:Q,clearRecordsMap:Z}=((e,r)=>{let{getRowKey:n,$size:a}=r;const i=t().useRef({uid:mo(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},mergeCells:[],scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:Co.rowHeightMaps[a]},store:new So,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)}),l=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 o=n(e,e.index),s=r?`${r}#${o}`:`${o}`,c=a?`${a}-${e.index+1}`:`${e.index+1}`,d={level:i,rowKey:o,rowKeyPath:s,indexPath:c};return e.indexPath=c,e._level=i,e.children&&(d.children=l(e.children,o,s,c,i+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},o=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...o(e.children)):t.push(e.rowKey)})),t};return{tableRef:i,...i.current,setElementStore:(e,t)=>{i.current.elementStore[e]=t},setOriginColumns:e=>{i.current.originColumns=e},setTableFullData:e=>{i.current.tableFullData=e},setTableOriginData:e=>{i.current.tableOriginData=e},setAllTableData:e=>{const t=eo(e);i.current.allTableData=t,i.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{i.current.treeTable=i.current.tableFullData.some((e=>Array.isArray(e.children))),i.current.treeTable&&(i.current.deriveRowKeys=l(e,""),i.current.flattenRowKeys=o(i.current.deriveRowKeys))},setInvalidRowKeys:e=>{i.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{i.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})})),i.current.mergeCells=t},setScrollYStore:e=>{i.current.scrollYStore=e},setResizeState:e=>{i.current.resizeState=e},setHandleState:e=>{i.current.handleState=e},setSummaries:e=>{i.current.summaries=e},setScrollYLoad:e=>{i.current.scrollYLoad=e},setShouldToTop:e=>{i.current.shouldToTop=e},setSelectionRows:e=>{i.current.selectionRows=e},setRecordsMap:(e,t)=>{i.current.recordsMap.set(e,t)},setUnMounted:e=>{i.current.unMounted=e},setHandleChange:e=>{i.current.isHandleChange=e},clearElementStore:()=>{for(const e in i.current.elementStore)i.current.elementStore[e]=null},clearRecordsMap:()=>{i.current.recordsMap.clear()}}})(0,{getRowKey:P,$size:S}),{tableData:te,setTableData:re,filters:ne,setFilters:ae,sorter:ie,setSorter:le,superFilters:oe,setSuperFilters:se,pagination:de,setPagination:ue,selectionKeys:pe,setSelectionKeys:me,rowExpandedKeys:he,setRowExpandedKeys:fe,highlightKey:ge,setHighlightKey:be,layout:ye,setLayout:ve,permission:xe,setPermission:Ee,spinning:we,setSpinning:Te,scrollX:Ne,setScrollX:Ie,scrollY:Re,setScrollY:Pe,isPingLeft:Oe,setPingLeft:Ae,isPingRight:ke,setPingRight:Fe,isFullScreen:He,setFullScreen:Le,updateTableData:qe}=(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:Co.pagination.current,pageSize:(()=>{if(r)return Number(localStorage.getItem(`tablePager_${r}`))||void 0})()??o?.pageSize??u?.table?.pagination?.pageSize??Co.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?To():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[F,H]=t().useState({export:!0,import:!0,print:!0}),[L,q]=t().useState(!1),[$,_]=t().useState(!1),[D,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:H,setLayout:k,spinning:L,setSpinning:q,scrollX:$,setScrollX:_,scrollY:D,setScrollY:j,isPingLeft:K,setPingLeft:M,isPingRight:V,setPingRight:z,isFullScreen:U,setFullScreen:B,updateTableData:()=>{g([...f])}}})(e),{isFetch:$e,isWebPagination:_e,isScrollPagination:je,showPagination:Ke,shouldUpdateHeight:Me,tableColumns:Ve,flattenColumns:ze,editableColumns:Ue,summationColumns:Be,leftFixedColumns:We,rightFixedColumns:Ge,treeExpandIndex:Ye,showSummary:Xe,showFooter:Qe,isHeadGroup:Ze,bordered:Je,isHeadSorter:et,isHeadFilter:tt,isServiceSummation:rt,isSelectCollection:nt,isTableImport:at,isTableClipboard:it,isSuperSearch:lt,isFastSearch:ot,isGroupSummary:st,isGroupSubtotal:ct,isDragMergeCell:dt,isTreeTable:ut,isTableEmpty:pt,summationRows:mt,fetchParams:ht}=Io(e,{getRowKey:P,tableRef:O,tableFullData:A,tableData:te,sorter:ie,filters:ne,superFilters:oe,selectionKeys:pe,pagination:de}),{createElementStore:gt,tableStyles:bt,getSpan:yt,getStickyLeft:vt,getStickyRight:xt,scrollXToColumn:Et,scrollYToRecord:St,rowInViewport:Ct,calcTableHeight:wt,resetTableScroll:Tt,doLayout:Nt}=Po(e,{getRowKey:P,tableRef:O,$size:S,tableColumns:Ve,flattenColumns:ze,leftFixedColumns:We,layout:ye,scrollY:Re,tableData:te,showFooter:Qe,showPagination:Ke,isWebPagination:_e,isFullScreen:He,setLayout:ve,setScrollX:Ie,setScrollY:Pe,setElementStore:k,setScrollYStore:K,setShouldToTop:W}),{initialTable:It,createTableFullData:Rt,getTableData:Pt,handleTableData:Ot,createTableData:At,createGroupData:kt,createSelectionKeys:Ft,createRowExpandedKeys:Ht,setSelectionKeysEffect:Lt,findParentRowKeys:qt,getAllChildRowKeys:$t,doFieldValidate:_t,getTableLog:Dt,dataChange:jt,tableChange:Kt,toLastPage:Mt,toFirstPage:Vt,getPageCount:zt,pagerChangeHandle:Ut,triggerScrollYEvent:Bt,scrollBottomDebouncer:Wt,clearTableSorter:Gt,clearTableFilter:Yt,clearSuperFilters:Xt,clearRowSelection:Qt,clearRowHighlight:Zt,clearTableLog:Jt,destroy:er}=Ro(e,{getRowKey:P,tableRef:O,tableElementRef:w,tableBodyRef:T,$size:S,tableColumns:Ve,tableFullData:A,pagination:de,layout:ye,filters:ne,sorter:ie,superFilters:oe,fetchParams:ht,selectionKeys:pe,rowExpandedKeys:he,highlightKey:ge,summationColumns:Be,shouldUpdateHeight:Me,isFetch:$e,isTreeTable:ut,isWebPagination:_e,isScrollPagination:je,isServiceSummation:rt,isGroupSubtotal:ct,doLayout:Nt,setTableData:re,setTableFullData:H,setTableOriginData:L,setAllTableData:q,setDeriveRowKeys:$,setPagination:ue,setSpinning:Te,setSorter:le,setFilters:ae,setSuperFilters:se,setSelectionKeys:me,setRowExpandedKeys:fe,setHighlightKey:be,setSelectionRows:B,setScrollYLoad:M,setScrollYStore:K,setFieldAuth:D,setResizeState:V,setSummaries:U,setPermission:Ee,setRecordsMap:G,resetTableScroll:Tt,clearElementStore:Q,clearRecordsMap:Z});((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,toLastPage:N,toFirstPage:I,getPageCount:R,setHandleState:P,scrollYToRecord:O,setSelectionKeysEffect:A,setOriginColumns:k,setRowExpandedKeys:F,setHighlightKey:H,setResizeState:L,setMergeCells:q,setPingRight:$,setUnMounted:_,setHandleChange:D,calcTableHeight:j,createSelectionKeys:K,createRowExpandedKeys:M,createElementStore:V,triggerScrollYEvent:z,initialTable:U,destroy:B}=r,{elementStore:W,handleState:G,scrollYLoad:Y}=c.current,X=t().useRef(E);De((()=>{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),D(!0)}),[y]),De((()=>{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]),De((()=>{const{allTableData:e,allRowKeys:t}=c.current;T&&F(M()),o&&(p.current.setClickedValues(x?[x,""]:[]),o.onChange?.(x,e[t.findIndex((e=>e===x))]??null))}),[x]),De((()=>{(0,J.isEqual)(E,X.current)||(X.current=E,S&&a&&a.onChange?.(E))}),[E]),De((()=>{const e=K(i.selectedRowKeys);(0,J.isEqual)(e,y)||(A(e),T&&F(M()))}),[i?.selectedRowKeys]),De((()=>{const e=M(l.expandedRowKeys);(0,J.isEqual)(e,v)||F(e)}),[l?.expandedRowKeys]),De((()=>{const{currentRowKey:e}=o;e!==x&&H(e??"")}),[o?.currentRowKey]),De((()=>{const{insert:e,remove:t}=G;e&&(C&&("after"===e?N():I()),O("","after"===e?1e5:0)),t&&b.current>R()&&N(),(e||t)&&P({insert:null,remove:!1})}),[b.total]),De((()=>{Y&&z(W.$tableBody.parentNode.parentNode.scrollTop)}),[Y]),De((()=>{$(f)}),[f]),De((()=>{j()}),[h]),De((()=>{q(s),p.current.forceUpdate()}),[s]),De((()=>{Y&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),w&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Y,w]);const Q=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(L(Object.assign({},e,{winHeight:r})),j())};t().useEffect((()=>(V({$toper:d.current,$table:u.current,$resizableBar:m.current}),k(ce(n)),U(),q(s),window.addEventListener("resize",Q,!1),j(),()=>{B(),window.removeEventListener("resize",Q),_(!0)})),[])})(e,{tableRef:O,topElementRef:C,tableElementRef:w,tableBodyRef:T,resizableBarRef:I,$size:S,scrollX:Ne,pagination:de,selectionKeys:pe,rowExpandedKeys:he,highlightKey:ge,showSummary:Xe,summationRows:mt,isWebPagination:_e,isScrollPagination:je,isTreeTable:ut,toLastPage:Mt,toFirstPage:Vt,getPageCount:zt,setHandleState:z,scrollYToRecord:St,setOriginColumns:F,setSelectionKeysEffect:Lt,setRowExpandedKeys:fe,setHighlightKey:be,setResizeState:V,setMergeCells:j,setPingRight:Fe,setUnMounted:Y,setHandleChange:X,calcTableHeight:wt,createSelectionKeys:Ft,createRowExpandedKeys:Ht,createElementStore:gt,triggerScrollYEvent:Bt,initialTable:It,destroy:er});const tr=t().useMemo((()=>({getRowKey:P,tableProps:e,tableRef:O,tableBodyRef:T,$size:S,flattenColumns:ze,editableColumns:Ue,leftFixedColumns:We,rightFixedColumns:Ge,treeExpandIndex:Ye,sorter:ie,filters:ne,superFilters:oe,layout:ye,bordered:Je,showFooter:Qe,showSummary:Xe,summationRows:mt,scrollX:Ne,scrollY:Re,pagination:de,fetchParams:ht,selectionKeys:pe,rowExpandedKeys:he,highlightKey:ge,isFetch:$e,isPingLeft:Oe,isPingRight:ke,isHeadSorter:et,isHeadFilter:tt,isFullScreen:He,isTableEmpty:pt,isHeadGroup:Ze,isTreeTable:ut,isGroupSubtotal:ct,isWebPagination:_e,isDragMergeCell:dt,dataChange:jt,tableChange:Kt,getTableData:Pt,setElementStore:k,createTableFullData:Rt,updateTableData:qe,setSorter:le,setFilters:ae,setSuperFilters:se,setHighlightKey:be,setRowExpandedKeys:fe,setSelectionRows:B,setSelectionKeysEffect:Lt,setInvalidRowKeys:_,getSpan:yt,getStickyLeft:vt,getStickyRight:xt,scrollXToColumn:Et,scrollYToRecord:St,rowInViewport:Ct,setPagination:ue,setPingLeft:Ae,setPingRight:Fe,setSpinning:Te,setFullScreen:Le,setShouldToTop:W,doFieldValidate:_t,createTableData:At,createGroupData:kt,findParentRowKeys:qt,getAllChildRowKeys:$t,triggerScrollYEvent:Bt,scrollBottomDebouncer:Wt,resetTableScroll:Tt,clearTableSorter:Gt,clearTableFilter:Yt,clearSuperFilters:Xt,clearRowSelection:Qt,clearRowHighlight:Zt})),[e,S,ze,Ue,We,Ge,Ye,ie,ne,oe,ye,Je,Qe,Xe,mt,Ne,Re,de,ht,pe,he,ge,$e,Oe,ke,et,tt,He,pt,Ze,ut,ct,_e,dt]);((e,r)=>{const{getRowKey:n,tableProps:a,tableRef:i,toolBoxRef:l,tableBodyRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:m,highlightKey:h,isFetch:f,dataChange:b,getTableData:y,handleTableData:v,createTableData:x,calcTableHeight:E,scrollXToColumn:S,scrollYToRecord:C,doFieldValidate:w,setHandleState:T,setSelectionKeysEffect:N,setRowExpandedKeys:I,setHighlightKey:R,setSelectionRows:P,setOriginColumns:O,setHandleChange:A,forceUpdate:k,getTableLog:F,clearRowSelection:H,clearRowHighlight:L,clearTableSorter:q,clearTableFilter:$,clearSuperFilters:_,clearTableLog:D}=r,{columns:j,columnsChange:K}=a,M=(e,t,r)=>{for(let a=0;a<e.length;a++){const i=e[a],l=n(i,i.index);Array.isArray(i.children)&&M(i.children,t,r),t.includes(l)&&(r?.(i,l),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:async e=>{f&&(await y(),e?.())},GET_LOG:()=>F(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(H(),L(),q(),$(),_(),D(),x([]))},CLEAR_LOG:()=>{D()},CREATE_FOCUS:(e,t)=>{o.current.createFocus(e,t)},FORCE_UPDATE:()=>{k()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{S(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,J.isEqual)(e,p)&&A(!1),N(e)},SET_HIGHLIGHT:e=>{R(e)},SET_EXPANDABLE:e=>{I(e)},SET_SELECTION_ROWS:e=>{P(e)},SET_TABLE_DATA:e=>{v(e)},DEFINE_INITIAL_COLUMNS:e=>{O(e)},SET_TABLE_COLUMN:(e,t,r)=>{const n=Yl(j,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&&(K?K([...j]):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=>{s.forEach((t=>{const{dataIndex:r}=t;[Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(r)||oo(e,r,lo(e,r))})),r.addToInserted(e)}));const o="before"===t?.mode,c=void 0===t?.parentRowKey;let d=a;if(c)d=o?[...l,...d]:d.concat(l);else{const e=vo(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)}x(d),c&&T(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),b()},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;M(r,a,((e,r)=>{t.addToRemoved(e),c.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&&(x(r),N(p.filter((e=>!a.includes(e)))),a.includes(h)&&L(),I(m.filter((e=>!a.includes(e)))),T(Object.assign({},i.current.handleState,{remove:!0})),b())},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((r=>{c.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&&w(c,lo(r,i),s,i)}))}));const{required:r,validate:a}=F(),l=[...r,...a];return l.length&&C(l[0].rowKey),k(),{required:r,validate:a}}})))})(r,{getRowKey:P,tableProps:e,tableRef:O,toolBoxRef:N,tableBodyRef:T,flattenColumns:ze,editableColumns:Ue,pagination:de,fetchParams:ht,selectionKeys:pe,rowExpandedKeys:he,highlightKey:ge,isFetch:$e,dataChange:jt,getTableData:Pt,handleTableData:Ot,createTableData:At,calcTableHeight:wt,scrollXToColumn:Et,scrollYToRecord:St,doFieldValidate:_t,setHandleState:z,setSelectionKeysEffect:Lt,setRowExpandedKeys:fe,setHighlightKey:be,setSelectionRows:B,setOriginColumns:F,setHandleChange:X,forceUpdate:R,getTableLog:Dt,clearRowSelection:Qt,clearRowHighlight:Zt,clearTableSorter:Gt,clearTableFilter:Yt,clearSuperFilters:Xt,clearTableLog:Jt}),t().useEffect((()=>{Al.register(O.current.uid,r??{current:null})}),[]);const rr=Ce("table"),nr={[`${rr}--wrapper`]:!0,[`${rr}--lg`]:"large"===S,[`${rr}--sm`]:"small"===S,[`${rr}--maximize`]:He,[c]:!!c},ar={[rr]:!0,"is--border":Je,"is--striped":o,"is--fixed":We.length||Ge.length,"is--sortable":et,"is--filterable":tt,"is--head-group":Ze,"is--merge-cell":dt,"is--empty":pt,"show--head":x,"show--foot":Qe,"ping--left":Oe,"ping--right":ke,"scroll--x":Ne,"scroll--y":Re};return t().createElement(xl.Provider,{value:tr},t().createElement("div",{className:Se()(nr)},h&&t().createElement("div",{ref:C,className:`${rr}-top`},t().createElement("div",{className:`${rr}-top__space`},"bottom"!==p?.position&&t().createElement(Ao,{total:de.total}),t().createElement("div",{className:`${rr}-top__space-slot`,style:{justifyContent:Pl[m]}},e.children)),t().createElement("div",{className:`${rr}-top__actions`},t().createElement(Cs,{ref:N,showFullScreen:f,showReload:b&&$e,showPrint:xe.print&&!!d,showImport:xe.import&&at,showExport:xe.export&&!!u,showClipboard:it,showCollection:nt,showFastSearch:ot,showSuperSearch:lt,showGroupSummary:st,showToolBox:y,tableColumns:Ve}),v&&t().createElement(ws,{columns:a}))),t().createElement(ft,{spinning:i??we},t().createElement("div",{ref:w,className:Se()(ar),style:bt},t().createElement("div",{className:`${rr}--main-wrapper`},x&&t().createElement(Fs,{tableColumns:Ve,flattenColumns:ze,sorter:ie,filters:ne}),t().createElement(Ys,{ref:T,tableData:te,flattenColumns:ze}),Qe&&t().createElement(Xs,{summationRows:mt,flattenColumns:ze})),Je&&t().createElement("div",{className:`${rr}--border-line`}),pt&&t().createElement(Js,null),s&&t().createElement("div",{ref:I,className:`${rr}--resizable-bar`}))),Ke&&t().createElement(Zs,ec({},de,{onChange:(e,t)=>Ut({current:e,pageSize:t})}))))}));tc.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},tc.displayName="QmTable";const rc=tc,nc=rc;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=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},onClose:d}=e,{size:u}=t().useContext(l),m=t().useMemo((()=>e.size??u??""),[e.size,u]),h=t().useRef(null),f=t().useRef(null),g=t().useRef(null),b=St(h),[y,v]=t().useState(c),[x,E]=t().useState(),[S,C]=t().useState(o),[w,T]=t().useState(!1),[N,I]=t().useState(300),[R,P]=t().useState(s),[O,A]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[k,F]=t().useState((0,J.merge)({},c.fetch?.params,a)),[H,L]=t().useState([]),q=()=>{const e=h.current,t=e.querySelector(".form-wrap");I(e.offsetHeight-t.offsetHeight-2*ln[m]-30)},$=Ct(q,5);De((()=>{$()}),[b.width]),De((()=>{(0,J.isEqual)(s,R)||P(s)}),[s]),t().useEffect((()=>{_()}),[k]),t().useEffect((()=>{i&&g.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&f.current?.SET_FIELDS_VALUE(a)}),[]);const _=async()=>{const{webPagination:e,fetch:t}=y;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(k)){T(!0);try{const e=await r(k);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(C([]),await ie(0)),L(t)}}catch(e){}T(!1)}},D=e=>{n||(E(e),d(e))},j=e=>{F(Object.assign({},k,e))},K=Ce("search-helper"),M=y.webPagination?{dataSource:H,loading:w,webPagination:!0}:{fetch:{...y.fetch,params:k}};return t().createElement("div",{ref:h,className:`${K}--wrapper`},t().createElement("div",{className:"form-wrap"},R.length?t().createElement(Ii,{ref:f,items:R,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>P(e),onCollapse:()=>q(),onFinish:e=>j(e),onReset:async()=>{const[e,t]=await f.current.GET_FORM_DATA();e||j(t)}}):null),t().createElement("div",null,t().createElement(nc,ac({ref:g,uniqueKey:r,height:N,columns:O,rowKey:y.rowKey||"pageIndex"},M,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{C(e),E(n?t:t[0])}},columnsChange:e=>A(e),onRowDblclick:D,onRowEnter:D}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ln[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>d(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!x,onClick:()=>d(x,n?S:void 0)},p("qm.dialog.confirm"))))};ic.displayName="SearchHelper";const lc=ic;function oc(){return oc=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},oc.apply(this,arguments)}const sc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...sc(e.children)),e.children&&t.push(e.value)})),t},cc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=cc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},dc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&dc(e.children,t),t(e)||e.children&&e.children.length))),uc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},onClose:u}=e,{size:m}=t().useContext(l),h=t().useMemo((()=>e.size??m??""),[e.size,m]),f=t().useRef(null),b=t().useRef(null),y=t().useRef(null),v=St(f),[x,E]=t().useState(c),[S,C]=t().useState(),[w,T]=t().useState(o),[N,I]=t().useState(!1),[R,P]=t().useState(300),[A,k]=t().useState(300),[F,H]=t().useState(s),[L,q]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[$,_]=t().useState((0,J.merge)({},c.fetch?.params,a)),[D,j]=t().useState([]),K=()=>{const e=f.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");P(e.offsetHeight-r.offsetHeight-10),k(e.offsetHeight-t.offsetHeight-2*ln[h]-30)},M=Ct(K,5);De((()=>{M()}),[v.width]),De((()=>{(0,J.isEqual)(s,F)||H(s)}),[s]),t().useEffect((()=>{V()}),[$]),t().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&b.current?.SET_FIELDS_VALUE(a),te()}),[]);const V=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i($)){I(!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||(T([]),await ie(0)),j(t)}}catch(e){}I(!1)}},z=e=>{n||(C(e),u(e))},U=e=>{_(Object.assign({},$,e))},[B,W]=t().useState([]),[G,Y]=t().useState([]),[X,Q]=t().useState(""),Z=t().useRef(B),ee=t().useRef([]);De((()=>{Y(sc(B))}),[B]);const te=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);W(t),Z.current=t,ee.current=e}}catch(e){}},re=e=>`${e}|${Ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ne=Ce("tree-table-helper"),le=x.webPagination?{dataSource:D,loading:N,webPagination:!0}:{fetch:{...x.fetch,params:$}};return t().createElement("div",{ref:f,className:`${ne}--wrapper`},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:X,style:{marginBottom:8},placeholder:p("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=dc(Z.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==re(r).indexOf(e)}));Q(e),W(t)})(e.target.value)}),t().createElement(O.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:G,treeData:B,filterTreeNode:e=>{if(!X)return!1;const t=e.text||"";return-1!==re(t).indexOf(X)},onExpand:e=>{Y(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]);U(r)})(cc(ee.current,(r=>(0,J.get)(r,t)===e[0]))||{})}})),t().createElement(nt.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},F.length?t().createElement(Ii,{ref:b,items:F,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>H(e),onCollapse:()=>K(),onFinish:e=>U(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||U(t)}}):null),t().createElement("div",null,t().createElement(nc,oc({ref:y,uniqueKey:r,height:A,columns:L,rowKey:x.rowKey||"pageIndex"},le,{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=>q(e),onRowDblclick:z,onRowEnter:z}))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ln[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!S,onClick:()=>u(S,n?w:void 0)},p("qm.dialog.confirm"))))};uc.displayName="TreeTableHelper";const pc=uc,mc=e=>{const{multiple:r,tree:n={},defaultSelectedKeys:a,onClose:i}=e,{size:o}=t().useContext(l),s=t().useMemo((()=>e.size??o??""),[e.size,o]),[c,d]=t().useState(),[u]=t().useState(n.fetch?.params),m=Ce("tree-helper"),h=n.fetch?{...Z()(n.fetch,["params","valueKey","textKey"]),params:u}:void 0;return t().createElement("div",{className:`${m}--wrapper`},t().createElement(vl,{multiple:r,fetch:h,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=>d(e),onCheckChange:e=>d(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ln[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>i(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!c,onClick:()=>i(c)},p("qm.dialog.confirm"))))};mc.displayName="TreeHelper";const hc=mc;function fc(){return fc=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},fc.apply(this,arguments)}const gc="_startSign",bc="_endSign",yc=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:gc,width:80,align:"right",render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:bc,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]),H=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*ln[c]-30)},L=Ct(H,5);De((()=>{L()}),[h.width]),De((()=>{(0,J.isEqual)(a,C)||w(a)}),[a]),t().useEffect((()=>{q()}),[I]);const q=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)}},$=(e,t)=>{delete e[t]},_=()=>{v.forEach((e=>{e&&($(e,gc),$(e,bc))})),x([])},D=e=>{_(),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(Ii,{ref:u,items:C,initialValues:n,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>H(),onFinish:e=>D(e),onReset:async()=>{const[e,t]=await u.current.GET_FORM_DATA();e||D(t)}}):null),t().createElement("div",null,t().createElement(nc,fc({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;[gc,bc].includes(r)&&(r===gc&&(e[r]?($(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?O.message.warning(p("qm.searchHelper.rangeStartTip")):(v[0]&&$(v[0],r),e[r]="[",x([e,v[1]]))),r===bc&&(e[r]?($(e,r),x([v[0],void 0])):e.pageIndex<k[0]?O.message.warning(p("qm.searchHelper.rangeEndTip")):(v[1]&&$(v[1],r),e[r]="]",x([v[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[gc]="["),e.pageIndex===k[1]&&(e[bc]="]")}))}}),t().createElement(he,{type:"primary",icon:t().createElement(we.ClearOutlined,null),title:p("qm.table.alert.clear"),onClick:()=>_()}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ln[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)[gc,bc].includes(r)||(t[r]=e[r]);return t})(e))))},p("qm.dialog.confirm"))))};yc.displayName="RangeTableHelper";const vc=yc;function xc(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 Ec=e=>null!=e;function Sc(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=xc((()=>{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 Cc=(t,r)=>{const n=e.useRef(!0);e.useLayoutEffect((()=>t(n.current)),r),e.useLayoutEffect((()=>(n.current=!1,()=>{n.current=!0})),[])};function wc(e,t){Cc((t=>{if(!t)return e()}),t)}function Tc(e){return void 0!==e}function Nc(t,r){const{defaultValue:n,value:a,onChange:i,postState:l}=r||{},[o,s]=e.useState((()=>Tc(a)?a:Tc(n)?"function"==typeof n?n():n:"function"==typeof t?t():t)),c=Tc(a)?a:o,d=l?l(c):c,u=xc(i),[p,m]=e.useState([c]);return wc((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),wc((()=>{Tc(a)||s(a)}),[a]),[d,xc((e=>{s(e),m([c])}))]}const Ic={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"]}},Rc={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"]}},Pc=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Oc(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(Ic).forEach((e=>{const c={...n&&Rc[e]||Ic[e],offset:[0,0]};switch(s[e]=c,Pc.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 Ac=require("@rc-component/portal");var kc=n.n(Ac);const Fc=require("@rc-component/trigger");var Hc=n.n(Fc);const Lc=require("rc-util/lib/hooks/useId");var qc=n.n(Lc);function $c(){return $c=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},$c.apply(this,arguments)}const _c={fill:"transparent",pointerEvents:"auto"},Dc=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-${qc()()}`,p="object"==typeof c?c?.placeholder:c;return t().createElement(kc(),{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",$c({},a?null:_c,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),a&&t().createElement(t().Fragment,null,t().createElement("rect",$c({},_c,{x:"0",y:"0",width:"100%",height:`${a.top}px`})),t().createElement("rect",$c({},_c,{x:"0",y:"0",width:a.left,height:"100%"})),t().createElement("rect",$c({},_c,{x:"0",y:a.top+a.height,width:"100%",height:`calc(100vh - ${a.top+a.height}px)`})),t().createElement("rect",$c({},_c,{x:a.left+a.width,y:"0",width:`calc(100vw - ${a.left+a.width}px)`,height:"100%"})))):null))},jc=e=>{const{prefixCls:r,zIndex:n,open:a,onPause:i,onPlay:l}=e,[o,s]=Nc(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 Kc(){const{locale:t}=e.useContext(l);return{t:p,$locale:t}}const Mc=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}=Kc(),f=Ec(i)?t().createElement("div",{className:`${r}-cover`},i):null,g=Ec(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"))))))},Vc=e=>{const{current:r,renderPanel:n}=e;return t().createElement(t().Fragment,null,"function"==typeof n?n(e,r):t().createElement(Mc,e))};function zc(){return zc=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},zc.apply(this,arguments)}const Uc={left:"50%",top:"50%",width:1,height:1},Bc=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]=Nc(0,{value:i,defaultValue:a}),[I,R]=Nc(void 0,{value:c,postState:e=>!(T<0||T>=n.length)&&(e??!1)}),[P,O]=Nc(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:H,placement:L,style:q,arrow:$,className:_,mask:D,scrollIntoViewOptions:j,zIndex:K,action:M}=n[T]||{},V=K||P,z=I&&(D??u),U=j??E,[B,W]=Sc(H,!!c,v,U),G=((e,t,r)=>r??t??(null===e?"center":"bottom"))(W,g,L),Y=!!W&&(void 0===$?p:$),X="object"==typeof Y&&Y.pointAtCenter;t().useLayoutEffect((()=>{w.current?.forceAlign()}),[X,T]),De((()=>{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,q),re=Ce("tour"),ne=[{[`${re}-${d}`]:"primary"===d},h,_],ae=Oc({arrowPointAtCenter:X,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Dc,{zIndex:V,prefixCls:re,pos:B,showMask:J,style:ee?.style,fill:ee?.color,open:A,animated:x,rootClassName:h}),t().createElement(Hc(),zc({ref:w},C,{zIndex:V,builtinPlacements:ae,popupStyle:te,popupPlacement:G,popupVisible:A,popupClassName:Se()(ne),prefixCls:re,popup:()=>t().createElement(Vc,zc({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(kc(),{open:A,autoLock:!0},t().createElement("div",{className:Se()(h,`${re}-target-placeholder`),style:{...B||Uc,position:"fixed",pointerEvents:"none"}}))),m&&t().createElement(kc(),{open:I},t().createElement(jc,{zIndex:V,prefixCls:re,onPause:()=>k(!1),onPlay:()=>k(!0)})))}));Bc.displayName="QmTour";const Wc=Bc,Gc=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Yc=e=>({_s:e,status:Gc[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Xc=e=>e?6:5,Qc=(e,t,r,n,a)=>{clearTimeout(n.current);const i=Yc(e);t(i),r.current=i,a?.({current:i})},Zc=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)((()=>Yc(o?2:Xc(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 Xc(t)}})(m.current._s,c);e&&Qc(e,p,m,h,d)}),[d,c]),y=(0,e.useCallback)((e=>{const t=e=>{switch(Qc(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:Xc(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 wc((()=>{c()}),[a]),t().createElement(t().Fragment,null,t().Children.map(r.children,(e=>t().isValidElement(e)?zs(e,{className:Se()(e.props.className,n,s.status)}):e)))},Jc={previewWidth:1100,defaultDistance:.45,logoHeight:60},ed=(0,e.createContext)(void 0);var td=null;function rd(){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 nd(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(rd()){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:td?r=td:((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),td=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&rd(),r}catch(e){O.message.error("getLodop 出错:"+e)}}rd();const ad=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)},id=t().forwardRef(((e,r)=>{const{templateRender:n,directPrint:a}=e,{global:i}=t().useContext(l),{$$preview:o}=t().useContext(ed),{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:H,DIRECT_PRINT:L}))),De((()=>{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*Jc.defaultDistance+10*Jc.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*Jc.defaultDistance+10*Jc.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return ad(v-10*(e.left-Jc.defaultDistance)-10*(e.right-Jc.defaultDistance))}),[s,v]),S=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return ad(x-10*(e.top-Jc.defaultDistance)-10*(e.bottom-Jc.defaultDistance))}),[s,x]),C=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:ad(10*e.left),right:ad(10*e.right),top:ad(10*e.top),bottom:ad(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=Jc.previewWidth-i<=0?0:(Jc.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>Jc.previewWidth?0:l>0?o:(Jc.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: ${Jc.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-Jc.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+=Jc.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>"},H=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return q();p.current.previewEl.innerHTML||(R(),await ie(0),P(),O(),y(!1))},L=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return q();R(),await ie(0),P(),O(),y(!1),o.doPrint(k()),await ie(0),o.doClose()},q=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},$={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:u,className:Se()($)},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}))))}));id.displayName="Container";const ld=id;function od(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 sd extends e.Component{constructor(){super(...arguments),od(this,"formRef",t().createRef()),od(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:Jc.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:Jc.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:Jc.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:Jc.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),od(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})})),od(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")}))),od(this,"state",{formList:this.createFormList()}),od(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())})),od(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return t().createElement(t().Fragment,null,t().createElement(Ii,{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"))))}}od(sd,"contextType",l);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,"provide",{$$preview:this}),dd(this,"containRef",t().createRef()),dd(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Jc.defaultDistance,right:Jc.defaultDistance,top:Jc.defaultDistance,bottom:Jc.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),dd(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),dd(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),dd(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 ds().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),dd(this,"doClose",(()=>{this.props.onClose?.()})),dd(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){}})),dd(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),dd(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 ')),dd(this,"doPrint",(e=>{const t=nd();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}=Jc,{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()})),dd(this,"doExport",(e=>{const t=nd();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=nd(),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 ds().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(e)&&await ds().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(ed.Provider,{value:this.provide},t().createElement(ld,{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(cd,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(ed.Provider,{value:this.provide},t().createElement(ld,{ref:this.containRef,templateRender:r,directPrint:!0}))}}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,"previewRef",t().createRef()),md(this,"state",{visible:!1,loading:!1}),md(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})})),md(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:`${Jc.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(pd,s)):e?t().createElement(pd,s):null})),md(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())}}md(hd,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:i().elementType}),md(hd,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),md(hd,"contextType",l);const fd=hd;function gd(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function bd(e){const t=gd(e);return t?t.frameElement:null}function yd(e){const t=Ed(e);return vd([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function vd(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 xd(e,t){const r=bd(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=yd(a);if(n.push(e),a=bd(a),i)break;a&&gd(a)===t&&(i=!0)}return vd(n)}return e.getBoundingClientRect()}function Ed(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 Sd(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 Cd=Object.assign;class wd{constructor(e,t){Sd(this,"node",void 0),Sd(this,"border",void 0),Sd(this,"padding",void 0),Sd(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=Rd.border,this.padding.style.borderColor=Rd.padding,this.content.style.backgroundColor=Rd.background,Cd(this.node.style,{borderColor:Rd.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){Id(t,"margin",this.node),Id(t,"border",this.border),Id(t,"padding",this.padding),Cd(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"}),Cd(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class Td{constructor(e,t){Sd(this,"tip",void 0),Sd(this,"nameSpan",void 0),Sd(this,"dimSpan",void 0),this.tip=e.createElement("div"),Cd(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),Cd(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),Cd(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});Cd(this.tip.style,n.style)}}class Nd{constructor(){Sd(this,"window",void 0),Sd(this,"tipBoundsWindow",void 0),Sd(this,"container",void 0),Sd(this,"tip",void 0),Sd(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 Td(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 wd(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=xd(e,this.window),a=Ed(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=xd(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 Id(e,t,r){Cd(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 Rd={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 Pd=null,Od=null;function Ad(){null!=window.document&&(Pd=null,null!==Od&&(Od.remove(),Od=null))}function kd(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{constructor(e){kd(this,"_isRunning",void 0),kd(this,"_selectIgnore",void 0),kd(this,"_lastHoveredNode",null),kd(this,"excludeSelectors",void 0),kd(this,"onSelect",void 0),kd(this,"iframesListeningTo",new Set),kd(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),kd(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),kd(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),kd(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,Ad();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!==Pd&&clearTimeout(Pd),null!=r&&(null===Od&&(Od=new Nd),Od.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),kd(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),kd(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(){Ad(),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 Hd(e){return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}const Ld=e=>{const{action:r,onConfirm:n,onCancel:a,onFinish:i}=e,{t:l}=Kc();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"))))},qd={left:"50%",top:"50%",width:1,height:1},$d=1001,_d=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}=Kc(),b=t().useRef(),y=t().useRef(l.length),[v,x]=Nc(0,{value:a,defaultValue:i}),[E,S]=Nc(void 0,{value:n,postState:e=>e??!1}),[C,w]=t().useState({}),[T,N]=t().useState(!1),[I,R]=t().useState(!1),[P,A]=Sc(C.node,!!n),[k,F]=t().useState(22),H=t().useRef(!1),L=t().useMemo((()=>v>=l.length?"add":"edit"),[v,l]),q=t().useMemo((()=>`${v+1} / ${l.length}`),[v,l]);t().useLayoutEffect((()=>{b.current=new Fd({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{w({id:mo(),node:e,path:t}),x(y.current),N(!0),_()}})}),[]),t().useEffect((()=>(E?$():_(),()=>{_()})),[E]),t().useEffect((()=>{y.current=l.length}),[l]);const $=()=>{b.current.startHandle()},_=()=>{b.current.stopHandle()},D=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=Oc({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Hc(),{zIndex:$d,builtinPlacements:M,popupPlacement:o,popupVisible:E&&T,popupClassName:Se()(K,c),popupStyle:d,prefixCls:j,popup:()=>{const e=()=>{N(!1),$()};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($r.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?.(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:Hd(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:Hd(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"),q)),p?p({id:C.id,nodePath:C.path,actionStatus:L,DO_CLOSE:e},v):t().createElement(Ld,{action:L,onConfirm:()=>{m?.("add"===L?[...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(kc(),{open:E&&T,autoLock:!0},t().createElement("div",{className:Se()(`${j}-target-placeholder`),style:{...P||qd,position:"fixed",zIndex:$d,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:D,onClick:D}))),s&&t().createElement(kc(),{open:E},t().createElement(jc,{zIndex:$d,prefixCls:j,onPause:()=>{H.current=T,N(!1),_()},onPlay:()=>{H.current?N(!0):$()}})))}));_d.displayName="QmGuideTracker";const Dd=_d,jd="2.0.1"})(),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:()=>_,DcpAnchor:()=>Wt,DcpButton:()=>he,DcpCollapse:()=>$e,DcpConfigProvider:()=>X,DcpCopyToClipboard:()=>Bs,DcpCountup:()=>ct,DcpCropper:()=>Zi,DcpDivider:()=>Ie,DcpDownload:()=>qt,DcpDrawer:()=>nr,DcpEmpty:()=>mt,DcpForm:()=>Ii,DcpGuideTracker:()=>Dd,DcpModal:()=>cr,DcpPrint:()=>fd,DcpRangeTableHelper:()=>vc,DcpScrollbar:()=>Pt,DcpSearchHelper:()=>lc,DcpSearchTree:()=>vl,DcpSpace:()=>xe,DcpSpin:()=>ft,DcpSplit:()=>nt,DcpTable:()=>nc,DcpTabs:()=>Jt,DcpTinymce:()=>Wi,DcpTour:()=>Wc,DcpTransition:()=>Zc,DcpTreeHelper:()=>hc,DcpTreeTableHelper:()=>pc,DcpUploadFile:()=>rl,DcpUploadImg:()=>cl,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:()=>$e,QmConfigProvider:()=>X,QmCopyToClipboard:()=>Bs,QmCountup:()=>ct,QmCropper:()=>Zi,QmDivider:()=>Ie,QmDownload:()=>qt,QmDrawer:()=>nr,QmEmpty:()=>mt,QmForm:()=>Ii,QmGuideTracker:()=>Dd,QmModal:()=>cr,QmPrint:()=>fd,QmRangeTableHelper:()=>vc,QmScrollbar:()=>Pt,QmSearchHelper:()=>lc,QmSearchTree:()=>vl,QmSpace:()=>xe,QmSpin:()=>ft,QmSplit:()=>nt,QmTable:()=>nc,QmTabs:()=>Jt,QmTinymce:()=>Wi,QmTour:()=>Wc,QmTransition:()=>Zc,QmTreeHelper:()=>hc,QmTreeTableHelper:()=>pc,QmUploadFile:()=>rl,QmUploadImg:()=>cl,Radio:()=>O.Radio,Rate:()=>O.Rate,Result:()=>O.Result,Row:()=>O.Row,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:()=>Ra,version:()=>jd});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",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()),q=require("antd/es/date-picker/generatePicker");var $=n.n(q);require("antd/es/date-picker/style/index");const _=$()(k());function D(){return D=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},D.apply(this,arguments)}const j=e.forwardRef(((t,r)=>e.createElement(_,D({},t,{picker:"time",mode:void 0,ref:r}))));j.displayName="TimePicker";const K=e.forwardRef(((t,r)=>e.createElement(_.RangePicker,D({},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",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,disabled:i,className:l,style:o,id:s}=this.props,c=e||this.context.size||"",d=Ce("divider"),u={[d]:!0,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c};return t().createElement("div",{id:s,className:Se()(u,l),style:o},t().createElement("span",{className:Se()(`${d}__title`)},r),t().createElement("div",{className:Se()(`${d}__extra`)},n),void 0!==a&&t().createElement(O.Button,{type:"link",className:Se()(`${d}__collapse`),disabled:i,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}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}),Te(Ne,"contextType",l);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 qe=e=>{const{defaultActive:r,label:n,extra:a,className:i,style:l,containerStyle:o,disabled:s,forceRender:c,destroyOnClose:d=!1,onChange:u}=e,[p,m]=t().useState(!!r),h=Ce("collapse"),f=Se()({[`${h}`]:!0,[`${h}-active`]:p,[`${h}-disabled`]:s},i);return t().createElement("div",{className:f,style:l},t().createElement(Ie,{label:n,extra:a,collapse:p,disabled:s,onCollapseChange:e=>{m(e),u?.(e)}}),t().createElement(ke(),He({visible:p},Oe,{leavedClassName:`${h}-content-hidden`,forceRender:c,removeOnLeave:d}),((r,n)=>{let{className:a,style:i}=r;return t().createElement(Le,{ref:n,prefixCls:h,className:a,style:i,boxStyle:o,isActive:p,forceRender:c},e.children)})))};qe.displayName="QmCollapse";const $e=qe,_e=t().createContext(void 0);function De(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(_e),[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(_e),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);De((()=>{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(_e.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,style:r={}}=this.props,n={[`${Ce("spin")}-full-height`]:e},a={wrapperClassName:Se()(n),...Z()(this.props,["fullHeight"]),style:{...r,maxHeight:"none"}};return t().createElement(O.Spin,a,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(Zc,{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);De((()=>{!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,(()=>({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 qt=Ht,$t=require("add-dom-event-listener");var _t=n.n($t);const Dt=require("scroll-into-view-if-needed");var jt=n.n(Dt);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=_t()(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=_t()(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=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},disabled:c}=e.option,{labelToCheckbox:d,falseValue:u=fr,trueValue:m=hr}=o;return t().createElement(O.Checkbox,{checked:n===m,style:s,disabled:c||r.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{a?.(e),i(e,p(e===m?"am.form.trueText":"am.form.falseText"))})(t?m:u)}},d?l:null)};class Hr 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(Lr,{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}(Hr,"contextType",pr);const qr=Hr,$r=require("react-sortablejs");function _r(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 Dr extends e.Component{get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}constructor(e){super(e),_r(this,"linkRef",t().createRef()),_r(this,"state",{visible:!1}),this.initLocalfields()}async getTableFieldsConfig(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){}}async saveTableColumnsConfig(e,t){const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getTableFieldsConfig(this.formUniqueKey).then((e=>{if(!e)return this.setLocalFields(this.props.items);localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()})).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.saveTableColumnsConfig(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($r.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));(0,J.isEqual)(r,a)||(n.setExpandHandle(!0),this.changeHandle(t),this.setLocalFields(t))}},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)))}))}}_r(Dr,"contextType",l);const jr=Dr,Kr=e=>{const{value:r,bordered:n}=e;return t().createElement(O.Input,{value:r,title:r,bordered:n,readOnly:!0})};Kr.displayName="FormItemView";const Mr=Kr;function Vr(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 zr=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(Mr,{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)}})}));zr.displayName="VInput";class Ur extends e.Component{constructor(){super(...arguments),Vr(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(zr,{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}))))}}Vr(Ur,"contextType",pr);const Br=Ur,Wr=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(Mr,{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 Gr 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(Wr,{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}(Gr,"contextType",pr);const Yr=Gr,Xr=require("big.js");var Qr=n.n(Xr);function Zr(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 Jr=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(Qr())(e).toFixed(v);return"function"==typeof w?w(t):t},P={[S]:!0,controls:C};return n.isOnlyShow?t().createElement(Mr,{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)}})}));Jr.displayName="VInputNumber";class en extends e.Component{constructor(){super(...arguments),Zr(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(Jr,{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}))))}}Zr(en,"contextType",pr);const tn=en,rn=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(Mr,{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 nn 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(rn,{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}(nn,"contextType",pr);const an=nn;let ln=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function on(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:sn}=O.Input;class cn extends e.Component{constructor(e){var t;super(e),t=this,on(this,"searchHelper",{}),on(this,"alias",void 0),on(this,"extras",void 0),on(this,"deriveParams",void 0),on(this,"valueKey",void 0),on(this,"_is_change",!1),on(this,"_record",void 0),on(this,"_prevValue",void 0),on(this,"state",{visible:!1,loading:!1}),on(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),on(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` 一起使用")})),on(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),on(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),on(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})}})),on(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),on(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 a.forEach((e=>i[e]=n)),i})),on(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()}))})),on(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})}})),on(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)})),on(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?.())})),on(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;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])});this._record=e;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)}))})),on(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)})),on(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("")}})),on(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),on(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),on(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),on(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:`${ln[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(Mr,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(sn,{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(lc,x)))}}on(cn,"contextType",pr);class dn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),on(this,"promiseRef",void 0),on(this,"searchRef",void 0),on(this,"state",{searchHelper:{}}),on(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),on(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(cn,{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}))))}}on(dn,"contextType",pr);const un=dn;function pn(){return pn=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},pn.apply(this,arguments)}function mn(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 hn=r=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,mn(this,"startClick",void 0),mn(this,"event1",null),mn(this,"event2",null),mn(this,"$el",null),mn(this,"omitClassNames",[]),mn(this,"state",{clickOutside:!1}),mn(this,"mousedownHandler",(e=>{this.startClick=e})),mn(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),mn(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})})),mn(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),mn(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=_t()(document,"mousedown",this.mousedownHandler),this.event2=_t()(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,pn({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return mn(n,"displayName",`OutsideClick(${r.displayName||r.name})`),t().forwardRef(((e,r)=>t().createElement(n,pn({},e,{forwardedRef:r}))))},fn=require("rc-trigger");var gn,bn,yn=n.n(fn);function vn(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 xn=hn((bn=class extends e.Component{constructor(e){var r;super(e),r=this,vn(this,"searchHelper",{}),vn(this,"alias",void 0),vn(this,"_records",[]),vn(this,"searchRef",t().createRef()),vn(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),vn(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`")})),vn(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})),vn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),vn(this,"setItemList",(e=>{this.setState({itemList:e})})),vn(this,"setRecords",(e=>{this._records=e})),vn(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),vn(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),vn(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?.())})),vn(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)}))})),vn(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:`${ln[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(Mr,{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(yn(),{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(lc,x)))}},vn(bn,"contextType",pr),gn=bn))||gn;class En extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),vn(this,"promiseRef",void 0),vn(this,"state",{searchHelper:{}}),vn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),vn(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(xn,{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}))))}}vn(En,"contextType",pr);const Sn=En;function Cn(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:wn}=O.Input;class Tn extends e.Component{constructor(e){super(e),Cn(this,"searchHelper",{}),Cn(this,"alias",void 0),Cn(this,"extras",void 0),Cn(this,"valueKey",void 0),Cn(this,"_record",void 0),Cn(this,"_prevValue",void 0),Cn(this,"state",{visible:!1,loading:!1}),Cn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Cn(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` 一起使用")})),Cn(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),Cn(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Cn(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})}})),Cn(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])})})),Cn(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?.())})),Cn(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;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])});this._record=e;const n=Ir(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Cn(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("")})),Cn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Cn(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:`${ln[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(Mr,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(wn,{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(pc,x)))}}Cn(Tn,"contextType",pr);class Nn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Cn(this,"promiseRef",void 0),Cn(this,"state",{searchHelper:{}}),Cn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Cn(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(Tn,{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}))))}}Cn(Nn,"contextType",pr);const In=Nn;var Rn,Pn;function On(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 An=hn((Pn=class extends e.Component{constructor(e){var r;super(e),r=this,On(this,"searchHelper",{}),On(this,"alias",void 0),On(this,"_records",[]),On(this,"searchRef",t().createRef()),On(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),On(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`")})),On(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})),On(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),On(this,"setItemList",(e=>{this.setState({itemList:e})})),On(this,"setRecords",(e=>{this._records=e})),On(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),On(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),On(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?.())})),On(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)}))})),On(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:`${ln[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(Mr,{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(yn(),{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(pc,x)))}},On(Pn,"contextType",pr),Rn=Pn))||Rn;class kn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),On(this,"promiseRef",void 0),On(this,"state",{searchHelper:{}}),On(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),On(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(An,{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}))))}}On(kn,"contextType",pr);const Fn=kn;function Ln(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 Hn=new Array(2).fill("");class qn extends e.Component{constructor(e){var t;super(e),t=this,Ln(this,"searchHelper",{}),Ln(this,"alias",void 0),Ln(this,"_is_change",!1),Ln(this,"_ceho_data",void 0),Ln(this,"_records",[]),Ln(this,"_is_clear",!1),Ln(this,"state",{visible:!1,loading:!1,itemList:[],textValue:Hn}),Ln(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`")})),Ln(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Ln(this,"setItemList",(e=>{this.setState({itemList:e})})),Ln(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ln(this,"setTextValue",(e=>{this.setState({textValue:e})})),Ln(this,"setRecords",(e=>{this._records=e})),Ln(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),Ln(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),Ln(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(Hn),this.triggerChange([])})),Ln(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)}))})),Ln(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?.())})),Ln(this,"createFilters",(e=>{const{fieldName:t}=this.props.option;return{[t]:se(e)?void 0:e}})),Ln(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()}))})),Ln(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()})),Ln(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=Hn.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:`${ln[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(Mr,{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(vc,g)))}}Ln(qn,"contextType",pr);class $n extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ln(this,"promiseRef",void 0),Ln(this,"state",{searchHelper:{}}),Ln(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ln(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(qn,{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}))))}}Ln($n,"contextType",pr);const _n=$n;function Dn(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 jn=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(Mr,{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 Kn extends e.Component{constructor(){super(...arguments),Dn(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(jn,{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}))))}}Dn(Kn,"contextType",pr);const Mn=Kn,Vn=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}=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 zn 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(Vn,{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}(zn,"contextType",pr);const Un=zn;function Bn(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 Wn=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.find((t=>t.value===e))?.text??"";return r.isOnlyShow?t().createElement(Mr,{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 Gn extends e.Component{constructor(){super(...arguments),Bn(this,"state",{itemList:[]}),Bn(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(Wn,{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}))))}}Bn(Gn,"contextType",pr);const Yn=Gn,Xn=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},disabled:c}=e.option,{labelToSwitch:d,falseValue:u=fr,trueValue:m=hr}=o;return t().createElement(t().Fragment,null,t().createElement(O.Switch,{checked:n===m,style:s,disabled:c||r.isOnlyShow,checkedChildren:t().createElement(we.CheckOutlined,null),unCheckedChildren:t().createElement(we.CloseOutlined,null),onChange:e=>{(e=>{a?.(e),i(e,p(e===m?"am.form.trueText":"am.form.falseText"))})(e?m:u)}}),d?t().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},l):null)};class Qn 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(Xn,{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}(Qn,"contextType",pr);const Zn=Qn,Jn=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 ea 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(Jn,{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}(ea,"contextType",pr);const ta=ea,ra=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(Mr,{value:C(n),bordered:d}):t().createElement(_,{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 na 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(ra,{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}(na,"contextType",pr);const aa=na,ia=e=>[s()().subtract(e,"day"),s()()],la=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}=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]]:ia(7),[p("qm.form.dateRangePickers")[1]]:ia(30),[p("qm.form.dateRangePickers")[2]]:ia(90),[p("qm.form.dateRangePickers")[3]]:ia(180)},C=e=>Nr(e)?"":e.map((e=>["date","exactdate"].includes(f)?e?.slice(0,10):e)).join(" - ");return r.isOnlyShow?t().createElement(Mr,{value:C(n),bordered:d}):t().createElement(_.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 oa 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(la,{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}(oa,"contextType",pr);const sa=oa,ca=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(Mr,{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 da 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(ca,{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}(da,"contextType",pr);const ua=da,pa=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}=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(Mr,{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 ma 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(pa,{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}(ma,"contextType",pr);const ha=ma,fa={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"}},ga="阿",ba="鿿",ya=1,va=2,xa=3;let Ea,Sa=null;function Ca(e){return e||null===Sa?("object"==typeof Intl&&Intl.Collator?(Ea=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Sa=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Sa=!1,Sa):Sa}function wa(e){const t=fa.UNIHANS,r=fa.PINYINS,n=fa.EXCEPTIONS,a={source:e};if(e in n)return a.type=va,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=ya,a.target=e,a;if(i=Ea.compare(e,ga),i<0)return a.type=xa,a.target=e,a;if(0===i)a.type=va,l=0;else{if(i=Ea.compare(e,ba),i>0)return a.type=xa,a.target=e,a;0===i&&(a.type=va,l=t.length-1)}if(a.type=va,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=Ea.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=xa,a.target=a.source),a}function Ta(e){return"string"==typeof e&&Ca()?e.split("").map((e=>wa(e))):e}const Na={isSupported:Ca,parse:Ta,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(fa)})))},genToken:wa,convertToPinyin:(e,t,r)=>Ta(e).map((e=>t&&e.type===va?e.target.toLowerCase():e.target)).join(r||"")},Ia={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}};Na.isSupported()&&Ia.shouldPatch(Na.genToken)&&Na.patchDict(Ia);const Ra=Na;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}function Oa(){return Oa=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},Oa.apply(this,arguments)}const{Option:Aa}=O.Select,ka=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(Mr,{value:w(n),bordered:m}):t().createElement(O.Select,Oa({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=Ra.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(Aa,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Fa extends e.Component{constructor(){super(...arguments),Pa(this,"state",{itemList:[],loading:!1}),Pa(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(ka,{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}))))}}Pa(Fa,"contextType",pr);const La=Fa;function Ha(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 qa extends e.Component{constructor(e){super(e),Ha(this,"searchHelper",{}),Ha(this,"alias",void 0),Ha(this,"extras",void 0),Ha(this,"valueKey",void 0),Ha(this,"_clicking",!1),Ha(this,"_record",void 0),Ha(this,"_prevValue",void 0),Ha(this,"searchRef",t().createRef()),Ha(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),Ha(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` 一起使用")})),Ha(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),Ha(this,"getLatestRequest",(()=>{const{request:e,searchHelper:t}=this.props.option;return Object.assign({},this.searchHelper.request,e,t?.request)})),Ha(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){}})),Ha(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])});this._record=e})),Ha(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),Ha(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ha(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Ha(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Ha(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(Mr,{value:o,bordered:u}):t().createElement(yn(),{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)}}))}))}}Ha(qa,"contextType",pr);class $a extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ha(this,"promiseRef",void 0),Ha(this,"state",{searchHelper:{}}),Ha(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ha(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(qa,{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}))))}}Ha($a,"contextType",pr);const _a=$a;class Da 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}(Da,"contextType",pr);const ja=Da;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}function Ma(){return Ma=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},Ma.apply(this,arguments)}const Va=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Va(e.children,t,r,n)}:e)),za=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);De((()=>{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(Mr,{value:R(n),bordered:m}):t().createElement(O.TreeSelect,Ma({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=Va(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=Ra.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 Ua extends e.Component{constructor(){super(...arguments),Ka(this,"state",{itemList:[],loading:!1}),Ka(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(za,{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}))))}}Ka(Ua,"contextType",pr);const Ba=Ua;function Wa(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 Ga(){return Ga=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},Ga.apply(this,arguments)}const Ya=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(Mr,{value:E(n),bordered:c}):t().createElement(O.Cascader,Ga({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=Ra.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 Xa extends e.Component{constructor(){super(...arguments),Wa(this,"state",{itemList:[],loading:!1}),Wa(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(Ya,{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}))))}}Wa(Xa,"contextType",pr);const Qa=Xa,Za=require("china-area-data");var Ja=n.n(Za);function ei(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 ti=["110000","120000","310000","500000"],ri=["810000","820000"],ni=[{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"}],ai=[{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"}],ii=e=>Ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),li=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=>![...ti,...ri].includes(e))):Object.keys(e[t])).map((n=>({l:ii(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:li(e,n,r+1)})))},oi=(e,t)=>t.map((t=>({l:ii(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class si extends e.Component{constructor(e){super(e),ei(this,"searchRef",t().createRef()),ei(this,"scrollRef",t().createRef()),ei(this,"zxsAndGa",void 0),ei(this,"provinces",void 0),ei(this,"allCities",void 0),ei(this,"letterCities",void 0),ei(this,"state",{visible:!1,select_type:"0",active_key:""}),ei(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ei(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:oi(Ja(),ti)},{l:"Z2",n:"港澳",c:"",p:"",children:oi(Ja(),ri)}]}createProvince(){return(li(Ja(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return ai.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...ti,...ri].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?ni:ai).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(Mr,{value:f,bordered:s}):t().createElement(yn(),{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)}}))}))}}ei(si,"contextType",pr);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,r),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,{flex:de(d.labelWidth||mr)},e.renderFormItemExtra({fieldName:i,...d}))))}}ei(ci,"contextType",pr);const di=ci;function ui(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 pi=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:pi(e,r)})))};class mi extends e.Component{constructor(e){super(e),ui(this,"searchRef",t().createRef()),ui(this,"prevText",void 0),ui(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ui(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const r=pi(Ja(),"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(Mr,{value:g,bordered:s}):t().createElement(yn(),{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()))}}))}))}}ui(mi,"contextType",pr);class hi 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(mi,{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}))))}}ui(hi,"contextType",pr);const fi=hi,gi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:h,allowDownloadOnDisable:f,onRemove:g}=l,{action:b,headers:y,params:v,withCredentials:x=!1,dataKey:E="",fieldAliasMap:S,beforeUpload:C,button:w}=o,T="function"==typeof S?S():S||{};return t().createElement(rl,{name:"file",action:b,multiple:d,headers:y,data:v,withCredentials:x,beforeUpload:C,maxCount:u,fileTypes:m,fileSize:h,disabled:c||r.isOnlyShow,allowDownloadOnDisable:f,button:w,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 T)r[n]=e[n]||t.data?.[T[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||(E?(0,J.get)(t.data,E):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:g})};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=>{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}(bi,"contextType",pr);const yi=bi,vi=e=>{const{$$form:r}=t().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:h,openCropper:f,fileTypes:g,fileSize:b,onRemove:y}=l,{action:v,headers:x,params:E,withCredentials:S=!1,dataKey:C="",fieldAliasMap:w,beforeUpload:T}=o,N="function"==typeof w?w():w||{};return t().createElement(cl,{name:"file",action:v,multiple:d,headers:x,data:E,withCredentials:S,beforeUpload:T,maxCount:u,fixedSize:m,quality:h,openCropper:f,fileTypes:g,fileSize:b,disabled:c||r.isOnlyShow,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 N)r[n]=e[n]||t.data?.[N[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)},onRemove:y})};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,"")}}))),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={},upload:o,style:s={},placeholder:c=p("qm.form.inputPlaceholder"),readOnly:d,disabled:u}=e.option,{tinymce:m,thresholdSize:h}=l;return t().createElement(Wi,{value:n,tinymce:m,upload:o,thresholdSize:h,style:{width:"100%",...s},disabled:d||u||r.isOnlyShow,onChange:e=>{(e=>{a?.(e),i(e)})(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=>{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 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,"provide",{$$form:this,echo_data:{}}),Ti(this,"_initialValues",void 0),Ti(this,"_initialOthers",void 0),Ti(this,"_initialExtras",void 0),Ti(this,"_fieldAuth",{}),Ti(this,"wrapperRef",t().createRef()),Ti(this,"formRef",t().createRef()),Ti(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Ti(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})})),Ti(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),Ti(this,"getFormItems",ur()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Ti(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}))),Ti(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Ti(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Ti(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Ti(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),Ti(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})})),Ti(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 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(Br,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(Yr,{option:e})}INPUT_NUMBER(e){return t().createElement(tn,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(an,{option:e})}SEARCH_HELPER(e){return t().createElement(un,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t().createElement(Sn,{option:e})}TREE_TABLE_HELPER(e){return t().createElement(In,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t().createElement(Fn,{option:e})}RANGE_SEARCH_HELPER(e){return t().createElement(_n,{option:e})}CHECKBOX(e){return t().createElement(qr,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(Mn,{option:e})}RATE(e){return t().createElement(Un,{option:e})}RADIO(e){return t().createElement(Yn,{option:e})}SWITCH(e){return t().createElement(Zn,{option:e})}TEXT_AREA(e){return t().createElement(ta,{option:e})}DATE(e){return t().createElement(aa,{option:e})}RANGE_DATE(e){return t().createElement(sa,{option:e})}TIME(e){return t().createElement(ua,{option:e})}RANGE_TIME(e){return t().createElement(ha,{option:e})}SELECT(e){return t().createElement(La,{option:e})}MULTIPLE_SELECT(e){return t().createElement(La,{option:e,multiple:!0})}IMMEDIATE(e){return t().createElement(_a,{option:e})}DIVIDER(e){return t().createElement(ja,{option:e})}TREE_SELECT(e){return t().createElement(Ba,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(Ba,{option:e,multiple:!0})}CASCADER(e){return t().createElement(Qa,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(Qa,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(di,{option:e})}REGION_SELECT(e){return t().createElement(fi,{option:e})}UPLOAD_FILE(e){return t().createElement(yi,{option:e})}UPLOAD_IMG(e){return t().createElement(Ei,{option:e})}TINYMCE(e){return t().createElement(wi,{option:e})}renderFormLabel(e){if(!(0,J.isPlainObject)(e))return e;const{type:r,fieldName:n,label:a,options:i={},placeholder:l,disabled:o,onChange:s=ne}=e,{itemList:c=[]}=i;return"SELECT"===r?t().createElement(O.Form.Item,{name:n,noStyle:!0},t().createElement(O.Select,{placeholder:l,disabled:o,onChange:e=>s(e,c.find((t=>t.value===e)).text)},c.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))):"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(Lr,{option:e,onValuesChange:e=>s(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(jr,{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())))}}Ti(Ni,"contextType",l),Ti(Ni,"propTypes",Sr),Ti(Ni,"defaultProps",Cr);const Ii=Ni,Ri={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},Pi={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}),...Ri},Oi=e=>"function"==typeof e,Ai=e=>e in Ri,ki=e=>e.substr(2),Fi=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(Ai),c=Object.keys(l).filter(Ai),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=ki(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=ki(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Li=0;const Hi=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Li++,e+"_"+r+Li+String(t)},qi=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),$i=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),_i=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Di=()=>({listeners:[],scriptId:Hi("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),ji=(()=>{let e=Di();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=Di()}}})(),Ki=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Mi(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 Vi extends e.Component{constructor(t){var r;super(t),r=this,Mi(this,"editor",void 0),Mi(this,"id",void 0),Mi(this,"elementRef",void 0),Mi(this,"inline",void 0),Mi(this,"currentContent",void 0),Mi(this,"boundHandlers",void 0),Mi(this,"rollbackTimer",void 0),Mi(this,"valueCursor",void 0),Mi(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})),Mi(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){}})),Mi(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Mi(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))}})),Mi(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Mi(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=Ki(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,$i(i).concat($i(l))),toolbar:r.props.toolbar??r.props.init?.toolbar,setup:e=>{r.editor=e,r.bindHandlers({}),r.inline&&!qi(t)&&e.once("PostRender",(t=>{e.setContent(r.getInitialValue(),{no_events:!0})})),r.props.init&&Oi(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;_i(r.editor,n?"readonly":"design"),r.props.init&&Oi(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(e)}};var i,l;r.inline||(t.style.visibility=""),qi(t)&&(t.value=r.getInitialValue()),n.init(a)})),this.id=this.props.id||Hi("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;_i(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==Ki(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&ji.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=Ki(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){Fi(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 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}Mi(Vi,"propTypes",Pi),Mi(Vi,"defaultProps",{cloudChannel:"6"});var Ui=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(Ui||{});class Bi extends e.Component{constructor(){super(...arguments),zi(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:Ui[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(Vi,b))}}zi(Bi,"contextType",l),zi(Bi,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const Wi=Bi,Gi=require("cropperjs");var Yi=n.n(Gi);function Xi(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 Qi extends e.Component{constructor(){super(...arguments),Xi(this,"imgRef",t().createRef()),Xi(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(Yi())(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}}))}}Xi(Qi,"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 Zi=Qi;function Ji(){return Ji=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},Ji.apply(this,arguments)}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}class tl extends e.Component{constructor(){super(...arguments),el(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)}))))}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{button:e={},disabled:r,allowDownloadOnDisable:n,onChange:a}=this.props,i={[Ce("upload-file")]:!0,disabled:r&&!n};return t().createElement(O.Upload,Ji({className:Se()(i)},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,onChange:a,onPreview:async e=>{if(!r||n)try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){O.message.error(p("qm.download.error"))}},onDownload:async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){O.message.error(p("qm.download.error"))}}}),this.props.children?this.props.children:t().createElement(O.Button,{type:e.type??"default",icon:e.icon??t().createElement(we.UploadOutlined,null),disabled:r},e.text||p("qm.upload.text")))}}el(tl,"defaultProps",{name:"file",multiple:!0,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)}});const rl=tl;function nl(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 al extends e.Component{constructor(){super(...arguments),nl(this,"cropperRef",t().createRef()),nl(this,"beforeUploadRef",void 0),nl(this,"fileRef",void 0),nl(this,"resolveRef",void 0),nl(this,"rejectRef",void 0),nl(this,"state",{src:""}),nl(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()})),nl(this,"onOk",(()=>{this.confirmHandle()})),nl(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(Zi,{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()))}}nl(al,"contextType",l);const il=al;function ll(){return ll=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},ll.apply(this,arguments)}function ol(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 sl extends e.Component{constructor(){super(...arguments),ol(this,"state",{previewVisible:!1,currentIndex:0}),ol(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)})))),ol(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})}))}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,openCropper:s,beforeCrop:c}=this.props,d=Ce("upload-img"),u=t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("div",{style:{marginTop:8}},p("qm.uploadCropper.dragableText"))),m=t().createElement(O.Upload,ll({className:d},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,onPreview:this.handlePreview}),this.showUploadButton?u:null);return t().createElement(t().Fragment,null,s?t().createElement(il,{fixedSize:a,quality:i,fileTypes:l,fileSize:o,beforeCrop:c},m):m,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:""}))))))}}ol(sl,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const cl=sl,dl=(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=dl(i.children,t,r);e&&(n=e)}}return n},ul=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&ul(e.children,t),t(e)||e.children&&e.children.length))),pl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...pl(e.children,t)),t(e)&&r.push(e)})),r},ml=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=ml(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},hl=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:hl(e.children,t,r,n)}:e)),fl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...fl(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},gl=(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=gl(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},bl=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...bl(e,t)))),r},yl=t().forwardRef(((e,r)=>{const{filterable:n=!0,multiple:a,draggable:i,dataSource:o,fetch:s,asyncLoad:c,checkStrictly:d,checkStrategy:u="SHOW_CHILD",placeholder:m=p("qm.form.inputPlaceholder"),fieldsDefine:h,value:f,height:g,defaultSelectedKeys:b=[],defaultExpandAll:y=!0,showSearchBar:v=!0,showCollapse:x=!0,onSelectChange:E,onCheckChange:S,onDragChange:C,onExpand:w}=e,{size:T}=t().useContext(l),N=t().useMemo((()=>e.size??T??""),[e.size,T]),I=h?.valueKey||"value",R=h?.textKey||"text",P=(h?.children,t().useRef(null)),A=St(P),[k,F]=t().useState(g),[L,H]=t().useState(!1),q=Ct((()=>{F(P.current.offsetHeight-Y.current.offsetHeight-10)}),5);De((()=>{g||q()}),[A.height]);const[$,_]=t().useState([]),[D,j]=t().useState({}),[K,M]=t().useState([]),[V,z]=t().useState([]),[U,B]=t().useState(""),[W,G]=t().useState(y),Y=t().useRef(null),X=t().useRef([]),Q=t().useRef([]);t().useEffect((()=>{Array.isArray(o)&&(Z(o),M(ee(o)),j({}))}),[o]),t().useEffect((()=>{ne()}),[]),De((()=>{ne()}),[s?.params]),De((()=>{z(re())}),[D]),t().useImperativeHandle(r,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=ml($,(t=>e===t[I]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],Z([...$]))},REMOVE_RECORD:e=>{const t=dl($,e,I);if(void 0===t&&$.find((t=>t[I]===e)))Z($.filter((t=>t[I]!==e)));else{const r=ml($,(e=>t===e[I]));if(!r)return;const n=r.children?.findIndex((t=>e===t[I]));n>=0&&(r.children.splice(n,1),Z([...$]))}},UPDATE_RECORD:(e,t)=>{const r=ml($,(t=>e===t[I]));r&&((0,J.merge)(r,t),Z([...$]))}})));const Z=e=>{_(e),X.current=e,Q.current=fl(e,I)},ee=e=>{if(a)return b;const t=pl(e,(e=>b.includes(e[R])));return 1===t.length?[t[0][I]]:[]},te=e=>gl($,e,I)?.slice(0,-1)||[],re=()=>{if(y)return Q.current;const e=[];return K.forEach((t=>{if(a){if("SHOW_ALL"===u&&!Q.current.includes(t)&&e.push(...te(t)),"SHOW_CHILD"===u&&e.push(...te(t)),"SHOW_PARENT"===u){const r=Ar($,t);if(r){const n=te(t),a=bl(r,I);e.push(...n,...[t,...a].filter((e=>Q.current.includes(e))))}}}else e.push(...te(t))})),[...new Set(e)]},ne=async()=>{if(!s)return;const{api:e,params:t,dataKey:r,callback:n}=s;try{H(!0);const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,r)??[];Z(e),M(ee(e)),j({}),n?.(e)}}catch(e){}H(!1)},ae=e=>`${e}|${Ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ie=Ce("search-tree"),le={[ie]:!0,[`${ie}--lg`]:"large"===N,[`${ie}--sm`]:"small"===N};return t().createElement("div",{ref:P,className:Se()(le)},t().createElement("div",{ref:Y,className:"topper"},v&&t().createElement(O.Input.Search,{value:U,size:N,placeholder:m,allowClear:!0,onChange:e=>(e=>{if(!n)return;const t=ul(X.current,(t=>{if(!e)return!0;const r=t[R]||"";return-1!==ae(r).indexOf(e)}));B(e),_(t),y||e?z(fl(t,I)):j({})})(e.target.value)}),x&&t().createElement("a",{className:"trigger",onClick:()=>{G(!W),z(W?[]:Q.current)}},W?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(W?"qm.form.collect":"qm.form.spread"))),t().createElement(ft,{spinning:L},t().createElement(O.Tree,{fieldNames:{title:R,key:I,children:"children"},multiple:a,draggable:i,blockNode:i,checkable:a,selectable:!a,height:k,disabled:e.disabled,checkStrictly:d,selectedKeys:f??K,checkedKeys:f??K,expandedKeys:V,treeData:$,loadData:c?async e=>{let{key:t,children:r}=e;if(!s||r)return;const{api:n,params:a,dataKey:i,formatter:l=(e=>e)}=s;try{const e=await n(l({...a,[I]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=hl(X.current,t,I,r);Z(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!U)return!1;const t=e[R]||"";return-1!==ae(t).indexOf(U)},onDragEnter:e=>{z(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][I]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},l=[...$];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)}));Z(l)},onDragEnd:e=>{C?.(e,$)},onExpand:(e,t)=>{z(e),w?.(e,t)},onSelect:e=>{M(e);const t=pl(X.current,(t=>e.includes((0,J.get)(t,I))));E?.(a?t:t[0])},onCheck:e=>{d&&(e=e.checked),M(e),"SHOW_CHILD"===u&&(e=e.filter((e=>!Q.current.includes(e)))),"SHOW_PARENT"===u&&(e=e.filter(((e,t,r)=>!r.includes(dl($,e,I)))));const t=pl(X.current,(t=>e.includes((0,J.get)(t,I))));S?.(a?t:t[0])}})))}));yl.displayName="QmSearchTree";const vl=yl,xl=(0,e.createContext)(void 0),El={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},Sl=(i().arrayOf(i().shape(El)).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().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),Cl="1",wl="0",Tl="YYYY-MM-DD",Nl="YYYY-MM-DD HH:mm:ss",Il="YYYYMMDDHHmmss",Rl={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 Pl=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Ol=[];const Al={getFocusInstance:function(){return Ol[0]??null},getInstance:function(e){return Ol.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Ol.findIndex((e=>e===t))&&(this.deregister(e),Ol=[t,...Ol])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Ol=[{id:e,vm:t},...Ol])},deregister:function(e){e&&(Ol=Ol.filter((t=>t.id!==e)))}},kl=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],Fl={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)kl.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 ")}},Ll=["==","<",">","<=",">=","!=","like","likes","in","nin"],Hl=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++)Ll.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),Ll.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},ql=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,$l=["string","number","boolean","symbol"],_l=e=>$l.includes(typeof e),Dl=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),jl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(ql,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(jl(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(jl(t))));break;case"in":_l(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":_l(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(Dl(e)?e.slice(0,10):e)!=r;break;case"<":n=(Dl(e)?e.slice(0,10):e)<r;break;case"<=":n=(Dl(e)?e.slice(0,10):e)<=r;break;case">":n=(Dl(e)?e.slice(0,10):e)>r;break;case">=":n=(Dl(e)?e.slice(0,10):e)>=r;break;default:n=(Dl(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 Kl=Fl.stringify,Ml=Fl.array_format,Vl=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},zl=(e,t,r)=>{let n=[];t=Fl.replace_symbols(t);try{if(r){const r=new Function("record",`return ${Hl(t,"record")};`);n=xo(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${Hl(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},Ul=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Ul(e.children)):t.push(e)})),t},Bl=e=>{const t=[];return e.forEach((e=>{let r=e;e.children&&(r={...e},r.children=Bl(e.children)),e.hidden||e.noAuth||t.push(r)})),t},Wl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Wl(e.children))})),t},Gl=(e,t)=>e.map((e=>(e.children&&(e.children=Gl(e.children,t)),t?.(e),e))),Yl=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Yl(r.children,t);if(e)return e}}return null},Xl=e=>{const t=e.children;return t?t[0].children?Xl(t[0]):t[0]:e},Ql=e=>{const t=e.children;return t?t[t.length-1].children?Ql(t[t.length-1]):t[t.length-1]:e},Zl=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Jl=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Jl(r.children,t);if(e)return e}}return null},eo=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...eo(e.children))})),t},to=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 Wl(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},ro=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 ro(e.offsetParent,t,r)}return r},no=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ao=(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])?ao(r,t[n]):r)})),io=(e,t)=>(0,J.intersection)(e,t).length===t.length,lo=(e,t)=>(0,J.get)(e,t)??"",oo=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,J.set)(e,t,r??"")},so=(e,t)=>{if(!t.includes("|"))return lo(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(lo(e,t))})),r.every((e=>!e))?"":r.join(" | ")},co=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),uo=(e,t)=>e?s()(e,t):null,po=(e,t)=>e?s()(e).format(t):"",mo=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)}))},ho=e=>{const t=[];if(te(e)){const{children:r}=e.props;Array.isArray(r)?r.forEach((e=>t.push(...ho(e)))):r&&t.push(...ho(r))}else t.push(e);return t},fo=e=>e.filter((e=>!e._group)),go=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)?Ml(i.condition):Kl(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])?Ml(l[e]):Kl(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},bo=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(lo(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},yo=(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=yo(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},vo=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=vo(r.children,t);if(e)return e}if(t(r))return r}return null},xo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&xo(e.children,t),t(e)||e.children&&e.children.length)));function Eo(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 So=class{constructor(){Eo(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),Eo(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),Eo(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)})),Eo(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),Eo(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)})),Eo(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),Eo(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)})),Eo(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),Eo(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),Eo(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),Eo(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),Eo(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),Eo(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),Eo(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),Eo(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},Co={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 wo;const To=()=>{if(ee)return 0;if(void 0!==wo)return wo;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),wo=t-n,wo},No=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=No(e.children)),e))),Io=(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]),q=t().useMemo((()=>!H&&!!h),[H,h]),$=t().useMemo((()=>H&&!!f),[H,f]),_=t().useMemo((()=>(H||q)&&!$),[H,q,$]),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]})(No(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Co.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:Co.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=u,a?.expandedRowRender?{dataIndex:Co.expandableColumn,title:"",width:Co.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),Bl(t)})(a)),[a]),K=t().useMemo((()=>Ul(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=>![Co.expandableColumn,Co.selectionColumn,Co.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((()=>to(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?fo(w.current.tableFullData):w.current.tableFullData,c=!k.length&&!!l;let d=(!i||c?s:k).reduce(((e,t)=>{if(t?.[Co.summaryIgnore])return e;const n=Number(lo(t,r));return Number.isNaN(n)?e:new(Qr())(e).plus(n).toNumber()}),0);!Object.keys(F).includes(r)||i&&!c||(d=Number(lo(F,r))),oo(e,r,d);let u=n>=0?d.toFixed(n):d;u=co(u),oo(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]=Co.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:Co.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?{[Co.sorterFieldName]:e}:null,...t.length?{[Co.filterFieldName]:t}:null,...ue?{[Co.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...n?.params??null,[Co.currentPageName]:A.current,[Co.pageSizeName]:A.pageSize}}),[n?.params,A.current,A.pageSize,R,P,O,ue]);return{isFetch:H,isWebPagination:q,isScrollPagination:$,showPagination:_,shouldUpdateHeight:D,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}},Ro=(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,tableFullData:I,pagination:R,layout:P,filters:O,sorter:A,superFilters:k,fetchParams:F,selectionKeys:L,rowExpandedKeys:H,highlightKey:q,summationColumns:$,shouldUpdateHeight:_,isFetch:D,isTreeTable:j,isWebPagination:K,isScrollPagination:M,isServiceSummation:V,isGroupSubtotal:z,doLayout:U,setTableData:B,setTableFullData:W,setTableOriginData:G,setAllTableData:Y,setDeriveRowKeys:X,setPagination:Q,setSpinning:ee,setSorter:te,setFilters:re,setSuperFilters:ne,setSelectionKeys:ie,setRowExpandedKeys:le,setHighlightKey:oe,setSelectionRows:ce,setScrollYLoad:de,setScrollYStore:ue,setFieldAuth:pe,setResizeState:me,setSummaries:he,setPermission:fe,setRecordsMap:ge,resetTableScroll:be,clearElementStore:ye,clearRecordsMap:ve}=r,{store:xe}=S.current,Ee=St(C),Se=t().useRef({...F}),Ce=t().useRef(new Map);De((()=>{U()}),[N,T,P.tableAutoHeight]),De((()=>{we()}),[Ee]),De((()=>{nt(),at(),it(),D||(K&&Ge(),Me(a)),o&&te(o),s&&re(s)}),[a,l?.params]),De((()=>{const e=_e(F,Se.current);e||D&&c?.clearableAfterFetched&<(),!e&&F[Co.currentPageName]>1&&!l?.stopToFirst?Ge():D&&Ke(),Se.current=F}),[F]),De((()=>{K&&Je(),M||be(),He()}),[R.current,R.pageSize]),De((()=>{D||Te(I.length),U()}),[I]),De((()=>{j&&u?.virtual&&(Ye(),Je())}),[H]);const we=()=>{const{scrollYLoad:e,resizeState:t}=S.current,{height:r}=t,{width:n,height:a}=Ee,i=a!==r;U(),i&&_&&e&&Je(),me(Object.assign({},t,{width:n,height:a}))},Te=e=>{e!==R.total&&Q((t=>Object.assign({},t,{total:e})))},Ne=Ct((e=>{Ue(),v?.(e)})),Ie=e=>z?Re(Pe(e,0)):e,Re=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Re(e.children)),delete e.children,t.push(e)})),t},Pe=(e,t)=>{const r=i.groupItems?.[t];return r?bo(e,[r.dataIndex]).map((e=>{const a={children:Pe(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&oo(a,n.toString(),mo()),r.titleIndex&&oo(a,r.titleIndex,lo(e[0],r.titleIndex)),oo(a,r.dataIndex,lo(e[0],r.dataIndex)),$.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[Co.summaryIgnore])return e;const n=Number(lo(r,t));return Number.isNaN(n)?e:e+n}),0);oo(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Oe=e=>{ie(e),ce((e=>{const{selectionRows:t,allTableData:r,recordsMap:n}=S.current;if(D)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))},Ae=e=>{const{type:t,checkStrictly:r=!0}=c||{},n=Array.isArray(e)?e:L;let a=[];return S.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{deriveRowKeys:r}=S.current,n=Jl(r,e);let a=[];if(!n)return a;const i=Fe(n?.children||[]),l=yo(r,e)?.slice(0,-1).reverse()||[];return a=[...new Set([...t,...i])],l.forEach((e=>{const t=Jl(r,e),n=io(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},ke=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:a}=d||{},i=Array.isArray(e)?e:H;if(S.current.treeTable){a&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...L];q&&e.unshift(q);let l=[];return e.forEach((e=>{const t=yo(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]:[]},Fe=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...Fe(e[r].children)),t.push(e[r].rowKey);return t},Le=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Le(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...Le(e,r[r.length-1])),r},He=Ct((()=>{ze(),f?.(R,$e(O),qe(A),k,{currentDataSource:Qe()})})),qe=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},$e=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[Co.showFilterType?`${n}|${a}`:n]=e[r]}return t},_e=(e,t)=>{const r=Object.keys(ao(e,t));return 1===r.length&&(r.includes(Co.currentPageName)||r.includes(Co.pageSizeName))},je=async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=ae,afterFetch:r,callback:n}=l;if(!t(F))return;const a=M&&F[Co.currentPageName]>Se.current[Co.currentPageName]&&_e(F,Se.current),o=!!i?.fetch?.api;ee(!0);try{const[t,s]=o?await Promise.all([l.api(e(F)),i.fetch.api(e(F))]):[await l.api(e(F))];if(o?200===t.code&&200===s.code:200===t.code){const e=l.dataKey??Co.dataKey;let i=(0,J.get)(t.data,e)??[];i="function"==typeof r?await r(i):i;const o=(0,J.get)(t.data,e.replace(/[^.]+$/,Co.totalKey))||i.length||0;if(S.current.unMounted)return;Me(a?S.current.tableFullData.concat(i):i),Te(o),Ve(s?.data||t.data),n?.(t.data,t)}}catch(e){x?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),ee(!1)},Ke=Ct(je),Me=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}=R;return!D||M?e:(t-1)*r+e})(r)),e))),r=Ie(t(e));et(r),tt(r),rt(),Oe(Ae()),le(ke()),ze(),y?.(r)},Ve=e=>{if(!V)return;const t=i?.fetch?.dataKey??Co.summationKey,r=(t?(0,J.get)(e,t):e)??{},n={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{oo(n,e.dataIndex,Number(lo(r,e.summation.dataKey)))})),he(n)},ze=()=>{const{type:e,selectFirstRowOnChange:t}=c||{};if("radio"===e&&t){const e=Qe();if(e.length){const t=E(e[0],e[0].index);Oe([t])}else Oe([])}},Ue=()=>{if(!M)return;const e=We();R.current>=e||Be({...R,current:R.current+1})},Be=e=>{let{current:t,pageSize:r}=e;Q((e=>Object.assign({},e,{current:t,pageSize:r})))},We=()=>{const{pageSize:e,total:t}=R;return Math.ceil(t/e)||1},Ge=()=>{Be(Object.assign({},R,{current:1}))},Ye=()=>{if(!S.current.treeTable||!u?.virtual)return;const e=Xe(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?H.filter((e=>!n.includes(e))):H})());Ce.current.clear(),e.forEach(((e,t)=>Ce.current.set(e,t)))},Xe=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Xe(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},Qe=()=>K?(()=>{const{current:e,pageSize:t}=R;return S.current.tableFullData.slice((e-1)*t,e*t)})():S.current.tableFullData,Ze=e=>{const{scrollYLoad:t,scrollYStore:r}=S.current;B(t?e.slice(r.startIndex,r.endIndex):e)},Je=()=>{let e=Qe();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];Ce.current.has(a)&&n.push(t[e])}return n})()),de(e.length>Co.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),Ze(e)},et=e=>{W(e),Y(e),X(e),Ye(),Je()},tt=e=>{G(e)},rt=()=>{const{allTableData:e}=S.current;ve(),e.forEach((e=>ge(E(e,e.index),e)))},nt=()=>{te({})},at=()=>{re({})},it=()=>{ne([])},lt=()=>{Oe([])};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;fe((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=S.current,n=Gl(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=Yl(r,n);pe(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)}})(),q&&w.current.setClickedValues([q,""]),"radio"===c?.type&&L.length&&w.current.setClickedValues([L[0],""]),D?je():Me(a)},createTableFullData:et,getTableData:je,handleTableData:Ze,createTableData:Me,createGroupData:Ie,createSelectionKeys:Ae,createRowExpandedKeys:ke,setSelectionKeysEffect:Oe,findParentRowKeys:Le,getAllChildRowKeys:Fe,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return g("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(xe.removeFromRequired({x:r,y:n}),xe.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&se(t)&&xe.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||xe.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=xe.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:He,toLastPage:()=>{const e=We();R.current!==e&&Be(Object.assign({},R,{current:e}))},toFirstPage:Ge,getPageCount:We,pagerChangeHandle:Be,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||(ue(Object.assign({},t,{startIndex:s,endIndex:c})),Je()))}(e)},scrollBottomDebouncer:Ne,clearTableSorter:nt,clearTableFilter:at,clearSuperFilters:it,clearRowSelection:lt,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{xe.clearAllLog()},destroy:()=>{ye(),xe.destroy(),Al.deregister(S.current.uid)}}},Po=(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:`${no(a)}px`}),i&&Object.assign(r,{maxHeight:`${no(i)}px`}),E?{...r,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...r,height:"auto"!==n?`${no(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?eo(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=Xl(Yl(p,e)).dataIndex);let t=0;for(let r=0;r<m.length;r++){const n=m[r];if(n.dataIndex===e)break;t+=no(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{m.findIndex((t=>t.dataIndex===e))<0&&(e=Ql(Yl(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+=no(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||Co.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?ln["small"!==u?"middle":u]+Sl:0)-Sl;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+Sl:0,n=e.$pager?e.$pager.offsetHeight+Sl:0;p=r.winHeight-t-n-20}l!==f.viewportHeight&&(e=>{const{scrollYStore:t,isIE:r}=d.current,{startIndex:n,endIndex:a}=t,i=Co.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}=Co,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 Oo(){const[,t]=e.useReducer((e=>e+1),0);return t}const Ao=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(xl),{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},ko=t().forwardRef(((e,r)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:i}=t().useContext(xl),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}));ko.displayName="FullScreen";const Fo=ko,Lo=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(xl),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}));Lo.displayName="Reload";const Ho=Lo,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(xl),{tablePrint:f,showHeader:g}=c,b=i?.print?.leftLogo??"",y=i?.print?.rightLogo??"",v=!(!b&&!y),x=t().useMemo((()=>ce(Zl(n,[Co.expandableColumn,Co.selectionColumn,Co.operationColumn]))),[n]),E=t().useMemo((()=>ce(Zl(d,[Co.expandableColumn,Co.selectionColumn,Co.operationColumn]))),[d]),S=t().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),C=(e,t)=>{const r=Object.assign({},Yl(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||Co.defaultColumnWidth,n<=Co.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=Co.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(to(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||Co.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):lo(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,_o=require("exceljs");var Do=n.n(_o);const jo="606060",Ko="thin",Mo="d4d4d4",Vo=(e,t)=>{t&&(e.height=Math.floor(.75*t))},zo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Uo=()=>({top:{style:Ko,color:{argb:Mo}},left:{style:Ko,color:{argb:Mo}},bottom:{style:Ko,color:{argb:Mo}},right:{style:Ko,color:{argb:Mo}}}),Bo=e=>{const{children:t}=e;return t&&t.length?Bo(t[0]):e},Wo=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},Go=()=>{const{tableRef:e,tableProps:r,getSpan:n,showSummary:a,isHeadGroup:i}=t().useContext(xl),{spanMethod:l,showHeader:o}=r,s=(e,t)=>e.find((e=>e.text==t))?.value??"";return{exportXLSX:async(t,r,s,c)=>{const{columns:d,footSummation:u}=t,{scrollYStore:{rowHeight:m}}=e.current,h=Ul(d),f=to(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||Co.defaultColumnWidth)/8})})),o&&(i?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Bo(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?lo(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):lo(e,i);n[i]=0===a&&""===o?p("qm.table.config.summaryText"):te(o)?ho(o).join(""):o})),b.push(n)}));const{sheetName:C,useStyle:w}=t,T=new(Do().Workbook),N=T.addWorksheet(C);N.columns=y,o&&N.addRows(g).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Yl(d,t.key),{align:n,theadAlign:a}=r;zo(e,a||n),w&&Object.assign(e,{font:{bold:!0,color:{argb:jo}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Uo()})}))})),N.addRows(S).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Yl(d,t.key),{align:n}=r;zo(e,n),Object.assign(e,Wo(r)),w&&Object.assign(e,{font:{color:{argb:jo}},border:Uo()})}))})),a&&u&&N.addRows(b).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=N.getColumn(e.col),r=Yl(d,t.key),{align:n}=r;zo(e,n),Object.assign(e,Wo(r)),w&&Object.assign(e,{font:{color:{argb:jo}},border:Uo()})}))})),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=Ul(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(Do().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=po(e,Nl)),t[l[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:l}=a[r];Array.isArray(l)&&(t[e]?.includes(",")?t[e]=t[e].split(",").map((e=>s(l,e))).filter((e=>""!==e)):t[e]=s(l,t[e])),oo(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)}}},Yo=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"))},Xo=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableProps:i,createTableData:l,dataChange:o}=t().useContext(xl),{beforeTableImport:s}=i,{importXLSX:c}=Go(),d=t().useRef(null),[u,m]=t().useState(!1),[h,f]=t().useState(!0),g=e=>e.filter((e=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.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(Yo,{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(Ii,{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"))))},Qo=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(Xo,{columns:n,onClose:()=>l(!1)})))}));Qo.displayName="TableImport";const Zo=Qo,Jo=e=>{const{columns:r,onChange:n}=e,{$size:a}=t().useContext(xl),i=t().useRef([]),[l,o]=t().useState(!1),[s,c]=t().useState(r);De((()=>{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(yn(),{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($r.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(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:Rl,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"))))},es=e=>{const{defaultValue:r,onClose:n,onOk:a}=e,{tableProps:i,selectionKeys:l,pagination:o,showSummary:c}=t().useContext(xl),{rowSelection:d}=i,u=t().useRef(null),[m,h]=t().useState(!1),f=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(Il)}.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(Jo,{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(Ii,{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"))))},ts=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(xl),{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((()=>Zl(n,[Co.expandableColumn,Co.selectionColumn,Co.operationColumn])),[n]),P=t().useMemo((()=>Zl(u,[Co.expandableColumn,Co.selectionColumn,Co.operationColumn])),[u]),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(g?fo(t):t).reduce(((e,t)=>{if(t?.[Co.summaryIgnore])return e;const r=Number(lo(t,n));return Number.isNaN(r)?e:e+r}),0);oo(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}=Go(),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),[Co.currentPageName]:1,[Co.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=eo(e.map(((e,t)=>{const r={...e,index:t,pageIndex:t};return P.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&oo(r,n,lo(r,n))})),r})))}}catch(e){}return T(!1),i},q=e=>{const t=i?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},$=v?.fileName??`${s()().format(Il)}.xlsx`,_=$.slice($.lastIndexOf(".")+1).toLowerCase(),D=()=>{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,[Co.currentPageName]:void 0,[Co.pageSizeName]:void 0});n.data&&(kt(n.data,e),q(e))}catch(e){}T(!1)})($):C(!0)};t().useImperativeHandle(r,(()=>({clickHandle:D})));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:$.slice(0,$.lastIndexOf(".")),fileType:_,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:()=>D()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.DownloadOutlined,null))),t().createElement(cr,K,t().createElement(es,{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`),q(`${t}.xlsx`)}if("csv"===r){const r=L(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=to(r),i=Ul(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||Co.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):lo(e,a);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):te(l)?ho(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));kt(r,`${t}.csv`),q(`${t}.csv`)}})(Object.assign({},e,{columns:Bl(e.columns)}))}})))}));ts.displayName="TableExport";const rs=ts,ns=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableBodyRef:i,tableProps:l,dataChange:o}=t().useContext(xl),{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(Ii,{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&&(oo(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"))))},as=t().forwardRef(((e,r)=>{const{flattenColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.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(ns,{columns:o,onClose:()=>l(!1)})))}));as.displayName="TableClipboard";const is=as,ls=e=>{const{columns:r,onClose:n}=e,{tableProps:a,tableRef:i,$size:l,selectionKeys:o,setSelectionKeysEffect:s}=t().useContext(xl),{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=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.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*ln[l]-30)}),5);return De((()=>{v()}),[u.width]),t().createElement("div",{ref:d,style:{height:"100%"}},t().createElement(rc,{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"))))},os=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(xl),{rowSelection:m}=i,[h,f]=t().useState(!1),g=t().useRef(!1);De((()=>{!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(ls,{columns:n,onClose:()=>f(!1)})))}));os.displayName="SelectCollection";const ss=os,cs=require("localforage");var ds=n.n(cs);const us=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),ps=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(xl),{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");De((()=>{const{current:e,pageSize:t}=d,r=i.current.tableFullData.slice((e-1)*t,e*t),n=eo(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=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[A,k]=t().useState({}),[F,L]=t().useState(R),[H]=t().useState(I([P[0]])),[q]=t().useState(I(P.slice(1))),[$,_]=t().useState(0),D=t().useMemo((()=>!Object.keys(A).length),[A]);De((()=>{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=lo(a,t),l=!0;if("text"===r||"textarea"===r?l=new RegExp(F.fullchar?`^${e[t]}$`:e[t],F.case?"":"i").test(n):(n=us(n)?n.slice(0,10):n,l=n==e[t]),!l){i=!1;break}}i&&r.push(a)}return r})(A),_(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=yo(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("");De((()=>{if(Y){const{filters:e,config:t}=U.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(Z()(e,q.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 ds().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await ds().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:$}))},t().createElement(Jt.TabPane,{tab:p("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t().createElement(Ii,{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(Ii,{ref:E,items:q,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:D,onChange:e=>{const{value:t}=e.target;G(t)}}),t().createElement(he,{type:"primary",disabled:!W||D,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=mo(),t=[...U,{text:W,value:e,list:{filters:A,config:F}}];B(t),X(e),G(""),await ds().setItem(z,t),await te(z,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Co.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 ds().setItem(z,t),await te(z,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!U.length&&t().createElement("div",{style:{padding:Sl}},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:`${ln[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"))))},ms=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{$size:a}=t().useContext(xl),[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:`${ln[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(ps,{onClose:()=>l(!1)})))}));ms.displayName="FastSearch";const hs=ms,fs=e=>{const{columns:r,group:n,summary:a}=e,{tableRef:i,tableProps:l,$size:o,pagination:c,fetchParams:d,isFetch:u}=t().useContext(xl),{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===Co.groupSummary.total.value?{dataIndex:e.summary,title:Co.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...h(e.summary),formula:e.formula})),b=t().useMemo((()=>Object.assign({},d,{[Co.sorterFieldName]:void 0,[Co.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[Co.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[Co.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===Co.groupSummary.total.value&&(n={dataIndex:Co.groupSummary.recordTotalIndex,summation:{render:()=>c.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(f,g)),[x]=t().useState(u?[]:(e=>{const t=bo(e,n.map((e=>e.group))),r=[];return t.forEach((e=>{const t={};y.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&oo(t,n,lo(e[0],n))})),a.forEach((r=>{const n=r.summary!==Co.groupSummary.total.value?r.summary:Co.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&oo(t,n,e.length),"sum"===a&&oo(t,n,(0,J.sumBy)(e,n)),"max"===a&&oo(t,n,(0,J.maxBy)(e,n)[n]),"min"===a&&oo(t,n,(0,J.minBy)(e,n)[n]),"avg"===a&&oo(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(rc,E)},gs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o}=t().useContext(xl),{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("");De((()=>{if(v){const{group:e,summary:t}=h.find((e=>e.value===v)).list;I(e),k(t)}else{const e=q();I(e?.group||[]),k(e?.summary||[])}}),[v]),t().useEffect((()=>{$()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),S=t().useMemo((()=>o.filter((e=>![Co.expandableColumn,Co.selectionColumn,"index","pageIndex",Co.operationColumn].includes(e.dataIndex)))),[o]),C=S.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[Co.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===Co.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]),q=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},$=async()=>{if(!E)return;const e=q();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await ds().getItem(E);t||(t=await _(E),Array.isArray(t)&&await ds().setItem(E,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},_=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},D=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(rc,{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(rc,{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=mo(),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 ds().setItem(E,t),await D(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Co.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 ds().setItem(E,t),await D(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!h.length&&t().createElement("div",{style:{padding:Sl}},t().createElement(mt,null)))))),t().createElement(cr,K,t().createElement(fs,{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"))))},bs=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(gs,{onClose:()=>i(!1)})))}));bs.displayName="GroupSummary";const ys=bs,vs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(xl),{uniqueKey:d}=a,u=t().useRef(null),[m,h]=t().useState([]),[f,b]=t().useState([]),[y,v]=t().useState(""),[x,E]=t().useState("");De((()=>{h(x?f.find((e=>e.value===x)).list:q()||[])}),[x]),t().useEffect((()=>{$()}),[]);const S=t().useMemo((()=>d?`superSearch_${d}`:""),[d]),C=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=go(m),T=t().useMemo((()=>!(w&&Vl(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))))},q=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},$=async()=>{if(!S)return;const e=q();e&&h(e);let t=await ds().getItem(S);t||(t=await _(S),Array.isArray(t)&&await ds().setItem(S,t)),Array.isArray(t)&&t.length&&(b(t),!e&&E(t[0].value))},_=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},D=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(rc,{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}})),Co.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=mo(),t=[...f,{text:y,value:e,list:m.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await ds().setItem(S,t),await D(S,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Co.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 ds().setItem(S,t),await D(S,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:Sl}},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"))))},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.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(vs,{onClose:()=>i(!1)})))}));xs.displayName="SuperSearch";const Es=xs,Ss=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(xl),{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),q=t().useRef(!1),$=t().useMemo((()=>C?`toolBox_${C}`:""),[C]),[_,D]=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);De((()=>{q.current&&(z(),q.current=!1)}),[_]),t().useEffect((()=>{V()}),[]),t().useImperativeHandle(r,(()=>({exportHandle:()=>{if(!P.current)return g("Table","执行导出需要配置 `exportExcel` 参数");P.current.clickHandle()}})));const V=()=>{if(!$||!b)return;const e=JSON.parse(localStorage.getItem($));e||U($).then((e=>{e&&(D(Object.assign({},_,e)),localStorage.setItem($,JSON.stringify(e)))})).catch((()=>{})),e&&D(Object.assign({},_,e))},z=()=>{if(!$||!b)return;const e={};for(const t in _)_[t]&&(e[t]=_[t]);localStorage.setItem($,JSON.stringify(e)),B($,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)=>{q.current=!0,D(Object.assign({},_,{[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(Fo,{ref:T,isFullScreen:E,open:!b||_.fullScreen}),i&&t().createElement(Ho,{ref:N,open:!b||_.reload}),o&&t().createElement($o,{ref:I,tableColumns:n,open:!b||_.print}),s&&t().createElement(Zo,{ref:R,tableColumns:n,open:!b||_.import}),c&&t().createElement(rs,{ref:P,tableColumns:n,open:(!b||_.export)&&!w?.hideIcon}),d&&t().createElement(is,{ref:A,flattenColumns:x,open:!b||_.clipboard}),u&&t().createElement(ss,{ref:k,columns:n,open:!b||_.collection}),m&&t().createElement(hs,{ref:F,open:!b||_.fastSearch}),f&&t().createElement(ys,{ref:L,open:!b||_.groupSummary}),h&&t().createElement(Es,{ref:H,open:!b||_.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:_.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:_.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:_.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:_.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:_.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:_.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:_.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:_.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:_.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:_.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)))))}));Ss.displayName="ToolBox";const Cs=Ss,ws=e=>{const{columns:r}=e,{global:n}=t().useContext(l),{tableProps:a,tableRef:i,$size:o}=t().useContext(xl),{uniqueKey:s,onlyShowIcon:c,columnsChange:d}=a,u=t().useRef([]),m=e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)),h=e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)),f=e=>e.filter((e=>!e.noAuth&&!e.fixed)),[g,b]=t().useState(!1),[y,v]=t().useState(m(r)),[x,E]=t().useState(h(r)),[S,C]=t().useState(f(r)),w=t().useMemo((()=>s?`table_${s}`:""),[s]),T=t().useMemo((()=>[...y,...S,...x]),[y,S,x]);De((()=>{A(r),P(r),I(r)}),[r]),t().useEffect((()=>{R()}),[]);const N=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=N(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}})),I=e=>{if(!w)return;const t=N(e),r=JSON.parse(localStorage.getItem(w));(0,J.isEqual)(t,r)||(localStorage.setItem(w,JSON.stringify(t)),(async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(w,t))},R=()=>{const e=(()=>{if(!w)return;const e=JSON.parse(localStorage.getItem(w));return e||(async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(w).then((e=>{if(!e)return I(r);localStorage.setItem(w,JSON.stringify(e)),R()})).catch((()=>{})),e?(0,J.xor)(e.map((e=>e.dataIndex)),r.map((e=>e.dataIndex))).length>0?Gl(r,(t=>{const r=Yl(e,t.dataIndex);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))})):e.map((e=>{const t=r.find((t=>t.dataIndex===e.dataIndex));return void 0===e.fixed&&delete t.fixed,(0,J.merge)({},t,e)})):void 0})();e&&(P(e),d?.(e))},P=e=>{const t=m(e),r=h(e),n=f(e);return v(t),E(r),C(n),[...t,...n,...r]},A=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))})),u.current=t},k=()=>{const e=[];T.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=u.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...u.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=T.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})))})),r.forEach(((t,r)=>{t.noAuth&&e.findIndex((e=>e.dataIndex===t.dataIndex))<0&&e.splice(r,0,t)})),d?.(e)},F=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const n=P(r);d?.(n)},L=(e,n)=>{const{colSpan:a,noFixed:i}=e;if(0===a)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const l=["svgicon","handle",`${n}-handle`];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(O.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,P(r),k()}}),t().createElement("i",{className:Se()(l),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title),"main"===n?t().createElement("span",{className:Se()("fixed",i?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>F(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>F(e,"right")},t().createElement(we.StepForwardOutlined,null))):t().createElement("span",{className:Se()("fixed",i?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>F(e)},t().createElement(we.CloseCircleOutlined,null))))},H=Ce("table"),q={[`${H}__popper`]:!0,"column-filter__popper":!0,[`${H}--lg`]:"large"===o,[`${H}--sm`]:"small"===o},$=[`${H}-column-filter`,{selected:g}];return t().createElement(yn(),{action:["click"],popupVisible:g,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:()=>{const e=ce(i.current.originColumns);P(e),d?.(e)}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement($r.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),r=y.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||v(e)},onEnd:()=>k()},y.map((e=>L(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement($r.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(e)},onEnd:()=>k()},S.map((e=>L(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement($r.ReactSortable,{itemKey:"dataIndex",handle:".right-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(e)},onEnd:()=>k()},x.map((e=>L(e,"right")))))),popupClassName:Se()(q),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{b(e)},builtinPlacements:Rl,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()($),title:c?p("qm.table.columnFilter.text"):void 0},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),!c&&t().createElement("span",null,p("qm.table.columnFilter.text"))))},Ts=()=>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 Ns(){return Ns=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},Ns.apply(this,arguments)}const Is=e=>{const{column:r,filters:n}=e,{$size:a,setFilters:i,clearSuperFilters:l}=t().useContext(xl),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,Ns({ref:s},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(O.InputNumber,Ns({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(O.InputNumber,Ns({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(O.InputNumber,Ns({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const r=e=>({value:uo(f[y]?.[e],Tl),format:Tl,size:a,onChange:t=>{b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:po(t,Tl)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(_,Ns({},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(_,Ns({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(_,Ns({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(_,Ns({},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(vl,{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(yn(),{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:Rl,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(Ts,null))))},Rs=e=>{const{column:r}=e,{tableProps:n,tableRef:a,bordered:i}=t().useContext(xl),{columns:l,resizable:o,columnsChange:s=ne}=n,c={resizable:!0,"is--line":o&&!i};return t().createElement("div",{className:Se()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=a.current,i=n.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=ro(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+o;n.$table.classList.add("c--resize"),i.style.left=`${d}px`,i.style.display="block";const u=r.width||r.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,n=u+t;n<(r.minWidth||Co.defaultColumnWidth)||(p=Math.floor(n),i.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),i.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Yl(l,r.dataIndex).width=p,s([...l]))},!1}})},Ps=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(xl),{rowSelection:h}=a,{fetchAllRowKeys:f,onSelectAll:g}=h,b=t().useRef([]),y=t().useMemo((()=>h.selectAllOnCurrentPage??!1),[h]),v=t().useMemo((()=>(h.filterable??!0)&&!y),[h,y]),x=()=>{const{tableFullData:e}=n.current,{current:t,pageSize:r}=l;return m?e.slice((t-1)*r,t*r):e},E=(()=>{const{allTableData:e,allRowKeys:t,selectionRows:r}=n.current,{disabled:a}=h;if(u)return b.current.length?b.current:(0,J.union)(t,r.map((e=>i(e,e.index))));if(!y)return a?t.filter(((t,r)=>!a(e[r]))):t;const l=a?x().filter((e=>!a(e))).map((e=>i(e,e.index))):x().map((e=>i(e,e.index)));return(0,J.union)(l,r.map((e=>i(e,e.index))))})(),S=r.filter((e=>!E.includes(e))),C=r.length-S.length,w=C>0&&C<E.length,T=!!C&&C===E.length;c(S);const N=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,x().filter((e=>n(e))).map((e=>i(e,e.index))))),b.current=t}}catch(e){}return d(!1),t},I=async e=>{let t=[];t=f?e?await N():[]:e?E.slice(0):[],t=[...new Set([...t,...S])],s(t),g?.(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(O.Checkbox,{checked:T,indeterminate:w,disabled:!E.length,onChange:e=>I(e.target.checked)}),v&&t().createElement(O.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{I(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=f?(0,J.xor)(r,await N()):(0,J.xor)(r,E),e=[...new Set([...e,...S])],s(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{I(!1)}}];return t().createElement(O.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),y&&t().createElement(O.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},Os=e=>{const{style:r}=e,{tableProps:n,tableRef:a,isTreeTable:i,setRowExpandedKeys:l}=t().useContext(xl),{expandable:o}=n,[s,c]=t().useState(o?.defaultExpandAllRows||!1);De((()=>{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})},As=()=>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"})),ks=()=>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"})),Fs=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(xl),{ellipsis:I,resizable:R,multipleSort:P,rowSelection:A,expandable:k}=o,[F,L]=Co.sortDirections,H=t().useRef(null),q=t().useMemo((()=>!g),[g]),$=t().useMemo((()=>!g),[g]),_=t().useMemo((()=>!k?.hideExpandAll),[k]),D=t().useMemo((()=>!(!A||(g?!A.selectAllOnCurrentPage&&!A.fetchAllRowKeys:A.hideSelectAll))),[g,A]);De((()=>{U(),v(),S()}),[a]),De((()=>{G(),v(),S()}),[i]),De((()=>{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===Co.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},D?t().createElement(Ps,{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&&_?t().createElement(Os,null):null,r===Co.expandableColumn&&_?t().createElement(Os,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(As,null)),t().createElement("span",{className:Se()(n)},t().createElement(ks,null)))},V=e=>t().createElement(Is,{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=()=>{q&&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=lo(e,n),i=lo(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(fo(r).sort("function"==typeof a?a:i)):r.sort("function"==typeof a?a:i).slice(0);N(l)},G=()=>{$&&Y()},Y=()=>{const{tableOriginData:e}=s.current,t=u.length?go(u):go(i),r=""!==t?y?T(zl(fo(e),t,b)):zl(e,t,b):e;N(r),B(!0)},X=to(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&&![Co.expandableColumn,Co.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(Rs,{column:e}))})(r,n,e))),d&&t().createElement("th",{className:Se()(n),style:{...i}}))))})(X))))};const Ls=e=>{const{selectionKeys:r,column:n,record:a,rowKey:i}=e,{tableProps:l,tableRef:o,isTreeTable:s,getAllChildRowKeys:c}=t().useContext(xl),{rowSelection:d}=l,u=t().useMemo((()=>n.type||""),[n.type]),p=e=>{const t=d.checkStrictly??!0;if(!s||t)return!1;const n=Jl(o.current.deriveRowKeys,e),a=c(n?.children??[]);return!(!Array.isArray(n?.children)||io(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})})()},Hs=e=>{const{record:r,rowKey:n,style:a}=e,{tableProps:i,rowExpandedKeys:l,setRowExpandedKeys:o}=t().useContext(xl),{expandable:s={}}=i,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(r)),d=t().useMemo((()=>l.includes(n)),[l,n]);De((()=>{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})},qs=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(Qr())(t).toFixed(p)),t},E=void 0!==i,[S,C]=t().useState(a??""),w=b(E?i:S),T=y(w);return De((()=>{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)}})}));qs.displayName="InputNumber";const $s=qs;function _s(){return _s=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},_s.apply(this,arguments)}const{Search:Ds}=O.Input,js=t().forwardRef(((e,r)=>{const{column:n,record:a,rowKey:i,columnKey:l,clicked:o,text:s}=e,{tableRef:c,tableBodyRef:d,$size:u,flattenColumns:m,updateTableData:h,doFieldValidate:f,dataChange:b}=t().useContext(xl),y=Oo(),{store:v,fieldAuth:x}=c.current,E=n.editRender?.(a,n)||{},S=t().useRef(null),C=t().useRef(null),w=t().useRef(null),T=t().useRef(null),N=t().useRef(null),I=t().useRef(!1),R=t().useRef({}),P=t().useRef({}),A=t().useRef([]),[k,F]=t().useState(!1),[L,H]=t().useState(!1),[q,$]=t().useState(!1),[D,j]=t().useState(E.items||[]),[K,V]=t().useState(),z=(E.editable||(0,J.isEqual)(o,[i,l]))&&!E.disabled&&!x[l]?.disabled,U=`${i}|${l}`,B=2===o.length?`${o[0]}|${o[1]}`:"",W=![...v.state.required,...v.state.validate].some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),G=v.state.required.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",Y=v.state.validate.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",X=v.state.edited.some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),Q=z||!W||k||q||L,Z=!!E.helper?.combinedDataIndex&&("search-helper"===E.type||"tree-helper"===E.type),ee=E.type.endsWith("multiple"),te=()=>{h(),b()};t().useEffect((()=>{Q&&B===U&&ie()}),[o]),t().useEffect((()=>{ee&&E.items&&ne(E.items.map((e=>({[P.current.valueKey]:e.value,[P.current.textKey]:e.text}))))}),[]);const re=(e,t)=>{F(e),t?.()},ne=e=>{A.current=e},ie=()=>{const{type:e}=E;switch(e){case"text":C.current?.focus();break;case"number":w.current?.select();break;case"search-helper":T.current?.focus();break;case"tree-helper":N.current?.focus()}};t().useImperativeHandle(r,(()=>({focus:ie})));const oe=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0}))},se=(e,t,r)=>{const{cornerSign:n=!0}=E.extra||{};v.addToUpdated(e),n&&v.addToEdited({x:t,y:r})},ce=e=>""!==e?Number(e):"",de={text:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:c=[],onInput:d,onChange:m,onEnter:h,onBlur:g}=E,b=lo(e,a),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),x=n?{rows:v.minRows,autoSize:v}:null,S=s.password?O.Input.Password:n?O.Input.TextArea:O.Input;return t().createElement(S,_s({ref:C,size:u,value:b,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??"";oo(e,a,r),f(c,r,i,l),y(),d?.({[U]:r}),I.current=!0},onFocus:()=>H(!0),onBlur:t=>{H(!1);const r=t.target.value??"";I.current&&(I.current=!1,se(e,i,l),m?.({[U]:r},e),g?.({[U]:r},e),te())},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";h?.({[U]:r},e)}},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||e.preventDefault()}}))},textarea:(e,t)=>de.text(e,t,!0),number:(e,r)=>{const{dataIndex:n,precision:a,formatType:o}=r,{type:s,extra:c={},rules:d=[],onInput:m,onChange:h,onEnter:g,onBlur:b}=E,v=lo(e,n);let x,S;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]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(x=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Qr())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Qr())(e).times(.01).toString()),t().createElement($s,{ref:w,size:u,value:v,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:S,onChange:t=>{oo(e,n,t),f(d,t,i,l),y(),m?.({[U]:t}),I.current=!0},onFocus:()=>H(!0),onBlur:(t,r)=>{if(H(!1),!I.current)return;I.current=!1;let a=c.stringMode?t:ce(t);"percent"===o&&"."===r.charAt(r.length-1)&&(a=Number(t)/100),oo(e,n,a),se(e,i,l),h?.({[U]:a},e),b?.({[U]:a},e),te()},onEnter:(t,r)=>{let n=c.stringMode?t:ce(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),g?.({[U]:n},e)}})},select:(e,r,n)=>{const{dataIndex:a,dictItems:o=[]}=r,{type:s,extra:d={},rules:m=[],items:h,onChange:g,onEnter:b}=E,{elementStore:y}=c.current,v=h||o,x=lo(e,a);let S=x;return t().createElement(O.Select,{mode:n?"multiple":void 0,size:u,popupClassName:"table-editable__popper",value:x||void 0,placeholder:d.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:d.allowClear,listHeight:d.listHeight,maxTagCount:d.collapseTags?"responsive":void 0,maxTagTextLength:d.maxTagTextLength,disabled:d.disabled,style:{width:"100%"},showSearch:d.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${Ra.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{oo(e,a,t),f(m,t,i,l),se(e,i,l),g?.({[U]:t},e),te()},onSelect:e=>{S=e},onInputKeyDown:t=>{13===t.keyCode&&le((()=>b?.({[U]:S},e)))}},v.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>de.select(e,t,!0),date:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:c=[],onChange:d}=E,m=n?Nl:Tl,h=lo(e,a);return t().createElement(_,{showTime:n,size:u,popupClassName:"table-editable__popper",value:uo(h,m)??void 0,format:s.format||m,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=po(t,m);oo(e,a,r),f(c,r,i,l),se(e,i,l),d?.({[U]:r},e),te()}})},datetime:(e,t)=>de.date(e,t,!0),time:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},rules:s=[],onChange:c}=E,d="HH:mm:ss",m=lo(e,n);return t().createElement(M,{size:u,popupClassName:"table-editable__popper",value:uo(m,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=po(t,d);oo(e,n,r),f(s,r,i,l),se(e,i,l),c?.({[U]:r},e),te()}})},checkbox:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=E,{trueValue:c=Cl,falseValue:d=wl,disabled:u}=o,p=lo(e,n);return t().createElement(O.Checkbox,{checked:p===c,disabled:u,onChange:t=>{const r=t.target.checked?c:d;oo(e,n,r),se(e,i,l),s?.({[U]:r},e),te()}})},switch:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=E,{trueValue:c=Cl,falseValue:d=wl,disabled:u}=o,p=lo(e,n);return t().createElement(O.Switch,{checked:p===c,disabled:u,onChange:t=>{const r=t?c:d;oo(e,n,r),se(e,i,l),s?.({[U]:r},e),te()}})},"search-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:c=[],helper:d={},onInput:h,onChange:b,onEnter:y}=E,v=so(e,Z?d.combinedDataIndex:n),x=d.fieldAliasMap;x||g("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof x?x():x||{};Object.keys(C).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Z&&(d.combinedDataIndex.split("|").every((e=>Object.keys(C).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),C[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 a.forEach((e=>i[e]=r)),i},N=e=>{const{autoQueryAssign:t=!0}=d;t&&(R.current=w(e)),F(!0)},P=(t,n)=>{const{beforeOpen:a}=d,i=(a??ae)({[U]:v},e,r);i?.then?i.then((()=>{N(t),n?.()})).catch((()=>{})):!1!==i&&(N(t),n?.())},O=e=>{const t={};for(const r in C){const a=C[r];r!==n&&(t[r]=so(e,a))}const r=C[n]?so(e,C[n]):"";L(r,t);const{closed:a}=d;re(!1,(()=>oe(S.current))),ie(),a?.(e)},A=()=>{const{onlySelect:e=!0}=d;I.current&&L(e?"":v),re(!1,(()=>oe(S.current)))},L=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=m.find((e=>e.dataIndex===t));if(a){oo(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&f(r.rules,n,i,t)}else oo(e,t,n)}Z&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return oo(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&oo(e,t,a[r]?.trim())}))})(e,d.combinedDataIndex),oo(e,n,t,a),f(c,t,i,l),se(e,i,l),b?.({[U]:t},e),te(),R.current={},I.current=!1,V(void 0)},H={visible:k,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ln[u]+20}px`},onClose:()=>{A()}},q={...d,size:u,initialValue:Object.assign({},R.current,d.initialValue),onClose:e=>{e?O(e):A()}};return t().createElement(t().Fragment,null,t().createElement(Ds,{ref:T,value:K??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(I.current&&!k)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=d,{beforeFetch:n=ae}=t.fetch;return $(!0),new Promise((async(a,i)=>{const l=(0,J.merge)({},t.fetch.params,{...r,...w(e)},{currentPage:1,pageSize:500});try{if(n(l)){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()}else i()}catch(e){i()}$(!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=>so(t,C[n]).toString().includes(e)));if(1===t.length)return O(t[0]);P(e)}(e,t))).catch((()=>L(""))):void L(t)},onChange:e=>{const{value:t}=e.target;h?.({[U]:t}),I.current=!0,V(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";y?.({[U]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;P(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&P(e)}}),t().createElement(cr,H,t().createElement(lc,q)))},"search-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,items:o=[],extra:s={},rules:c=[],helper:d={},onInput:m,onChange:h,onEnter:b}=E,y=lo(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`"),P.current=x;const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[U]:y},e,r);a?.then?a.then((()=>{F(!0),t?.()})).catch((()=>{})):!1!==a&&(F(!0),t?.())},w=()=>{re(!1,(()=>oe(S.current)))},T=t=>{oo(e,n,t),f(c,t,i,l),se(e,i,l),h?.({[U]:t},e,A.current),te()},N={visible:k,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ln[u]+20}px`},onClose:()=>{w()}},I={...d,size:u,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=x;ne((0,J.uniqBy)([...A.current.filter((e=>t.includes(e[n]))),...e],n));const a=A.current.map((e=>({text:e[r],value:e[n]}))),i=(0,J.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));j(i),T(i.map((e=>e.value)));const{closed:l}=d;re(!1,(()=>oe(S.current))),l?.(A.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&&b?.({[U]:y},e)},onDoubleClick:()=>{s.disabled||C()},onChange:e=>{const{valueKey:t}=x;ne(A.current.filter((r=>e.includes(r[t])))),T(e)}},D.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:()=>{C()}})))),t().createElement(cr,N,t().createElement(lc,I)))},"tree-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:c=[],helper:d={},onChange:h,onEnter:b}=E,y=so(e,Z?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` 值"),Z&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[U]:y},e,r);a?.then?a.then((()=>{F(!0),t?.()})).catch((()=>{})):!1!==a&&(F(!0),t?.())},w=()=>{re(!1,(()=>oe(S.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=m.find((e=>e.dataIndex===t));if(a){oo(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&f(r.rules,n,i,t)}else oo(e,t,n)}oo(e,n,t,a),f(c,t,i,l),se(e,i,l),h?.({[U]:t},e),te()},I={visible:k,title:p("qm.searchHelper.text"),width:d.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ln[u]+20}px`},onClose:()=>{w()}},R={...d,defaultSelectedKeys:[y],size:u,onClose:e=>{e?(e=>{const t={};for(const r in x){const a=x[r];r!==n&&(t[r]=so(e,a))}const r=x[n]?so(e,x[n]):"";T(r,t);const{closed:a}=d;re(!1,(()=>oe(S.current))),ie(),a?.(e)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement(Ds,{ref:N,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??"";b?.({[U]:r},e)}},onDoubleClick:()=>{C()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?C():T(""))}}),t().createElement(cr,I,t().createElement(hc,R)))},"tree-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},items:s=[],rules:c=[],helper:d={},onInput:m,onChange:h,onEnter:b}=E,y=lo(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`"),P.current=x;const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[U]:y},e,r);a?.then?a.then((()=>{F(!0),t?.()})).catch((()=>{})):!1!==a&&(F(!0),t?.())},w=()=>{re(!1,(()=>oe(S.current)))},T=t=>{oo(e,n,t),f(c,t,i,l),se(e,i,l),h?.({[U]:t},e,A.current),te()},N={visible:k,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ln[u]+20}px`},onClose:()=>{w()}},I={...d,size:u,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=x;ne(e);const n=A.current.map((e=>({text:e[t],value:e[r]})));j(n),T(n.map((e=>e.value)));const{closed:a}=d;re(!1,(()=>oe(S.current))),a?.(A.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&&b?.({[U]:y},e)},onDoubleClick:()=>{o.disabled||C()},onChange:e=>{const{valueKey:t}=x;ne(A.current.filter((r=>e.includes(r[t])))),T(e)}},D.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:()=>{C()}})))),t().createElement(cr,N,t().createElement(hc,I)))}};return t().createElement(t().Fragment,null,Q?(()=>{const{type:e}=E,r=de[e];if(!r)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!W}];return t().createElement("div",{ref:S,className:Se()(i)},r(a,n),!W&&t().createElement("div",{className:"cell-error"},G||Y))})():(()=>{const{extra:e={}}=E,r=Z?so(a,E.helper.combinedDataIndex):s;return e.disabledColor?t().createElement("span",{style:{color:e.disabledColor}},r):t().createElement(t().Fragment,null,r)})(),X&&t().createElement("i",{className:"cell--sign"}))}));js.displayName="CellEdit";const Ks=js,Ms=require("copy-to-clipboard");var Vs=n.n(Ms);const zs=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)},Us=e=>{const{text:r,options:n,showMessage:a=!0,onCopy:i}=e;return zs(e.children,{onClick:l=>{const o=t().Children.only(e.children),s=Vs()(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)}})};Us.displayName="QmCopyToClipboard";const Bs=Us;function Ws(){return Ws=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},Ws.apply(this,arguments)}const Gs=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:q,scrollXToColumn:$,scrollYToRecord:_,rowInViewport:D,dataChange:j,setPingLeft:K,setPingRight:M,setFullScreen:V,findParentRowKeys:z,getAllChildRowKeys:U,triggerScrollYEvent:B,scrollBottomDebouncer:W}=t().useContext(xl),{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(xl),{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");De((()=>{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||Co.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(Tl):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(Nl):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(Nl.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(Number(e))?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>co(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:no(Y)-e-r+"px"}),X&&Object.assign(i,{maxHeight:no(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([]),qe=Oo(),$e=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:qe}))),De((()=>{$e&&(ze([]),O&&Pe())}),[$e]),De((()=>{Le.length&&Al.focus(c.current.uid)}),[Le]),t().useEffect((()=>{je()}),[]);const _e=t().useCallback((e=>{const{keyCode:t}=e;if(c.current.uid===Al.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?eo(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),D(s)||(38===t&&_(u,s),40===t&&_(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]),$(a)}}}),[Le,a,E,d,Fe]);t().useEffect((()=>{const e=_t()(document,"keydown",_e);return()=>e.remove()}),[_e]);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=Jl(n,e);let i=[];const l=U(a?.children||[]),o=yo(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=Jl(n,e),r=io(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*Co.selectionColumnWidth:Co.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?`${q(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=tt(e,n,a,r);return t().createElement("td",{key:d,title:v?O:void 0,rowSpan:b>1?b:void 0,colSpan:y>1?y:void 0,"data-index":r,className:Se()(C),style:{...w,...P,...T,...N},onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([Co.expandableColumn,Co.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===Co.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),[Co.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;[Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(n)||be?.(t,r,e)})(t,n,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(n)||ye?.(t,r,e)})(t,n,e)},t().createElement("div",{className:"cell"},et(e,n,a,r,O,i,o)))},et=(e,r,n,a,i,l,o)=>{const{dataIndex:s,canCopy:c,editRender:d,render:u}=e,m=lo(r,s);if(s===Co.expandableColumn)return t().createElement(Hs,{record:r,rowKey:l});if(s===Co.selectionColumn)return t().createElement(Ls,{selectionKeys:E,column:e,record:r,rowKey:l});const f=rt(m,e,r);if(d)return t().createElement(Ks,{ref:e=>Ee.current[`${l}-${s}`]=e,column:e,record:r,rowKey:l,columnKey:s,clicked:Le,text:f});const g=u?u(m,r,e,n,a):f;return I&&s===h?[it(ee?.virtual?r._level:o),t().createElement(Hs,{key:"expand",record:r,rowKey:l,style:Ye(r)?{}:{visibility:"hidden"}}),g]:c?t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},g),i&&t().createElement(Bs,{text:i},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([Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(a))return"";let l="";const o=lo(t,a);if("function"==typeof i){const a=i(o,t,e,r,n);l=te(a)?ho(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(Qr())(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*Co.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",Ws({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($r.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=[];c.current.tableFullData.forEach((t=>{a.includes(t)?n.push(e.shift()):n.push(t)})),k(n),j()}},a.map((e=>Ze(e,e.index,l(e,e.index))))):t().createElement("tbody",null,Qe(a)))),O&&Re())}));Gs.displayName="TableBody";const Ys=Gs,Xs=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(xl),{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):lo(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 Qs=function(e){return e.small="small",e.middle="default",e.large="default",e}(Qs||{});const Zs=e=>{const{current:r,pageSize:n,total:a,onChange:i}=e,{global:o}=t().useContext(l),{tableProps:s,$size:c,setElementStore:d}=t().useContext(xl),{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??Co.pagination.showSizeChanger,y=p?.showQuickJumper??Co.pagination.showQuickJumper,v=p?.pageSizeOptions||o?.table?.pagination?.pageSizeOptions||Co.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)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(Ao,{total:a})),t().createElement(O.Pagination,{size:Qs[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}`))}}))},Js=()=>{const{layout:e}=t().useContext(xl),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 ec(){return ec=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},ec.apply(this,arguments)}const tc=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,showColumnDefine:v,showHeader:x}=e,{size:E}=t().useContext(l),S=t().useMemo((()=>e.size??E??""),[e.size,E]),C=t().useRef(null),w=t().useRef(null),T=t().useRef(null),N=t().useRef(null),I=t().useRef(null),R=Oo(),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:q,setDeriveRowKeys:$,setInvalidRowKeys:_,setFieldAuth:D,setMergeCells:j,setScrollYStore:K,setScrollYLoad:M,setResizeState:V,setHandleState:z,setSummaries:U,setSelectionRows:B,setShouldToTop:W,setRecordsMap:G,setUnMounted:Y,setHandleChange:X,clearElementStore:Q,clearRecordsMap:Z}=((e,r)=>{let{getRowKey:n,$size:a}=r;const i=t().useRef({uid:mo(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},mergeCells:[],scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:Co.rowHeightMaps[a]},store:new So,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)}),l=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 o=n(e,e.index),s=r?`${r}#${o}`:`${o}`,c=a?`${a}-${e.index+1}`:`${e.index+1}`,d={level:i,rowKey:o,rowKeyPath:s,indexPath:c};return e.indexPath=c,e._level=i,e.children&&(d.children=l(e.children,o,s,c,i+1)),t?Object.assign({},d,{parentRowKey:t}):d}))},o=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...o(e.children)):t.push(e.rowKey)})),t};return{tableRef:i,...i.current,setElementStore:(e,t)=>{i.current.elementStore[e]=t},setOriginColumns:e=>{i.current.originColumns=e},setTableFullData:e=>{i.current.tableFullData=e},setTableOriginData:e=>{i.current.tableOriginData=e},setAllTableData:e=>{const t=eo(e);i.current.allTableData=t,i.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{i.current.treeTable=i.current.tableFullData.some((e=>Array.isArray(e.children))),i.current.treeTable&&(i.current.deriveRowKeys=l(e,""),i.current.flattenRowKeys=o(i.current.deriveRowKeys))},setInvalidRowKeys:e=>{i.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{i.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})})),i.current.mergeCells=t},setScrollYStore:e=>{i.current.scrollYStore=e},setResizeState:e=>{i.current.resizeState=e},setHandleState:e=>{i.current.handleState=e},setSummaries:e=>{i.current.summaries=e},setScrollYLoad:e=>{i.current.scrollYLoad=e},setShouldToTop:e=>{i.current.shouldToTop=e},setSelectionRows:e=>{i.current.selectionRows=e},setRecordsMap:(e,t)=>{i.current.recordsMap.set(e,t)},setUnMounted:e=>{i.current.unMounted=e},setHandleChange:e=>{i.current.isHandleChange=e},clearElementStore:()=>{for(const e in i.current.elementStore)i.current.elementStore[e]=null},clearRecordsMap:()=>{i.current.recordsMap.clear()}}})(0,{getRowKey:P,$size:S}),{tableData:te,setTableData:re,filters:ne,setFilters:ae,sorter:ie,setSorter:le,superFilters:oe,setSuperFilters:se,pagination:de,setPagination:ue,selectionKeys:pe,setSelectionKeys:me,rowExpandedKeys:he,setRowExpandedKeys:fe,highlightKey:ge,setHighlightKey:be,layout:ye,setLayout:ve,permission:xe,setPermission:Ee,spinning:we,setSpinning:Te,scrollX:Ne,setScrollX:Ie,scrollY:Re,setScrollY:Pe,isPingLeft:Oe,setPingLeft:Ae,isPingRight:ke,setPingRight:Fe,isFullScreen:Le,setFullScreen:He,updateTableData:qe}=(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:Co.pagination.current,pageSize:(()=>{if(r)return Number(localStorage.getItem(`tablePager_${r}`))||void 0})()??o?.pageSize??u?.table?.pagination?.pageSize??Co.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?To():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,q]=t().useState(!1),[$,_]=t().useState(!1),[D,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:q,scrollX:$,setScrollX:_,scrollY:D,setScrollY:j,isPingLeft:K,setPingLeft:M,isPingRight:V,setPingRight:z,isFullScreen:U,setFullScreen:B,updateTableData:()=>{g([...f])}}})(e),{isFetch:$e,isWebPagination:_e,isScrollPagination:je,showPagination:Ke,shouldUpdateHeight:Me,tableColumns:Ve,flattenColumns:ze,editableColumns:Ue,summationColumns:Be,leftFixedColumns:We,rightFixedColumns:Ge,treeExpandIndex:Ye,showSummary:Xe,showFooter:Qe,isHeadGroup:Ze,bordered:Je,isHeadSorter:et,isHeadFilter:tt,isServiceSummation:rt,isSelectCollection:nt,isTableImport:at,isTableClipboard:it,isSuperSearch:lt,isFastSearch:ot,isGroupSummary:st,isGroupSubtotal:ct,isDragMergeCell:dt,isTreeTable:ut,isTableEmpty:pt,summationRows:mt,fetchParams:ht}=Io(e,{getRowKey:P,tableRef:O,tableFullData:A,tableData:te,sorter:ie,filters:ne,superFilters:oe,selectionKeys:pe,pagination:de}),{createElementStore:gt,tableStyles:bt,getSpan:yt,getStickyLeft:vt,getStickyRight:xt,scrollXToColumn:Et,scrollYToRecord:St,rowInViewport:Ct,calcTableHeight:wt,resetTableScroll:Tt,doLayout:Nt}=Po(e,{getRowKey:P,tableRef:O,$size:S,tableColumns:Ve,flattenColumns:ze,leftFixedColumns:We,layout:ye,scrollY:Re,tableData:te,showFooter:Qe,showPagination:Ke,isWebPagination:_e,isFullScreen:Le,setLayout:ve,setScrollX:Ie,setScrollY:Pe,setElementStore:k,setScrollYStore:K,setShouldToTop:W}),{initialTable:It,createTableFullData:Rt,getTableData:Pt,handleTableData:Ot,createTableData:At,createGroupData:kt,createSelectionKeys:Ft,createRowExpandedKeys:Lt,setSelectionKeysEffect:Ht,findParentRowKeys:qt,getAllChildRowKeys:$t,doFieldValidate:_t,getTableLog:Dt,dataChange:jt,tableChange:Kt,toLastPage:Mt,toFirstPage:Vt,getPageCount:zt,pagerChangeHandle:Ut,triggerScrollYEvent:Bt,scrollBottomDebouncer:Wt,clearTableSorter:Gt,clearTableFilter:Yt,clearSuperFilters:Xt,clearRowSelection:Qt,clearRowHighlight:Zt,clearTableLog:Jt,destroy:er}=Ro(e,{getRowKey:P,tableRef:O,tableElementRef:w,tableBodyRef:T,$size:S,tableColumns:Ve,tableFullData:A,pagination:de,layout:ye,filters:ne,sorter:ie,superFilters:oe,fetchParams:ht,selectionKeys:pe,rowExpandedKeys:he,highlightKey:ge,summationColumns:Be,shouldUpdateHeight:Me,isFetch:$e,isTreeTable:ut,isWebPagination:_e,isScrollPagination:je,isServiceSummation:rt,isGroupSubtotal:ct,doLayout:Nt,setTableData:re,setTableFullData:L,setTableOriginData:H,setAllTableData:q,setDeriveRowKeys:$,setPagination:ue,setSpinning:Te,setSorter:le,setFilters:ae,setSuperFilters:se,setSelectionKeys:me,setRowExpandedKeys:fe,setHighlightKey:be,setSelectionRows:B,setScrollYLoad:M,setScrollYStore:K,setFieldAuth:D,setResizeState:V,setSummaries:U,setPermission:Ee,setRecordsMap:G,resetTableScroll:Tt,clearElementStore:Q,clearRecordsMap:Z});((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,toLastPage:N,toFirstPage:I,getPageCount:R,setHandleState:P,scrollYToRecord:O,setSelectionKeysEffect:A,setOriginColumns:k,setRowExpandedKeys:F,setHighlightKey:L,setResizeState:H,setMergeCells:q,setPingRight:$,setUnMounted:_,setHandleChange:D,calcTableHeight:j,createSelectionKeys:K,createRowExpandedKeys:M,createElementStore:V,triggerScrollYEvent:z,initialTable:U,destroy:B}=r,{elementStore:W,handleState:G,scrollYLoad:Y}=c.current,X=t().useRef(E);De((()=>{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),D(!0)}),[y]),De((()=>{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]),De((()=>{const{allTableData:e,allRowKeys:t}=c.current;T&&F(M()),o&&(p.current.setClickedValues(x?[x,""]:[]),o.onChange?.(x,e[t.findIndex((e=>e===x))]??null))}),[x]),De((()=>{(0,J.isEqual)(E,X.current)||(X.current=E,S&&a&&a.onChange?.(E))}),[E]),De((()=>{const e=K(i.selectedRowKeys);(0,J.isEqual)(e,y)||(A(e),T&&F(M()))}),[i?.selectedRowKeys]),De((()=>{const e=M(l.expandedRowKeys);(0,J.isEqual)(e,v)||F(e)}),[l?.expandedRowKeys]),De((()=>{const{currentRowKey:e}=o;e!==x&&L(e??"")}),[o?.currentRowKey]),De((()=>{const{insert:e,remove:t}=G;e&&(C&&("after"===e?N():I()),O("","after"===e?1e5:0)),t&&b.current>R()&&N(),(e||t)&&P({insert:null,remove:!1})}),[b.total]),De((()=>{Y&&z(W.$tableBody.parentNode.parentNode.scrollTop)}),[Y]),De((()=>{$(f)}),[f]),De((()=>{j()}),[h]),De((()=>{q(s),p.current.forceUpdate()}),[s]),De((()=>{Y&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),w&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Y,w]);const Q=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(H(Object.assign({},e,{winHeight:r})),j())};t().useEffect((()=>(V({$toper:d.current,$table:u.current,$resizableBar:m.current}),k(ce(n)),U(),q(s),window.addEventListener("resize",Q,!1),j(),()=>{B(),window.removeEventListener("resize",Q),_(!0)})),[])})(e,{tableRef:O,topElementRef:C,tableElementRef:w,tableBodyRef:T,resizableBarRef:I,$size:S,scrollX:Ne,pagination:de,selectionKeys:pe,rowExpandedKeys:he,highlightKey:ge,showSummary:Xe,summationRows:mt,isWebPagination:_e,isScrollPagination:je,isTreeTable:ut,toLastPage:Mt,toFirstPage:Vt,getPageCount:zt,setHandleState:z,scrollYToRecord:St,setOriginColumns:F,setSelectionKeysEffect:Ht,setRowExpandedKeys:fe,setHighlightKey:be,setResizeState:V,setMergeCells:j,setPingRight:Fe,setUnMounted:Y,setHandleChange:X,calcTableHeight:wt,createSelectionKeys:Ft,createRowExpandedKeys:Lt,createElementStore:gt,triggerScrollYEvent:Bt,initialTable:It,destroy:er});const tr=t().useMemo((()=>({getRowKey:P,tableProps:e,tableRef:O,tableBodyRef:T,$size:S,flattenColumns:ze,editableColumns:Ue,leftFixedColumns:We,rightFixedColumns:Ge,treeExpandIndex:Ye,sorter:ie,filters:ne,superFilters:oe,layout:ye,bordered:Je,showFooter:Qe,showSummary:Xe,summationRows:mt,scrollX:Ne,scrollY:Re,pagination:de,fetchParams:ht,selectionKeys:pe,rowExpandedKeys:he,highlightKey:ge,isFetch:$e,isPingLeft:Oe,isPingRight:ke,isHeadSorter:et,isHeadFilter:tt,isFullScreen:Le,isTableEmpty:pt,isHeadGroup:Ze,isTreeTable:ut,isGroupSubtotal:ct,isWebPagination:_e,isDragMergeCell:dt,dataChange:jt,tableChange:Kt,getTableData:Pt,setElementStore:k,createTableFullData:Rt,updateTableData:qe,setSorter:le,setFilters:ae,setSuperFilters:se,setHighlightKey:be,setRowExpandedKeys:fe,setSelectionRows:B,setSelectionKeysEffect:Ht,setInvalidRowKeys:_,getSpan:yt,getStickyLeft:vt,getStickyRight:xt,scrollXToColumn:Et,scrollYToRecord:St,rowInViewport:Ct,setPagination:ue,setPingLeft:Ae,setPingRight:Fe,setSpinning:Te,setFullScreen:He,setShouldToTop:W,doFieldValidate:_t,createTableData:At,createGroupData:kt,findParentRowKeys:qt,getAllChildRowKeys:$t,triggerScrollYEvent:Bt,scrollBottomDebouncer:Wt,resetTableScroll:Tt,clearTableSorter:Gt,clearTableFilter:Yt,clearSuperFilters:Xt,clearRowSelection:Qt,clearRowHighlight:Zt})),[e,S,ze,Ue,We,Ge,Ye,ie,ne,oe,ye,Je,Qe,Xe,mt,Ne,Re,de,ht,pe,he,ge,$e,Oe,ke,et,tt,Le,pt,Ze,ut,ct,_e,dt]);((e,r)=>{const{getRowKey:n,tableProps:a,tableRef:i,toolBoxRef:l,tableBodyRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:m,highlightKey:h,isFetch:f,dataChange:b,getTableData:y,handleTableData:v,createTableData:x,calcTableHeight:E,scrollXToColumn:S,scrollYToRecord:C,doFieldValidate:w,setHandleState:T,setSelectionKeysEffect:N,setRowExpandedKeys:I,setHighlightKey:R,setSelectionRows:P,setOriginColumns:O,setHandleChange:A,forceUpdate:k,getTableLog:F,clearRowSelection:L,clearRowHighlight:H,clearTableSorter:q,clearTableFilter:$,clearSuperFilters:_,clearTableLog:D}=r,{columns:j,columnsChange:K}=a,M=(e,t,r)=>{for(let a=0;a<e.length;a++){const i=e[a],l=n(i,i.index);Array.isArray(i.children)&&M(i.children,t,r),t.includes(l)&&(r?.(i,l),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:async e=>{f&&(await y(),e?.())},GET_LOG:()=>F(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(L(),H(),q(),$(),_(),D(),x([]))},CLEAR_LOG:()=>{D()},CREATE_FOCUS:(e,t)=>{o.current.createFocus(e,t)},FORCE_UPDATE:()=>{k()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{S(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,J.isEqual)(e,p)&&A(!1),N(e)},SET_HIGHLIGHT:e=>{R(e)},SET_EXPANDABLE:e=>{I(e)},SET_SELECTION_ROWS:e=>{P(e)},SET_TABLE_DATA:e=>{v(e)},DEFINE_INITIAL_COLUMNS:e=>{O(e)},SET_TABLE_COLUMN:(e,t,r)=>{const n=Yl(j,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&&(K?K([...j]):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=>{s.forEach((t=>{const{dataIndex:r}=t;[Co.expandableColumn,Co.selectionColumn,Co.operationColumn].includes(r)||oo(e,r,lo(e,r))})),r.addToInserted(e)}));const o="before"===t?.mode,c=void 0===t?.parentRowKey;let d=a;if(c)d=o?[...l,...d]:d.concat(l);else{const e=vo(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)}x(d),c&&T(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),b()},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;M(r,a,((e,r)=>{t.addToRemoved(e),c.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&&(x(r),N(p.filter((e=>!a.includes(e)))),a.includes(h)&&H(),I(m.filter((e=>!a.includes(e)))),T(Object.assign({},i.current.handleState,{remove:!0})),b())},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((r=>{c.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&&w(c,lo(r,i),s,i)}))}));const{required:r,validate:a}=F(),l=[...r,...a];return l.length&&C(l[0].rowKey),k(),{required:r,validate:a}}})))})(r,{getRowKey:P,tableProps:e,tableRef:O,toolBoxRef:N,tableBodyRef:T,flattenColumns:ze,editableColumns:Ue,pagination:de,fetchParams:ht,selectionKeys:pe,rowExpandedKeys:he,highlightKey:ge,isFetch:$e,dataChange:jt,getTableData:Pt,handleTableData:Ot,createTableData:At,calcTableHeight:wt,scrollXToColumn:Et,scrollYToRecord:St,doFieldValidate:_t,setHandleState:z,setSelectionKeysEffect:Ht,setRowExpandedKeys:fe,setHighlightKey:be,setSelectionRows:B,setOriginColumns:F,setHandleChange:X,forceUpdate:R,getTableLog:Dt,clearRowSelection:Qt,clearRowHighlight:Zt,clearTableSorter:Gt,clearTableFilter:Yt,clearSuperFilters:Xt,clearTableLog:Jt}),t().useEffect((()=>{Al.register(O.current.uid,r??{current:null})}),[]);const rr=Ce("table"),nr={[`${rr}--wrapper`]:!0,[`${rr}--lg`]:"large"===S,[`${rr}--sm`]:"small"===S,[`${rr}--maximize`]:Le,[c]:!!c},ar={[rr]:!0,"is--border":Je,"is--striped":o,"is--fixed":We.length||Ge.length,"is--sortable":et,"is--filterable":tt,"is--head-group":Ze,"is--merge-cell":dt,"is--empty":pt,"show--head":x,"show--foot":Qe,"ping--left":Oe,"ping--right":ke,"scroll--x":Ne,"scroll--y":Re};return t().createElement(xl.Provider,{value:tr},t().createElement("div",{className:Se()(nr)},h&&t().createElement("div",{ref:C,className:`${rr}-top`},t().createElement("div",{className:`${rr}-top__space`},"bottom"!==p?.position&&t().createElement(Ao,{total:de.total}),t().createElement("div",{className:`${rr}-top__space-slot`,style:{justifyContent:Pl[m]}},e.children)),t().createElement("div",{className:`${rr}-top__actions`},t().createElement(Cs,{ref:N,showFullScreen:f,showReload:b&&$e,showPrint:xe.print&&!!d,showImport:xe.import&&at,showExport:xe.export&&!!u,showClipboard:it,showCollection:nt,showFastSearch:ot,showSuperSearch:lt,showGroupSummary:st,showToolBox:y,tableColumns:Ve}),v&&t().createElement(ws,{columns:a}))),t().createElement(ft,{spinning:i??we},t().createElement("div",{ref:w,className:Se()(ar),style:bt},t().createElement("div",{className:`${rr}--main-wrapper`},x&&t().createElement(Fs,{tableColumns:Ve,flattenColumns:ze,sorter:ie,filters:ne}),t().createElement(Ys,{ref:T,tableData:te,flattenColumns:ze}),Qe&&t().createElement(Xs,{summationRows:mt,flattenColumns:ze})),Je&&t().createElement("div",{className:`${rr}--border-line`}),pt&&t().createElement(Js,null),s&&t().createElement("div",{ref:I,className:`${rr}--resizable-bar`}))),Ke&&t().createElement(Zs,ec({},de,{onChange:(e,t)=>Ut({current:e,pageSize:t})}))))}));tc.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},tc.displayName="QmTable";const rc=tc,nc=rc;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=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},onClose:d}=e,{size:u}=t().useContext(l),m=t().useMemo((()=>e.size??u??""),[e.size,u]),h=t().useRef(null),f=t().useRef(null),g=t().useRef(null),b=St(h),[y,v]=t().useState(c),[x,E]=t().useState(),[S,C]=t().useState(o),[w,T]=t().useState(!1),[N,I]=t().useState(300),[R,P]=t().useState(s),[O,A]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[k,F]=t().useState((0,J.merge)({},c.fetch?.params,a)),[L,H]=t().useState([]),q=()=>{const e=h.current,t=e.querySelector(".form-wrap");I(e.offsetHeight-t.offsetHeight-2*ln[m]-30)},$=Ct(q,5);De((()=>{$()}),[b.width]),De((()=>{(0,J.isEqual)(s,R)||P(s)}),[s]),t().useEffect((()=>{_()}),[k]),t().useEffect((()=>{i&&g.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&f.current?.SET_FIELDS_VALUE(a)}),[]);const _=async()=>{const{webPagination:e,fetch:t}=y;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(k)){T(!0);try{const e=await r(k);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(C([]),await ie(0)),H(t)}}catch(e){}T(!1)}},D=e=>{n||(E(e),d(e))},j=e=>{F(Object.assign({},k,e))},K=Ce("search-helper"),M=y.webPagination?{dataSource:L,loading:w,webPagination:!0}:{fetch:{...y.fetch,params:k}};return t().createElement("div",{ref:h,className:`${K}--wrapper`},t().createElement("div",{className:"form-wrap"},R.length?t().createElement(Ii,{ref:f,items:R,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>P(e),onCollapse:()=>q(),onFinish:e=>j(e),onReset:async()=>{const[e,t]=await f.current.GET_FORM_DATA();e||j(t)}}):null),t().createElement("div",null,t().createElement(nc,ac({ref:g,uniqueKey:r,height:N,columns:O,rowKey:y.rowKey||"pageIndex"},M,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{C(e),E(n?t:t[0])}},columnsChange:e=>A(e),onRowDblclick:D,onRowEnter:D}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ln[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>d(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!x,onClick:()=>d(x,n?S:void 0)},p("qm.dialog.confirm"))))};ic.displayName="SearchHelper";const lc=ic;function oc(){return oc=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},oc.apply(this,arguments)}const sc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...sc(e.children)),e.children&&t.push(e.value)})),t},cc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=cc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},dc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&dc(e.children,t),t(e)||e.children&&e.children.length))),uc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},onClose:u}=e,{size:m}=t().useContext(l),h=t().useMemo((()=>e.size??m??""),[e.size,m]),f=t().useRef(null),b=t().useRef(null),y=t().useRef(null),v=St(f),[x,E]=t().useState(c),[S,C]=t().useState(),[w,T]=t().useState(o),[N,I]=t().useState(!1),[R,P]=t().useState(300),[A,k]=t().useState(300),[F,L]=t().useState(s),[H,q]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[$,_]=t().useState((0,J.merge)({},c.fetch?.params,a)),[D,j]=t().useState([]),K=()=>{const e=f.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");P(e.offsetHeight-r.offsetHeight-10),k(e.offsetHeight-t.offsetHeight-2*ln[h]-30)},M=Ct(K,5);De((()=>{M()}),[v.width]),De((()=>{(0,J.isEqual)(s,F)||L(s)}),[s]),t().useEffect((()=>{V()}),[$]),t().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&b.current?.SET_FIELDS_VALUE(a),te()}),[]);const V=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i($)){I(!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||(T([]),await ie(0)),j(t)}}catch(e){}I(!1)}},z=e=>{n||(C(e),u(e))},U=e=>{_(Object.assign({},$,e))},[B,W]=t().useState([]),[G,Y]=t().useState([]),[X,Q]=t().useState(""),Z=t().useRef(B),ee=t().useRef([]);De((()=>{Y(sc(B))}),[B]);const te=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);W(t),Z.current=t,ee.current=e}}catch(e){}},re=e=>`${e}|${Ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ne=Ce("tree-table-helper"),le=x.webPagination?{dataSource:D,loading:N,webPagination:!0}:{fetch:{...x.fetch,params:$}};return t().createElement("div",{ref:f,className:`${ne}--wrapper`},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:X,style:{marginBottom:8},placeholder:p("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=dc(Z.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==re(r).indexOf(e)}));Q(e),W(t)})(e.target.value)}),t().createElement(O.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:G,treeData:B,filterTreeNode:e=>{if(!X)return!1;const t=e.text||"";return-1!==re(t).indexOf(X)},onExpand:e=>{Y(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]);U(r)})(cc(ee.current,(r=>(0,J.get)(r,t)===e[0]))||{})}})),t().createElement(nt.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},F.length?t().createElement(Ii,{ref:b,items:F,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>L(e),onCollapse:()=>K(),onFinish:e=>U(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||U(t)}}):null),t().createElement("div",null,t().createElement(nc,oc({ref:y,uniqueKey:r,height:A,columns:H,rowKey:x.rowKey||"pageIndex"},le,{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=>q(e),onRowDblclick:z,onRowEnter:z}))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ln[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!S,onClick:()=>u(S,n?w:void 0)},p("qm.dialog.confirm"))))};uc.displayName="TreeTableHelper";const pc=uc,mc=e=>{const{multiple:r,tree:n={},defaultSelectedKeys:a,onClose:i}=e,{size:o}=t().useContext(l),s=t().useMemo((()=>e.size??o??""),[e.size,o]),[c,d]=t().useState(),[u]=t().useState(n.fetch?.params),m=Ce("tree-helper"),h=n.fetch?{...Z()(n.fetch,["params","valueKey","textKey"]),params:u}:void 0;return t().createElement("div",{className:`${m}--wrapper`},t().createElement(vl,{multiple:r,fetch:h,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=>d(e),onCheckChange:e=>d(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ln[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>i(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!c,onClick:()=>i(c)},p("qm.dialog.confirm"))))};mc.displayName="TreeHelper";const hc=mc;function fc(){return fc=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},fc.apply(this,arguments)}const gc="_startSign",bc="_endSign",yc=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:gc,width:80,align:"right",render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:bc,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*ln[c]-30)},H=Ct(L,5);De((()=>{H()}),[h.width]),De((()=>{(0,J.isEqual)(a,C)||w(a)}),[a]),t().useEffect((()=>{q()}),[I]);const q=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)}},$=(e,t)=>{delete e[t]},_=()=>{v.forEach((e=>{e&&($(e,gc),$(e,bc))})),x([])},D=e=>{_(),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(Ii,{ref:u,items:C,initialValues:n,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>L(),onFinish:e=>D(e),onReset:async()=>{const[e,t]=await u.current.GET_FORM_DATA();e||D(t)}}):null),t().createElement("div",null,t().createElement(nc,fc({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;[gc,bc].includes(r)&&(r===gc&&(e[r]?($(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?O.message.warning(p("qm.searchHelper.rangeStartTip")):(v[0]&&$(v[0],r),e[r]="[",x([e,v[1]]))),r===bc&&(e[r]?($(e,r),x([v[0],void 0])):e.pageIndex<k[0]?O.message.warning(p("qm.searchHelper.rangeEndTip")):(v[1]&&$(v[1],r),e[r]="]",x([v[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[gc]="["),e.pageIndex===k[1]&&(e[bc]="]")}))}}),t().createElement(he,{type:"primary",icon:t().createElement(we.ClearOutlined,null),title:p("qm.table.alert.clear"),onClick:()=>_()}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ln[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)[gc,bc].includes(r)||(t[r]=e[r]);return t})(e))))},p("qm.dialog.confirm"))))};yc.displayName="RangeTableHelper";const vc=yc;function xc(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 Ec=e=>null!=e;function Sc(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=xc((()=>{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 Cc=(t,r)=>{const n=e.useRef(!0);e.useLayoutEffect((()=>t(n.current)),r),e.useLayoutEffect((()=>(n.current=!1,()=>{n.current=!0})),[])};function wc(e,t){Cc((t=>{if(!t)return e()}),t)}function Tc(e){return void 0!==e}function Nc(t,r){const{defaultValue:n,value:a,onChange:i,postState:l}=r||{},[o,s]=e.useState((()=>Tc(a)?a:Tc(n)?"function"==typeof n?n():n:"function"==typeof t?t():t)),c=Tc(a)?a:o,d=l?l(c):c,u=xc(i),[p,m]=e.useState([c]);return wc((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),wc((()=>{Tc(a)||s(a)}),[a]),[d,xc((e=>{s(e),m([c])}))]}const Ic={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"]}},Rc={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"]}},Pc=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Oc(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(Ic).forEach((e=>{const c={...n&&Rc[e]||Ic[e],offset:[0,0]};switch(s[e]=c,Pc.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 Ac=require("@rc-component/portal");var kc=n.n(Ac);const Fc=require("@rc-component/trigger");var Lc=n.n(Fc);const Hc=require("rc-util/lib/hooks/useId");var qc=n.n(Hc);function $c(){return $c=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},$c.apply(this,arguments)}const _c={fill:"transparent",pointerEvents:"auto"},Dc=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-${qc()()}`,p="object"==typeof c?c?.placeholder:c;return t().createElement(kc(),{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",$c({},a?null:_c,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),a&&t().createElement(t().Fragment,null,t().createElement("rect",$c({},_c,{x:"0",y:"0",width:"100%",height:`${a.top}px`})),t().createElement("rect",$c({},_c,{x:"0",y:"0",width:a.left,height:"100%"})),t().createElement("rect",$c({},_c,{x:"0",y:a.top+a.height,width:"100%",height:`calc(100vh - ${a.top+a.height}px)`})),t().createElement("rect",$c({},_c,{x:a.left+a.width,y:"0",width:`calc(100vw - ${a.left+a.width}px)`,height:"100%"})))):null))},jc=e=>{const{prefixCls:r,zIndex:n,open:a,onPause:i,onPlay:l}=e,[o,s]=Nc(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 Kc(){const{locale:t}=e.useContext(l);return{t:p,$locale:t}}const Mc=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}=Kc(),f=Ec(i)?t().createElement("div",{className:`${r}-cover`},i):null,g=Ec(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"))))))},Vc=e=>{const{current:r,renderPanel:n}=e;return t().createElement(t().Fragment,null,"function"==typeof n?n(e,r):t().createElement(Mc,e))};function zc(){return zc=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},zc.apply(this,arguments)}const Uc={left:"50%",top:"50%",width:1,height:1},Bc=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]=Nc(0,{value:i,defaultValue:a}),[I,R]=Nc(void 0,{value:c,postState:e=>!(T<0||T>=n.length)&&(e??!1)}),[P,O]=Nc(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:q,arrow:$,className:_,mask:D,scrollIntoViewOptions:j,zIndex:K,action:M}=n[T]||{},V=K||P,z=I&&(D??u),U=j??E,[B,W]=Sc(L,!!c,v,U),G=((e,t,r)=>r??t??(null===e?"center":"bottom"))(W,g,H),Y=!!W&&(void 0===$?p:$),X="object"==typeof Y&&Y.pointAtCenter;t().useLayoutEffect((()=>{w.current?.forceAlign()}),[X,T]),De((()=>{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,q),re=Ce("tour"),ne=[{[`${re}-${d}`]:"primary"===d},h,_],ae=Oc({arrowPointAtCenter:X,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Dc,{zIndex:V,prefixCls:re,pos:B,showMask:J,style:ee?.style,fill:ee?.color,open:A,animated:x,rootClassName:h}),t().createElement(Lc(),zc({ref:w},C,{zIndex:V,builtinPlacements:ae,popupStyle:te,popupPlacement:G,popupVisible:A,popupClassName:Se()(ne),prefixCls:re,popup:()=>t().createElement(Vc,zc({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(kc(),{open:A,autoLock:!0},t().createElement("div",{className:Se()(h,`${re}-target-placeholder`),style:{...B||Uc,position:"fixed",pointerEvents:"none"}}))),m&&t().createElement(kc(),{open:I},t().createElement(jc,{zIndex:V,prefixCls:re,onPause:()=>k(!1),onPlay:()=>k(!0)})))}));Bc.displayName="QmTour";const Wc=Bc,Gc=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Yc=e=>({_s:e,status:Gc[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Xc=e=>e?6:5,Qc=(e,t,r,n,a)=>{clearTimeout(n.current);const i=Yc(e);t(i),r.current=i,a?.({current:i})},Zc=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)((()=>Yc(o?2:Xc(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 Xc(t)}})(m.current._s,c);e&&Qc(e,p,m,h,d)}),[d,c]),y=(0,e.useCallback)((e=>{const t=e=>{switch(Qc(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:Xc(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 wc((()=>{c()}),[a]),t().createElement(t().Fragment,null,t().Children.map(r.children,(e=>t().isValidElement(e)?zs(e,{className:Se()(e.props.className,n,s.status)}):e)))},Jc={previewWidth:1100,defaultDistance:.45,logoHeight:60},ed=(0,e.createContext)(void 0);var td=null;function rd(){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 nd(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(rd()){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:td?r=td:((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),td=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&rd(),r}catch(e){O.message.error("getLodop 出错:"+e)}}rd();const ad=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)},id=t().forwardRef(((e,r)=>{const{templateRender:n,directPrint:a}=e,{global:i}=t().useContext(l),{$$preview:o}=t().useContext(ed),{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}))),De((()=>{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*Jc.defaultDistance+10*Jc.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*Jc.defaultDistance+10*Jc.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return ad(v-10*(e.left-Jc.defaultDistance)-10*(e.right-Jc.defaultDistance))}),[s,v]),S=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return ad(x-10*(e.top-Jc.defaultDistance)-10*(e.bottom-Jc.defaultDistance))}),[s,x]),C=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:ad(10*e.left),right:ad(10*e.right),top:ad(10*e.top),bottom:ad(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=Jc.previewWidth-i<=0?0:(Jc.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>Jc.previewWidth?0:l>0?o:(Jc.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: ${Jc.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-Jc.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+=Jc.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 q();p.current.previewEl.innerHTML||(R(),await ie(0),P(),O(),y(!1))},H=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return q();R(),await ie(0),P(),O(),y(!1),o.doPrint(k()),await ie(0),o.doClose()},q=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},$={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:u,className:Se()($)},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}))))}));id.displayName="Container";const ld=id;function od(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 sd extends e.Component{constructor(){super(...arguments),od(this,"formRef",t().createRef()),od(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:Jc.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:Jc.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:Jc.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:Jc.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),od(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})})),od(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")}))),od(this,"state",{formList:this.createFormList()}),od(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())})),od(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return t().createElement(t().Fragment,null,t().createElement(Ii,{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"))))}}od(sd,"contextType",l);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,"provide",{$$preview:this}),dd(this,"containRef",t().createRef()),dd(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Jc.defaultDistance,right:Jc.defaultDistance,top:Jc.defaultDistance,bottom:Jc.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),dd(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),dd(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),dd(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 ds().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),dd(this,"doClose",(()=>{this.props.onClose?.()})),dd(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){}})),dd(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),dd(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 ')),dd(this,"doPrint",(e=>{const t=nd();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}=Jc,{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()})),dd(this,"doExport",(e=>{const t=nd();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=nd(),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 ds().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(e)&&await ds().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(ed.Provider,{value:this.provide},t().createElement(ld,{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(cd,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(ed.Provider,{value:this.provide},t().createElement(ld,{ref:this.containRef,templateRender:r,directPrint:!0}))}}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,"previewRef",t().createRef()),md(this,"state",{visible:!1,loading:!1}),md(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})})),md(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:`${Jc.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(pd,s)):e?t().createElement(pd,s):null})),md(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())}}md(hd,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:i().elementType}),md(hd,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),md(hd,"contextType",l);const fd=hd;function gd(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function bd(e){const t=gd(e);return t?t.frameElement:null}function yd(e){const t=Ed(e);return vd([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function vd(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 xd(e,t){const r=bd(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=yd(a);if(n.push(e),a=bd(a),i)break;a&&gd(a)===t&&(i=!0)}return vd(n)}return e.getBoundingClientRect()}function Ed(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 Sd(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 Cd=Object.assign;class wd{constructor(e,t){Sd(this,"node",void 0),Sd(this,"border",void 0),Sd(this,"padding",void 0),Sd(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=Rd.border,this.padding.style.borderColor=Rd.padding,this.content.style.backgroundColor=Rd.background,Cd(this.node.style,{borderColor:Rd.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){Id(t,"margin",this.node),Id(t,"border",this.border),Id(t,"padding",this.padding),Cd(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"}),Cd(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class Td{constructor(e,t){Sd(this,"tip",void 0),Sd(this,"nameSpan",void 0),Sd(this,"dimSpan",void 0),this.tip=e.createElement("div"),Cd(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),Cd(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),Cd(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});Cd(this.tip.style,n.style)}}class Nd{constructor(){Sd(this,"window",void 0),Sd(this,"tipBoundsWindow",void 0),Sd(this,"container",void 0),Sd(this,"tip",void 0),Sd(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 Td(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 wd(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=xd(e,this.window),a=Ed(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=xd(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 Id(e,t,r){Cd(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 Rd={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 Pd=null,Od=null;function Ad(){null!=window.document&&(Pd=null,null!==Od&&(Od.remove(),Od=null))}function kd(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{constructor(e){kd(this,"_isRunning",void 0),kd(this,"_selectIgnore",void 0),kd(this,"_lastHoveredNode",null),kd(this,"excludeSelectors",void 0),kd(this,"onSelect",void 0),kd(this,"iframesListeningTo",new Set),kd(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),kd(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),kd(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),kd(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,Ad();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!==Pd&&clearTimeout(Pd),null!=r&&(null===Od&&(Od=new Nd),Od.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),kd(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),kd(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(){Ad(),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 Ld(e){return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}const Hd=e=>{const{action:r,onConfirm:n,onCancel:a,onFinish:i}=e,{t:l}=Kc();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"))))},qd={left:"50%",top:"50%",width:1,height:1},$d=1001,_d=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}=Kc(),b=t().useRef(),y=t().useRef(l.length),[v,x]=Nc(0,{value:a,defaultValue:i}),[E,S]=Nc(void 0,{value:n,postState:e=>e??!1}),[C,w]=t().useState({}),[T,N]=t().useState(!1),[I,R]=t().useState(!1),[P,A]=Sc(C.node,!!n),[k,F]=t().useState(22),L=t().useRef(!1),H=t().useMemo((()=>v>=l.length?"add":"edit"),[v,l]),q=t().useMemo((()=>`${v+1} / ${l.length}`),[v,l]);t().useLayoutEffect((()=>{b.current=new Fd({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{w({id:mo(),node:e,path:t}),x(y.current),N(!0),_()}})}),[]),t().useEffect((()=>(E?$():_(),()=>{_()})),[E]),t().useEffect((()=>{y.current=l.length}),[l]);const $=()=>{b.current.startHandle()},_=()=>{b.current.stopHandle()},D=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=Oc({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Lc(),{zIndex:$d,builtinPlacements:M,popupPlacement:o,popupVisible:E&&T,popupClassName:Se()(K,c),popupStyle:d,prefixCls:j,popup:()=>{const e=()=>{N(!1),$()};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($r.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?.(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:Ld(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:Ld(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"),q)),p?p({id:C.id,nodePath:C.path,actionStatus:H,DO_CLOSE:e},v):t().createElement(Hd,{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(kc(),{open:E&&T,autoLock:!0},t().createElement("div",{className:Se()(`${j}-target-placeholder`),style:{...P||qd,position:"fixed",zIndex:$d,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:D,onClick:D}))),s&&t().createElement(kc(),{open:E},t().createElement(jc,{zIndex:$d,prefixCls:j,onPause:()=>{L.current=T,N(!1),_()},onPlay:()=>{L.current?N(!0):$()}})))}));_d.displayName="QmGuideTracker";const Dd=_d,jd="2.0.3"})(),a})()));
|