@jiaozhiye/qm-design-react 1.7.19 → 1.7.21
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/anchor/index.d.ts +2 -2
- package/lib/anchor/src/anchor-item.d.ts +1 -1
- package/lib/anchor/src/anchor.d.ts +1 -1
- package/lib/button/index.d.ts +1 -1
- package/lib/button/src/button.d.ts +3 -3
- package/lib/collapse/index.d.ts +1 -1
- package/lib/collapse/src/collapse.d.ts +1 -1
- package/lib/config-provider/index.d.ts +1 -1
- package/lib/config-provider/src/config-provider.d.ts +1 -1
- package/lib/copy-to-clipboard/index.d.ts +1 -1
- package/lib/copy-to-clipboard/src/copy-to-clipboard.d.ts +1 -1
- package/lib/countup/index.d.ts +1 -1
- package/lib/countup/src/countup.d.ts +1 -1
- package/lib/cropper/index.d.ts +1 -1
- package/lib/cropper/src/cropper.d.ts +1 -1
- package/lib/divider/index.d.ts +1 -1
- package/lib/divider/src/divider.d.ts +1 -1
- package/lib/download/index.d.ts +1 -1
- package/lib/download/src/download.d.ts +1 -1
- package/lib/drawer/index.d.ts +1 -1
- package/lib/drawer/src/drawer.d.ts +3 -3
- package/lib/drawer/style/index.less +2 -2
- package/lib/empty/index.d.ts +1 -1
- package/lib/empty/src/empty.d.ts +3 -3
- package/lib/form/index.d.ts +2 -2
- package/lib/form/src/form.d.ts +3 -3
- package/lib/index.d.ts +29 -29
- package/lib/index.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/lib/modal/index.d.ts +1 -1
- package/lib/modal/src/modal.d.ts +3 -3
- package/lib/modal/style/index.less +2 -2
- package/lib/print/index.d.ts +1 -1
- package/lib/print/src/print.d.ts +1 -1
- package/lib/range-table-helper/index.d.ts +1 -1
- package/lib/range-table-helper/src/range-table-helper.d.ts +1 -1
- package/lib/scrollbar/index.d.ts +1 -1
- package/lib/scrollbar/src/scrollbar.d.ts +1 -1
- package/lib/search-helper/index.d.ts +1 -1
- package/lib/search-helper/src/search-helper.d.ts +1 -1
- package/lib/search-tree/index.d.ts +1 -1
- package/lib/search-tree/src/search-tree.d.ts +1 -1
- package/lib/space/index.d.ts +1 -1
- package/lib/space/src/space.d.ts +3 -3
- package/lib/spin/index.d.ts +1 -1
- package/lib/spin/src/spin.d.ts +3 -3
- package/lib/split/index.d.ts +2 -2
- package/lib/split/src/split-pane.d.ts +1 -1
- package/lib/split/src/split.d.ts +3 -3
- package/lib/style/index.css +4 -4
- package/lib/style/index.min.css +1 -1
- package/lib/style/themes/default.less +1 -1
- package/lib/table/index.d.ts +2 -2
- package/lib/table/src/pager/index.d.ts +0 -2
- package/lib/table/src/table/index.d.ts +1 -1
- package/lib/table/src/table/types.d.ts +0 -4
- package/lib/tabs/index.d.ts +2 -2
- package/lib/tabs/src/tab-pane.d.ts +3 -3
- package/lib/tabs/src/tabs.d.ts +3 -3
- package/lib/tinymce/index.d.ts +1 -1
- package/lib/tinymce/src/index.d.ts +1 -1
- package/lib/transition/index.d.ts +1 -1
- package/lib/transition/src/transition.d.ts +1 -1
- package/lib/tree-helper/index.d.ts +1 -1
- package/lib/tree-helper/src/tree-helper.d.ts +1 -1
- package/lib/tree-table-helper/index.d.ts +1 -1
- package/lib/tree-table-helper/src/tree-table-helper.d.ts +1 -1
- package/lib/upload-file/index.d.ts +1 -1
- package/lib/upload-file/src/upload-file.d.ts +1 -1
- package/lib/upload-img/index.d.ts +1 -1
- package/lib/upload-img/src/upload-img.d.ts +1 -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:()=>$,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:()=>Bt,QmButton:()=>he,QmCollapse:()=>_e,QmConfigProvider:()=>X,QmCopyToClipboard:()=>zs,QmCountup:()=>st,QmCropper:()=>Qi,QmDivider:()=>Ne,QmDownload:()=>Lt,QmDrawer:()=>rr,QmEmpty:()=>pt,QmForm:()=>Ii,QmModal:()=>sr,QmPrint:()=>kc,QmRangeTableHelper:()=>bc,QmScrollbar:()=>Rt,QmSearchHelper:()=>ac,QmSearchTree:()=>yl,QmSpace:()=>xe,QmSpin:()=>ht,QmSplit:()=>rt,QmTable:()=>tc,QmTabs:()=>Zt,QmTinymce:()=>Bi,QmTransition:()=>Dc,QmTreeHelper:()=>pc,QmTreeTableHelper:()=>uc,QmUploadFile:()=>tl,QmUploadImg:()=>sl,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:()=>V,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:()=>Na,version:()=>jc});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:"结束位置不能小于起始位置"},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 u=c;function d(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=u;for(let e=0,t=l.length;e<t;e++){if(i=o[l[e]],e===t-1)return d(i,a);if(!i)return"";o=i}return""},m=e=>{u=e||u,u.name&&s().locale(u.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 I=require("dayjs/plugin/weekOfYear");var N=n.n(I);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(N()),s().extend(P());const O=require("antd"),A=require("rc-picker/es/generate/dayjs");var F=n.n(A);const H=require("antd/es/calendar/generateCalendar");var k=n.n(H);require("antd/es/calendar/style");const L=k()(F()),q=require("antd/es/date-picker/generatePicker");var _=n.n(q);require("antd/es/date-picker/style/index");const $=_()(F());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 V=j,M={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"},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={[M.name]:{qm:M,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},ue=e=>(0,J.isNumber)(e)?`${e}px`:e.toString();function de(){return de=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},de.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,de({},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 Ie 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||"",u=Ce("divider"),d={[u]:!0,[`${u}--lg`]:"large"===c,[`${u}--sm`]:"small"===c};return t().createElement("div",{id:s,className:Se()(d,l),style:o},t().createElement("span",{className:Se()(`${u}__title`)},r),t().createElement("div",{className:Se()(`${u}__extra`)},n),void 0!==a&&t().createElement(O.Button,{type:"link",className:Se()(`${u}__collapse`),disabled:i,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}Te(Ie,"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(Ie,"contextType",l);const Ne=Ie,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 Fe=n.n(Ae);const He=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 u=Ce("collapse");return t().createElement("div",{ref:r,className:Se()(`${u}-content`,{[`${u}-content-active`]:o,[`${u}-content-inactive`]:!o},a),style:i},t().createElement("div",{className:`${u}-content-box`,style:l},e.children))}));He.displayName="PanelContent";const ke=He;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:u=!1,onChange:d}=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(Ne,{label:n,extra:a,collapse:p,disabled:s,onCollapseChange:e=>{m(e),d?.(e)}}),t().createElement(Fe(),Le({visible:p},Oe,{leavedClassName:`${h}-content-hidden`,forceRender:c,removeOnLeave:u}),((r,n)=>{let{className:a,style:i}=r;return t().createElement(ke,{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){const n=e.useRef(!1);e.useEffect((()=>{n.current?t():n.current=!0}),r)}const je=require("react-draggable");var Ke=n.n(je);const Ve=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Me=(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=>{const{minValues:r,onDragChange:n,onDragging:a}=e,{splitRef:i,direction:l}=t().useContext($e),[o,s]=t().useState(),[c,u]=t().useState(0),d="vertical"===l?"y":"x",m={[`${Ce("split")}__resize-bar`]:!0,vertical:"vertical"===l,horizontal:"horizontal"===l};return t().createElement(Ke(),{bounds:o,axis:d,position:{x:0,y:0},positionOffset:{[d]:-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)=>{u(t[d]),a(t[d])},onStop:()=>n(!1)},t().createElement("div",{className:Se()(m),title:p("qm.split.resize")}))};Xe.displayName="ResizeBar";const Qe=Xe,Ze=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},u=void 0!==n?{[s]:ue(n)}:{flex:1,[s]:0};return t().createElement("div",{ref:r,className:Se()(c),style:{...u,...i}},e.children)}));Ze.displayName="QmSplitPane";const Je=Ze;function et(){return et=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},et.apply(this,arguments)}const tt=e=>{const{direction:r="horizontal",defaultValue:n="50%",uniqueKey:a,className:i,style:o,onDragStart:s,onDrag:c=ne,onDragEnd:u}=e,{global:d}=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))):(u?.(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=d?.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=d?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},I=t().useMemo((()=>({splitRef:p,direction:r,dragging:y})),[r,y]),N=[];t().Children.map(e.children,(e=>{te(e)&&!re(e)&&"QmSplitPane"===e.type?.displayName&&N.push(e)}));const[R,P]=N,O=t().useMemo((()=>[g(R),g(P)]),[R,P]),A={[Ce("split")]:!0,vertical:"vertical"===r};return t().createElement($e.Provider,{value:I},t().createElement("div",{ref:p,className:Se()(A,i),style:o},t().createElement(Je,et({},R.props,{ref:m,offset:x})),t().createElement(Qe,{minValues:O,onDragChange:e=>v(e),onDragging:e=>{const t=S.current+e;E(`${t}px`),c(t)}}),t().createElement(Je,P.props)))};tt.Pane=Je,tt.displayName="QmSplit";const rt=tt,nt=require("react-countup");var at=n.n(nt);function it(){return it=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},it.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 ot 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(at(),it({},this.props,{className:Se()(l,r),style:n}),this.props.children)}}lt(ot,"defaultProps",{duration:2}),lt(ot,"contextType",l);const st=ot;function ct(){return ct=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},ct.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 dt 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,ct({},i,{className:Se()(l,r)}))}}ut(dt,"contextType",l),ut(dt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const pt=dt;class mt 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}(mt,"defaultProps",{tip:"Loading...",fullHeight:!1});const ht=mt,ft=t().createContext(void 0),gt=require("resize-observer-polyfill");var bt=n.n(gt);const yt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},vt=function(e,t){!ee&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(bt())(yt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},xt=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function Et(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&&vt(e,r),()=>{e&&xt(e,r)}}),[t]),r}function St(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 Ct=6,wt={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"}},Tt=e=>{const{thumb:r,always:n,barSize:a=Ct,direction:i="vertical",onDrag:l=ne}=e,{dragging:o,scrollbarElement:s,wrapElement:c}=t().useContext(ft),u=wt[i],d=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((()=>{d.current=r}),[r]),t().useEffect((()=>{const e=s.current;return Ve(e,"mousemove",C),Ve(e,"mouseleave",w),()=>{S(),Me(document,"mouseup",E),Me(e,"mousemove",C),Me(e,"mouseleave",w)}}),[]);const x=e=>{if(!p.current||!m.current)return;if(!f.current)return;const t=h.current[u.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[u.direction]-e[u.client])-(m.current[u.offset]-t))/p.current[u.offset];c.current[u.scroll]=r*c.current[u.scrollSize]/100,l(!0)},E=()=>{f.current=!1,h.current={[u.axis]:0},Me(document,"mousemove",x),Me(document,"mouseup",E),S(),g.current&&v(!1),l(!1)},S=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},C=()=>{g.current=!1,v(!!d.current.size)},w=()=>{g.current=!0,v(f.current)},T=Ce("scrollbar"),I={[`${T}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},N={[u.reverse]:a},R={[u.size]:r.size,transform:`translate${u.axis}(${r.offset}%)`};return t().createElement(Dc,{name:"fade",in:n||o||y,timeout:300},t().createElement("div",{ref:p,className:Se()(I),style:N},t().createElement("div",{ref:m,className:`${T}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),Ve(document,"mousemove",x),Ve(document,"mouseup",E),f.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},It=20,Nt=t().forwardRef(((e,r)=>{const{wrapClassName:n,wrapStyle:a,barWidth:i,always:l,native:o,minSize:s=It,onScroll:c}=e,u=t().useRef(null),d=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=Et(u),E=Et(p);De((()=>{!o&&S()}),[E.width,E.height,x.width,x.height]);const S=St((()=>{if(!d.current)return;const e=d.current.offsetHeight-4,t=d.current.offsetWidth-4,r=e**2/d.current.scrollHeight,n=t**2/d.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,u=i+4<t?i:0,p=100*d.current.scrollTop/e*l,g=100*d.current.scrollLeft/t*o;h(Object.assign({},m,{size:u,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)?d.current.scrollTop=e:g("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=e=>{(0,J.isNumber)(e)?d.current.scrollLeft=e:g("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t().useImperativeHandle(r,(()=>({SET_SCROLL_TOP:w,SET_SCROLL_LEFT:T})));const I=t().useMemo((()=>({dragging:y,scrollbarElement:u,wrapElement:d})),[y]),N=Ce("scrollbar"),R={[`${N}__wrap`]:!0,[`${N}__wrap--hidden`]:!o};return t().createElement("div",{ref:u,className:Se()(N,e.className),style:e.style},t().createElement("div",{ref:d,className:Se()(R,n),style:a,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!o&&(()=>{if(!d.current)return;const e=d.current.offsetHeight-4,t=d.current.offsetWidth-4,r=100*d.current.scrollTop/e*f.ratio,n=100*d.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:`${N}__view`},e.children)),!o&&t().createElement(ft.Provider,{value:I},t().createElement(Tt,{direction:"horizontal",thumb:m,barSize:i,always:l,onDrag:C}),t().createElement(Tt,{direction:"vertical",thumb:f,barSize:i,always:l,onDrag:C})))}));Nt.displayName="QmScrollbar";const Rt=Nt,Pt=require("axios");var Ot=n.n(Pt);const At=(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 kt 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 Ot()({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));At(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(kt,"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(kt,"defaultProps",{icon:t().createElement(we.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),Ht(kt,"contextType",l);const Lt=kt,qt=require("add-dom-event-listener");var _t=n.n(qt);const $t=require("scroll-into-view-if-needed");var Dt=n.n($t);class jt 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 Kt=jt;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(Ne,{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 Mt=Vt;function zt(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 Ut extends e.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(t){super(t),zt(this,"currentState","ready"),zt(this,"itemsTotal",void 0),zt(this,"timer",void 0),zt(this,"scrollEvent",void 0),zt(this,"scrollRef",(0,e.createRef)()),zt(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),zt(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Dt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),zt(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||"",u=Ce("anchor"),d={[u]:!0,[`${u}-left`]:"left"===a,[`${u}-top`]:"top"===a,[`${u}--lg`]:"large"===c,[`${u}--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()(d,o),style:s},t().createElement("div",{className:Se()("anchor-nav"),style:{width:n?ue(n):""}},t().createElement(Kt,{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))}}zt(Ut,"Item",Mt),zt(Ut,"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}))}),zt(Ut,"defaultProps",{tabPosition:"left"}),zt(Ut,"contextType",l);const Bt=Ut;class Wt 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}(Wt,"displayName","QmTabPane");const Gt=Wt;function Yt(){return Yt=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},Yt.apply(this,arguments)}function Xt(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 Qt 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},u={...Z()(this.props,["items","authConfig"]),size:o,tabBarGutter:a??(["top","bottom"].includes(n)?30:0)},d=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmTabPane"===e.type?.displayName&&d.push(e)}));const p=e?[...e]:d.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,Yt({},u,{items:p,className:Se()(c,i)}))}}Xt(Qt,"TabPane",Gt),Xt(Qt,"contextType",l),Xt(Qt,"defaultProps",{tabPosition:"top"});const Zt=Qt;function Jt(){return Jt=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},Jt.apply(this,arguments)}function er(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 tr extends e.Component{constructor(){super(...arguments),er(this,"titleRef",t().createRef()),er(this,"$drawer",null),er(this,"opened",!1),er(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),er(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}))})),er(this,"toggleHandle",(()=>{this.$drawer=Ye(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),er(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),er(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:ue(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,u=this.context.global,d=i||this.context.size||"",p=Ce("drawer"),m={[p]:!0,[`${p}--lg`]:"large"===d,[`${p}--sm`]:"small"===d};return t().createElement(O.Drawer,Jt({},Z()(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??n,maskClosable:s??u?.maskClosable??!1,className:Se()(m,l),title:this.renderTitle(),footer:null,onClose:c,afterOpenChange:this.afterVisibleChange}),this.props.children,(o||r||e)&&t().createElement(ht,{spinning:!0,className:Se()("spinning")}))}}er(tr,"contextType",l),er(tr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),er(tr,"defaultProps",{width:"72%",showFullScreen:!0,destroyOnClose:!0,footer:null});const rr=tr;function nr(){return nr=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},nr.apply(this,arguments)}function ar(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 ir="10vh";var lr=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e}(lr||{});class or extends e.Component{constructor(){super(...arguments),ar(this,"$event",null),ar(this,"draggleRef",t().createRef()),ar(this,"opened",!1),ar(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),ar(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=_t()(document.body,"mousedown",ze))})),ar(this,"removeMouseDownEvent",(()=>{this.$event&&(this.$event?.remove(),this.$event=null)})),ar(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}})})),ar(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:ue(this.props.width||"60%"),height:"auto",top:ir}),Be(r,{height:n?ue(n):this.defaultHeight,maxHeight:"auto"===n?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(r,{height:`calc(100vh - ${lr[this.$size]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),ar(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),ar(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),ar(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${ir} - ${ir} - ${lr[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:u,loading:d,draggable:p,maskClosable:m,bodyStyle:h,onClose:f}=this.props,g=this.context.global,b=Ce("modal"),y={height:c?ue(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,nr({},Z()(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:s??o,maskClosable:m??g?.maskClosable??!1,className:Se()(v,u),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,(d||r||e)&&t().createElement(ht,{spinning:!0,className:Se()("spinning")}))}}ar(or,"contextType",l),ar(or,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),ar(or,"defaultProps",{width:"60%",showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:ir}});const sr=or,cr=require("memoize-one");var ur=n.n(cr);const dr=(0,e.createContext)(void 0),pr=80,mr="1",hr="0",fr=400,gr=["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"],br={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let yr=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}({}),vr=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}({}),xr=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Er={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},Sr={layout:"horizontal",labelWidth:pr,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},Cr=(e,t)=>{if(!e)return null;if(t===vr.week){const t=e.match(/^(\d{4})-(\d+)/);return t?s()().year(Number(t[1])).week(Number(t[2])):null}if(t===vr.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)},wr=(e,t)=>e?s()(e).format(t):"",Tr=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},Nr=(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]]},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)=>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=Pr(e.children,t,r)),n})),Or=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=Or(r.children,t);if(e)return e}}return null},Ar=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(...Ar(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(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},disabled:s}=e.option,{falseValue:c=hr,trueValue:u=mr}=l;return t().createElement(O.Checkbox,{checked:n===u,style:o,disabled:s||r.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{a?.(e),i(e,p(e===u?"am.form.trueText":"am.form.falseText"))})(t?u:c)}})};class kr 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Hr,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(kr,"contextType",dr);const Lr=kr,qr=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 $r 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(dr.Consumer,null,(r=>{const n=r.$$form;return t().createElement("div",{className:Se()("ant-dropdown-menu","fields-list")},t().createElement(qr.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(dr.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($r,"contextType",l);const Dr=$r,jr=e=>{const{value:r,bordered:n}=e;return t().createElement(O.Input,{value:r,title:r,bordered:n,readOnly:!0})};jr.displayName="FormItemView";const Kr=jr;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 Mr=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(dr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:d=!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:I}=o,N=I&&(m||h),R=e=>{i?.(e),l(e)},P=v?O.Input.Password:O.Input,A=N?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,I):a;return n.isOnlyShow?t().createElement(Kr,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(A),bordered:u}):t().createElement(P,{ref:r,value:A,autoComplete:v?"new-password":T,autoFocus:w,placeholder:c,style:s,title:v?"":A,prefix:b,suffix:y,maxLength:x,bordered:u,allowClear:d,readOnly:m,disabled:h,onBlur:t=>{let r=t.target.value??"";if(C){const e=r.trim();r!==e&&(r=e,R(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()}},onChange:e=>{let t=e.target.value;(0,J.isRegExp)(E)&&(t=E.test(t)?t:a??""),S&&(t=t.toUpperCase()),R(t)}})}));Mr.displayName="VInput";class zr 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:u,buttonAfter:d,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":ue(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(Mr,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&t().createElement(O.Col,null,e.renderFormItemButton(i,d)),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Vr(zr,"contextType",dr);const Ur=zr,Br=e=>{const{$$form:r}=t().useContext(dr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:u,disabled:d}=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(Kr,{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:u,disabled:d,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:d,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:u,disabled:d,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class Wr 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:u,rules:d=[],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":ue(o)},required:e.getFormItemRequired(d)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:d,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Br,{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:ue(c.labelWidth||pr)},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}(Wr,"contextType",dr);const Gr=Wr,Yr=require("big.js");var Xr=n.n(Yr);function Qr(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(dr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:d,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,I=t().useRef(a),N=e=>{const t=Tr(e)?"":(0,J.isNumber)(e)?e.toFixed(v):new(Xr())(e).toFixed(v);return"function"==typeof w?w(t):t},R={[S]:!0,controls:C};return n.isOnlyShow?t().createElement(Kr,{value:N(a),bordered:u}):t().createElement(O.InputNumber,{ref:r,value:a,className:Se()(R),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:u,readOnly:d,disabled:m,onBlur:()=>{le((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(I.current),h(I.current)}))},onKeyUp:e=>{13===e.keyCode&&f(a)},onChange:e=>{const t=e??"";!E&&t.toString().replace(/^-|\./g,"").length>17||(e=>{I.current=e,i?.(e),l(e,N(e))})(t)}})}));Zr.displayName="VInputNumber";class Jr extends e.Component{constructor(){super(...arguments),Qr(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:u,buttonAfter:d,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":ue(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,r)=>{h(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,null,e.renderFormItemButton(i,d)),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Qr(Jr,"contextType",dr);const en=Jr,tn=e=>{const{$$form:r}=t().useContext(dr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:u,disabled:d}=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=>Tr(e)?"":e.map((e=>Tr(e)?"":Number(e).toFixed(y))),w={[g]:!0,controls:b};return r.isOnlyShow?t().createElement(Kr,{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:u,disabled:d,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:d,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:u,disabled:d,onChange:e=>{S([n[0],e])},onBlur:()=>{E(n)}}))};class rn 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:u,rules:d=[],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":ue(o)},required:e.getFormItemRequired(d)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:d,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(tn,{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:ue(c.labelWidth||pr)},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}(rn,"contextType",dr);const nn=rn;let an=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});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{Search:on}=O.Input;class sn extends e.Component{constructor(e){var t;super(e),t=this,ln(this,"searchHelper",{}),ln(this,"alias",void 0),ln(this,"extras",void 0),ln(this,"deriveParams",void 0),ln(this,"valueKey",void 0),ln(this,"_is_change",!1),ln(this,"_record",void 0),ln(this,"_prevValue",void 0),ln(this,"state",{visible:!1,loading:!1}),ln(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ln(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` 一起使用")})),ln(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),ln(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),ln(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&&Nr(t,this.alias,o),s&&Rr(t,this.extras,s),this._record=t,this.setFieldsValue(t),a?.([t])}}}catch(e){}this.setState({loading:!1})}})),ln(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),ln(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})),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,"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})}})),ln(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)})),ln(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?.())})),ln(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)}))})),ln(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)})),ln(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("")}})),ln(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),ln(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),ln(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),ln(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:u=p("qm.form.inputPlaceholder"),bordered:d=!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:`${an[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(Kr,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement(on,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:u,style:c,prefix:g,suffix:b,maxLength:y,bordered:d,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(sr,v,t().createElement(ac,x)))}}ln(sn,"contextType",dr);class cn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),ln(this,"promiseRef",void 0),ln(this,"searchRef",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);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:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[]}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(sn,{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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}ln(cn,"contextType",dr);const un=cn;function dn(){return dn=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},dn.apply(this,arguments)}function pn(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 mn=r=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,pn(this,"startClick",void 0),pn(this,"event1",null),pn(this,"event2",null),pn(this,"$el",null),pn(this,"omitClassNames",[]),pn(this,"state",{clickOutside:!1}),pn(this,"mousedownHandler",(e=>{this.startClick=e})),pn(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),pn(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})})),pn(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),pn(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,dn({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return pn(n,"displayName",`OutsideClick(${r.displayName||r.name})`),t().forwardRef(((e,r)=>t().createElement(n,dn({},e,{forwardedRef:r}))))},hn=require("rc-trigger");var fn,gn,bn=n.n(hn);function yn(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 vn=mn((gn=class extends e.Component{constructor(e){var r;super(e),r=this,yn(this,"searchHelper",{}),yn(this,"alias",void 0),yn(this,"_records",[]),yn(this,"searchRef",t().createRef()),yn(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),yn(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`")})),yn(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})),yn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),yn(this,"setItemList",(e=>{this.setState({itemList:e})})),yn(this,"setRecords",(e=>{this._records=e})),yn(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),yn(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),yn(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?.())})),yn(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)}))})),yn(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:u={},placeholder:d=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:`${an[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,I={[w]:!0,[`${w}--lg`]:"large"===T,[`${w}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${w}`]);const N=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Kr,{value:N,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(bn(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(I),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:br,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:d,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...u},title:N,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(sr,v,t().createElement(ac,x)))}},yn(gn,"contextType",dr),fn=gn))||fn;class xn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),yn(this,"promiseRef",void 0),yn(this,"state",{searchHelper:{}}),yn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),yn(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:u,extra:d,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,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(vn,{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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}yn(xn,"contextType",dr);const En=xn;function Sn(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:Cn}=O.Input;class wn extends e.Component{constructor(e){super(e),Sn(this,"searchHelper",{}),Sn(this,"alias",void 0),Sn(this,"extras",void 0),Sn(this,"valueKey",void 0),Sn(this,"_record",void 0),Sn(this,"_prevValue",void 0),Sn(this,"state",{visible:!1,loading:!1}),Sn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Sn(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` 一起使用")})),Sn(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),Sn(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Sn(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&&Nr(t,this.alias,l),o&&Rr(t,this.extras,o),this._record=t,this.setFieldsValue(t)}}}catch(e){}this.setState({loading:!1})}})),Sn(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])})})),Sn(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?.())})),Sn(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)}))})),Sn(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("")})),Sn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Sn(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:u=p("qm.form.selectPlaceholder"),bordered:d=!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:`${an[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(Kr,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement(Cn,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:u,style:c,prefix:g,suffix:b,maxLength:y,bordered:d,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(sr,v,t().createElement(uc,x)))}}Sn(wn,"contextType",dr);class Tn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Sn(this,"promiseRef",void 0),Sn(this,"state",{searchHelper:{}}),Sn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Sn(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:u,extra:d,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,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(wn,{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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Sn(Tn,"contextType",dr);const In=Tn;var Nn,Rn;function Pn(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 On=mn((Rn=class extends e.Component{constructor(e){var r;super(e),r=this,Pn(this,"searchHelper",{}),Pn(this,"alias",void 0),Pn(this,"_records",[]),Pn(this,"searchRef",t().createRef()),Pn(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Pn(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`")})),Pn(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})),Pn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Pn(this,"setItemList",(e=>{this.setState({itemList:e})})),Pn(this,"setRecords",(e=>{this._records=e})),Pn(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Pn(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Pn(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?.())})),Pn(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)}))})),Pn(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:u={},placeholder:d=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:`${an[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,I={[w]:!0,[`${w}--lg`]:"large"===T,[`${w}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${w}`]);const N=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Kr,{value:N,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(bn(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(I),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:br,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:d,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...u},title:N,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(sr,v,t().createElement(uc,x)))}},Pn(Rn,"contextType",dr),Nn=Rn))||Nn;class An extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Pn(this,"promiseRef",void 0),Pn(this,"state",{searchHelper:{}}),Pn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Pn(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:u,extra:d,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,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(On,{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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Pn(An,"contextType",dr);const Fn=An;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 kn=new Array(2).fill("");class Ln 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:kn}),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(kn),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=kn.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:u=!0,readOnly:d,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:`${an[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(Kr,{value:i.join(" - "),bordered:u}):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:u,readOnly:d,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:u,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:u,allowClear:!0,readOnly:d,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(sr,f,t().createElement(bc,g)))}}Hn(Ln,"contextType",dr);class qn 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:u,buttonAfter:d,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":ue(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(Ln,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{h(t,n),e.setViewValue(l,r)}}))),d&&t().createElement(O.Col,null,e.renderFormItemButton(l,d)),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Hn(qn,"contextType",dr);const _n=qn;function $n(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 Dn=e=>{const{$$form:r}=t().useContext(dr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:u,disabled:d}=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(Kr,{value:h(n),bordered:c}):t().createElement(O.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:d,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 jn extends e.Component{constructor(){super(...arguments),$n(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:u,extra:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(Dn,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}$n(jn,"contextType",dr);const Kn=jn,Vn=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},allowClear:s=!0,readOnly:c,disabled:u}=e.option,{allowHalf:d,count:p=5,tooltips:m}=l;return t().createElement(O.Rate,{value:n,count:p,style:o,allowHalf:d,allowClear:s,tooltips:m,disabled:u||r.isOnlyShow,onChange:e=>{(e=>{var t;a?.(e),i(e,(t=e,m?m[Math.ceil(t)-1]:t.toString()))})(e)}})};class Mn 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Vn,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(Mn,"contextType",dr);const zn=Mn;function Un(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 Bn=e=>{const{$$form:r}=t().useContext(dr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:u,disabled:d}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.find((t=>t.value===e))?.text??"";return r.isOnlyShow?t().createElement(Kr,{value:h(n),bordered:c}):t().createElement(O.Radio.Group,{value:n,style:{width:"100%",...s},disabled:d||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 Wn extends e.Component{constructor(){super(...arguments),Un(this,"state",{itemList:[]}),Un(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:u,extra:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(Bn,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Un(Wn,"contextType",dr);const Gn=Wn,Yn=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},disabled:s}=e.option,{falseValue:c=hr,trueValue:u=mr}=l;return t().createElement(O.Switch,{checked:n===u,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===u?"am.form.trueText":"am.form.falseText"))})(e?u:c)}})};class Xn 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Yn,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(Xn,"contextType",dr);const Qn=Xn,Zn=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:u,readOnly:d,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:u,readOnly:d||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 Jn 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Zn,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(Jn,"contextType",dr);const ea=Jn,ta=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:c=p("qm.form.datePlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=e.option,{dateType:f="date",format:g,minDateTime:b,maxDateTime:y,shortCuts:v=!0}=l,x=t().createRef(),E=e=>{e&&"date"===f&&(e=e.slice(0,10)+" 00:00:00"),a?.(e),i(e,S(e))},S=e=>Tr(e)?"":["date","exactdate"].includes(f)?e.slice(0,10):e,C=e=>{let t=wr(s()().subtract(e,"day"),vr[f]);"date"===f&&(t=t.slice(0,10)),E(t),x.current.blur(),x.current.focus()};return r.isOnlyShow?t().createElement(Kr,{value:S(n),bordered:u}):t().createElement($,{ref:x,style:{width:"100%",...o},picker:yr[f],format:g,bordered:u,showToday:!1,showTime:"datetime"===f&&{defaultValue:s()("00:00:00","HH:mm:ss")},allowClear:d,disabled:h,inputReadOnly:m,disabledDate: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,[b,y]),renderExtraFooter:v?()=>t().createElement(t().Fragment,null,t().createElement(O.Tag,{color:"processing",onClick:()=>C(0)},p("qm.form.datePickers")[0]),t().createElement(O.Tag,{color:"processing",onClick:()=>C(1)},p("qm.form.datePickers")[1]),t().createElement(O.Tag,{color:"processing",onClick:()=>C(7)},p("qm.form.datePickers")[2]),t().createElement(O.Tag,{color:"processing",onClick:()=>C(30)},p("qm.form.datePickers")[3])):void 0,value:Cr(n,vr[f]),onChange:(e,t)=>{E(wr(e,vr[f]))}})};class ra 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ta,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(ra,"contextType",dr);const na=ra,aa=e=>[s()().subtract(e,"day"),s()()],ia=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:c=p("qm.form.daterangePlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=e.option,{dateType:f="date",format:g,disableds:b=[!1,!1],minDateTime:y,maxDateTime:v,shortCuts:x=!0}=l,E={[p("qm.form.dateRangePickers")[0]]:aa(7),[p("qm.form.dateRangePickers")[1]]:aa(30),[p("qm.form.dateRangePickers")[2]]:aa(90),[p("qm.form.dateRangePickers")[3]]:aa(180)},S=e=>Tr(e)?"":e.map((e=>["date","exactdate"].includes(f)?e?.slice(0,10):e)).join(" - ");return r.isOnlyShow?t().createElement(Kr,{value:S(n),bordered:u}):t().createElement($.RangePicker,{style:{width:"100%",...o},picker:yr[f],format:g,bordered:u,showTime:"datetime"===f&&{defaultValue:[s()("00:00:00","HH:mm:ss"),s()("23:59:59","HH:mm:ss")]},allowClear:d,disabled:h?[!0,!0]:b,inputReadOnly:m,disabledDate: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]),ranges:x?E:void 0,value:se(n)?null:[Cr(n?.[0],vr[f]),Cr(n?.[1],vr[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,S(e))})([wr(e?.[0],vr[f]),wr(e?.[1],vr[f])])}})};class la 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ia,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(la,"contextType",dr);const oa=la,sa=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.timePlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,disabled:m}=e.option,{timeType:h="hour-minute-second",hourStep:f=1,minuteStep:g=1,secondStep:b=1}=l;return r.isOnlyShow?t().createElement(Kr,{value:n,bordered:c}):t().createElement(V,{style:{width:"100%",...o},bordered:c,showNow:!0,hourStep:f,minuteStep:g,secondStep:b,allowClear:u,disabled:m,inputReadOnly:d,format:xr[h],value:Cr(n,xr[h]),onChange:(e,t)=>{(e=>{const t=wr(e,xr[h]);a?.(t),i(t)})(e)}})};class ca 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(sa,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(ca,"contextType",dr);const ua=ca,da=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.timerangePlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,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=>Tr(e)?"":e.join(" - ");return r.isOnlyShow?t().createElement(Kr,{value:v(n),bordered:c}):t().createElement(V.RangePicker,{style:{width:"100%",...o},bordered:c,showNow:!1,hourStep:g,minuteStep:b,secondStep:y,allowClear:u,disabled:m?[!0,!0]:f,inputReadOnly:d,format:xr[h],value:se(n)?null:[Cr(n?.[0],xr[h]),Cr(n?.[1],xr[h])],onChange:(e,t)=>{(e=>{const t=[wr(e?.[0],xr[h]),wr(e?.[1],xr[h])];a?.(t),i(t,v(t))})(e)}})};class pa 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(da,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(pa,"contextType",dr);const ma=pa,ha={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"}},fa="阿",ga="鿿",ba=1,ya=2,va=3;let xa,Ea=null;function Sa(e){return e||null===Ea?("object"==typeof Intl&&Intl.Collator?(xa=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Ea=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Ea=!1,Ea):Ea}function Ca(e){const t=ha.UNIHANS,r=ha.PINYINS,n=ha.EXCEPTIONS,a={source:e};if(e in n)return a.type=ya,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=ba,a.target=e,a;if(i=xa.compare(e,fa),i<0)return a.type=va,a.target=e,a;if(0===i)a.type=ya,l=0;else{if(i=xa.compare(e,ga),i>0)return a.type=va,a.target=e,a;0===i&&(a.type=ya,l=t.length-1)}if(a.type=ya,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=xa.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=va,a.target=a.source),a}function wa(e){return"string"==typeof e&&Sa()?e.split("").map((e=>Ca(e))):e}const Ta={isSupported:Sa,parse:wa,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(ha)})))},genToken:Ca,convertToPinyin:(e,t,r)=>wa(e).map((e=>t&&e.type===ya?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}};Ta.isSupported()&&Ia.shouldPatch(Ta.genToken)&&Ta.patchDict(Ia);const Na=Ta;function Ra(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pa(){return Pa=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},Pa.apply(this,arguments)}const{Option:Oa}=O.Select,Aa=e=>{const{$$form:r}=t().useContext(dr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{options:c={},style:u={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=e.option,{itemList:b=[],filterable:y=!0,listHeight:v=fr,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(Kr,{value:w(n),bordered:m}):t().createElement(O.Select,Pa({value:n,mode:i?"multiple":void 0,placeholder:d,style:u,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=Na.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(Oa,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Fa extends e.Component{constructor(){super(...arguments),Ra(this,"state",{itemList:[],loading:!1}),Ra(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:u=e.props.labelWidth,className:d,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,d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},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(Aa,{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:ue(p.labelWidth||pr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Ra(Fa,"contextType",dr);const Ha=Fa;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}class La extends e.Component{constructor(e){super(e),ka(this,"searchHelper",{}),ka(this,"alias",void 0),ka(this,"extras",void 0),ka(this,"valueKey",void 0),ka(this,"prevValue",""),ka(this,"_record",void 0),ka(this,"_prevValue",void 0),ka(this,"searchRef",t().createRef()),ka(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0}),ka(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` 一起使用")})),ka(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),ka(this,"getLatestRequest",(()=>{const{request:e,searchHelper:t}=this.props.option;return Object.assign({},this.searchHelper.request,e,t?.request)})),ka(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,fieldAliasMap:a,extraAliasMap:i}=this.searchHelper.echoRequest||{},l="function"==typeof a?a():a||{},o="function"==typeof i?i():i||{},s=this.getItemValue();if(e&&!se(s))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&&Nr(t,this.alias,l),o&&Rr(t,this.extras,o),this._record=t,this.setFieldsValue(t)}}}catch(e){}})),ka(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Ir(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])});this._record=e,this.prevValue=Ir(e,this.alias[r])??""})),ka(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),ka(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ka(this,"triggerChange",((e,t)=>{const{onChange:r,onValuesChange:n}=this.props;r?.(e),t&&n(e,this._record)})),ka(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),ka(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.prevValue=a??"",this.triggerChange(a,!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}=this.state,{value:i}=this.props,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=this.props.option,{listHeight:f=fr}=o,{hideHeader:g,onlySelect:b=!0}=this.searchHelper||o,y=this.searchHelper.columns||[],v=Ce("form-immediate"),x=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,E=t().createElement(O.Spin,{spinning:n},a.length?t().createElement("table",{cellSpacing:0,cellPadding:0,className:Se()("table")},!g&&t().createElement("thead",null,t().createElement("tr",null,y.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})},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},y.filter((e=>!e.hidden)).map((r=>t().createElement("td",{key:r.dataIndex},(0,J.get)(e,r.dataIndex))))))))):t().createElement(pt,null));return t().createElement(l.Consumer,null,(n=>{const l={[v]:!0,[`${v}--lg`]:"large"===n?.size,[`${v}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Kr,{value:i,bordered:u}):t().createElement(bn(),{action:h?[]:["click"],popupVisible:!h&&r,popup:E,popupClassName:Se()(l),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:br,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:c,allowClear:d,bordered:u,readOnly:m,disabled:h,style:{width:"100%",...s},value:i,title:i,onFocus:()=>{!a.length&&this.fetchHandle(i)},onBlur:e=>{const{value:t}=e.target;b&&t!==this.prevValue&&this.triggerChange(this.prevValue,!1),this.triggerBlur(t)},onKeyUp: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),t?(this.handleVisibleChange(!0),this.triggerChange(t,!b)):this.clickHandle(null)}}))}))}}ka(La,"contextType",dr);class qa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),ka(this,"promiseRef",void 0),ka(this,"state",{searchHelper:{}}),ka(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),ka(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("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:u,extra:d,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,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(La,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange: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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}ka(qa,"contextType",dr);const _a=qa;class $a 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:u=[],onCollapse:d=ne}=o,p=[];if(u.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===a))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=u.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(Ne,{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})}))),d(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}($a,"contextType",dr);const Da=$a;function ja(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ka(){return Ka=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},Ka.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)),Ma=e=>{const{$$form:r}=t().useContext(dr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{options:c={},style:u={},placeholder:d=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=fr,checkStrictly:E,checkStrategy:S="SHOW_CHILD",collapseTags:C,openPyt:w=!0}=c,[T,I]=t().useState(se(y)?a:y);De((()=>{I(se(y)?a:y)}),[y,a]);const N=e=>Or(T,e)?.text||"",R=e=>i?e.map((e=>N(e))).filter((e=>!!e)).join(","):N(e);return r.isOnlyShow?t().createElement(Kr,{value:R(n),bordered:m}):t().createElement(O.TreeSelect,Ka({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:i,treeCheckable:i,treeCheckStrictly:E,showCheckedStrategy:O.TreeSelect[S],placeholder:d,listHeight:x,style:u,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,Pr(r,o,l));I(n),s?.(r)}}catch(e){}}:void 0,treeData:T},i?{title:R(n)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=Na.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 za extends e.Component{constructor(){super(...arguments),ja(this,"state",{itemList:[],loading:!1}),ja(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=Pr(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:u=e.props.labelWidth,className:d,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,d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},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(Ma,{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:ue(p.labelWidth||pr)},e.renderFormItemExtra({fieldName:o,...p}))))}}ja(za,"contextType",dr);const Ua=za;function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wa(){return Wa=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},Wa.apply(this,arguments)}const Ga=e=>{const{$$form:r}=t().useContext(dr),{value:n,multiple:a,items:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,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=>Ar(x,e).map((e=>e.text)).join("/"))).join(","):Ar(x,e).map((e=>e.text)).join("/");return r.isOnlyShow?t().createElement(Kr,{value:E(n),bordered:c}):t().createElement(O.Cascader,Wa({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:u,disabled:m,showSearch:b&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=Na.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 Ya extends e.Component{constructor(){super(...arguments),Ba(this,"state",{itemList:[],loading:!1}),Ba(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=Pr(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:u=e.props.labelWidth,className:d,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,d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},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(Ga,{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:ue(p.labelWidth||pr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Ba(Ya,"contextType",dr);const Xa=Ya,Qa=require("china-area-data");var Za=n.n(Qa);function Ja(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ei=["110000","120000","310000","500000"],ti=["810000","820000"],ri=[{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"}],ni=[{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"}],ai=e=>Na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),ii=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=>![...ei,...ti].includes(e))):Object.keys(e[t])).map((n=>({l:ai(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:ii(e,n,r+1)})))},li=(e,t)=>t.map((t=>({l:ai(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class oi extends e.Component{constructor(e){super(e),Ja(this,"searchRef",t().createRef()),Ja(this,"scrollRef",t().createRef()),Ja(this,"zxsAndGa",void 0),Ja(this,"provinces",void 0),Ja(this,"allCities",void 0),Ja(this,"letterCities",void 0),Ja(this,"state",{visible:!1,select_type:"0",active_key:""}),Ja(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ja(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}),Dt()(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:li(Za(),ei)},{l:"Z2",n:"港澳",c:"",p:"",children:li(Za(),ti)}]}createProvince(){return(ii(Za(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return ni.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...ei,...ti].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?ri:ni).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:u,disabled:d}=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(Kr,{value:f,bordered:s}):t().createElement(bn(),{action:d?[]:["click"],popupVisible:!d&&r,popup:g,popupClassName:Se()(a),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:br,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:u,disabled:d,style:{width:"100%",...i},value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}Ja(oi,"contextType",dr);class si extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(oi,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ja(si,"contextType",dr);const ci=si;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 di=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:di(e,r)})))};class pi 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=di(Za(),"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=Or(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(pt,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:u,disabled:d}=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(Kr,{value:g,bordered:s}):t().createElement(bn(),{action:d?[]:["click"],popupVisible:!d&&r,popup:f,popupClassName:Se()(a),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:br,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:u,disabled:d,value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&le((()=>this.initial()))}}))}))}}ui(pi,"contextType",dr);class mi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(pi,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ui(mi,"contextType",dr);const hi=mi,fi=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c}=e.option,{multiple:u=!0,maxCount:d=1,fileTypes:p,fileSize:m,onRemove:h}=l,{action:f,headers:g,params:b,withCredentials:y=!1,dataKey:v="",fieldAliasMap:x,button:E}=o,S="function"==typeof x?x():x||{};return t().createElement(tl,{name:"file",action:f,multiple:u,headers:g,data:b,withCredentials:y,maxCount:d,fileTypes:p,fileSize:m,disabled:c||r.isOnlyShow,button:E,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={};for(const r in S)t[r]=e[r]||e.response?.data?.[S[r]]||"";return{uid:e.uid,name:e.name,...t,url:e.url||(v?(0,J.get)(e.response?.data,v):e.response?.data)||"",status:e.status}}));a?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:h})};class gi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(fi,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(gi,"contextType",dr);const bi=gi,yi=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c}=e.option,{multiple:u=!0,maxCount:d=1,fixedSize:p,quality:m,openCropper:h,fileTypes:f,fileSize:g,onRemove:b}=l,{action:y,headers:v,params:x,withCredentials:E=!1,dataKey:S="",fieldAliasMap:C}=o,w="function"==typeof C?C():C||{};return t().createElement(sl,{name:"file",action:y,multiple:u,headers:v,data:x,withCredentials:E,maxCount:d,fixedSize:p,quality:m,openCropper:h,fileTypes:f,fileSize:g,disabled:c||r.isOnlyShow,fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t={};for(const r in w)t[r]=e[r]||e.response?.data?.[w[r]]||"";return{uid:e.uid,name:e.name,...t,url:e.url||(S?(0,J.get)(e.response?.data,S):e.response?.data)||"",status:e.status}}));a?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:b})};class vi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(yi,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(vi,"contextType",dr);const xi=vi,Ei=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o,style:s={},placeholder:c=p("qm.form.inputPlaceholder"),readOnly:u,disabled:d}=e.option,{tinymce:m,thresholdSize:h}=l;return t().createElement(Bi,{value:n,tinymce:m,upload:o,thresholdSize:h,style:{width:"100%",...s},disabled:u||d||r.isOnlyShow,onChange:e=>{(e=>{a?.(e),i(e)})(e)}})};class Si extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Ei,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Si,"contextType",dr);const Ci=Si;function wi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ti extends e.Component{constructor(e){super(e),wi(this,"provide",{$$form:this,echo_data:{}}),wi(this,"_initialValues",void 0),wi(this,"_initialOthers",void 0),wi(this,"_initialExtras",void 0),wi(this,"_fieldAuth",{}),wi(this,"wrapperRef",t().createRef()),wi(this,"formRef",t().createRef()),wi(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),wi(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})})),wi(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),wi(this,"getFormItems",ur()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),wi(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}))),wi(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),wi(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),wi(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),wi(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),wi(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})})),wi(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Dt()(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(){vt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){xt(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,gr.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??hr),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(Tr(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Tr(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(Ur,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(Gr,{option:e})}INPUT_NUMBER(e){return t().createElement(en,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(nn,{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(En,{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(Lr,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(Kn,{option:e})}RATE(e){return t().createElement(zn,{option:e})}RADIO(e){return t().createElement(Gn,{option:e})}SWITCH(e){return t().createElement(Qn,{option:e})}TEXT_AREA(e){return t().createElement(ea,{option:e})}DATE(e){return t().createElement(na,{option:e})}RANGE_DATE(e){return t().createElement(oa,{option:e})}TIME(e){return t().createElement(ua,{option:e})}RANGE_TIME(e){return t().createElement(ma,{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(Da,{option:e})}TREE_SELECT(e){return t().createElement(Ua,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(Ua,{option:e,multiple:!0})}CASCADER(e){return t().createElement(Xa,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(Xa,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(ci,{option:e})}REGION_SELECT(e){return t().createElement(hi,{option:e})}UPLOAD_FILE(e){return t().createElement(bi,{option:e})}UPLOAD_IMG(e){return t().createElement(xi,{option:e})}TINYMCE(e){return t().createElement(Ci,{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:u}=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:ue(o)}},u?.(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,u=[],d=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 d=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(r);return d&&u.push(o[n]),t().createElement(O.Col,{key:s??n,span:a*l,style:this.isFilterType?{display:!this.showFilterCollapse||d?"block":"none"}:{display:p?"block":"none"}},i?this.createFormItem(ce(r)):null)}));return a&&"default"===r&&d.push(t().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...d,this.createSearchButtonLayout(u[u.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(Dr,{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"),u={required:"${label}"+p("qm.form.requiredTips")},d={[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()(d,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":ue(i)},validateMessages:u,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t().createElement(dr.Provider,{value:this.provide},t().createElement(O.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}wi(Ti,"contextType",l),wi(Ti,"propTypes",Er),wi(Ti,"defaultProps",Sr);const Ii=Ti,Ni={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},Ri={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}),...Ni},Pi=e=>"function"==typeof e,Oi=e=>e in Ni,Ai=e=>e.substr(2),Fi=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(Oi),c=Object.keys(l).filter(Oi),u=s.filter((e=>void 0===l[e])),d=c.filter((e=>void 0===i[e]));u.forEach((e=>{const t=Ai(e),r=o[t];n(t,r),delete o[t]})),d.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=Ai(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Hi=0;const ki=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Hi++,e+"_"+r+Hi+String(t)},Li=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),qi=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))},$i=()=>({listeners:[],scriptId:ki("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Di=(()=>{let e=$i();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=$i()}}})(),ji=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Ki(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,Ki(this,"editor",void 0),Ki(this,"id",void 0),Ki(this,"elementRef",void 0),Ki(this,"inline",void 0),Ki(this,"currentContent",void 0),Ki(this,"boundHandlers",void 0),Ki(this,"rollbackTimer",void 0),Ki(this,"valueCursor",void 0),Ki(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})),Ki(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){}})),Ki(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Ki(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))}})),Ki(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Ki(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=ji(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,qi(i).concat(qi(l))),toolbar:r.props.toolbar??r.props.init?.toolbar,setup:e=>{r.editor=e,r.bindHandlers({}),r.inline&&!Li(t)&&e.once("PostRender",(t=>{e.setContent(r.getInitialValue(),{no_events:!0})})),r.props.init&&Pi(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&&Pi(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(e)}};var i,l;r.inline||(t.style.visibility=""),Li(t)&&(t.value=r.getInitialValue()),n.init(a)})),this.id=this.props.id||ki("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!==ji(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Di.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=ji(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 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}Ki(Vi,"propTypes",Ri),Ki(Vi,"defaultProps",{cloudChannel:"6"});var zi=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(zi||{});class Ui extends e.Component{constructor(){super(...arguments),Mi(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:u=ne}=this.props,d=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:zi[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()}`,u=new FormData;u.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>l)try{const{data:e}=await Ot().post(n,u,{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||d?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{u(t.getContent())}};return t().createElement("div",{className:Se()(g,r),style:n},t().createElement(Vi,b))}}Mi(Ui,"contextType",l),Mi(Ui,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const Bi=Ui,Wi=require("cropperjs");var Gi=n.n(Wi);function Yi(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 Xi extends e.Component{constructor(){super(...arguments),Yi(this,"imgRef",t().createRef()),Yi(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(Gi())(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}}))}}Yi(Xi,"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 Qi=Xi;function Zi(){return Zi=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},Zi.apply(this,arguments)}function Ji(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 el extends e.Component{constructor(){super(...arguments),Ji(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)}}r(e)}))))}async downloadFile(e,t){const r=await Ot()({url:e,responseType:"blob"}),n=r.data,a=r.headers["content-disposition"],i=t||(a?a.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));At(n,i)}render(){const{button:e={},disabled:r,onChange:n}=this.props,a=Ce("upload-file");return t().createElement(O.Upload,Zi({className:a},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,onChange:e=>{n?.(e)},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")))}}Ji(el,"defaultProps",{name:"file",multiple:!0,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)}});const tl=el;function rl(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 nl extends e.Component{constructor(){super(...arguments),rl(this,"cropperRef",t().createRef()),rl(this,"beforeUploadRef",void 0),rl(this,"fileRef",void 0),rl(this,"resolveRef",void 0),rl(this,"rejectRef",void 0),rl(this,"state",{src:""}),rl(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()})),rl(this,"onOk",(()=>{this.confirmHandle()})),rl(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(Qi,{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()))}}rl(nl,"contextType",l);const al=nl;function il(){return il=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},il.apply(this,arguments)}function ll(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ol extends e.Component{constructor(){super(...arguments),ll(this,"state",{previewVisible:!1,previewImage:"",previewTitle:""}),ll(this,"beforeUpload",((e,t)=>new Promise((async(t,r)=>{const{fileTypes:n=[],fileSize:a}=this.props,i=!n.length||n.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),l=!a||e.size/1024/1024<a,o=i&&l;if(i||O.message.warning(p("qm.upload.tooltip",{type:n.join(",")})),l||O.message.warning(p("qm.upload.sizeLimit",{size:a})),!o)return o||O.Upload.LIST_IGNORE;t(e)})))),ll(this,"handlePreview",(async e=>{e.url||e.preview||(e.preview=await(e=>new Promise(((t,r)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>t(n.result),n.onerror=e=>r(e)})))(e.originFileObj)),this.setState({previewImage:e.url||e.preview,previewVisible:!0,previewTitle:e.name||e.url.substring(e.url.lastIndexOf("/")+1)})}))}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}render(){const{previewVisible:e,previewImage:r,previewTitle:n}=this.state,{fileList:a,fixedSize:i,quality:l,fileTypes:o,fileSize:s,openCropper:c,beforeCrop:u}=this.props,d=Ce("upload-img"),m=t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("div",{style:{marginTop:8}},p("qm.uploadCropper.dragableText"))),h=t().createElement(O.Upload,il({className:d},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,onPreview:this.handlePreview}),this.showUploadButton?m:null);return t().createElement(t().Fragment,null,c?t().createElement(al,{fixedSize:i,quality:l,fileTypes:o,fileSize:s,beforeCrop:u},h):h,t().createElement("div",{style:{display:"none"}},t().createElement(O.Image.PreviewGroup,{preview:{visible:e,onVisibleChange:e=>{this.setState({previewVisible:e})}}},a?.map((e=>t().createElement(O.Image,{key:e.uid,src:e.url,alt:""}))))))}}ll(ol,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const sl=ol,cl=(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=cl(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))),dl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...dl(e.children,t)),t(e)&&r.push(e)})),r},pl=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=pl(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},ml=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:ml(e.children,t,r,n)}:e)),hl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...hl(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},fl=(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=fl(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},gl=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...gl(e,t)))),r},bl=t().forwardRef(((e,r)=>{const{filterable:n=!0,multiple:a,draggable:i,dataSource:o,fetch:s,asyncLoad:c,checkStrictly:u,checkStrategy:d="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),I=t().useMemo((()=>e.size??T??""),[e.size,T]),N=h?.valueKey||"value",R=h?.textKey||"text",P=(h?.children,t().useRef(null)),A=Et(P),[F,H]=t().useState(g),[k,L]=t().useState(!1),q=St((()=>{H(P.current.offsetHeight-Y.current.offsetHeight-10)}),5);De((()=>{g||q()}),[A.height]);const[_,$]=t().useState([]),[D,j]=t().useState({}),[K,V]=t().useState([]),[M,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),V(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=pl(_,(t=>e===t[N]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],Z([..._]))},REMOVE_RECORD:e=>{const t=cl(_,e,N);if(void 0===t&&_.find((t=>t[N]===e)))Z(_.filter((t=>t[N]!==e)));else{const r=pl(_,(e=>t===e[N]));if(!r)return;const n=r.children?.findIndex((t=>e===t[N]));n>=0&&(r.children.splice(n,1),Z([..._]))}},UPDATE_RECORD:(e,t)=>{const r=pl(_,(t=>e===t[N]));r&&((0,J.merge)(r,t),Z([..._]))}})));const Z=e=>{$(e),X.current=e,Q.current=hl(e,N)},ee=e=>{if(a)return b;const t=dl(e,(e=>b.includes(e[R])));return 1===t.length?[t[0][N]]:[]},te=e=>fl(_,e,N)?.slice(0,-1)||[],re=()=>{if(y)return Q.current;const e=[];return K.forEach((t=>{if(a){if("SHOW_ALL"===d&&!Q.current.includes(t)&&e.push(...te(t)),"SHOW_CHILD"===d&&e.push(...te(t)),"SHOW_PARENT"===d){const r=Or(_,t);if(r){const n=te(t),a=gl(r,N);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),V(ee(e)),j({}),n?.(e)}}catch(e){}L(!1)},ae=e=>`${e}|${Na.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"===I,[`${ie}--sm`]:"small"===I};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:I,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(hl(t,N)):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(ht,{spinning:k},t().createElement(O.Tree,{fieldNames:{title:R,key:N,children:"children"},multiple:a,draggable:i,blockNode:i,checkable:a,selectable:!a,height:F,disabled:e.disabled,checkStrictly:u,selectedKeys:f??K,checkedKeys:f??K,expandedKeys:M,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,[N]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=ml(X.current,t,N,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][N]===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=>{V(e);const t=dl(X.current,(t=>e.includes((0,J.get)(t,N))));E?.(a?t:t[0])},onCheck:e=>{u&&(e=e.checked),V(e),"SHOW_CHILD"===d&&(e=e.filter((e=>!Q.current.includes(e)))),"SHOW_PARENT"===d&&(e=e.filter(((e,t,r)=>!r.includes(cl(_,e,N)))));const t=dl(X.current,(t=>e.includes((0,J.get)(t,N))));S?.(a?t:t[0])}})))}));bl.displayName="QmSearchTree";const yl=bl,vl=(0,e.createContext)(void 0),xl={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,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},El=(i().arrayOf(i().shape(xl)).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),Sl="1",Cl="0",wl="YYYY-MM-DD",Tl="YYYY-MM-DD HH:mm:ss",Il="YYYYMMDDHHmmss",Nl={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 Rl=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Pl=[];const Ol={getFocusInstance:function(){return Pl[0]??null},getInstance:function(e){return Pl.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Pl.findIndex((e=>e===t))&&(this.deregister(e),Pl=[t,...Pl])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Pl=[{id:e,vm:t},...Pl])},deregister:function(e){e&&(Pl=Pl.filter((t=>t.id!==e)))}},Al=["&&","||","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++)Al.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"],kl=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(" ")},Ll=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,ql=["string","number","boolean","symbol"],_l=e=>ql.includes(typeof e),$l=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Dl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Ll,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Dl(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(Dl(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=($l(e)?e.slice(0,10):e)!=r;break;case"<":n=($l(e)?e.slice(0,10):e)<r;break;case"<=":n=($l(e)?e.slice(0,10):e)<=r;break;case">":n=($l(e)?e.slice(0,10):e)>r;break;case">=":n=($l(e)?e.slice(0,10):e)>=r;break;default:n=($l(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 jl=Fl.stringify,Kl=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},Ml=(e,t,r)=>{let n=[];t=Fl.replace_symbols(t);try{if(r){const r=new Function("record",`return ${kl(t,"record")};`);n=vo(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${kl(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},zl=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...zl(e.children)):t.push(e)})),t},Ul=e=>{const t=[];return e.forEach((e=>{let r=e;e.children&&(r={...e},r.children=Ul(e.children)),e.hidden||e.noAuth||t.push(r)})),t},Bl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Bl(e.children))})),t},Wl=(e,t)=>e.map((e=>(e.children&&(e.children=Wl(e.children,t)),t?.(e),e))),Gl=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Gl(r.children,t);if(e)return e}}return null},Yl=e=>{const t=e.children;return t?t[0].children?Yl(t[0]):t[0]:e},Xl=e=>{const t=e.children;return t?t[t.length-1].children?Xl(t[t.length-1]):t[t.length-1]:e},Ql=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Zl=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Zl(r.children,t);if(e)return e}}return null},Jl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Jl(e.children))})),t},eo=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 Bl(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},to=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 to(e.offsetParent,t,r)}return r},ro=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,no=(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])?no(r,t[n]):r)})),ao=(e,t)=>(0,J.intersection)(e,t).length===t.length,io=(e,t)=>(0,J.get)(e,t)??"",lo=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,J.set)(e,t,r??"")},oo=(e,t)=>{if(!t.includes("|"))return io(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(io(e,t))})),r.every((e=>!e))?"":r.join(" | ")},so=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},co=(e,t)=>e?s()(e,t):null,uo=(e,t)=>e?s()(e).format(t):"",po=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)}))},mo=e=>{const t=[];if(te(e)){const{children:r}=e.props;Array.isArray(r)?r.forEach((e=>t.push(...mo(e)))):r&&t.push(...mo(r))}else t.push(e);return t},ho=e=>e.filter((e=>!e._group)),fo=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)?Kl(i.condition):jl(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])?Kl(l[e]):jl(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},go=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(io(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},bo=(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=bo(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},yo=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=yo(r.children,t);if(e)return e}if(t(r))return r}return null},vo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&vo(e.children,t),t(e)||e.children&&e.children.length)));function xo(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 Eo=class{constructor(){xo(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),xo(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),xo(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)})),xo(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),xo(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)})),xo(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),xo(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)})),xo(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),xo(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),xo(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),xo(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),xo(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),xo(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),xo(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),xo(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},So={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 Co;const wo=()=>{if(ee)return 0;if(void 0!==Co)return Co;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),Co=t-n,Co},To=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=To(e.children)),e))),Io=(e,r)=>{const{fetch:n,columns:a,height:i,minHeight:l,maxHeight:o,border:s=!0,rowSelection:c,summation:u,expandable:d,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:I,sorter:N,filters:R,superFilters:P,pagination:O}=r,{selectionRows:A,summaries:F}=w.current,{expandIconColumn:H=""}=m||{},k=t().useMemo((()=>!!n?.api),[n?.api]),L=t().useMemo((()=>!k&&!!h),[k,h]),q=t().useMemo((()=>k&&!!f),[k,f]),_=t().useMemo((()=>(k||L)&&!q),[k,L,q]),$=t().useMemo((()=>!!(i||l||o)),[i,l,o]),D=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]})(To(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:So.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:So.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=d,a?.expandedRowRender?{dataIndex:So.expandableColumn,title:"",width:So.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),Ul(t)})(a)),[a]),j=t().useMemo((()=>zl(D)),[D]),K=t().useMemo((()=>j.filter((e=>"function"==typeof e.editRender))),[j]),V=t().useMemo((()=>j.filter((e=>!!e.summation))),[j]),M=t().useMemo((()=>j.filter((e=>"left"===e.fixed))),[j]),z=t().useMemo((()=>j.filter((e=>"right"===e.fixed))),[j]),U=t().useMemo((()=>{const e=j.filter((e=>![So.expandableColumn,So.selectionColumn,So.operationColumn].includes(e.dataIndex)));return H&&e.some((e=>e.dataIndex===H))?H:e[0]?.dataIndex??""}),[j,H]),B=t().useMemo((()=>V.length>0),[V]),W=t().useMemo((()=>!!C||B),[C,B]),G=t().useMemo((()=>eo(D).length>1),[D]),Y=t().useMemo((()=>s||G),[s,G]),X=t().useMemo((()=>j.some((e=>e.sorter))),[j]),Q=t().useMemo((()=>j.some((e=>e.filter))),[j]),Z=t().useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),J=t().useMemo((()=>!k&&!!x),[k,x]),ee=t().useMemo((()=>!!E&&K.length>0),[E,K]),te=t().useMemo((()=>!!S&&"checkbox"===c?.type),[S,c]),re=t().useMemo((()=>!!b&&Q),[b,Q]),ne=t().useMemo((()=>!k&&!!y&&Q),[k,y,Q]),ae=t().useMemo((()=>!!v&&j.some((e=>!!e.groupSummary))),[j]),ie=t().useMemo((()=>!!u?.groupItems?.length),[u]),le=t().useMemo((()=>!!g&&!k&&!h),[g,k,h]),oe=t().useMemo((()=>T.some((e=>Array.isArray(e.children)&&e.children.length))),[T]),se=t().useMemo((()=>!I.length),[I]),ce=t().useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:r,precision:n,summation:a}=t,{sumBySelection:i,displayWhenNotSelect:l,unit:o}=a,s=ie?ho(w.current.tableFullData):w.current.tableFullData,c=!A.length&&!!l;let u=(!i||c?s:A).reduce(((e,t)=>{if(t?.[So.summaryIgnore])return e;const n=Number(io(t,r));return Number.isNaN(n)?e:new(Xr())(e).plus(n).toNumber()}),0);!Object.keys(F).includes(r)||i&&!c||(u=Number(io(F,r))),lo(e,r,u);let d=n>=0?u.toFixed(n):u;d=so(d),lo(e,`${r}_text`,o?`${d} ${o}`:d)})),[e]})()),[T,A,F]),ue=t().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),de=t().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(N),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=So.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:So.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})(R,P);return{...e?{[So.sorterFieldName]:e}:null,...t.length?{[So.filterFieldName]:t}:null,...ue?{[So.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...n?.params??null,[So.currentPageName]:O.current,[So.pageSizeName]:O.pageSize}}),[n?.params,O.current,O.pageSize,N,R,P,ue]);return{isFetch:k,isWebPagination:L,isScrollPagination:q,showPagination:_,shouldUpdateHeight:$,tableColumns:D,flattenColumns:j,editableColumns:K,summationColumns:V,leftFixedColumns:M,rightFixedColumns:z,treeExpandIndex:U,showSummary:B,showFooter:W,isHeadGroup:G,bordered:Y,isHeadSorter:X,isHeadFilter:Q,isServiceSummation:Z,isSelectCollection:te,isTableImport:J,isTableClipboard:ee,isSuperSearch:re,isFastSearch:ne,isGroupSummary:ae,isGroupSubtotal:ie,isDragMergeCell:le,isTreeTable:oe,isTableEmpty:se,summationRows:ce,fetchParams:de}},No=(e,r)=>{const{rowKey:n,dataSource:a,summation:i,fetch:l,initialSorter:o,initialFilter:s,rowSelection:c,expandable:u,treeConfig:d,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:I,tableFullData:N,pagination:R,layout:P,filters:O,sorter:A,superFilters:F,fetchParams:H,selectionKeys:k,rowExpandedKeys:L,highlightKey:q,summationColumns:_,shouldUpdateHeight:$,isFetch:D,isTreeTable:j,isWebPagination:K,isScrollPagination:V,isServiceSummation:M,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:ue,setScrollYStore:de,setFieldAuth:pe,setResizeState:me,setSummaries:he,setPermission:fe,setRecordsMap:ge,resetTableScroll:be,clearElementStore:ye,clearRecordsMap:ve}=r,{store:xe}=S.current,Ee=Et(C),Se=t().useRef({...H}),Ce=t().useRef(new Map);De((()=>{U()}),[I,T,P.tableAutoHeight]),De((()=>{we()}),[Ee]),De((()=>{nt(),at(),it(),D||(K&&Ge(),Ve(a)),o&&te(o),s&&re(s)}),[a,l?.params]),De((()=>{const e=$e(H,Se.current);e||D&&c?.clearableAfterFetched&<(),!e&&H[So.currentPageName]>1&&!l?.stopToFirst?Ge():D&&Ke(),Se.current=H}),[H]),De((()=>{K&&Je(),V||be(),Le()}),[R.current,R.pageSize]),De((()=>{D||Te(N.length),U()}),[N]),De((()=>{j&&d?.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})))},Ie=St((e=>{Ue(),v?.(e)})),Ne=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?go(e,[r.dataIndex]).map((e=>{const a={children:Pe(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&lo(a,n.toString(),po()),r.titleIndex&&lo(a,r.titleIndex,io(e[0],r.titleIndex)),lo(a,r.dataIndex,io(e[0],r.dataIndex)),_.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[So.summaryIgnore])return e;const n=Number(io(r,t));return Number.isNaN(n)?e:e+n}),0);lo(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Oe=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},Ae=e=>{const{type:t,checkStrictly:r=!0}=c||{},n=Array.isArray(e)?e:k;let a=[];return S.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{deriveRowKeys:r}=S.current,n=Zl(r,e);let a=[];if(!n)return a;const i=He(n?.children||[]),l=bo(r,e)?.slice(0,-1).reverse()||[];return a=[...new Set([...t,...i])],l.forEach((e=>{const t=Zl(r,e),n=ao(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},Fe=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:a}=u||{},i=Array.isArray(e)?e:L;if(S.current.treeTable){a&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...k];q&&e.unshift(q);let l=[];return e.forEach((e=>{const t=bo(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 u?n?t.slice(0):[...i]:[]},He=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...He(e[r].children)),t.push(e[r].rowKey);return t},ke=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...ke(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...ke(e,r[r.length-1])),r},Le=St((()=>{ze(),f?.(R,_e(O),qe(A),F,{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[So.showFilterType?`${n}|${a}`:n]=e[r]}return t},$e=(e,t)=>{const r=Object.keys(no(e,t));return 1===r.length&&(r.includes(So.currentPageName)||r.includes(So.pageSizeName))},je=async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=ae,afterFetch:r,callback:n}=l;if(!t(H))return;const a=V&&H[So.currentPageName]>Se.current[So.currentPageName]&&$e(H,Se.current),o=!!i?.fetch?.api;ee(!0);try{const[t,s]=o?await Promise.all([l.api(e(H)),i.fetch.api(e(H))]):[await l.api(e(H))];if(o?200===t.code&&200===s.code:200===t.code){const e=l.dataKey??So.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(/[^.]+$/,So.totalKey))||i.length||0;Ve(a?S.current.tableFullData.concat(i):i),Te(o),Me(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=St(je),Ve=e=>{const t=e=>e.map(((e,r)=>(Array.isArray(e.children)&&e.children.length&&(e.children=t(e.children)),e.index=r,m||(e.pageIndex=(e=>{const{current:t,pageSize:r}=R;return!D||V?e:(t-1)*r+e})(r)),e))),r=Ne(t(e));et(r),tt(r),rt(),ie(Ae()),le(Fe()),ce(Oe(k)),ze(),y?.(r)},Me=e=>{if(!M)return;const t=i?.fetch?.dataKey??So.summationKey,r=(t?(0,J.get)(e,t):e)??{},n={};_.filter((e=>!!e.summation.dataKey)).forEach((e=>{lo(n,e.dataIndex,Number(io(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);ie([t])}else ie([])}},Ue=()=>{if(!V)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)},Ge=()=>{Be(Object.assign({},R,{current:1}))},Ye=()=>{if(!S.current.treeTable||!d?.virtual)return;const e=Xe(S.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=S.current,{rowExpandable:r}=u||{},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&&d?.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})()),ue(e.length>So.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=()=>{ie([])};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=Wl(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=Gl(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&&k.length&&w.current.setClickedValues([k[0],""]),D?je():Ve(a)},createTableFullData:et,getTableData:je,handleTableData:Ze,createTableData:Ve,createGroupData:Ne,createSelectionKeys:Ae,createSelectionRows:Oe,createRowExpandedKeys:Fe,findParentRowKeys:ke,getAllChildRowKeys:He,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||(de(Object.assign({},t,{startIndex:s,endIndex:c})),Je()))}(e)},scrollBottomDebouncer:Ie,clearTableSorter:nt,clearTableFilter:at,clearSuperFilters:it,clearRowSelection:lt,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{xe.clearAllLog()},destroy:()=>{ye(),xe.destroy(),Ol.deregister(S.current.uid)}}},Ro=(e,r)=>{const{height:n,minHeight:a,maxHeight:i,resizable:l,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:u,$size:d,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:I,setShouldToTop:N}=r,R=t().useRef(g),P=t().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=f,r={};return a&&Object.assign(r,{minHeight:`${ro(a)}px`}),i&&Object.assign(r,{maxHeight:`${ro(i)}px`}),E?{...r,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...r,height:"auto"!==n?`${ro(n)}px`:`${t}px`}:r}),[n,i,a,E,f]),O=(e,t)=>{const{elementStore:r,scrollYStore:n,allTableData:a}=u.current,i=r.$tableBody.parentNode.parentNode;if(void 0!==t&&t>=0)i.scrollTop=t*n.rowHeight;else{const t=(x?Jl(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}=u.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=Yl(Gl(p,e)).dataIndex);let t=0;for(let r=0;r<m.length;r++){const n=m[r];if(n.dataIndex===e)break;t+=ro(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{m.findIndex((t=>t.dataIndex===e))<0&&(e=Xl(Gl(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+=ro(n.width||n.renderWidth||0)}return t},scrollXToColumn:(e,t)=>{const{elementStore:r}=u.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||So.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}=u.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}=u.current,r=t.winHeight-e.$table.getBoundingClientRect().top-(v?an["small"!==d?"middle":d]+El:0)-El;S((e=>Object.assign({},e,{tableAutoHeight:r})))},resetTableScroll:()=>{const{shouldToTop:e}=u.current;e&&O("",0),N(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=u.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+El:0,n=e.$pager?e.$pager.offsetHeight+El:0;p=r.winHeight-t-n-20}l!==f.viewportHeight&&(e=>{const{scrollYStore:t,isIE:r}=u.current,{startIndex:n,endIndex:a}=t,i=So.rowHeightMaps[d],l=Math.max(8,Math.ceil(e/i)+2),o=r?5:0;I(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}=u.current,t=e.$table.clientWidth,r=R.current?f.gutterWidth:0,{defaultColumnWidth:n}=So,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 Po(){const[,t]=e.useReducer((e=>e+1),0);return t}const Oo=e=>{const{total:r}=e,{tableRef:n,tableProps:a,selectionKeys:i,isHeadSorter:l,isHeadFilter:o,isTreeTable:s,clearTableSorter:c,clearTableFilter:u,clearSuperFilters:d,clearRowSelection:m,clearRowHighlight:h}=t().useContext(vl),{infoBarConfig:f,rowSelection:g,rowHighlight:b}=a,{allTableData:y}=n.current,{hideAlert:v,hideClearButton:x}=f||{},E=t().useMemo((()=>!v),[v]),S=t().useMemo((()=>!x&&!!(l||o||g||b)),[x,l,o,g,b]),C={[`${Ce("table")}__alert`]:!0};return E?t().createElement("div",{className:Se()(C)},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})}`:""),S&&t().createElement("em",{onClick:()=>{c(),u(),d(),m(),h()}},p("qm.table.alert.clear"))):null},Ao=t().forwardRef(((e,r)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:i}=t().useContext(vl),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}));Ao.displayName="FullScreen";const Fo=Ao,Ho=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(vl),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 ko=Ho,Lo=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:s,tableProps:c,flattenColumns:u,summationRows:d,showSummary:m,getSpan:h}=t().useContext(vl),{tablePrint:f,showHeader:g}=c,b=i?.print?.leftLogo??"",y=i?.print?.rightLogo??"",v=!(!b&&!y),x=t().useMemo((()=>ce(Ql(n,[So.expandableColumn,So.selectionColumn,So.operationColumn]))),[n]),E=t().useMemo((()=>ce(Ql(u,[So.expandableColumn,So.selectionColumn,So.operationColumn]))),[u]),S=t().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),C=(e,t)=>{const r=Object.assign({},Gl(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||So.defaultColumnWidth,n<=So.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=So.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(eo(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+=I(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},I=(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||So.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&&d.length&&(a+=["<tfoot>",d.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(r):io(e,`${a}_text`);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},N=()=>{((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});At(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:N})));const R=Ce("table");return a?t().createElement("span",{className:`${R}-print`,title:p("qm.table.print.text"),onClick:()=>N()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PrinterOutlined,null))):null}));Lo.displayName="TablePrint";const qo=Lo,_o=require("exceljs");var $o=n.n(_o);const Do="606060",jo="thin",Ko="d4d4d4",Vo=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Mo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},zo=()=>({top:{style:jo,color:{argb:Ko}},left:{style:jo,color:{argb:Ko}},bottom:{style:jo,color:{argb:Ko}},right:{style:jo,color:{argb:Ko}}}),Uo=e=>{const{children:t}=e;return t&&t.length?Uo(t[0]):e},Bo=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},Wo=()=>{const{tableRef:e,tableProps:r,getSpan:n,showSummary:a,isHeadGroup:i}=t().useContext(vl),{spanMethod:l,showHeader:o}=r,s=(e,t)=>e.find((e=>e.text==t))?.value??"";return{exportXLSX:async(t,r,s,c)=>{const{columns:u,footSummation:d}=t,{scrollYStore:{rowHeight:m}}=e.current,h=zl(u),f=eo(u),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||So.defaultColumnWidth)/8})})),o&&(i?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Uo(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?io(e,i.dataIndex):c(e,t,i,o)})),a}));x+=S.length,a&&d&&s(h,r).forEach(((e,t)=>{const n={};h.forEach(((t,a)=>{const{dataIndex:i,summation:l}=t,o=l?.render?l.render(r):io(e,i);n[i]=0===a&&""===o?p("qm.table.config.summaryText"):te(o)?mo(o).join(""):o})),b.push(n)}));const{sheetName:C,useStyle:w}=t,T=new($o().Workbook),I=T.addWorksheet(C);I.columns=y,o&&I.addRows(g).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),r=Gl(u,t.key),{align:n,theadAlign:a}=r;Mo(e,a||n),w&&Object.assign(e,{font:{bold:!0,color:{argb:Do}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:zo()})}))})),I.addRows(S).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),r=Gl(u,t.key),{align:n}=r;Mo(e,n),Object.assign(e,Bo(r)),w&&Object.assign(e,{font:{color:{argb:Do}},border:zo()})}))})),a&&d&&I.addRows(b).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),r=Gl(u,t.key),{align:n}=r;Mo(e,n),Object.assign(e,Bo(r)),w&&Object.assign(e,{font:{color:{argb:Do}},border:zo()})}))})),v.forEach((e=>{let{s:t,e:r}=e;I.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const N=await T.xlsx.writeBuffer();return new Blob([N],{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=zl(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($o().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=uo(e,Tl)),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])),lo(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)}}},Go=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 u="";if(!n)for(let e=0;e<s.length;e++){const{type:r}=o(s[e]);if(t.type!==r){u=r;break}}u?(O.message.warning(p("qm.upload.notType",{type:u})),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"))},Yo=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableProps:i,createTableData:l,dataChange:o}=t().useContext(vl),{beforeTableImport:s}=i,{importXLSX:c}=Wo(),u=t().useRef(null),[d,m]=t().useState(!1),[h,f]=t().useState(!0),g=e=>e.filter((e=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.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(Go,{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:u,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:d,disabled:h,onClick:()=>(async()=>{const[e,t]=await u.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"))))},Xo=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(sr,c,t().createElement(Yo,{columns:n,onClose:()=>l(!1)})))}));Xo.displayName="TableImport";const Qo=Xo,Zo=e=>{const{columns:r,onChange:n}=e,{$size:a}=t().useContext(vl),i=t().useRef([]),[l,o]=t().useState(!1),[s,c]=t().useState(r);De((()=>{d()}),[s]),t().useEffect((()=>{u()}),[r]);const u=()=>{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},d=()=>{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(bn(),{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(qr.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:Nl,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"))))},Jo=e=>{const{defaultValue:r,onClose:n,onOk:a}=e,{tableProps:i,pagination:l,showSummary:o}=t().useContext(vl),{rowSelection:c}=i,u=t().useRef(null),[d,m]=t().useState(!1),h=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(Il)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:"all","startIndex|endIndex":[1,l.total],footSummation:o?1:0,useStyle:0},r,{columns:ce(r.columns||[])})),[]),[f,g]=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"!==c?.type},{text:p("qm.table.export.custom"),value:"custom"}]},onChange:e=>{f.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,g([...f])}},options:{min:1},disabled:!0},{type:"INPUT",label:p("qm.table.columnFilter.text"),fieldName:"columns",render:(e,r)=>t().createElement(Zo,{columns:r.state.formData.columns,onChange:e=>{r.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:p("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!o,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:p("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),b=Ce("table");return t().createElement("div",{className:`${b}-export__setting`},t().createElement(Ii,{ref:u,initialValues:h,items:f,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:d,onClick:()=>(async()=>{const[e,t]=await u.current.GET_FORM_DATA();if(!e){m(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);a(t),await ie(1e3),m(!1),n()}})()},p("qm.table.export.text"))))},es=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:c,tableProps:u,flattenColumns:d,pagination:m,fetchParams:h,isFetch:f,isGroupSubtotal:g,showSummary:b,getSpan:y}=t().useContext(vl),{exportExcel:v,fetch:x,showHeader:E}=u,[S,C]=t().useState(!1),[w,T]=t().useState(!1),I=t().useMemo((()=>!!v?.fetch?.api),[v]),N=t().useMemo((()=>!m.total||w),[m.total,w]),R=t().useMemo((()=>Ql(n,[So.expandableColumn,So.selectionColumn,So.operationColumn])),[n]),P=t().useMemo((()=>Ql(d,[So.expandableColumn,So.selectionColumn,So.operationColumn])),[d]),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(g?ho(t):t).reduce(((e,t)=>{if(t?.[So.summaryIgnore])return e;const r=Number(io(t,n));return Number.isNaN(r)?e:e+r}),0);lo(r,n,a)})),[r]},F=(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:H,exportCSV:k}=Wo(),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),[So.currentPageName]:1,[So.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=Jl(e.map(((e,t)=>{const r={...e,index:t,pageIndex:t};return P.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&lo(r,n,io(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(N)return O.message.warning(p("qm.table.export.warnText"));I?(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,[So.currentPageName]:void 0,[So.pageSizeName]:void 0});n.data&&(At(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)},V={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(sr,K,t().createElement(Jo,{defaultValue:V,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 H(e,c,A,F);At(r,`${t}.xlsx`),q(`${t}.xlsx`)}if("csv"===r){const r=k(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=eo(r),i=zl(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||So.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}">${F(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):io(e,a);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):te(l)?mo(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));At(r,`${t}.csv`),q(`${t}.csv`)}})(Object.assign({},e,{columns:Ul(e.columns)}))}})))}));es.displayName="TableExport";const ts=es,rs=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableBodyRef:i,tableProps:l,dataChange:o}=t().useContext(vl),{beforeClipboard:s}=l,c=t().useRef(null),[u,d]=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:u,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:u}=a.current;h(!0);const d=t.content.trim().replace(/(\r|\n)$/,"");let m=d.replace(/"[^"]+"/g,"^");(d.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&&(lo(o,s.dataIndex,e),u.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"))))},ns=t().forwardRef(((e,r)=>{const{flattenColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:s})));const c={[`${Ce("table")}-clipboard`]:!0},u={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(sr,u,t().createElement(rs,{columns:o,onClose:()=>l(!1)})))}));ns.displayName="TableClipboard";const as=ns,is=e=>{const{columns:r,onClose:n}=e,{tableProps:a,tableRef:i,$size:l,selectionKeys:o,setSelectionKeys:s}=t().useContext(vl),{rowKey:c}=a,u=t().useRef(null),d=Et(u),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=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.operationColumn].includes(e.dataIndex))))]),[g]=t().useState(i.current.selectionRows.map((e=>({...e,children:void 0})))),[b,y]=t().useState(300),v=St((()=>{const e=u.current;y(e.offsetHeight-2*an[l]-30)}),5);return De((()=>{v()}),[d.width]),t().createElement("div",{ref:u,style:{height:"100%"}},t().createElement(ec,{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"))))},ls=t().forwardRef(((e,r)=>{const{columns:n,open:a=!0}=e,{tableProps:i,getRowKey:l,isFetch:o,isTableEmpty:s,setSelectionKeys:c,setSelectionRows:u}=t().useContext(vl),{rowSelection:d}=i,[m,h]=t().useState(!1),f=t().useRef(!1);De((()=>{!f.current&&g()}),[s]);const g=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=d;if(o&&e)try{const r=await e.api(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))),u(n),c(n.map(((e,t)=>l(e,t)))),f.current=!0}}catch(e){}},b=()=>{h(!0)};t().useImperativeHandle(r,(()=>({clickHandle:b})));const y=Ce("table"),v={visible:m,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>h(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:`${y}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>b()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CheckSquareOutlined,null))),t().createElement(sr,v,t().createElement(is,{columns:n,onClose:()=>h(!1)})))}));ls.displayName="SelectCollection";const os=ls,ss=require("localforage");var cs=n.n(ss);const us=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),ds=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,tableRef:i,getRowKey:o,$size:s,flattenColumns:c,pagination:u,setPagination:d,scrollYToRecord:m,setHighlightKey:h,setShouldToTop:f,isTreeTable:b,isWebPagination:y}=t().useContext(vl),{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}=u,r=i.current.tableFullData.slice((e-1)*t,e*t),n=Jl(r).findIndex((e=>o(e,e.index)===C.current));m("",n)}),[u.current]);const I=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},N=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:I(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);F(a)}}))),R={case:0,fullchar:0},P=t().useMemo((()=>c.filter((e=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[A,F]=t().useState({}),[H,k]=t().useState(R),[L]=t().useState(N([P[0]])),[q]=t().useState(N(P.slice(1))),[_,$]=t().useState(0),D=t().useMemo((()=>!Object.keys(A).length),[A]);De((()=>{T.current="ready"}),[A,H]);const j=e=>{k(Object.assign({},H,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()}})})),V=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=io(a,t),l=!0;if("text"===r||"textarea"===r?l=new RegExp(H.fullchar?`^${e[t]}$`:e[t],H.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=bo(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}=u,r=Math.ceil((t+1)/e);f(!1),d(Object.assign({},u,{current:r}))}else m(e)})(r,n),h(r)},M=()=>{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)))),F(e),k(t)}else M(),F({}),k(R)}),[Y]),t().useEffect((()=>{Q()}),[]);const Q=async()=>{if(!z)return;let e=await cs().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await cs().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(Zt,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t().createElement("span",null,p("qm.table.alert.total",{total:_}))},t().createElement(Zt.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(Zt.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=po(),t=[...U,{text:W,value:e,list:{filters:A,config:H}}];B(t),X(e),G(""),await cs().setItem(z,t),await te(z,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${So.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 cs().setItem(z,t),await te(z,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!U.length&&t().createElement("div",{style:{padding:El}},t().createElement(pt,null)))))),t().createElement("div",{className:"bottom"},t().createElement("div",null,t().createElement(O.Checkbox,{checked:!!H.case,onChange:e=>j({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t().createElement(O.Checkbox,{checked:!!H.fullchar,onChange:e=>j({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t().createElement("div",null,t().createElement(he,{onClick:()=>M()},p("qm.table.fastSearch.clear"))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${an[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:()=>V("prev")},p("qm.table.fastSearch.queryPrev")),t().createElement(he,{type:"primary",onClick:()=>V("next")},p("qm.table.fastSearch.queryNext"))))},ps=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{$size:a}=t().useContext(vl),[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:`${an[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(sr,c,t().createElement(ds,{onClose:()=>l(!1)})))}));ps.displayName="FastSearch";const ms=ps,hs=e=>{const{columns:r,group:n,summary:a}=e,{tableRef:i,tableProps:l,$size:o,pagination:c,fetchParams:u,isFetch:d}=t().useContext(vl),{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===So.groupSummary.total.value?{dataIndex:e.summary,title:So.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...h(e.summary),formula:e.formula})),b=t().useMemo((()=>Object.assign({},u,{[So.sorterFieldName]:void 0,[So.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[So.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[So.currentPageName]:1})),[u,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===So.groupSummary.total.value&&(n={dataIndex:So.groupSummary.recordTotalIndex,summation:{render:()=>c.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(f,g)),[x]=t().useState(d?[]:(e=>{const t=go(e,n.map((e=>e.group))),r=[];return t.forEach((e=>{const t={};y.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&lo(t,n,io(e[0],n))})),a.forEach((r=>{const n=r.summary!==So.groupSummary.total.value?r.summary:So.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&lo(t,n,e.length),"sum"===a&&lo(t,n,(0,J.sumBy)(e,n)),"max"===a&&lo(t,n,(0,J.maxBy)(e,n)[n]),"min"===a&&lo(t,n,(0,J.minBy)(e,n)[n]),"avg"===a&&lo(t,n,((0,J.sumBy)(e,n)/e.length).toFixed(2))})),r.push(t)})),r})(i.current.tableFullData)),E={size:o,height:400,...d?{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(ec,E)},fs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o}=t().useContext(vl),{uniqueKey:s}=a,c=t().useRef(null),u=t().useRef(null),[d,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;N(e),F(t)}else{const e=q();N(e?.group||[]),F(e?.summary||[])}}),[v]),t().useEffect((()=>{_()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),S=t().useMemo((()=>o.filter((e=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.operationColumn].includes(e.dataIndex)))),[o]),C=S.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[So.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"}],[I,N]=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:I.findIndex((t=>t.group===e.value))>-1})))})}]),[A,F]=t().useState([]),[H,k]=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:()=>{u.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===So.groupSummary.total.value?T.slice(T.length-1):T})}]),L=t().useMemo((()=>{const e=I.length&&I.every((e=>Object.values(e).every((e=>""!==e)))),t=A.length&&A.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[I,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;N(t),F(r)}let t=await cs().getItem(E);t||(t=await $(E),Array.isArray(t)&&await cs().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:d,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(ec,{ref:c,size:i,columns:R,dataSource:I,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{N(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(ec,{ref:u,size:i,columns:H,dataSource:A,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{F(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{u.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=po(),t=[...h,{text:b,value:e,list:{group:I.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))}}];f(t),x(e),y(""),await cs().setItem(E,t),await D(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${So.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 cs().setItem(E,t),await D(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!h.length&&t().createElement("div",{style:{padding:El}},t().createElement(pt,null)))))),t().createElement(sr,K,t().createElement(hs,{columns:S,group:I,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:I.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))})),void m(!0))},p("qm.table.groupSummary.confirmButton"))))},gs=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(sr,s,t().createElement(fs,{onClose:()=>i(!1)})))}));gs.displayName="GroupSummary";const bs=gs,ys=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(vl),{uniqueKey:u}=a,d=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((()=>u?`superSearch_${u}`:""),[u]),C=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=fo(m),T=t().useMemo((()=>!(w&&Vl(w))),[w]),I=t().useMemo((()=>!!m.length&&T),[m,T]),N=[{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},F=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},[H,k]=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:()=>{d.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=F(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:F(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:N,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 cs().getItem(S);t||(t=await $(S),Array.isArray(t)&&await cs().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(ec,{ref:d,size:i,columns:H,dataSource:m,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(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:()=>{d.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),So.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=po(),t=[...f,{text:y,value:e,list:m.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await cs().setItem(S,t),await D(S,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${So.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 cs().setItem(S,t),await D(S,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:El}},t().createElement(pt,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:I,onClick:()=>(c(),s(m.map((e=>Z()(e,["index","pageIndex"])))),L(),void r())},p("qm.table.highSearch.searchButton"))))},vs=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.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(sr,s,t().createElement(ys,{onClose:()=>i(!1)})))}));vs.displayName="SuperSearch";const xs=vs,Es=t().forwardRef(((e,r)=>{const{tableColumns:n,showFullScreen:a,showReload:i,showPrint:o,showImport:s,showExport:c,showClipboard:u,showCollection:d,showFastSearch:m,showSuperSearch:h,showGroupSummary:f,showToolBox:b}=e,{global:y}=t().useContext(l),{tableProps:v,flattenColumns:x,isFullScreen:E,$size:S}=t().useContext(vl),{uniqueKey:C,exportExcel:w}=v,T=t().useRef(null),I=t().useRef(null),N=t().useRef(null),R=t().useRef(null),P=t().useRef(null),A=t().useRef(null),F=t().useRef(null),H=t().useRef(null),k=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:u,collection:d,fastSearch:m,superSearch:h,groupSummary:f},[K,V]=t().useState(!1);De((()=>{q.current&&(z(),q.current=!1)}),[$]),t().useEffect((()=>{M()}),[]),t().useImperativeHandle(r,(()=>({exportHandle:()=>{if(!P.current)return g("Table","执行导出需要配置 `exportExcel` 参数");P.current.clickHandle()}})));const M=()=>{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=>{V(!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(ko,{ref:I,open:!b||$.reload}),o&&t().createElement(qo,{ref:N,tableColumns:n,open:!b||$.print}),s&&t().createElement(Qo,{ref:R,tableColumns:n,open:!b||$.import}),c&&t().createElement(ts,{ref:P,tableColumns:n,open:(!b||$.export)&&!w?.hideIcon}),u&&t().createElement(as,{ref:A,flattenColumns:x,open:!b||$.clipboard}),d&&t().createElement(os,{ref:F,columns:n,open:!b||$.collection}),m&&t().createElement(ms,{ref:H,open:!b||$.fastSearch}),f&&t().createElement(bs,{ref:k,open:!b||$.groupSummary}),h&&t().createElement(xs,{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(I)},{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(N)},{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(F)},{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(H)},{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(k)},{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=>{V(e)}},t().createElement("span",{className:`${Y}-toolbox`,title:p("qm.table.toolbox.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.AppstoreAddOutlined,null)))))}));Es.displayName="ToolBox";const Ss=Es,Cs=e=>{const{columns:r}=e,{global:n}=t().useContext(l),{tableProps:a,tableRef:i,$size:o}=t().useContext(vl),{uniqueKey:s,onlyShowIcon:c,columnsChange:u}=a,d=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),N(r)}),[r]),t().useEffect((()=>{R()}),[]);const I=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=I(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}})),N=e=>{if(!w)return;const t=I(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 N(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?Wl(r,(t=>{const r=Gl(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),u?.(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))})),d.current=t},F=()=>{const e=[];T.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=d.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...d.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)})),u?.(e)},H=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const n=P(r);u?.(n)},k=(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),F()}}),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:()=>H(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>H(e,"right")},t().createElement(we.StepForwardOutlined,null))):t().createElement("span",{className:Se()("fixed",i?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>H(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(bn(),{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),u?.(e)}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement(qr.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:()=>F()},y.map((e=>k(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement(qr.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:()=>F()},S.map((e=>k(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement(qr.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:()=>F()},x.map((e=>k(e,"right")))))),popupClassName:Se()(q),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{b(e)},builtinPlacements:Nl,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"))))},ws=()=>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 Ts(){return Ts=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},Ts.apply(this,arguments)}const Is=e=>{const{column:r,filters:n}=e,{$size:a,setFilters:i,clearSuperFilters:l}=t().useContext(vl),o=t().useRef(null),s=t().useRef(null),c=t().useRef(null),[u,d]=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((()=>{u&&setTimeout((()=>x()),50)}),[u]),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})),d(!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,Ts({ref:s},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(O.InputNumber,Ts({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(O.InputNumber,Ts({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(O.InputNumber,Ts({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const r=e=>({value:co(f[y]?.[e],wl),format:wl,size:a,onChange:t=>{b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:uo(t,wl)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement($,Ts({},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement($,Ts({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement($,Ts({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement($,Ts({},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(yl,{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:u,actived:v}];return t().createElement(bn(),{action:["click"],popupVisible:u,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=>{d(e)},builtinPlacements:Nl,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(ws,null))))},Ns=e=>{const{column:r}=e,{tableProps:n,tableRef:a,bordered:i}=t().useContext(vl),{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,u=to(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+o;n.$table.classList.add("c--resize"),i.style.left=`${u}px`,i.style.display="block";const d=r.width||r.renderWidth;let p=d;return document.onmousemove=function(e){if("number"!=typeof d)return;const t=e.clientX-c,n=d+t;n<(r.minWidth||So.defaultColumnWidth)||(p=Math.floor(n),i.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),i.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Gl(l,r.dataIndex).width=p,s([...l]))},!1}})},Rs=e=>{const{selectionKeys:r}=e,{tableRef:n,tableProps:a,getRowKey:i,pagination:l,fetchParams:o,setSelectionKeys:s,setSpinning:c,isWebPagination:u}=t().useContext(vl),{rowSelection:d}=a,{fetchAllRowKeys:m,onSelectAll:h}=d,f=t().useRef([]),g=t().useMemo((()=>d.selectAllOnCurrentPage??!1),[d]),b=t().useMemo((()=>(d.filterable??!0)&&!g),[d,g]),y=(()=>{const{allTableData:e,allRowKeys:t}=n.current,{disabled:a=(e=>!1)}=d;return g?(0,J.union)((()=>{const{tableFullData:e}=n.current,{current:t,pageSize:r}=l;return u?e.slice((t-1)*r,t*r):e})().filter((e=>!a(e))).map((e=>i(e,e.index))),r):t.filter(((t,r)=>!a(e[r])))})(),v=r.length>0&&r.length<(m||g?l.total:n.current.allRowKeys.length),x=!!r.length&&r.length===(f.current.length||y.length),E=async()=>{const e=m;let t=[];c(!0);try{const r=await e.api(o);200===r.code&&(t=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[],f.current=t)}catch(e){}return c(!1),t},S=async e=>{let t=[];t=m?e?await E():[]:e?y.slice(0):[],s(t),h?.(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(O.Checkbox,{checked:x,indeterminate:v,disabled:!y.length,onChange:e=>S(e.target.checked)}),b&&t().createElement(O.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{S(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=m?(0,J.xor)(r,await E()):(0,J.xor)(r,y),s(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{S(!1)}}];return t().createElement(O.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),g&&t().createElement(O.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},Ps=e=>{const{style:r}=e,{tableProps:n,tableRef:a,isTreeTable:i,setRowExpandedKeys:l}=t().useContext(vl),{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 u={[`${Ce("expand")}--icon`]:!0,expanded:s,collapsed:!s};return t().createElement("span",{className:Se()(u),title:"",onClick:e=>{e.stopPropagation(),c(!s)},style:r})},Os=()=>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"})),As=()=>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:u,superFilters:d,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:I}=t().useContext(vl),{ellipsis:N,resizable:R,multipleSort:P,rowSelection:A,expandable:F}=o,[H,k]=So.sortDirections,L=t().useRef(null),q=t().useMemo((()=>!g),[g]),_=t().useMemo((()=>!g),[g]),$=t().useMemo((()=>!F?.hideExpandAll),[F]),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()}),[d]),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===So.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},D?t().createElement(Rs,{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(Ps,null):null,r===So.expandableColumn&&$?t().createElement(Ps,null):l)),o&&s.push(t().createElement(O.Tooltip,{key:1,placement:"top",title:o},t().createElement(we.InfoCircleOutlined,{className:"tip"}))),i&&s.push(V(a[r])),s},V=e=>{const r=["svgicon cell--sorter__asc",{actived:e===H}],n=["svgicon cell--sorter__desc",{actived:e===k}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Se()(r)},t().createElement(Os,null)),t().createElement("span",{className:Se()(n)},t().createElement(As,null)))},M=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===k?null:k:H;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"},H)},W=(e,t)=>{const{tableFullData:r}=s.current,{dataIndex:n,sorter:a}=e,i=(e,r)=>{const a=io(e,n),i=io(r,n);return Number.isNaN(a-i)?t===H?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===H?a-i:i-a},l=y?T(ho(r).sort("function"==typeof a?a:i)):r.sort("function"==typeof a?a:i).slice(0);I(l)},G=()=>{_&&Y()},Y=()=>{const{tableOriginData:e}=s.current,t=d.length?fo(d):fo(i),r=""!==t?y?T(Ml(ho(e),t,b)):Ml(e,t,b):e;I(r),B(!0)},X=eo(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`}})})),u&&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:d,rowSpan:p,fixed:m,align:h,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===d)return null;const E=f||h,S=["header--column",{"col--ellipsis":e.ellipsis??N,"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)+(u?l:0)}px`:""},I=R&&![So.expandableColumn,So.selectionColumn].includes(o);return t().createElement("th",{key:o,className:Se()(S),colSpan:d,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?M(e):null)),I&&t().createElement(Ns,{column:e}))})(r,n,e))),u&&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(vl),{rowSelection:u}=l,d=t().useMemo((()=>n.type||""),[n.type]),p=e=>{const t=u.checkStrictly??!0;if(!s||t)return!1;const n=Zl(o.current.deriveRowKeys,e),a=c(n?.children??[]);return!(!Array.isArray(n?.children)||ao(r,n?.children.map((e=>e.rowKey))||[]))&&a.some((e=>r.includes(e)))};return"radio"===d?(()=>{const e=u.disabled,n=e?.(a),l=!n&&r[0]===i;return t().createElement(O.Radio,{checked:l,disabled:n})})():(()=>{const e=u.disabled,n=e?.(a),l=!!r.includes(i);return t().createElement(O.Checkbox,{checked:l,indeterminate:p(i),disabled:n})})()},ks=e=>{const{record:r,rowKey:n,style:a}=e,{tableProps:i,rowExpandedKeys:l,setRowExpandedKeys:o}=t().useContext(vl),{expandable:s={}}=i,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(r)),u=t().useMemo((()=>l.includes(n)),[l,n]);De((()=>{s.onExpand?.(u,r)}),[u]);const d={[`${Ce("expand")}--icon`]:!0,expanded:u,collapsed:!u,disabled:c};return t().createElement("span",{className:Se()(d),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=u?l.filter((e=>e!==n)):[...l,n];o(t)},style:a})},Ls=t().forwardRef(((e,r)=>{const{size:n,defaultValue:a,value:i,min:l,max:o,prefix:s,suffix:c,placeholder:u,maxLength:d,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(Xr())(t).toFixed(p)),t},E=void 0!==i,[S,C]=t().useState(a??""),w=b(E?i:S),T=y(w),I=t=>{E?e.onChange?.(t):C(t)};return De((()=>{e.onChange?.(T)}),[S]),t().createElement(O.Input,{ref:r,size:n,value:w,maxLength:d,prefix:s,suffix:c,placeholder:u,allowClear:h,readOnly:f,disabled:g,onChange:e=>{const t=y(e.target.value);let r=/^-?\d*(\.\d*)?$/.test(t)||""===t||"-"===t;if(0===p&&t.includes(".")&&(r=!1),l>=0&&t.startsWith("-")&&(r=!1),r){if(!m&&t.replace(/^-|\./g,"").length>17)return;I(t)}},onFocus:v,onBlur:()=>{const t=x(T);t!==T&&I(t),e.onBlur?.(t,T)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(T),T)}})}));Ls.displayName="InputNumber";const qs=Ls;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:$s}=O.Input,Ds=e=>{const{column:r,record:n,rowKey:a,columnKey:i,clicked:l,text:o}=e,{tableRef:s,tableBodyRef:c,$size:u,flattenColumns:d,doFieldValidate:m,dataChange:h}=t().useContext(vl),f=t().useRef(null),b=t().useRef(null),y=t().useRef(null),v=t().useRef(null),x=t().useRef(null),E=t().useRef(!1),S=t().useRef([]),C=t().useRef({}),w=Po(),{store:T,fieldAuth:I}=s.current,N=r.editRender?.(n,r)||{},[R,P]=t().useState(!1),[A,F]=t().useState(!1),[H,k]=t().useState(!1),[L,q]=t().useState(N.items||[]),[_,D]=t().useState(),j=(N.editable||(0,J.isEqual)(l,[a,i]))&&!N.disabled&&!I[i]?.disabled,K=`${a}|${i}`,M=2===l.length?`${l[0]}|${l[1]}`:"",z=![...T.state.required,...T.state.validate].some((e=>{let{x:t,y:r}=e;return t===a&&r===i})),U=T.state.required.find((e=>{let{x:t,y:r}=e;return t===a&&r===i}))?.text||"",B=T.state.validate.find((e=>{let{x:t,y:r}=e;return t===a&&r===i}))?.text||"",W=T.state.edited.some((e=>{let{x:t,y:r}=e;return t===a&&r===i})),G=j||!z||R||H||A,Y=!!N.helper?.combinedDataIndex&&("search-helper"===N.type||"tree-helper"===N.type),X=()=>{h()};t().useEffect((()=>{G&&M===K&&ee()}),[l]);const Q=(e,t)=>{P(e),t?.()},Z=e=>{S.current=e},ee=()=>{const{type:e}=N;switch(e){case"text":b.current?.focus();break;case"number":y.current?.select();break;case"search-helper":v.current?.focus();break;case"tree-helper":x.current?.focus()}},te=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0}))},re=(e,t,r)=>{const{cornerSign:n=!0}=N.extra||{};T.addToUpdated(e),n&&T.addToEdited({x:t,y:r})},ne=e=>""!==e?Number(e):"",ie={text:(e,r,n)=>{const{dataIndex:l}=r,{type:o,extra:s={},rules:c=[],onInput:d,onChange:h,onEnter:f,onBlur:g}=N,y=io(e,l),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:b,size:u,value:y,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??"";lo(e,l,r),m(c,r,a,i),w(),d?.({[K]:r}),E.current=!0},onFocus:()=>F(!0),onBlur:t=>{F(!1);const r=t.target.value??"";E.current&&(E.current=!1,re(e,a,i),h?.({[K]:r},e),g?.({[K]:r},e),X())},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";f?.({[K]:r},e)}},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||e.preventDefault()}}))},textarea:(e,t)=>ie.text(e,t,!0),number:(e,r)=>{const{dataIndex:n,precision:l,formatType:o}=r,{type:s,extra:c={},rules:d=[],onInput:h,onChange:f,onEnter:g,onBlur:b}=N,v=io(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(Xr())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Xr())(e).times(.01).toString()),t().createElement(qs,{ref:y,size:u,value:v,min:c.min,max:c.max,precision:l,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=>{lo(e,n,t),m(d,t,a,i),w(),h?.({[K]:t}),E.current=!0},onFocus:()=>F(!0),onBlur:(t,r)=>{if(F(!1),!E.current)return;E.current=!1;let l=c.stringMode?t:ne(t);"percent"===o&&"."===r.charAt(r.length-1)&&(l=Number(t)/100),lo(e,n,l),re(e,a,i),f?.({[K]:l},e),b?.({[K]:l},e),X()},onEnter:(t,r)=>{let n=c.stringMode?t:ne(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),g?.({[K]:n},e)}})},select:(e,r,n)=>{const{dataIndex:l,dictItems:o=[]}=r,{type:c,extra:d={},rules:h=[],items:f,onChange:g,onEnter:b}=N,{elementStore:y}=s.current,v=f||o,x=io(e,l);let E=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}|${Na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{lo(e,l,t),m(h,t,a,i),re(e,a,i),w(),g?.({[K]:t},e),X()},onSelect:e=>{E=e},onInputKeyDown:t=>{13===t.keyCode&&le((()=>b?.({[K]:E},e)))}},v.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ie.select(e,t,!0),date:(e,r,n)=>{const{dataIndex:l}=r,{type:o,extra:s={},rules:c=[],onChange:d}=N,h=n?Tl:wl,f=io(e,l);return t().createElement($,{showTime:n,size:u,popupClassName:"table-editable__popper",value:co(f,h)??void 0,format:h,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=uo(t,h);lo(e,l,r),m(c,r,a,i),re(e,a,i),w(),d?.({[K]:r},e),X()}})},datetime:(e,t)=>ie.date(e,t,!0),time:(e,r)=>{const{dataIndex:n}=r,{type:l,extra:o={},rules:s=[],onChange:c}=N,d=o.format||"HH:mm:ss",h=io(e,n);return t().createElement(V,{size:u,popupClassName:"table-editable__popper",value:co(h,d)??void 0,format:d,placeholder:p("qm.table.editable.datetimePlaceholder"),allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=uo(t,d);lo(e,n,r),m(s,r,a,i),re(e,a,i),w(),c?.({[K]:r},e),X()}})},checkbox:(e,r)=>{const{dataIndex:n}=r,{type:l,extra:o={},onChange:s}=N,{trueValue:c=Sl,falseValue:u=Cl,disabled:d}=o,p=io(e,n);return t().createElement(O.Checkbox,{checked:p===c,disabled:d,onChange:t=>{const r=t.target.checked?c:u;lo(e,n,r),re(e,a,i),w(),s?.({[K]:r},e),X()}})},switch:(e,r)=>{const{dataIndex:n}=r,{type:l,extra:o={},onChange:s}=N,{trueValue:c=Sl,falseValue:u=Cl,disabled:d}=o,p=io(e,n);return t().createElement(O.Switch,{checked:p===c,disabled:d,onChange:t=>{const r=t?c:u;lo(e,n,r),re(e,a,i),w(),s?.({[K]:r},e),X()}})},"search-helper":(e,r)=>{const{dataIndex:n,precision:l}=r,{type:o,extra:s={},rules:h=[],helper:b={},onInput:y,onChange:x,onEnter:S}=N,w=oo(e,Y?b.combinedDataIndex:n),T=b.fieldAliasMap;T||g("Table","helper 需要配置 `fieldAliasMap` 选项");const I="function"==typeof T?T():T||{};Object.keys(I).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Y&&(b.combinedDataIndex.split("|").every((e=>Object.keys(I).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),I[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const O=e=>{const{filterAliasMap:t}=b,r=""!==e?e:void 0,a="function"==typeof t?t():t??[],i={[n]:r};return a.forEach((e=>i[e]=r)),i},A=e=>{const{autoQueryAssign:t=!0}=b;t&&(C.current=O(e)),P(!0)},F=(t,n)=>{const{beforeOpen:a}=b,i=(a??ae)({[K]:w},e,r);i?.then?i.then((()=>{A(t),n?.()})).catch((()=>{})):!1!==i&&(A(t),n?.())},H=e=>{const t={};for(const r in I){const a=I[r];r!==n&&(t[r]=oo(e,a))}const r=I[n]?oo(e,I[n]):"";q(r,t);const{closed:a}=b;Q(!1,(()=>te(f.current))),ee(),a?.(e)},L=()=>{const{onlySelect:e=!0}=b;E.current&&q(e?"":w),Q(!1,(()=>te(f.current)))},q=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],i=d.find((e=>e.dataIndex===t));if(i){lo(e,t,n,i.precision);const r=i.editRender?.(e,i);r&&Array.isArray(r.rules)&&m(r.rules,n,a,t)}else lo(e,t,n)}c.current.forceUpdate()}lo(e,n,t,l),m(h,t,a,i),re(e,a,i),x?.({[K]:t},e),X(),C.current={},E.current=!1,D(void 0)},$={visible:R,title:p("qm.searchHelper.text"),width:b.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${an[u]+20}px`},onClose:()=>{L()}},j={...b,size:u,initialValue:Object.assign({},C.current,b.initialValue),onClose:e=>{e?H(e):L()}};return t().createElement(t().Fragment,null,t().createElement($s,{ref:v,value:_??w,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}=b;if(E.current&&!R)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=b,{beforeFetch:n=ae}=t.fetch;return k(!0),new Promise((async(a,i)=>{const l=(0,J.merge)({},t.fetch.params,{...r,...O(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()}k(!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=>oo(t,I[n]).toString().includes(e)));if(1===t.length)return H(t[0]);F(e)}(e,t))).catch((()=>q(""))):void q(t)},onChange:e=>{const{value:t}=e.target;y?.({[K]:t}),E.current=!0,D(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";S?.({[K]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;F(t)},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?F(e):q(""))}}),t().createElement(sr,$,t().createElement(ac,j)))},"search-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:l,items:o=[],extra:s={},rules:c=[],helper:d={},onInput:h,onChange:b,onEnter:y}=N,v=io(e,n),x=d.fieldAliasMap;x||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`");const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[K]:v},e,r);a?.then?a.then((()=>{P(!0),t?.()})).catch((()=>{})):!1!==a&&(P(!0),t?.())},T=()=>{Q(!1,(()=>te(f.current)))},I=t=>{lo(e,n,t),m(c,t,a,i),re(e,a,i),b?.({[K]:t},e,S.current),X()},A={visible:R,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${an[u]+20}px`},onClose:()=>{T()}},F={...d,size:u,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:v,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=E;Z((0,J.uniqBy)([...S.current.filter((e=>t.includes(e[n]))),...e],n));const a=S.current.map((e=>({text:e[r],value:e[n]}))),i=(0,J.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));q(i),I(i.map((e=>e.value)));const{closed:l}=d;Q(!1,(()=>te(f.current))),l?.(S.current)})(e,t):T()}};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:v,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&&y?.({[K]:v},e)},onDoubleClick:()=>{s.disabled||C()},onChange:e=>{const{valueKey:t}=E;Z(S.current.filter((r=>e.includes(r[t])))),I(e),w()}},L.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(sr,A,t().createElement(ac,F)))},"tree-helper":(e,r)=>{const{dataIndex:n,precision:l}=r,{type:o,extra:s={},rules:h=[],helper:b={},onChange:y,onEnter:v}=N,E=oo(e,Y?b.combinedDataIndex:n),S=b.fieldAliasMap;S||g("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof S?S():S||{};Object.keys(C).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Y&&(b.combinedDataIndex.split("|").every((e=>Object.keys(C).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),C[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const T=t=>{const{beforeOpen:n}=b,a=(n??ae)({[K]:E},e,r);a?.then?a.then((()=>{P(!0),t?.()})).catch((()=>{})):!1!==a&&(P(!0),t?.())},I=()=>{Q(!1,(()=>te(f.current)))},O=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],i=d.find((e=>e.dataIndex===t));if(i){lo(e,t,n,i.precision);const r=i.editRender?.(e,i);r&&Array.isArray(r.rules)&&m(r.rules,n,a,t)}else lo(e,t,n)}c.current.forceUpdate()}lo(e,n,t,l),m(h,t,a,i),re(e,a,i),y?.({[K]:t},e),X()},A={visible:R,title:p("qm.searchHelper.text"),width:b.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${an[u]+20}px`},onClose:()=>{I()}},F={...b,defaultSelectedKeys:[E],size:u,onClose:e=>{e?(e=>{const t={};for(const r in C){const a=C[r];r!==n&&(t[r]=oo(e,a))}const r=C[n]?oo(e,C[n]):"";O(r,t);const{closed:a}=b;Q(!1,(()=>te(f.current))),ee(),a?.(e)})(e):I()}};return t().createElement(t().Fragment,null,t().createElement($s,{ref:x,value:E,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;t||w()},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";v?.({[K]:r},e)}},onDoubleClick:()=>{T()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?T():O(""))}}),t().createElement(sr,A,t().createElement(pc,F)))},"tree-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:l,extra:o={},items:s=[],rules:c=[],helper:d={},onInput:h,onChange:b,onEnter:y}=N,v=io(e,n),x=d.fieldAliasMap;x||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`");const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[K]:v},e,r);a?.then?a.then((()=>{P(!0),t?.()})).catch((()=>{})):!1!==a&&(P(!0),t?.())},T=()=>{Q(!1,(()=>te(f.current)))},I=t=>{lo(e,n,t),m(c,t,a,i),re(e,a,i),b?.({[K]:t},e,S.current),X()},A={visible:R,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${an[u]+20}px`},onClose:()=>{T()}},F={...d,size:u,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:v,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=E;Z(e);const n=S.current.map((e=>({text:e[t],value:e[r]})));q(n),I(n.map((e=>e.value)));const{closed:a}=d;Q(!1,(()=>te(f.current))),a?.(S.current)})(e):T()}};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:v,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&&y?.({[K]:v},e)},onDoubleClick:()=>{o.disabled||C()},onChange:e=>{const{valueKey:t}=E;Z(S.current.filter((r=>e.includes(r[t])))),I(e),w()}},L.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(sr,A,t().createElement(pc,F)))}};return t().createElement(t().Fragment,null,G?(()=>{const{type:e}=N,a=ie[e];if(!a)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!z}];return t().createElement("div",{ref:f,className:Se()(i)},a(n,r),!z&&t().createElement("div",{className:"cell-error"},U||B))})():(()=>{const{extra:e={}}=N,r=Y?oo(n,N.helper.combinedDataIndex):o;return e.disabledColor?t().createElement("span",{style:{color:e.disabledColor}},r):t().createElement(t().Fragment,null,r)})(),W&&t().createElement("i",{className:"cell--sign"}))},js=require("copy-to-clipboard");var Ks=n.n(js);const Vs=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)},Ms=e=>{const{text:r,options:n,showMessage:a=!0,onCopy:i}=e;return Vs(e.children,{onClick:l=>{const o=t().Children.only(e.children),s=Ks()(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)}})};Ms.displayName="QmCopyToClipboard";const zs=Ms;function Us(){return Us=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},Us.apply(this,arguments)}const Bs=t().forwardRef(((r,n)=>{const{tableData:a,flattenColumns:i}=r,{getRowKey:l,tableProps:o,tableRef:c,editableColumns:u,leftFixedColumns:d,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:I,isTreeTable:N,isGroupSubtotal:R,isWebPagination:P,isDragMergeCell:O,setElementStore:A,createTableFullData:F,setSelectionKeys:H,setHighlightKey:k,getStickyLeft:L,getStickyRight:q,scrollXToColumn:_,scrollYToRecord:$,rowInViewport:D,dataChange:j,setPingLeft:K,setPingRight:V,setFullScreen:M,findParentRowKeys:z,getAllChildRowKeys:U,triggerScrollYEvent:B,scrollBottomDebouncer:W}=t().useContext(vl),{height:G,minHeight:Y,maxHeight:X,rowSelection:Q,rowHighlight:Z,treeConfig:re,expandable:ie,stripe:le,summation:se,rowStyle:ce,cellStyle:ue,spanMethod:de,nativeScrollBar:pe,ellipsis:me,showHeader:fe,rowDraggable:ge,onRowClick:be,onRowDblclick:ye,onRowContextmenu:ve,onRowEnter:xe}=o,Ee=t().useRef(null),Te=t().useRef(null),Ie=t().useRef({prevST:0,prevSL:0}),{dragStart:Ne,renderDragPanel:Re,closeDragPanel:Pe}=(()=>{const{tableProps:e,tableRef:r,layout:n,flattenColumns:a,isDragMergeCell:i}=t().useContext(vl),{mergeCells:l=[],onMergeChange:o}=e,[s,c]=t().useState(!1),u=t().useRef(null),d=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(u.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},d.current&&!S(d.current)||(d.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,d=t-a,p=r-i;return d<0&&(d=Math.abs(d),s=l-d,Be(u.current,{left:`${s}px`})),p<0&&(p=Math.abs(p),c=o-p,Be(u.current,{top:`${c+n.headerHeight}px`})),Be(u.current,{width:`${d}px`,height:`${p}px`}),v(s,c,d,p),!1},v=St(((e,t,n,i)=>{const{allTableData:l,scrollYStore:o}=r.current;let s=-1,c=-1,u=-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])&&(u=t),e+n>m&&e+n<m+C(a[t])&&(p=t),m+=C(a[t]);const h={row:s,col:u,rowSpan:c-s+1,colSpan:p-u+1};(0,J.isEqual)(d,h)||(d.current=h,x(s,c,u,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||So.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;d.current=null,m.current={x:t,y:a,disX:t+s-l,disY:a+p-(o+n.headerHeight)},Be(u.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:u,className:`${h}--merge-cell`,onMouseDown:e=>e.stopPropagation()},s&&t().createElement(t().Fragment,null,t().createElement(he,{size:"small",className:"btn cancel",onClick:()=>{if(d.current&&!S(d.current)){const e=g(d.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(d.current&&!S(d.current)){const e=g(d.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,d.current])}f()}},p("qm.table.mergeCell.confirm")))),closeDragPanel:f}})(),Oe={dateFormat:e=>{const t=e?s()(e).format(wl):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(Tl):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(Tl.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(Number(e))?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>so(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 I&&Object.assign(i,{minHeight:"100px"}),Y&&Object.assign(i,{minHeight:ro(Y)-e-r+"px"}),X&&Object.assign(i,{maxHeight:ro(X)-e-r+"px"}),G||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[G,X,Y,I,b]),Fe=t().useMemo((()=>{const{tableBodyWidth:e,gutterWidth:t}=b;return e&&x?e-t:e}),[b,x]),He=t().useMemo((()=>{const{scrollYStore:e}=c.current,{viewportHeight:t,gutterWidth:r}=b;return Math.floor((v?t-r:t)/e.rowHeight)}),[b,v]),[ke,Le]=t().useState([]),qe=Po(),_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,u=r?.map((e=>document.querySelector(e))),d=u?.some((e=>e?.contains(i)))||u?.includes(l);a(!(o||s||c||d))})(t,e)};return n&&(Ve(document,"mousedown",i),Ve(document,"mouseup",l)),()=>{n&&(Me(document,"mousedown",i),Me(document,"mouseup",l))}}),[t]),n}(Ee,[".table-editable__popper"]);t().useImperativeHandle(n,(()=>({renderCellTitle:Je,setClickedValues:Ke,forceUpdate:qe}))),De((()=>{_e&&(Ke([]),O&&Pe())}),[_e]),De((()=>{ke.length&&Ol.focus(c.current.uid)}),[ke]),t().useEffect((()=>{je()}),[]);const $e=t().useCallback((e=>{const{keyCode:t}=e;if(c.current.uid===Ol.getFocusInstance()?.id&&(27===t&&(Ke([]),k(""),M(!1)),ke.length&&(((e,t)=>{if(ee||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1})(document.activeElement,Ee.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&&xe?.(r,e)}if(38===t||40===t){Ue(e);const{allTableData:r}=c.current,n=P?Jl(a):r,i=n.length;let o=n.findIndex((e=>l(e,e.index)===ke[0]));const s=38===t?(--o+i)%i:++o%i,u=n[s],d=l(u,u.index);"radio"!==Q?.type||Q.disabled?.(u)||H([d]),Z&&!Z.disabled?.(u)&&k(d),D(s)||(38===t&&$(d,s),40===t&&$(d,He>s+1?0:s+1-He)),Ke([d,ke[1]])}if(9===t){if(Ue(e),!u.length)return Ke([]);const t=u.length;let r=u.findIndex((e=>e.dataIndex===ke[1]));const n=++r%t,a=u[n].dataIndex;Ke([ke[0],a]),_(a)}}}),[ke,a,E,u,He]);t().useEffect((()=>{const e=_t()(document,"keydown",$e);return()=>e.remove()}),[$e]);const je=()=>{A("$tableBody",Ee.current),A("$tableYspace",Te.current)},Ke=e=>{(0,J.isEqual)(e,ke)||Le(e)},ze=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),We=(e,t,r)=>{const{deriveRowKeys:n}=c.current,a=Zl(n,e);let i=[];const l=U(a?.children||[]),o=bo(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=Zl(n,e),r=ao(i,t?.children?.map((e=>e.rowKey))||[]);i=r?[...i,e]:i.filter((t=>t!==e))})),i},Ge=e=>Array.isArray(e.children)&&e.children.length>0,Ye=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(Xe(e,a,o,r)),ie?.expandedRowRender){const{expandedRowClassName:r,rowExpandable:l=ae}=ie;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?"100px":"50px"}},t().createElement("div",{className:Se()("cell",r)},ie.expandedRowRender(e,a)))))}if(!re?.virtual&&Ge(e)){const t="function"!=typeof ie?.rowExpandable||ie.rowExpandable(e);S.includes(o)&&t&&n.push(...Ye(e.children,r+1))}})),n},Xe=function(e,r,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const l=["body--row",{"body--row-striped":le&&r%2!=0,"body--row-selected":E.includes(n),"body--row-current":C===n,...R?at(e._group):null}];return t().createElement("tr",{key:n,className:Se()(l)},i.map(((t,i)=>Qe(t,i,e,r,n,a))))},Qe=(e,r,n,a,i,o)=>{const{isIE:s}=c.current,{dataIndex:u,fixed:p,align:h,className:g=""}=e,{rowSpan:b,colSpan:y}=tt(n,e,a,r);if(!b||!y)return null;const v=e.ellipsis??me,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[u],"cell-fix-left":x,"cell-fix-right":S,"cell-fix-left-last":x&&d[d.length-1].dataIndex===u,"cell-fix-right-first":S&&m[0].dataIndex===u,[g]:!!g}],w=s?null:{left:x?`${L(u)}px`:"",right:S?`${q(u)}px`:""},T=ce?"function"==typeof ce?ce(n,a):ce:null,I=ue?"function"==typeof ue?ue(n,e,a,r):ue:null,P=R?nt(n._group):null,O=Je(e,n,a,r);return t().createElement("td",{key:u,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,...I},onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([So.expandableColumn,So.operationColumn].includes(n))return;const a=l(t,t.index);Ke([a,n]);const i=r.editRender?.(t,r),o=i&&!i.disabled,{type:s,selectByClickRow:c=!0,disabled:u=ne}=Q||{};!s||u(t)||o||(c||n===So.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=Q||{};if("radio"===r&&H([e]),"checkbox"===r){const r=!E.includes(e),i=N&&!n?We(e,E,r):ze(e,E,r);H(i),a?.(r,t,i)}})(a,t),[So.selectionColumn].includes(n)||(!Z||Z.disabled?.(t)||o||k(a),be?.(t,r,e))})(t,n,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[So.expandableColumn,So.selectionColumn,So.operationColumn].includes(n)||ye?.(t,r,e)})(t,n,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[So.expandableColumn,So.selectionColumn,So.operationColumn].includes(n)||ve?.(t,r,e)})(t,n,e)},t().createElement("div",{className:"cell"},Ze(e,n,a,r,O,i,o)))},Ze=(e,r,n,a,i,l,o)=>{const{dataIndex:s,canCopy:c,editRender:u,render:d}=e,m=io(r,s);if(s===So.expandableColumn)return t().createElement(ks,{record:r,rowKey:l});if(s===So.selectionColumn)return t().createElement(Hs,{selectionKeys:E,column:e,record:r,rowKey:l});const f=et(m,e,r);if(u)return t().createElement(Ds,{column:e,record:r,rowKey:l,columnKey:s,clicked:ke,text:f});const g=d?d(m,r,e,n,a):f;return N&&s===h?[rt(re?.virtual?r._level:o),t().createElement(ks,{key:"expand",record:r,rowKey:l,style:Ge(r)?{}:{visibility:"hidden"}}),g]:c?t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},g),i&&t().createElement(zs,{text:i},t().createElement(we.CopyOutlined,{className:"icon",title:p("qm.table.config.copyText"),onClick:e=>e.stopPropagation()}))):g},Je=(e,t,r,n)=>{const{dataIndex:a,render:i}=e;if([So.expandableColumn,So.selectionColumn,So.operationColumn].includes(a))return"";let l="";const o=io(t,a);if("function"==typeof i){const a=i(o,t,e,r,n);l=te(a)?mo(a).join(""):a}else l=et(o,e,t).toString();return l},et=(e,t,r)=>{const{dictItems:n,precision:a,formatType:i,editRender:l}=t,o=n||l?.(r,t)?.items||[],s=o.find((t=>t.value==e));let c=s?.text??e??"";if(Array.isArray(e)&&(c=e.map((e=>{const t=o.find((t=>t.value==e));return t?.text??e})).join(",")),a>=0&&""!==c&&(c=Number(c).toFixed(a)),i){const e=Oe[`${oe(i)}Format`];e?c=e(c):g("Table","字段的格式化类型 `formatType` 配置不正确")}return c},tt=(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}=tt(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}},rt=e=>e?t().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*So.treeTable.textIndent+"px"}}):null,nt=e=>{const{backgroundColor:t,color:r}=se.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},at=e=>{const t=se.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},it=Ce("table"),lt=O?{onMouseDown:Ne}:null;return t().createElement(t().Fragment,null,t().createElement(Rt,{wrapClassName:`${it}--body-wrapper`,wrapStyle:Ae,native:pe,onScroll:e=>{const{elementStore:t,scrollYLoad:r}=c.current,{prevST:n,prevSL:a}=Ie.current,i=x?b.gutterWidth:0,{scrollTop:l,scrollLeft:o}=e;if(o!==a){fe&&(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&&V(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})}Ie.current.prevST=l,Ie.current.prevSL=o}},t().createElement("div",{ref:Te,className:"body--y-space"}),t().createElement("div",{className:"body--x-space",style:{width:Fe?`${Fe}px`:""}}),t().createElement("table",Us({ref:Ee,className:`${it}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},lt,{style:{width:Fe?`${Fe}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`}})}))),ge?t().createElement(qr.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)})),F(n),j()}},a.map((e=>Xe(e,e.index,l(e,e.index))))):t().createElement("tbody",null,Ye(a)))),O&&Re())}));Bs.displayName="TableBody";const Ws=Bs,Gs=e=>{const{summationRows:r,flattenColumns:n}=e,{getRowKey:a,tableProps:i,tableRef:l,sorter:o,layout:s,scrollY:c,leftFixedColumns:u,rightFixedColumns:d,setElementStore:m,getStickyLeft:h,getStickyRight:f}=t().useContext(vl),{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":!!d.length}],i=e?null:{right:d.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&&u[u.length-1].dataIndex===m,"cell-fix-right-first":!a&&"right"===g&&d[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):io(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 Ys=function(e){return e.small="small",e.middle="default",e.large="default",e}(Ys||{});const Xs=e=>{const{current:r,pageSize:n,total:a,config:i,onChange:o}=e,{global:s}=t().useContext(l),{tableProps:c,$size:u,setElementStore:d}=t().useContext(vl),{infoBarConfig:p}=c,m=t().useRef(null);t().useEffect((()=>{h()}),[]);const h=()=>{d("$pager",m.current)},f=(e,t)=>{o(e,t)},g=i?.showSizeChanger??So.pagination.showSizeChanger,b=i?.showQuickJumper??So.pagination.showQuickJumper,y=i?.pageSizeOptions||s?.table?.pagination?.pageSizeOptions||So.pagination.pageSizeOptions,v={[`${Ce("table")}-pager`]:!0};return t().createElement("div",{ref:m,className:Se()(v)},t().createElement("div",{className:"pager-alert"},"bottom"===p?.position&&t().createElement(Oo,{total:a})),t().createElement(O.Pagination,{size:Ys[u],showSizeChanger:g,showQuickJumper:b,pageSizeOptions:y,current:r,pageSize:n,total:a,onChange:f,onShowSizeChange:f}))},Qs=()=>{const{layout:e}=t().useContext(vl),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(pt,null))};function Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zs.apply(this,arguments)}const Js=t().forwardRef(((e,r)=>{const{rowKey:n,columns:a,loading:i,stripe:o,resizable:s,customClass:c,paginationConfig:u,tablePrint:d,exportExcel:p,infoBarConfig:m,topSpaceAlign:h,showTableInfo:f,showFullScreen:b,showRefresh:y,showToolBox:v,showColumnDefine:x,showHeader:E}=e,{size:S}=t().useContext(l),C=t().useMemo((()=>e.size??S??""),[e.size,S]),w=t().useRef(null),T=t().useRef(null),I=t().useRef(null),N=t().useRef(null),R=t().useRef(null),P=Po(),O=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:A,tableFullData:F,setElementStore:H,setOriginColumns:k,setTableFullData:L,setTableOriginData:q,setAllTableData:_,setDeriveRowKeys:$,setFieldAuth:D,setMergeCells:j,setScrollYStore:K,setScrollYLoad:V,setResizeState:M,setHandleState:z,setSummaries:U,setSelectionRows:B,setShouldToTop:W,setRecordsMap:G,setHandleChange:Y,clearElementStore:X,clearRecordsMap:Q}=((e,r)=>{let{getRowKey:n,$size:a}=r;const i=t().useRef({uid:po(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],fieldAuth:{},mergeCells:[],scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:So.rowHeightMaps[a]},store:new Eo,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,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}`,u={level:i,rowKey:o,rowKeyPath:s,indexPath:c};return e.indexPath=c,e._level=i,e.children&&(u.children=l(e.children,o,s,c,i+1)),t?Object.assign({},u,{parentRowKey:t}):u}))},o=e=>{const t=[];return e.forEach((e=>{e.children?.length?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=Jl(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)&&e.children.length)),i.current.treeTable&&(i.current.deriveRowKeys=l(e,""),i.current.flattenRowKeys=o(i.current.deriveRowKeys))},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)},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:O,$size:C}),{tableData:Z,setTableData:te,filters:re,setFilters:ne,sorter:ae,setSorter:ie,superFilters:le,setSuperFilters:oe,pagination:se,setPagination:ue,selectionKeys:de,setSelectionKeys:pe,rowExpandedKeys:me,setRowExpandedKeys:he,highlightKey:fe,setHighlightKey:ge,layout:be,setLayout:ye,permission:ve,setPermission:xe,spinning:Ee,setSpinning:we,scrollX:Te,setScrollX:Ie,scrollY:Ne,setScrollY:Re,isPingLeft:Pe,setPingLeft:Oe,isPingRight:Ae,setPingRight:Fe,isFullScreen:He,setFullScreen:ke}=(e=>{const{nativeScrollBar:r,initialSorter:n={},initialFilter:a={},paginationConfig:i,rowSelection:o,expandable:s,rowHighlight:c}=e,{global:u}=t().useContext(l),d={current:So.pagination.current,pageSize:i?.pageSize??u?.table?.pagination?.pageSize??So.pagination.pageSize,total:0},p=o?.selectedRowKeys??o?.defaultSelectedRowKeys??[],m=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[h,f]=t().useState([]),[g,b]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),a),[y,v]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),n),[x,E]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),[]),[S,C]=t().useState(d),[w,T]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),p),[I,N]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),m),[R,P]=t().useState(c?.currentRowKey??""),[O,A]=t().useState({gutterWidth:r?wo():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}),[k,L]=t().useState(!1),[q,_]=t().useState(!1),[$,D]=t().useState(!1),[j,K]=t().useState(!1),[V,M]=t().useState(!1),[z,U]=t().useState(!1);return{tableData:h,setTableData:f,filters:g,setFilters:b,sorter:y,setSorter:v,superFilters:x,setSuperFilters:E,pagination:S,setPagination:C,selectionKeys:w,setSelectionKeys:T,rowExpandedKeys:I,setRowExpandedKeys:N,highlightKey:R,setHighlightKey:P,layout:O,permission:F,setPermission:H,setLayout:A,spinning:k,setSpinning:L,scrollX:q,setScrollX:_,scrollY:$,setScrollY:D,isPingLeft:j,setPingLeft:K,isPingRight:V,setPingRight:M,isFullScreen:z,setFullScreen:U}})(e),{isFetch:Le,isWebPagination:qe,isScrollPagination:_e,showPagination:$e,shouldUpdateHeight:je,tableColumns:Ke,flattenColumns:Ve,editableColumns:Me,summationColumns:ze,leftFixedColumns:Ue,rightFixedColumns:Be,treeExpandIndex:We,showSummary:Ge,showFooter:Ye,isHeadGroup:Xe,bordered:Qe,isHeadSorter:Ze,isHeadFilter:Je,isServiceSummation:et,isSelectCollection:tt,isTableImport:rt,isTableClipboard:nt,isSuperSearch:at,isFastSearch:it,isGroupSummary:lt,isGroupSubtotal:ot,isDragMergeCell:st,isTreeTable:ct,isTableEmpty:ut,summationRows:dt,fetchParams:pt}=Io(e,{getRowKey:O,tableRef:A,tableFullData:F,tableData:Z,sorter:ae,filters:re,superFilters:le,pagination:se}),{createElementStore:mt,tableStyles:ft,getSpan:gt,getStickyLeft:bt,getStickyRight:yt,scrollXToColumn:vt,scrollYToRecord:xt,rowInViewport:Et,calcTableHeight:St,resetTableScroll:Ct,doLayout:wt}=Ro(e,{getRowKey:O,tableRef:A,$size:C,tableColumns:Ke,flattenColumns:Ve,leftFixedColumns:Ue,layout:be,scrollY:Ne,tableData:Z,showFooter:Ye,showPagination:$e,isWebPagination:qe,isFullScreen:He,setLayout:ye,setScrollX:Ie,setScrollY:Re,setElementStore:H,setScrollYStore:K,setShouldToTop:W}),{initialTable:Tt,createTableFullData:It,getTableData:Nt,handleTableData:Rt,createTableData:Pt,createGroupData:Ot,createSelectionKeys:At,createSelectionRows:Ft,createRowExpandedKeys:Ht,findParentRowKeys:kt,getAllChildRowKeys:Lt,doFieldValidate:qt,getTableLog:_t,dataChange:$t,tableChange:Dt,toLastPage:jt,toFirstPage:Kt,getPageCount:Vt,pagerChangeHandle:Mt,triggerScrollYEvent:zt,scrollBottomDebouncer:Ut,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearRowSelection:Yt,clearRowHighlight:Xt,clearTableLog:Qt,destroy:Zt}=No(e,{getRowKey:O,tableRef:A,tableElementRef:T,tableBodyRef:I,$size:C,tableColumns:Ke,tableFullData:F,pagination:se,layout:be,filters:re,sorter:ae,superFilters:le,fetchParams:pt,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,summationColumns:ze,shouldUpdateHeight:je,isFetch:Le,isTreeTable:ct,isWebPagination:qe,isScrollPagination:_e,isServiceSummation:et,isGroupSubtotal:ot,doLayout:wt,setTableData:te,setTableFullData:L,setTableOriginData:q,setAllTableData:_,setDeriveRowKeys:$,setPagination:ue,setSpinning:we,setSorter:ie,setFilters:ne,setSuperFilters:oe,setSelectionKeys:pe,setRowExpandedKeys:he,setHighlightKey:ge,setSelectionRows:B,setScrollYLoad:V,setScrollYStore:K,setFieldAuth:D,setResizeState:M,setSummaries:U,setPermission:xe,setRecordsMap:G,resetTableScroll:Ct,clearElementStore:X,clearRecordsMap:Q});((e,r)=>{const{columns:n,summation:a,rowSelection:i,expandable:l,rowHighlight:o,mergeCells:s=[]}=e,{tableRef:c,topElementRef:u,tableElementRef:d,tableBodyRef:p,resizableBarRef:m,$size:h,scrollX:f,pagination:b,selectionKeys:y,rowExpandedKeys:v,highlightKey:x,summationRows:E,summationColumns:S,showSummary:C,isWebPagination:w,isScrollPagination:T,isTreeTable:I,toLastPage:N,toFirstPage:R,getPageCount:P,setHandleState:O,scrollYToRecord:A,setSelectionKeys:F,setOriginColumns:H,setSelectionRows:k,setRowExpandedKeys:L,setHighlightKey:q,setResizeState:_,setMergeCells:$,setPingRight:D,setHandleChange:j,calcTableHeight:K,createSelectionKeys:V,createSelectionRows:M,createRowExpandedKeys:z,createElementStore:U,triggerScrollYEvent:B,forceUpdate:W,initialTable:G,destroy:Y}=r,{elementStore:X,handleState:Q,scrollYLoad:Z}=c.current,ee=t().useRef(E);De((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&p.current.setClickedValues(y.length?[y[0],""]:[]),k(M(y)),c.current.isHandleChange&&e?.(y,c.current.selectionRows),j(!0),C&&S.some((e=>e.summation.sumBySelection))&&W()}),[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;I&&L(z()),o&&(p.current.setClickedValues(x?[x,""]:[]),o.onChange?.(x,e[t.findIndex((e=>e===x))]??null))}),[x]),De((()=>{(0,J.isEqual)(E,ee.current)||(ee.current=E,C&&a&&a.onChange?.(E))}),[E]),De((()=>{const e=V(i.selectedRowKeys);(0,J.isEqual)(e,y)||(F(e),I&&L(z()))}),[i?.selectedRowKeys]),De((()=>{const e=z(l.expandedRowKeys);(0,J.isEqual)(e,v)||L(e)}),[l?.expandedRowKeys]),De((()=>{const{currentRowKey:e}=o;e!==x&&q(e??"")}),[o?.currentRowKey]),De((()=>{const{insert:e,remove:t}=Q;e&&(w&&("after"===e?N():R()),A("","after"===e?1e5:0)),t&&b.current>P()&&N(),(e||t)&&O({insert:null,remove:!1})}),[b.total]),De((()=>{Z&&B(X.$tableBody.parentNode.parentNode.scrollTop)}),[Z]),De((()=>{D(f)}),[f]),De((()=>{K()}),[h]),De((()=>{$(s),p.current.forceUpdate()}),[s]),De((()=>{Z&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),T&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Z,T]);const te=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(_(Object.assign({},e,{winHeight:r})),K())};t().useEffect((()=>(U({$toper:u.current,$table:d.current,$resizableBar:m.current}),H(ce(n)),G(),$(s),window.addEventListener("resize",te,!1),K(),()=>{Y(),window.removeEventListener("resize",te)})),[])})(e,{tableRef:A,topElementRef:w,tableElementRef:T,tableBodyRef:I,resizableBarRef:R,$size:C,scrollX:Te,pagination:se,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,showSummary:Ge,summationRows:dt,summationColumns:ze,isWebPagination:qe,isScrollPagination:_e,isTreeTable:ct,toLastPage:jt,toFirstPage:Kt,getPageCount:Vt,setHandleState:z,scrollYToRecord:xt,setOriginColumns:k,setSelectionKeys:pe,setSelectionRows:B,setRowExpandedKeys:he,setHighlightKey:ge,setResizeState:M,setMergeCells:j,setPingRight:Fe,setHandleChange:Y,calcTableHeight:St,createSelectionKeys:At,createSelectionRows:Ft,createRowExpandedKeys:Ht,createElementStore:mt,triggerScrollYEvent:zt,forceUpdate:P,initialTable:Tt,destroy:Zt});const Jt=t().useMemo((()=>({getRowKey:O,tableProps:e,tableRef:A,tableBodyRef:I,$size:C,flattenColumns:Ve,editableColumns:Me,leftFixedColumns:Ue,rightFixedColumns:Be,treeExpandIndex:We,sorter:ae,filters:re,superFilters:le,layout:be,bordered:Qe,showFooter:Ye,showSummary:Ge,summationRows:dt,scrollX:Te,scrollY:Ne,pagination:se,fetchParams:pt,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,isFetch:Le,isPingLeft:Pe,isPingRight:Ae,isHeadSorter:Ze,isHeadFilter:Je,isFullScreen:He,isTableEmpty:ut,isHeadGroup:Xe,isTreeTable:ct,isGroupSubtotal:ot,isWebPagination:qe,isDragMergeCell:st,dataChange:$t,tableChange:Dt,getTableData:Nt,setElementStore:H,createTableFullData:It,setSorter:ie,setFilters:ne,setSuperFilters:oe,setSelectionKeys:pe,setHighlightKey:ge,setRowExpandedKeys:he,setSelectionRows:B,getSpan:gt,getStickyLeft:bt,getStickyRight:yt,scrollXToColumn:vt,scrollYToRecord:xt,rowInViewport:Et,setPagination:ue,setPingLeft:Oe,setPingRight:Fe,setSpinning:we,setFullScreen:ke,setShouldToTop:W,doFieldValidate:qt,createTableData:Pt,createGroupData:Ot,findParentRowKeys:kt,getAllChildRowKeys:Lt,triggerScrollYEvent:zt,scrollBottomDebouncer:Ut,resetTableScroll:Ct,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearRowSelection:Yt,clearRowHighlight:Xt})),[e,C,Ve,Me,Ue,Be,We,ae,re,le,be,Qe,Ye,Ge,dt,Te,Ne,se,pt,de,me,fe,Le,Pe,Ae,Ze,Je,He,ut,Xe,ct,ot,qe,st]);((e,r)=>{const{getRowKey:n,tableProps:a,tableRef:i,toolBoxRef:l,flattenColumns:o,editableColumns:s,pagination:c,fetchParams:u,selectionKeys:d,rowExpandedKeys:p,highlightKey:m,isFetch:h,dataChange:f,getTableData:b,handleTableData:y,createTableData:v,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:S,doFieldValidate:C,setHandleState:w,setSelectionKeys:T,setRowExpandedKeys:I,setHighlightKey:N,setSelectionRows:R,setOriginColumns:P,setHandleChange:O,forceUpdate:A,getTableLog:F,clearRowSelection:H,clearRowHighlight:k,clearTableSorter:L,clearTableFilter:q,clearSuperFilters:_,clearTableLog:$}=r,{columns:D,columnsChange:j}=a,K=(e,t,r)=>{for(let a=0;a<e.length;a++){const i=e[a],l=n(i,i.index);Array.isArray(i.children)&&K(i.children,t,r),t.includes(l)&&(r?.(i,l),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:async e=>{h&&(await b(),e?.())},GET_LOG:()=>F(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(c).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{h||(H(),k(),L(),q(),_(),$(),v([]))},CLEAR_LOG:()=>{$()},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{S(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,J.isEqual)(e,d)&&O(!1),T(e)},SET_HIGHLIGHT:e=>{N(e)},SET_EXPANDABLE:e=>{I(e)},SET_SELECTION_ROWS:e=>{R(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{P(e)},SET_TABLE_COLUMN:(e,t,r)=>{const n=Gl(D,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&&(j?j([...D]):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=>{o.forEach((t=>{const{dataIndex:r}=t;[So.expandableColumn,So.selectionColumn,So.operationColumn].includes(r)||lo(e,r,io(e,r))})),r.addToInserted(e)}));const s="before"===t?.mode,c=void 0===t?.parentRowKey;let u=a;if(c)u=s?[...l,...u]:u.concat(l);else{const e=yo(a,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?s?e.children.unshift(...l):e.children.push(...l):e.children=l)}v(u),c&&w(Object.assign({},i.current.handleState,{insert:s?"before":"after"})),f()},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;K(r,a,((e,r)=>{t.addToRemoved(e),s.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&&(v(r),T(d.filter((e=>!a.includes(e)))),a.includes(m)&&k(),I(p.filter((e=>!a.includes(e)))),w(Object.assign({},i.current.handleState,{remove:!0})),f())},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((r=>{s.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:u}=o;!u&&c.length&&C(c,io(r,i),s,i)}))}));const{required:r,validate:a}=F(),l=[...r,...a];return l.length&&S(l[0].rowKey),A(),{required:r,validate:a}}})))})(r,{getRowKey:O,tableProps:e,tableRef:A,toolBoxRef:N,flattenColumns:Ve,editableColumns:Me,pagination:se,fetchParams:pt,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,isFetch:Le,dataChange:$t,getTableData:Nt,handleTableData:Rt,createTableData:Pt,calcTableHeight:St,scrollXToColumn:vt,scrollYToRecord:xt,doFieldValidate:qt,setHandleState:z,setSelectionKeys:pe,setRowExpandedKeys:he,setHighlightKey:ge,setSelectionRows:B,setOriginColumns:k,setHandleChange:Y,forceUpdate:P,getTableLog:_t,clearRowSelection:Yt,clearRowHighlight:Xt,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearTableLog:Qt}),t().useEffect((()=>{Ol.register(A.current.uid,r??{current:null})}),[]);const er=Ce("table"),tr={[`${er}--wrapper`]:!0,[`${er}--lg`]:"large"===C,[`${er}--sm`]:"small"===C,[`${er}--maximize`]:He,[c]:!!c},rr={[er]:!0,"is--border":Qe,"is--striped":o,"is--fixed":Ue.length||Be.length,"is--sortable":Ze,"is--filterable":Je,"is--head-group":Xe,"is--merge-cell":st,"is--empty":ut,"show--head":E,"show--foot":Ye,"ping--left":Pe,"ping--right":Ae,"scroll--x":Te,"scroll--y":Ne};return t().createElement(vl.Provider,{value:Jt},t().createElement("div",{className:Se()(tr)},f&&t().createElement("div",{ref:w,className:`${er}-top`},t().createElement("div",{className:`${er}-top__space`},"bottom"!==m?.position&&t().createElement(Oo,{total:se.total}),t().createElement("div",{className:`${er}-top__space-slot`,style:{justifyContent:Rl[h]}},e.children)),t().createElement("div",{className:`${er}-top__actions`},t().createElement(Ss,{ref:N,showFullScreen:b,showReload:y&&Le,showPrint:ve.print&&!!d,showImport:ve.import&&rt,showExport:ve.export&&!!p,showClipboard:nt,showCollection:tt,showFastSearch:it,showSuperSearch:at,showGroupSummary:lt,showToolBox:v,tableColumns:Ke}),x&&t().createElement(Cs,{columns:a}))),t().createElement(ht,{spinning:i??Ee},t().createElement("div",{ref:T,className:Se()(rr),style:ft},t().createElement("div",{className:`${er}--main-wrapper`},E&&t().createElement(Fs,{tableColumns:Ke,flattenColumns:Ve,sorter:ae,filters:re}),t().createElement(Ws,{ref:I,tableData:Z,flattenColumns:Ve}),Ye&&t().createElement(Gs,{summationRows:dt,flattenColumns:Ve})),Qe&&t().createElement("div",{className:`${er}--border-line`}),ut&&t().createElement(Qs,null),s&&t().createElement("div",{ref:R,className:`${er}--resizable-bar`}))),$e&&t().createElement(Xs,Zs({},se,{config:u,onChange:(e,t)=>Mt({current:e,pageSize:t})}))))}));Js.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},Js.displayName="QmTable";const ec=Js,tc=ec;function rc(){return rc=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},rc.apply(this,arguments)}const nc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},onClose:u}=e,{size:d}=t().useContext(l),m=t().useMemo((()=>e.size??d??""),[e.size,d]),h=t().useRef(null),f=t().useRef(null),g=t().useRef(null),b=Et(h),[y,v]=t().useState(c),[x,E]=t().useState(),[S,C]=t().useState(o),[w,T]=t().useState(!1),[I,N]=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||[]]),[F,H]=t().useState((0,J.merge)({},c.fetch?.params,a)),[k,L]=t().useState([]),q=()=>{const e=h.current,t=e.querySelector(".form-wrap");N(e.offsetHeight-t.offsetHeight-2*an[m]-30)},_=St(q,5);De((()=>{_()}),[b.width]),De((()=>{(0,J.isEqual)(s,R)||P(s)}),[s]),t().useEffect((()=>{$()}),[F]),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:n,beforeFetch:a=ae}=t;if(a(F)){T(!0);try{const e=await r(F);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[];L(t)}}catch(e){}T(!1)}},D=e=>{n||(E(e),u(e))},j=e=>{H(Object.assign({},F,e))},K=Ce("search-helper"),V=y.webPagination?{dataSource:k,loading:w,webPagination:!0}:{fetch:{...y.fetch,params:F}};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(tc,rc({ref:g,uniqueKey:r,height:I,columns:O,rowKey:y.rowKey||"pageIndex"},V,{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:`${an[m]+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:!x,onClick:()=>u(x,n?S:void 0)},p("qm.dialog.confirm"))))};nc.displayName="SearchHelper";const ac=nc;function ic(){return ic=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ic.apply(this,arguments)}const lc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...lc(e.children)),e.children&&t.push(e.value)})),t},oc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=oc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},sc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&sc(e.children,t),t(e)||e.children&&e.children.length))),cc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:u={},onClose:d}=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=Et(f),[x,E]=t().useState(c),[S,C]=t().useState(),[w,T]=t().useState(o),[I,N]=t().useState(!1),[R,P]=t().useState(300),[A,F]=t().useState(300),[H,k]=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),F(e.offsetHeight-t.offsetHeight-2*an[h]-30)},V=St(K,5);De((()=>{V()}),[v.width]),De((()=>{(0,J.isEqual)(s,H)||k(s)}),[s]),t().useEffect((()=>{M()}),[_]),t().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&b.current?.SET_FIELDS_VALUE(a),te()}),[]);const M=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=ae}=t;if(a(_)){N(!0);try{const e=await r(_);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[];j(t)}}catch(e){}N(!1)}},z=e=>{n||(C(e),d(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(lc(B))}),[B]);const te=async()=>{if(!u.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=u.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=Pr(e,n,a);W(t),Z.current=t,ee.current=e}}catch(e){}},re=e=>`${e}|${Na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ne=Ce("tree-table-helper"),ie=x.webPagination?{dataSource:D,loading:I,webPagination:!0}:{fetch:{...x.fetch,params:_}};return t().createElement("div",{ref:f,className:`${ne}--wrapper`},t().createElement(rt,{defaultValue:200,style:{height:"100%"}},t().createElement(rt.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=sc(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"}=u.fetch;(e=>{if(!u.tableParamsMap)return g("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof u.tableParamsMap?u.tableParamsMap():u.tableParamsMap,r={};for(const n in t)r[n]=(0,J.get)(e,t[n]);U(r)})(oc(ee.current,(r=>(0,J.get)(r,t)===e[0]))||{})}})),t().createElement(rt.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},H.length?t().createElement(Ii,{ref:b,items:H,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(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(tc,ic({ref:y,uniqueKey:r,height:A,columns:L,rowKey:x.rowKey||"pageIndex"},ie,{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:`${an[h]+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:!S,onClick:()=>d(S,n?w:void 0)},p("qm.dialog.confirm"))))};cc.displayName="TreeTableHelper";const uc=cc,dc=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,u]=t().useState(),[d]=t().useState(n.fetch?.params),m=Ce("tree-helper"),h=n.fetch?{...Z()(n.fetch,["params","valueKey","textKey"]),params:d}:void 0;return t().createElement("div",{className:`${m}--wrapper`},t().createElement(yl,{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=>u(e),onCheckChange:e=>u(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${an[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"))))};dc.displayName="TreeHelper";const pc=dc;function mc(){return mc=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},mc.apply(this,arguments)}const hc="_startSign",fc="_endSign",gc=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]),u=t().useRef(null),d=t().useRef(null),m=t().useRef(null),h=Et(u),[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,I]=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:hc,width:80,align:"right",render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:fc,fixed:"right",width:80,render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)}]),[N,R]=t().useState((0,J.merge)({},i.fetch?.params,n)),[P,A]=t().useState([]),F=t().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),H=t().useMemo((()=>2===F.length&&F.every((e=>void 0!==e))),[F]),k=()=>{const e=u.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*an[c]-30)},L=St(k,5);De((()=>{L()}),[h.width]),De((()=>{(0,J.isEqual)(a,C)||w(a)}),[a]),t().useEffect((()=>{q()}),[N]);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(N)){y(!0);try{const e=await r(N);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,hc),_(e,fc))})),x([])},D=e=>{$(),R(Object.assign({},N,e))},j=Ce("range-helper"),K=f.webPagination?{dataSource:P,loading:b,webPagination:!0}:{fetch:{...f.fetch,params:N}};return t().createElement("div",{ref:u,className:`${j}--wrapper`},t().createElement("div",{className:"form-wrap"},C.length?t().createElement(Ii,{ref:d,items:C,initialValues:n,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>k(),onFinish:e=>D(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||D(t)}}):null),t().createElement("div",null,t().createElement(tc,mc({ref:m,height:E,columns:T,rowKey:f.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=F[0]&&e.pageIndex<=F[1]?{backgroundColor:"#f5f5f5"}:{}},K,{columnsChange:e=>I(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[hc,fc].includes(r)&&(r===hc&&(e[r]?(_(e,r),x([void 0,v[1]])):e.pageIndex>F[1]?O.message.warning(p("qm.searchHelper.rangeStartTip")):(v[0]&&_(v[0],r),e[r]="[",x([e,v[1]]))),r===fc&&(e[r]?(_(e,r),x([v[0],void 0])):e.pageIndex<F[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===F[0]&&(e[hc]="["),e.pageIndex===F[1]&&(e[fc]="]")}))}}),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:`${an[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:!H,onClick:()=>o(v.map((e=>(e=>{const t={};for(const r in e)[hc,fc].includes(r)||(t[r]=e[r]);return t})(e))))},p("qm.dialog.confirm"))))};gc.displayName="RangeTableHelper";const bc=gc,yc={previewWidth:1100,defaultDistance:.45,logoHeight:60},vc=(0,e.createContext)(void 0);var xc=null;function Ec(){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 Sc(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(Ec()){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:xc?r=xc:((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),xc=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&Ec(),r}catch(e){O.message.error("getLodop 出错:"+e)}}Ec();const Cc=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)},wc=t().forwardRef(((e,r)=>{const{templateRender:n,directPrint:a}=e,{global:i}=t().useContext(l),{$$preview:o}=t().useContext(vc),{state:s,isWindowsPrinter:c,pageSize:u}=o,d=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:H,createPrintHtml:F,SHOW_PREVIEW:k,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=d.current.querySelector(".origin-template").children[0],p.current.previewEl=d.current.querySelector(".workspace")}),[]);const v=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*yc.defaultDistance+10*yc.defaultDistance:0;return("vertical"===e?u[0]:u[1])-t}),[s,c,u]),x=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*yc.defaultDistance+10*yc.defaultDistance:0;return("vertical"===e?u[1]:u[0])-t}),[s,c,u]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Cc(v-10*(e.left-yc.defaultDistance)-10*(e.right-yc.defaultDistance))}),[s,v]),S=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Cc(x-10*(e.top-yc.defaultDistance)-10*(e.bottom-yc.defaultDistance))}),[s,x]),C=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:Cc(10*e.left),right:Cc(10*e.right),top:Cc(10*e.top),bottom:Cc(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=yc.previewWidth-i<=0?0:(yc.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>yc.previewWidth?0:l>0?o:(yc.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]),I=(m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=i?.print?.leftLogo??"",t=i?.print?.rightLogo??"";return[`<tr style="height: ${yc.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("")}),N=()=>{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=N().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([N(),I(),...m.current]);const r=e.fixedLogo?S-yc.logoHeight:S;let n=[];if(f.current=[],"stylus"===t)f.current.push([N(),...e.fixedLogo?[I()]:[],...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+=yc.logoHeight),t+=o,t<=r?n.push(l):(f.current.push([N(),...e.fixedLogo?[I()]:[],...n]),n=[],t=0,a-=1),a===i-1&&n.length&&f.current.push([N(),...e.fixedLogo?[I()]:[],...n])}}e.fixedLogo||f.current[0]?.splice(1,0,I());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},F=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},H=()=>{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>"+I()+N()+e.join("")+"</table>"},k=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(F()),await ie(0),o.doClose()},q=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},_={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:d,className:Se()(_)},t().createElement(ht,{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}))))}));wc.displayName="Container";const Tc=wc;function Ic(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 Nc extends e.Component{constructor(){super(...arguments),Ic(this,"formRef",t().createRef()),Ic(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:yc.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:yc.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:yc.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:yc.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),Ic(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})})),Ic(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")}))),Ic(this,"state",{formList:this.createFormList()}),Ic(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())})),Ic(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"))))}}Ic(Nc,"contextType",l);const Rc=Nc;function Pc(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 Oc extends e.Component{constructor(){super(...arguments),Pc(this,"provide",{$$preview:this}),Pc(this,"containRef",t().createRef()),Pc(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:yc.defaultDistance,right:yc.defaultDistance,top:yc.defaultDistance,bottom:yc.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Pc(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Pc(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Pc(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 cs().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Pc(this,"doClose",(()=>{this.props.onClose?.()})),Pc(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){}})),Pc(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Pc(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 ')),Pc(this,"doPrint",(e=>{const t=Sc();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}=yc,{left:u,right:d,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*(u-c)+"mm",`RightMargin: ${10*(d-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()})),Pc(this,"doExport",(e=>{const t=Sc();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=Sc(),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 cs().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(e)&&await cs().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})}},u={[s]:!0};return e?t().createElement(t().Fragment,null,t().createElement("div",{className:Se()(u)},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(vc.Provider,{value:this.provide},t().createElement(Tc,{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(sr,c,t().createElement(Rc,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(vc.Provider,{value:this.provide},t().createElement(Tc,{ref:this.containRef,templateRender:r,directPrint:!0}))}}Pc(Oc,"contextType",l);const Ac=Oc;function Fc(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 Hc extends e.Component{constructor(){super(...arguments),Fc(this,"previewRef",t().createRef()),Fc(this,"state",{visible:!1,loading:!1}),Fc(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})})),Fc(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:`${yc.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(sr,o,t().createElement(Ac,s)):e?t().createElement(Ac,s):null})),Fc(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())}}Fc(Hc,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:i().elementType}),Fc(Hc,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),Fc(Hc,"contextType",l);const kc=Hc,Lc=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],qc=e=>({_s:e,status:Lc[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),_c=e=>e?6:5,$c=(e,t,r,n,a)=>{clearTimeout(n.current);const i=qc(e);t(i),r.current=i,a?.({current:i})},Dc=r=>{const{name:n,in:a,timeout:i,preEnter:l=!0,preExit:o}=r,s=t().useRef(!1),[c,u]=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:u}=t||{},[d,p]=(0,e.useState)((()=>qc(o?2:_c(s)))),m=(0,e.useRef)(d),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 _c(t)}})(m.current._s,c);e&&$c(e,p,m,h,u)}),[u,c]),y=(0,e.useCallback)((e=>{const t=e=>{switch($c(e,p,m,h,u),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:_c(c))}),[b,u,r,n,a,i,f,g,c]);return(0,e.useEffect)((()=>()=>clearTimeout(h.current)),[]),[d,y,b]}({timeout:i,preEnter:l,preExit:o,initialEntered:a});return t().useLayoutEffect((()=>{s.current?u():s.current=!0}),[a]),t().createElement(t().Fragment,null,t().Children.map(r.children,(e=>t().isValidElement(e)?Vs(e,{className:Se()(e.props.className,n,c.status)}):e)))},jc="1.7.19"})(),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:()=>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:()=>_,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:()=>Bt,QmButton:()=>he,QmCollapse:()=>$e,QmConfigProvider:()=>X,QmCopyToClipboard:()=>zs,QmCountup:()=>st,QmCropper:()=>Qi,QmDivider:()=>Ne,QmDownload:()=>Lt,QmDrawer:()=>rr,QmEmpty:()=>pt,QmForm:()=>Ii,QmModal:()=>sr,QmPrint:()=>kc,QmRangeTableHelper:()=>bc,QmScrollbar:()=>Rt,QmSearchHelper:()=>ac,QmSearchTree:()=>yl,QmSpace:()=>xe,QmSpin:()=>ht,QmSplit:()=>rt,QmTable:()=>tc,QmTabs:()=>Zt,QmTinymce:()=>Bi,QmTransition:()=>Dc,QmTreeHelper:()=>pc,QmTreeTableHelper:()=>uc,QmUploadFile:()=>tl,QmUploadImg:()=>sl,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:()=>V,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:()=>Na,version:()=>jc});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:"结束位置不能小于起始位置"},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 u=c;function d(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=u;for(let e=0,t=l.length;e<t;e++){if(i=o[l[e]],e===t-1)return d(i,a);if(!i)return"";o=i}return""},m=e=>{u=e||u,u.name&&s().locale(u.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 I=require("dayjs/plugin/weekOfYear");var N=n.n(I);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(N()),s().extend(P());const O=require("antd"),A=require("rc-picker/es/generate/dayjs");var F=n.n(A);const H=require("antd/es/calendar/generateCalendar");var k=n.n(H);require("antd/es/calendar/style");const L=k()(F()),q=require("antd/es/date-picker/generatePicker");var $=n.n(q);require("antd/es/date-picker/style/index");const _=$()(F());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 V=j,M={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"},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={[M.name]:{qm:M,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},ue=e=>(0,J.isNumber)(e)?`${e}px`:e.toString();function de(){return de=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},de.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,de({},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 Ie 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||"",u=Ce("divider"),d={[u]:!0,[`${u}--lg`]:"large"===c,[`${u}--sm`]:"small"===c};return t().createElement("div",{id:s,className:Se()(d,l),style:o},t().createElement("span",{className:Se()(`${u}__title`)},r),t().createElement("div",{className:Se()(`${u}__extra`)},n),void 0!==a&&t().createElement(O.Button,{type:"link",className:Se()(`${u}__collapse`),disabled:i,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}Te(Ie,"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(Ie,"contextType",l);const Ne=Ie,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 Fe=n.n(Ae);const He=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 u=Ce("collapse");return t().createElement("div",{ref:r,className:Se()(`${u}-content`,{[`${u}-content-active`]:o,[`${u}-content-inactive`]:!o},a),style:i},t().createElement("div",{className:`${u}-content-box`,style:l},e.children))}));He.displayName="PanelContent";const ke=He;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:u=!1,onChange:d}=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(Ne,{label:n,extra:a,collapse:p,disabled:s,onCollapseChange:e=>{m(e),d?.(e)}}),t().createElement(Fe(),Le({visible:p},Oe,{leavedClassName:`${h}-content-hidden`,forceRender:c,removeOnLeave:u}),((r,n)=>{let{className:a,style:i}=r;return t().createElement(ke,{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){const n=e.useRef(!1);e.useEffect((()=>{n.current?t():n.current=!0}),r)}const je=require("react-draggable");var Ke=n.n(je);const Ve=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Me=(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=>{const{minValues:r,onDragChange:n,onDragging:a}=e,{splitRef:i,direction:l}=t().useContext(_e),[o,s]=t().useState(),[c,u]=t().useState(0),d="vertical"===l?"y":"x",m={[`${Ce("split")}__resize-bar`]:!0,vertical:"vertical"===l,horizontal:"horizontal"===l};return t().createElement(Ke(),{bounds:o,axis:d,position:{x:0,y:0},positionOffset:{[d]:-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)=>{u(t[d]),a(t[d])},onStop:()=>n(!1)},t().createElement("div",{className:Se()(m),title:p("qm.split.resize")}))};Xe.displayName="ResizeBar";const Qe=Xe,Ze=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},u=void 0!==n?{[s]:ue(n)}:{flex:1,[s]:0};return t().createElement("div",{ref:r,className:Se()(c),style:{...u,...i}},e.children)}));Ze.displayName="QmSplitPane";const Je=Ze;function et(){return et=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},et.apply(this,arguments)}const tt=e=>{const{direction:r="horizontal",defaultValue:n="50%",uniqueKey:a,className:i,style:o,onDragStart:s,onDrag:c=ne,onDragEnd:u}=e,{global:d}=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))):(u?.(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=d?.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=d?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},I=t().useMemo((()=>({splitRef:p,direction:r,dragging:y})),[r,y]),N=[];t().Children.map(e.children,(e=>{te(e)&&!re(e)&&"QmSplitPane"===e.type?.displayName&&N.push(e)}));const[R,P]=N,O=t().useMemo((()=>[g(R),g(P)]),[R,P]),A={[Ce("split")]:!0,vertical:"vertical"===r};return t().createElement(_e.Provider,{value:I},t().createElement("div",{ref:p,className:Se()(A,i),style:o},t().createElement(Je,et({},R.props,{ref:m,offset:x})),t().createElement(Qe,{minValues:O,onDragChange:e=>v(e),onDragging:e=>{const t=S.current+e;E(`${t}px`),c(t)}}),t().createElement(Je,P.props)))};tt.Pane=Je,tt.displayName="QmSplit";const rt=tt,nt=require("react-countup");var at=n.n(nt);function it(){return it=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},it.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 ot 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(at(),it({},this.props,{className:Se()(l,r),style:n}),this.props.children)}}lt(ot,"defaultProps",{duration:2}),lt(ot,"contextType",l);const st=ot;function ct(){return ct=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},ct.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 dt 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,ct({},i,{className:Se()(l,r)}))}}ut(dt,"contextType",l),ut(dt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const pt=dt;class mt 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}(mt,"defaultProps",{tip:"Loading...",fullHeight:!1});const ht=mt,ft=t().createContext(void 0),gt=require("resize-observer-polyfill");var bt=n.n(gt);const yt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},vt=function(e,t){!ee&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(bt())(yt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},xt=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function Et(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&&vt(e,r),()=>{e&&xt(e,r)}}),[t]),r}function St(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 Ct=6,wt={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"}},Tt=e=>{const{thumb:r,always:n,barSize:a=Ct,direction:i="vertical",onDrag:l=ne}=e,{dragging:o,scrollbarElement:s,wrapElement:c}=t().useContext(ft),u=wt[i],d=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((()=>{d.current=r}),[r]),t().useEffect((()=>{const e=s.current;return Ve(e,"mousemove",C),Ve(e,"mouseleave",w),()=>{S(),Me(document,"mouseup",E),Me(e,"mousemove",C),Me(e,"mouseleave",w)}}),[]);const x=e=>{if(!p.current||!m.current)return;if(!f.current)return;const t=h.current[u.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[u.direction]-e[u.client])-(m.current[u.offset]-t))/p.current[u.offset];c.current[u.scroll]=r*c.current[u.scrollSize]/100,l(!0)},E=()=>{f.current=!1,h.current={[u.axis]:0},Me(document,"mousemove",x),Me(document,"mouseup",E),S(),g.current&&v(!1),l(!1)},S=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},C=()=>{g.current=!1,v(!!d.current.size)},w=()=>{g.current=!0,v(f.current)},T=Ce("scrollbar"),I={[`${T}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},N={[u.reverse]:a},R={[u.size]:r.size,transform:`translate${u.axis}(${r.offset}%)`};return t().createElement(Dc,{name:"fade",in:n||o||y,timeout:300},t().createElement("div",{ref:p,className:Se()(I),style:N},t().createElement("div",{ref:m,className:`${T}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),Ve(document,"mousemove",x),Ve(document,"mouseup",E),f.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},It=20,Nt=t().forwardRef(((e,r)=>{const{wrapClassName:n,wrapStyle:a,barWidth:i,always:l,native:o,minSize:s=It,onScroll:c}=e,u=t().useRef(null),d=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=Et(u),E=Et(p);De((()=>{!o&&S()}),[E.width,E.height,x.width,x.height]);const S=St((()=>{if(!d.current)return;const e=d.current.offsetHeight-4,t=d.current.offsetWidth-4,r=e**2/d.current.scrollHeight,n=t**2/d.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,u=i+4<t?i:0,p=100*d.current.scrollTop/e*l,g=100*d.current.scrollLeft/t*o;h(Object.assign({},m,{size:u,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)?d.current.scrollTop=e:g("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=e=>{(0,J.isNumber)(e)?d.current.scrollLeft=e:g("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t().useImperativeHandle(r,(()=>({SET_SCROLL_TOP:w,SET_SCROLL_LEFT:T})));const I=t().useMemo((()=>({dragging:y,scrollbarElement:u,wrapElement:d})),[y]),N=Ce("scrollbar"),R={[`${N}__wrap`]:!0,[`${N}__wrap--hidden`]:!o};return t().createElement("div",{ref:u,className:Se()(N,e.className),style:e.style},t().createElement("div",{ref:d,className:Se()(R,n),style:a,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!o&&(()=>{if(!d.current)return;const e=d.current.offsetHeight-4,t=d.current.offsetWidth-4,r=100*d.current.scrollTop/e*f.ratio,n=100*d.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:`${N}__view`},e.children)),!o&&t().createElement(ft.Provider,{value:I},t().createElement(Tt,{direction:"horizontal",thumb:m,barSize:i,always:l,onDrag:C}),t().createElement(Tt,{direction:"vertical",thumb:f,barSize:i,always:l,onDrag:C})))}));Nt.displayName="QmScrollbar";const Rt=Nt,Pt=require("axios");var Ot=n.n(Pt);const At=(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 kt 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 Ot()({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));At(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(kt,"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(kt,"defaultProps",{icon:t().createElement(we.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),Ht(kt,"contextType",l);const Lt=kt,qt=require("add-dom-event-listener");var $t=n.n(qt);const _t=require("scroll-into-view-if-needed");var Dt=n.n(_t);class jt 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 Kt=jt;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(Ne,{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 Mt=Vt;function zt(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 Ut extends e.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(t){super(t),zt(this,"currentState","ready"),zt(this,"itemsTotal",void 0),zt(this,"timer",void 0),zt(this,"scrollEvent",void 0),zt(this,"scrollRef",(0,e.createRef)()),zt(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),zt(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Dt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),zt(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||"",u=Ce("anchor"),d={[u]:!0,[`${u}-left`]:"left"===a,[`${u}-top`]:"top"===a,[`${u}--lg`]:"large"===c,[`${u}--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()(d,o),style:s},t().createElement("div",{className:Se()("anchor-nav"),style:{width:n?ue(n):""}},t().createElement(Kt,{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))}}zt(Ut,"Item",Mt),zt(Ut,"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}))}),zt(Ut,"defaultProps",{tabPosition:"left"}),zt(Ut,"contextType",l);const Bt=Ut;class Wt 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}(Wt,"displayName","QmTabPane");const Gt=Wt;function Yt(){return Yt=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},Yt.apply(this,arguments)}function Xt(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 Qt 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},u={...Z()(this.props,["items","authConfig"]),size:o,tabBarGutter:a??(["top","bottom"].includes(n)?30:0)},d=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmTabPane"===e.type?.displayName&&d.push(e)}));const p=e?[...e]:d.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,Yt({},u,{items:p,className:Se()(c,i)}))}}Xt(Qt,"TabPane",Gt),Xt(Qt,"contextType",l),Xt(Qt,"defaultProps",{tabPosition:"top"});const Zt=Qt;function Jt(){return Jt=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},Jt.apply(this,arguments)}function er(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 tr extends e.Component{constructor(){super(...arguments),er(this,"titleRef",t().createRef()),er(this,"$drawer",null),er(this,"opened",!1),er(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),er(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}))})),er(this,"toggleHandle",(()=>{this.$drawer=Ye(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),er(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),er(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:ue(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,u=this.context.global,d=i||this.context.size||"",p=Ce("drawer"),m={[p]:!0,[`${p}--lg`]:"large"===d,[`${p}--sm`]:"small"===d};return t().createElement(O.Drawer,Jt({},Z()(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??n,maskClosable:s??u?.maskClosable??!1,className:Se()(m,l),title:this.renderTitle(),footer:null,onClose:c,afterOpenChange:this.afterVisibleChange}),this.props.children,(o||r||e)&&t().createElement(ht,{spinning:!0,className:Se()("spinning")}))}}er(tr,"contextType",l),er(tr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),er(tr,"defaultProps",{width:"72%",showFullScreen:!0,destroyOnClose:!0,footer:null});const rr=tr;function nr(){return nr=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},nr.apply(this,arguments)}function ar(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 ir="10vh";var lr=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e}(lr||{});class or extends e.Component{constructor(){super(...arguments),ar(this,"$event",null),ar(this,"draggleRef",t().createRef()),ar(this,"opened",!1),ar(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),ar(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=$t()(document.body,"mousedown",ze))})),ar(this,"removeMouseDownEvent",(()=>{this.$event&&(this.$event?.remove(),this.$event=null)})),ar(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}})})),ar(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:ue(this.props.width||"60%"),height:"auto",top:ir}),Be(r,{height:n?ue(n):this.defaultHeight,maxHeight:"auto"===n?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(r,{height:`calc(100vh - ${lr[this.$size]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),ar(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),ar(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),ar(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${ir} - ${ir} - ${lr[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:u,loading:d,draggable:p,maskClosable:m,bodyStyle:h,onClose:f}=this.props,g=this.context.global,b=Ce("modal"),y={height:c?ue(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,nr({},Z()(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:s??o,maskClosable:m??g?.maskClosable??!1,className:Se()(v,u),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,(d||r||e)&&t().createElement(ht,{spinning:!0,className:Se()("spinning")}))}}ar(or,"contextType",l),ar(or,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),ar(or,"defaultProps",{width:"60%",showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:ir}});const sr=or,cr=require("memoize-one");var ur=n.n(cr);const dr=(0,e.createContext)(void 0),pr=80,mr="1",hr="0",fr=400,gr=["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"],br={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let yr=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}({}),vr=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}({}),xr=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Er={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},Sr={layout:"horizontal",labelWidth:pr,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},Cr=(e,t)=>{if(!e)return null;if(t===vr.week){const t=e.match(/^(\d{4})-(\d+)/);return t?s()().year(Number(t[1])).week(Number(t[2])):null}if(t===vr.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)},wr=(e,t)=>e?s()(e).format(t):"",Tr=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},Nr=(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]]},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)=>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=Pr(e.children,t,r)),n})),Or=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=Or(r.children,t);if(e)return e}}return null},Ar=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(...Ar(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(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},disabled:s}=e.option,{falseValue:c=hr,trueValue:u=mr}=l;return t().createElement(O.Checkbox,{checked:n===u,style:o,disabled:s||r.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{a?.(e),i(e,p(e===u?"am.form.trueText":"am.form.falseText"))})(t?u:c)}})};class kr 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Hr,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(kr,"contextType",dr);const Lr=kr,qr=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 _r 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(dr.Consumer,null,(r=>{const n=r.$$form;return t().createElement("div",{className:Se()("ant-dropdown-menu","fields-list")},t().createElement(qr.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(dr.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(_r,"contextType",l);const Dr=_r,jr=e=>{const{value:r,bordered:n}=e;return t().createElement(O.Input,{value:r,title:r,bordered:n,readOnly:!0})};jr.displayName="FormItemView";const Kr=jr;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 Mr=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(dr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:d=!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:I}=o,N=I&&(m||h),R=e=>{i?.(e),l(e)},P=v?O.Input.Password:O.Input,A=N?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,I):a;return n.isOnlyShow?t().createElement(Kr,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(A),bordered:u}):t().createElement(P,{ref:r,value:A,autoComplete:v?"new-password":T,autoFocus:w,placeholder:c,style:s,title:v?"":A,prefix:b,suffix:y,maxLength:x,bordered:u,allowClear:d,readOnly:m,disabled:h,onBlur:t=>{let r=t.target.value??"";if(C){const e=r.trim();r!==e&&(r=e,R(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()}},onChange:e=>{let t=e.target.value;(0,J.isRegExp)(E)&&(t=E.test(t)?t:a??""),S&&(t=t.toUpperCase()),R(t)}})}));Mr.displayName="VInput";class zr 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:u,buttonAfter:d,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":ue(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(Mr,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&t().createElement(O.Col,null,e.renderFormItemButton(i,d)),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Vr(zr,"contextType",dr);const Ur=zr,Br=e=>{const{$$form:r}=t().useContext(dr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:u,disabled:d}=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(Kr,{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:u,disabled:d,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:d,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:u,disabled:d,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class Wr 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:u,rules:d=[],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":ue(o)},required:e.getFormItemRequired(d)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:d,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Br,{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:ue(c.labelWidth||pr)},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}(Wr,"contextType",dr);const Gr=Wr,Yr=require("big.js");var Xr=n.n(Yr);function Qr(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(dr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:d,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,I=t().useRef(a),N=e=>{const t=Tr(e)?"":(0,J.isNumber)(e)?e.toFixed(v):new(Xr())(e).toFixed(v);return"function"==typeof w?w(t):t},R={[S]:!0,controls:C};return n.isOnlyShow?t().createElement(Kr,{value:N(a),bordered:u}):t().createElement(O.InputNumber,{ref:r,value:a,className:Se()(R),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:u,readOnly:d,disabled:m,onBlur:()=>{le((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(I.current),h(I.current)}))},onKeyUp:e=>{13===e.keyCode&&f(a)},onChange:e=>{const t=e??"";!E&&t.toString().replace(/^-|\./g,"").length>17||(e=>{I.current=e,i?.(e),l(e,N(e))})(t)}})}));Zr.displayName="VInputNumber";class Jr extends e.Component{constructor(){super(...arguments),Qr(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:u,buttonAfter:d,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":ue(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,r)=>{h(t),e.setViewValue(i,r)}}))),d&&t().createElement(O.Col,null,e.renderFormItemButton(i,d)),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Qr(Jr,"contextType",dr);const en=Jr,tn=e=>{const{$$form:r}=t().useContext(dr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:u,disabled:d}=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=>Tr(e)?"":e.map((e=>Tr(e)?"":Number(e).toFixed(y))),w={[g]:!0,controls:b};return r.isOnlyShow?t().createElement(Kr,{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:u,disabled:d,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:d,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:u,disabled:d,onChange:e=>{S([n[0],e])},onBlur:()=>{E(n)}}))};class rn 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:u,rules:d=[],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":ue(o)},required:e.getFormItemRequired(d)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:i,noStyle:!0,rules:d,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(tn,{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:ue(c.labelWidth||pr)},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}(rn,"contextType",dr);const nn=rn;let an=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});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{Search:on}=O.Input;class sn extends e.Component{constructor(e){var t;super(e),t=this,ln(this,"searchHelper",{}),ln(this,"alias",void 0),ln(this,"extras",void 0),ln(this,"deriveParams",void 0),ln(this,"valueKey",void 0),ln(this,"_is_change",!1),ln(this,"_record",void 0),ln(this,"_prevValue",void 0),ln(this,"state",{visible:!1,loading:!1}),ln(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ln(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` 一起使用")})),ln(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),ln(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),ln(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&&Nr(t,this.alias,o),s&&Rr(t,this.extras,s),this._record=t,this.setFieldsValue(t),a?.([t])}}}catch(e){}this.setState({loading:!1})}})),ln(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),ln(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})),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,"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})}})),ln(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)})),ln(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?.())})),ln(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)}))})),ln(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)})),ln(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("")}})),ln(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),ln(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),ln(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),ln(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:u=p("qm.form.inputPlaceholder"),bordered:d=!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:`${an[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(Kr,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement(on,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:u,style:c,prefix:g,suffix:b,maxLength:y,bordered:d,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(sr,v,t().createElement(ac,x)))}}ln(sn,"contextType",dr);class cn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),ln(this,"promiseRef",void 0),ln(this,"searchRef",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);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:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[]}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(sn,{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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}ln(cn,"contextType",dr);const un=cn;function dn(){return dn=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},dn.apply(this,arguments)}function pn(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 mn=r=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,pn(this,"startClick",void 0),pn(this,"event1",null),pn(this,"event2",null),pn(this,"$el",null),pn(this,"omitClassNames",[]),pn(this,"state",{clickOutside:!1}),pn(this,"mousedownHandler",(e=>{this.startClick=e})),pn(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),pn(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})})),pn(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),pn(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,dn({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return pn(n,"displayName",`OutsideClick(${r.displayName||r.name})`),t().forwardRef(((e,r)=>t().createElement(n,dn({},e,{forwardedRef:r}))))},hn=require("rc-trigger");var fn,gn,bn=n.n(hn);function yn(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 vn=mn((gn=class extends e.Component{constructor(e){var r;super(e),r=this,yn(this,"searchHelper",{}),yn(this,"alias",void 0),yn(this,"_records",[]),yn(this,"searchRef",t().createRef()),yn(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),yn(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`")})),yn(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})),yn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),yn(this,"setItemList",(e=>{this.setState({itemList:e})})),yn(this,"setRecords",(e=>{this._records=e})),yn(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),yn(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),yn(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?.())})),yn(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)}))})),yn(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:u={},placeholder:d=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:`${an[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,I={[w]:!0,[`${w}--lg`]:"large"===T,[`${w}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${w}`]);const N=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Kr,{value:N,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(bn(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(I),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:br,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:d,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...u},title:N,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(sr,v,t().createElement(ac,x)))}},yn(gn,"contextType",dr),fn=gn))||fn;class xn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),yn(this,"promiseRef",void 0),yn(this,"state",{searchHelper:{}}),yn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),yn(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:u,extra:d,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,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(vn,{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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}yn(xn,"contextType",dr);const En=xn;function Sn(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:Cn}=O.Input;class wn extends e.Component{constructor(e){super(e),Sn(this,"searchHelper",{}),Sn(this,"alias",void 0),Sn(this,"extras",void 0),Sn(this,"valueKey",void 0),Sn(this,"_record",void 0),Sn(this,"_prevValue",void 0),Sn(this,"state",{visible:!1,loading:!1}),Sn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Sn(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` 一起使用")})),Sn(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),Sn(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Sn(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&&Nr(t,this.alias,l),o&&Rr(t,this.extras,o),this._record=t,this.setFieldsValue(t)}}}catch(e){}this.setState({loading:!1})}})),Sn(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])})})),Sn(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?.())})),Sn(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)}))})),Sn(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("")})),Sn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Sn(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:u=p("qm.form.selectPlaceholder"),bordered:d=!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:`${an[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(Kr,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement(Cn,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:u,style:c,prefix:g,suffix:b,maxLength:y,bordered:d,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(sr,v,t().createElement(uc,x)))}}Sn(wn,"contextType",dr);class Tn extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Sn(this,"promiseRef",void 0),Sn(this,"state",{searchHelper:{}}),Sn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Sn(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:u,extra:d,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,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(wn,{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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Sn(Tn,"contextType",dr);const In=Tn;var Nn,Rn;function Pn(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 On=mn((Rn=class extends e.Component{constructor(e){var r;super(e),r=this,Pn(this,"searchHelper",{}),Pn(this,"alias",void 0),Pn(this,"_records",[]),Pn(this,"searchRef",t().createRef()),Pn(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Pn(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`")})),Pn(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})),Pn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Pn(this,"setItemList",(e=>{this.setState({itemList:e})})),Pn(this,"setRecords",(e=>{this._records=e})),Pn(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Pn(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Pn(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?.())})),Pn(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)}))})),Pn(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:u={},placeholder:d=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:`${an[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,I={[w]:!0,[`${w}--lg`]:"large"===T,[`${w}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${w}`]);const N=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Kr,{value:N,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(bn(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(I),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:br,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:d,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...u},title:N,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(sr,v,t().createElement(uc,x)))}},Pn(Rn,"contextType",dr),Nn=Rn))||Nn;class An extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Pn(this,"promiseRef",void 0),Pn(this,"state",{searchHelper:{}}),Pn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Pn(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:u,extra:d,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,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(On,{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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Pn(An,"contextType",dr);const Fn=An;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 kn=new Array(2).fill("");class Ln 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:kn}),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(kn),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=kn.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:u=!0,readOnly:d,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:`${an[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(Kr,{value:i.join(" - "),bordered:u}):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:u,readOnly:d,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:u,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:u,allowClear:!0,readOnly:d,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(sr,f,t().createElement(bc,g)))}}Hn(Ln,"contextType",dr);class qn 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:u,buttonAfter:d,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":ue(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(Ln,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{h(t,n),e.setViewValue(l,r)}}))),d&&t().createElement(O.Col,null,e.renderFormItemButton(l,d)),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Hn(qn,"contextType",dr);const $n=qn;function _n(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 Dn=e=>{const{$$form:r}=t().useContext(dr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:u,disabled:d}=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(Kr,{value:h(n),bordered:c}):t().createElement(O.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:d,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 jn extends e.Component{constructor(){super(...arguments),_n(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:u,extra:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(Dn,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}_n(jn,"contextType",dr);const Kn=jn,Vn=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},allowClear:s=!0,readOnly:c,disabled:u}=e.option,{allowHalf:d,count:p=5,tooltips:m}=l;return t().createElement(O.Rate,{value:n,count:p,style:o,allowHalf:d,allowClear:s,tooltips:m,disabled:u||r.isOnlyShow,onChange:e=>{(e=>{var t;a?.(e),i(e,(t=e,m?m[Math.ceil(t)-1]:t.toString()))})(e)}})};class Mn 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Vn,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(Mn,"contextType",dr);const zn=Mn;function Un(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 Bn=e=>{const{$$form:r}=t().useContext(dr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:u,disabled:d}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.find((t=>t.value===e))?.text??"";return r.isOnlyShow?t().createElement(Kr,{value:h(n),bordered:c}):t().createElement(O.Radio.Group,{value:n,style:{width:"100%",...s},disabled:d||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 Wn extends e.Component{constructor(){super(...arguments),Un(this,"state",{itemList:[]}),Un(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:u,extra:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:Se()(l,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(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(Bn,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Un(Wn,"contextType",dr);const Gn=Wn,Yn=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},disabled:s}=e.option,{falseValue:c=hr,trueValue:u=mr}=l;return t().createElement(O.Switch,{checked:n===u,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===u?"am.form.trueText":"am.form.falseText"))})(e?u:c)}})};class Xn 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Yn,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(Xn,"contextType",dr);const Qn=Xn,Zn=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:u,readOnly:d,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:u,readOnly:d||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 Jn 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Zn,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(Jn,"contextType",dr);const ea=Jn,ta=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:c=p("qm.form.datePlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=e.option,{dateType:f="date",format:g,minDateTime:b,maxDateTime:y,shortCuts:v=!0}=l,x=t().createRef(),E=e=>{e&&"date"===f&&(e=e.slice(0,10)+" 00:00:00"),a?.(e),i(e,S(e))},S=e=>Tr(e)?"":["date","exactdate"].includes(f)?e.slice(0,10):e,C=e=>{let t=wr(s()().subtract(e,"day"),vr[f]);"date"===f&&(t=t.slice(0,10)),E(t),x.current.blur(),x.current.focus()};return r.isOnlyShow?t().createElement(Kr,{value:S(n),bordered:u}):t().createElement(_,{ref:x,style:{width:"100%",...o},picker:yr[f],format:g,bordered:u,showToday:!1,showTime:"datetime"===f&&{defaultValue:s()("00:00:00","HH:mm:ss")},allowClear:d,disabled:h,inputReadOnly:m,disabledDate: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,[b,y]),renderExtraFooter:v?()=>t().createElement(t().Fragment,null,t().createElement(O.Tag,{color:"processing",onClick:()=>C(0)},p("qm.form.datePickers")[0]),t().createElement(O.Tag,{color:"processing",onClick:()=>C(1)},p("qm.form.datePickers")[1]),t().createElement(O.Tag,{color:"processing",onClick:()=>C(7)},p("qm.form.datePickers")[2]),t().createElement(O.Tag,{color:"processing",onClick:()=>C(30)},p("qm.form.datePickers")[3])):void 0,value:Cr(n,vr[f]),onChange:(e,t)=>{E(wr(e,vr[f]))}})};class ra 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ta,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(ra,"contextType",dr);const na=ra,aa=e=>[s()().subtract(e,"day"),s()()],ia=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:c=p("qm.form.daterangePlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=e.option,{dateType:f="date",format:g,disableds:b=[!1,!1],minDateTime:y,maxDateTime:v,shortCuts:x=!0}=l,E={[p("qm.form.dateRangePickers")[0]]:aa(7),[p("qm.form.dateRangePickers")[1]]:aa(30),[p("qm.form.dateRangePickers")[2]]:aa(90),[p("qm.form.dateRangePickers")[3]]:aa(180)},S=e=>Tr(e)?"":e.map((e=>["date","exactdate"].includes(f)?e?.slice(0,10):e)).join(" - ");return r.isOnlyShow?t().createElement(Kr,{value:S(n),bordered:u}):t().createElement(_.RangePicker,{style:{width:"100%",...o},picker:yr[f],format:g,bordered:u,showTime:"datetime"===f&&{defaultValue:[s()("00:00:00","HH:mm:ss"),s()("23:59:59","HH:mm:ss")]},allowClear:d,disabled:h?[!0,!0]:b,inputReadOnly:m,disabledDate: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]),ranges:x?E:void 0,value:se(n)?null:[Cr(n?.[0],vr[f]),Cr(n?.[1],vr[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,S(e))})([wr(e?.[0],vr[f]),wr(e?.[1],vr[f])])}})};class la 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ia,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(la,"contextType",dr);const oa=la,sa=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.timePlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,disabled:m}=e.option,{timeType:h="hour-minute-second",hourStep:f=1,minuteStep:g=1,secondStep:b=1}=l;return r.isOnlyShow?t().createElement(Kr,{value:n,bordered:c}):t().createElement(V,{style:{width:"100%",...o},bordered:c,showNow:!0,hourStep:f,minuteStep:g,secondStep:b,allowClear:u,disabled:m,inputReadOnly:d,format:xr[h],value:Cr(n,xr[h]),onChange:(e,t)=>{(e=>{const t=wr(e,xr[h]);a?.(t),i(t)})(e)}})};class ca 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(sa,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(ca,"contextType",dr);const ua=ca,da=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.timerangePlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,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=>Tr(e)?"":e.join(" - ");return r.isOnlyShow?t().createElement(Kr,{value:v(n),bordered:c}):t().createElement(V.RangePicker,{style:{width:"100%",...o},bordered:c,showNow:!1,hourStep:g,minuteStep:b,secondStep:y,allowClear:u,disabled:m?[!0,!0]:f,inputReadOnly:d,format:xr[h],value:se(n)?null:[Cr(n?.[0],xr[h]),Cr(n?.[1],xr[h])],onChange:(e,t)=>{(e=>{const t=[wr(e?.[0],xr[h]),wr(e?.[1],xr[h])];a?.(t),i(t,v(t))})(e)}})};class pa 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:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(da,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!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}(pa,"contextType",dr);const ma=pa,ha={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"}},fa="阿",ga="鿿",ba=1,ya=2,va=3;let xa,Ea=null;function Sa(e){return e||null===Ea?("object"==typeof Intl&&Intl.Collator?(xa=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Ea=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Ea=!1,Ea):Ea}function Ca(e){const t=ha.UNIHANS,r=ha.PINYINS,n=ha.EXCEPTIONS,a={source:e};if(e in n)return a.type=ya,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=ba,a.target=e,a;if(i=xa.compare(e,fa),i<0)return a.type=va,a.target=e,a;if(0===i)a.type=ya,l=0;else{if(i=xa.compare(e,ga),i>0)return a.type=va,a.target=e,a;0===i&&(a.type=ya,l=t.length-1)}if(a.type=ya,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=xa.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=va,a.target=a.source),a}function wa(e){return"string"==typeof e&&Sa()?e.split("").map((e=>Ca(e))):e}const Ta={isSupported:Sa,parse:wa,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(ha)})))},genToken:Ca,convertToPinyin:(e,t,r)=>wa(e).map((e=>t&&e.type===ya?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}};Ta.isSupported()&&Ia.shouldPatch(Ta.genToken)&&Ta.patchDict(Ia);const Na=Ta;function Ra(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pa(){return Pa=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},Pa.apply(this,arguments)}const{Option:Oa}=O.Select,Aa=e=>{const{$$form:r}=t().useContext(dr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{options:c={},style:u={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=e.option,{itemList:b=[],filterable:y=!0,listHeight:v=fr,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(Kr,{value:w(n),bordered:m}):t().createElement(O.Select,Pa({value:n,mode:i?"multiple":void 0,placeholder:d,style:u,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=Na.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(Oa,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Fa extends e.Component{constructor(){super(...arguments),Ra(this,"state",{itemList:[],loading:!1}),Ra(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:u=e.props.labelWidth,className:d,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,d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},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(Aa,{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:ue(p.labelWidth||pr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Ra(Fa,"contextType",dr);const Ha=Fa;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}class La extends e.Component{constructor(e){super(e),ka(this,"searchHelper",{}),ka(this,"alias",void 0),ka(this,"extras",void 0),ka(this,"valueKey",void 0),ka(this,"prevValue",""),ka(this,"_record",void 0),ka(this,"_prevValue",void 0),ka(this,"searchRef",t().createRef()),ka(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0}),ka(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` 一起使用")})),ka(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),ka(this,"getLatestRequest",(()=>{const{request:e,searchHelper:t}=this.props.option;return Object.assign({},this.searchHelper.request,e,t?.request)})),ka(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,fieldAliasMap:a,extraAliasMap:i}=this.searchHelper.echoRequest||{},l="function"==typeof a?a():a||{},o="function"==typeof i?i():i||{},s=this.getItemValue();if(e&&!se(s))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&&Nr(t,this.alias,l),o&&Rr(t,this.extras,o),this._record=t,this.setFieldsValue(t)}}}catch(e){}})),ka(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Ir(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Ir(e,this.extras[r])});this._record=e,this.prevValue=Ir(e,this.alias[r])??""})),ka(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),ka(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ka(this,"triggerChange",((e,t)=>{const{onChange:r,onValuesChange:n}=this.props;r?.(e),t&&n(e,this._record)})),ka(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),ka(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.prevValue=a??"",this.triggerChange(a,!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}=this.state,{value:i}=this.props,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=this.props.option,{listHeight:f=fr}=o,{hideHeader:g,onlySelect:b=!0}=this.searchHelper||o,y=this.searchHelper.columns||[],v=Ce("form-immediate"),x=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,E=t().createElement(O.Spin,{spinning:n},a.length?t().createElement("table",{cellSpacing:0,cellPadding:0,className:Se()("table")},!g&&t().createElement("thead",null,t().createElement("tr",null,y.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})},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},y.filter((e=>!e.hidden)).map((r=>t().createElement("td",{key:r.dataIndex},(0,J.get)(e,r.dataIndex))))))))):t().createElement(pt,null));return t().createElement(l.Consumer,null,(n=>{const l={[v]:!0,[`${v}--lg`]:"large"===n?.size,[`${v}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Kr,{value:i,bordered:u}):t().createElement(bn(),{action:h?[]:["click"],popupVisible:!h&&r,popup:E,popupClassName:Se()(l),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:br,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:c,allowClear:d,bordered:u,readOnly:m,disabled:h,style:{width:"100%",...s},value:i,title:i,onFocus:()=>{!a.length&&this.fetchHandle(i)},onBlur:e=>{const{value:t}=e.target;b&&t!==this.prevValue&&this.triggerChange(this.prevValue,!1),this.triggerBlur(t)},onKeyUp: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),t?(this.handleVisibleChange(!0),this.triggerChange(t,!b)):this.clickHandle(null)}}))}))}}ka(La,"contextType",dr);class qa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),ka(this,"promiseRef",void 0),ka(this,"state",{searchHelper:{}}),ka(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),ka(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("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:u,extra:d,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,u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(O.Row,{wrap:!1,gutter:4},t().createElement(O.Col,{flex:"auto"},t().createElement(O.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(La,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange: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)),d&&t().createElement(O.Col,{flex:ue(d.labelWidth||pr)},e.renderFormItemExtra({fieldName:l,...d}))))}}ka(qa,"contextType",dr);const $a=qa;class _a 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:u=[],onCollapse:d=ne}=o,p=[];if(u.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===a))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=u.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(Ne,{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})}))),d(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}(_a,"contextType",dr);const Da=_a;function ja(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ka(){return Ka=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},Ka.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)),Ma=e=>{const{$$form:r}=t().useContext(dr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{options:c={},style:u={},placeholder:d=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=fr,checkStrictly:E,checkStrategy:S="SHOW_CHILD",collapseTags:C,openPyt:w=!0}=c,[T,I]=t().useState(se(y)?a:y);De((()=>{I(se(y)?a:y)}),[y,a]);const N=e=>Or(T,e)?.text||"",R=e=>i?e.map((e=>N(e))).filter((e=>!!e)).join(","):N(e);return r.isOnlyShow?t().createElement(Kr,{value:R(n),bordered:m}):t().createElement(O.TreeSelect,Ka({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:i,treeCheckable:i,treeCheckStrictly:E,showCheckedStrategy:O.TreeSelect[S],placeholder:d,listHeight:x,style:u,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,Pr(r,o,l));I(n),s?.(r)}}catch(e){}}:void 0,treeData:T},i?{title:R(n)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=Na.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 za extends e.Component{constructor(){super(...arguments),ja(this,"state",{itemList:[],loading:!1}),ja(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=Pr(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:u=e.props.labelWidth,className:d,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,d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},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(Ma,{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:ue(p.labelWidth||pr)},e.renderFormItemExtra({fieldName:o,...p}))))}}ja(za,"contextType",dr);const Ua=za;function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wa(){return Wa=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},Wa.apply(this,arguments)}const Ga=e=>{const{$$form:r}=t().useContext(dr),{value:n,multiple:a,items:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,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=>Ar(x,e).map((e=>e.text)).join("/"))).join(","):Ar(x,e).map((e=>e.text)).join("/");return r.isOnlyShow?t().createElement(Kr,{value:E(n),bordered:c}):t().createElement(O.Cascader,Wa({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:u,disabled:m,showSearch:b&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=Na.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 Ya extends e.Component{constructor(){super(...arguments),Ba(this,"state",{itemList:[],loading:!1}),Ba(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=Pr(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:u=e.props.labelWidth,className:d,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,d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},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(Ga,{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:ue(p.labelWidth||pr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Ba(Ya,"contextType",dr);const Xa=Ya,Qa=require("china-area-data");var Za=n.n(Qa);function Ja(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ei=["110000","120000","310000","500000"],ti=["810000","820000"],ri=[{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"}],ni=[{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"}],ai=e=>Na.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),ii=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=>![...ei,...ti].includes(e))):Object.keys(e[t])).map((n=>({l:ai(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:ii(e,n,r+1)})))},li=(e,t)=>t.map((t=>({l:ai(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class oi extends e.Component{constructor(e){super(e),Ja(this,"searchRef",t().createRef()),Ja(this,"scrollRef",t().createRef()),Ja(this,"zxsAndGa",void 0),Ja(this,"provinces",void 0),Ja(this,"allCities",void 0),Ja(this,"letterCities",void 0),Ja(this,"state",{visible:!1,select_type:"0",active_key:""}),Ja(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ja(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}),Dt()(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:li(Za(),ei)},{l:"Z2",n:"港澳",c:"",p:"",children:li(Za(),ti)}]}createProvince(){return(ii(Za(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return ni.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...ei,...ti].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?ri:ni).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:u,disabled:d}=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(Kr,{value:f,bordered:s}):t().createElement(bn(),{action:d?[]:["click"],popupVisible:!d&&r,popup:g,popupClassName:Se()(a),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:br,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(O.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:u,disabled:d,style:{width:"100%",...i},value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}Ja(oi,"contextType",dr);class si extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(oi,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ja(si,"contextType",dr);const ci=si;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 di=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:di(e,r)})))};class pi 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=di(Za(),"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=Or(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(pt,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:u,disabled:d}=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(Kr,{value:g,bordered:s}):t().createElement(bn(),{action:d?[]:["click"],popupVisible:!d&&r,popup:f,popupClassName:Se()(a),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:br,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:u,disabled:d,value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&le((()=>this.initial()))}}))}))}}ui(pi,"contextType",dr);class mi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(pi,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ui(mi,"contextType",dr);const hi=mi,fi=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c}=e.option,{multiple:u=!0,maxCount:d=1,fileTypes:p,fileSize:m,onRemove:h}=l,{action:f,headers:g,params:b,withCredentials:y=!1,dataKey:v="",fieldAliasMap:x,button:E}=o,S="function"==typeof x?x():x||{};return t().createElement(tl,{name:"file",action:f,multiple:u,headers:g,data:b,withCredentials:y,maxCount:d,fileTypes:p,fileSize:m,disabled:c||r.isOnlyShow,button:E,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={};for(const r in S)t[r]=e[r]||e.response?.data?.[S[r]]||"";return{uid:e.uid,name:e.name,...t,url:e.url||(v?(0,J.get)(e.response?.data,v):e.response?.data)||"",status:e.status}}));a?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:h})};class gi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(fi,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(gi,"contextType",dr);const bi=gi,yi=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c}=e.option,{multiple:u=!0,maxCount:d=1,fixedSize:p,quality:m,openCropper:h,fileTypes:f,fileSize:g,onRemove:b}=l,{action:y,headers:v,params:x,withCredentials:E=!1,dataKey:S="",fieldAliasMap:C}=o,w="function"==typeof C?C():C||{};return t().createElement(sl,{name:"file",action:y,multiple:u,headers:v,data:x,withCredentials:E,maxCount:d,fixedSize:p,quality:m,openCropper:h,fileTypes:f,fileSize:g,disabled:c||r.isOnlyShow,fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t={};for(const r in w)t[r]=e[r]||e.response?.data?.[w[r]]||"";return{uid:e.uid,name:e.name,...t,url:e.url||(S?(0,J.get)(e.response?.data,S):e.response?.data)||"",status:e.status}}));a?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:b})};class vi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(yi,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(vi,"contextType",dr);const xi=vi,Ei=e=>{const{$$form:r}=t().useContext(dr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o,style:s={},placeholder:c=p("qm.form.inputPlaceholder"),readOnly:u,disabled:d}=e.option,{tinymce:m,thresholdSize:h}=l;return t().createElement(Bi,{value:n,tinymce:m,upload:o,thresholdSize:h,style:{width:"100%",...s},disabled:u||d||r.isOnlyShow,onChange:e=>{(e=>{a?.(e),i(e)})(e)}})};class Si extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,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":ue(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:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Ei,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(O.Col,{flex:ue(u.labelWidth||pr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Si,"contextType",dr);const Ci=Si;function wi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ti extends e.Component{constructor(e){super(e),wi(this,"provide",{$$form:this,echo_data:{}}),wi(this,"_initialValues",void 0),wi(this,"_initialOthers",void 0),wi(this,"_initialExtras",void 0),wi(this,"_fieldAuth",{}),wi(this,"wrapperRef",t().createRef()),wi(this,"formRef",t().createRef()),wi(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),wi(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})})),wi(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),wi(this,"getFormItems",ur()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),wi(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}))),wi(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),wi(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),wi(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),wi(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),wi(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})})),wi(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Dt()(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(){vt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){xt(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,gr.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??hr),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(Tr(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Tr(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(Ur,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(Gr,{option:e})}INPUT_NUMBER(e){return t().createElement(en,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(nn,{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(En,{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(Lr,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(Kn,{option:e})}RATE(e){return t().createElement(zn,{option:e})}RADIO(e){return t().createElement(Gn,{option:e})}SWITCH(e){return t().createElement(Qn,{option:e})}TEXT_AREA(e){return t().createElement(ea,{option:e})}DATE(e){return t().createElement(na,{option:e})}RANGE_DATE(e){return t().createElement(oa,{option:e})}TIME(e){return t().createElement(ua,{option:e})}RANGE_TIME(e){return t().createElement(ma,{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(Da,{option:e})}TREE_SELECT(e){return t().createElement(Ua,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(Ua,{option:e,multiple:!0})}CASCADER(e){return t().createElement(Xa,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(Xa,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(ci,{option:e})}REGION_SELECT(e){return t().createElement(hi,{option:e})}UPLOAD_FILE(e){return t().createElement(bi,{option:e})}UPLOAD_IMG(e){return t().createElement(xi,{option:e})}TINYMCE(e){return t().createElement(Ci,{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:u}=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:ue(o)}},u?.(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,u=[],d=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 d=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(r);return d&&u.push(o[n]),t().createElement(O.Col,{key:s??n,span:a*l,style:this.isFilterType?{display:!this.showFilterCollapse||d?"block":"none"}:{display:p?"block":"none"}},i?this.createFormItem(ce(r)):null)}));return a&&"default"===r&&d.push(t().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...d,this.createSearchButtonLayout(u[u.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(Dr,{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"),u={required:"${label}"+p("qm.form.requiredTips")},d={[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()(d,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":ue(i)},validateMessages:u,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t().createElement(dr.Provider,{value:this.provide},t().createElement(O.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}wi(Ti,"contextType",l),wi(Ti,"propTypes",Er),wi(Ti,"defaultProps",Sr);const Ii=Ti,Ni={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},Ri={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}),...Ni},Pi=e=>"function"==typeof e,Oi=e=>e in Ni,Ai=e=>e.substr(2),Fi=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(Oi),c=Object.keys(l).filter(Oi),u=s.filter((e=>void 0===l[e])),d=c.filter((e=>void 0===i[e]));u.forEach((e=>{const t=Ai(e),r=o[t];n(t,r),delete o[t]})),d.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=Ai(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Hi=0;const ki=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Hi++,e+"_"+r+Hi+String(t)},Li=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),qi=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))},_i=()=>({listeners:[],scriptId:ki("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Di=(()=>{let e=_i();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=_i()}}})(),ji=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Ki(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,Ki(this,"editor",void 0),Ki(this,"id",void 0),Ki(this,"elementRef",void 0),Ki(this,"inline",void 0),Ki(this,"currentContent",void 0),Ki(this,"boundHandlers",void 0),Ki(this,"rollbackTimer",void 0),Ki(this,"valueCursor",void 0),Ki(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})),Ki(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){}})),Ki(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Ki(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))}})),Ki(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Ki(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=ji(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,qi(i).concat(qi(l))),toolbar:r.props.toolbar??r.props.init?.toolbar,setup:e=>{r.editor=e,r.bindHandlers({}),r.inline&&!Li(t)&&e.once("PostRender",(t=>{e.setContent(r.getInitialValue(),{no_events:!0})})),r.props.init&&Pi(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&&Pi(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(e)}};var i,l;r.inline||(t.style.visibility=""),Li(t)&&(t.value=r.getInitialValue()),n.init(a)})),this.id=this.props.id||ki("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!==ji(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Di.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=ji(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 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}Ki(Vi,"propTypes",Ri),Ki(Vi,"defaultProps",{cloudChannel:"6"});var zi=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(zi||{});class Ui extends e.Component{constructor(){super(...arguments),Mi(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:u=ne}=this.props,d=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:zi[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()}`,u=new FormData;u.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>l)try{const{data:e}=await Ot().post(n,u,{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||d?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{u(t.getContent())}};return t().createElement("div",{className:Se()(g,r),style:n},t().createElement(Vi,b))}}Mi(Ui,"contextType",l),Mi(Ui,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const Bi=Ui,Wi=require("cropperjs");var Gi=n.n(Wi);function Yi(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 Xi extends e.Component{constructor(){super(...arguments),Yi(this,"imgRef",t().createRef()),Yi(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(Gi())(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}}))}}Yi(Xi,"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 Qi=Xi;function Zi(){return Zi=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},Zi.apply(this,arguments)}function Ji(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 el extends e.Component{constructor(){super(...arguments),Ji(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)}}r(e)}))))}async downloadFile(e,t){const r=await Ot()({url:e,responseType:"blob"}),n=r.data,a=r.headers["content-disposition"],i=t||(a?a.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));At(n,i)}render(){const{button:e={},disabled:r,onChange:n}=this.props,a=Ce("upload-file");return t().createElement(O.Upload,Zi({className:a},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,onChange:e=>{n?.(e)},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")))}}Ji(el,"defaultProps",{name:"file",multiple:!0,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)}});const tl=el;function rl(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 nl extends e.Component{constructor(){super(...arguments),rl(this,"cropperRef",t().createRef()),rl(this,"beforeUploadRef",void 0),rl(this,"fileRef",void 0),rl(this,"resolveRef",void 0),rl(this,"rejectRef",void 0),rl(this,"state",{src:""}),rl(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()})),rl(this,"onOk",(()=>{this.confirmHandle()})),rl(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(Qi,{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()))}}rl(nl,"contextType",l);const al=nl;function il(){return il=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},il.apply(this,arguments)}function ll(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ol extends e.Component{constructor(){super(...arguments),ll(this,"state",{previewVisible:!1,previewImage:"",previewTitle:""}),ll(this,"beforeUpload",((e,t)=>new Promise((async(t,r)=>{const{fileTypes:n=[],fileSize:a}=this.props,i=!n.length||n.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),l=!a||e.size/1024/1024<a,o=i&&l;if(i||O.message.warning(p("qm.upload.tooltip",{type:n.join(",")})),l||O.message.warning(p("qm.upload.sizeLimit",{size:a})),!o)return o||O.Upload.LIST_IGNORE;t(e)})))),ll(this,"handlePreview",(async e=>{e.url||e.preview||(e.preview=await(e=>new Promise(((t,r)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>t(n.result),n.onerror=e=>r(e)})))(e.originFileObj)),this.setState({previewImage:e.url||e.preview,previewVisible:!0,previewTitle:e.name||e.url.substring(e.url.lastIndexOf("/")+1)})}))}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}render(){const{previewVisible:e,previewImage:r,previewTitle:n}=this.state,{fileList:a,fixedSize:i,quality:l,fileTypes:o,fileSize:s,openCropper:c,beforeCrop:u}=this.props,d=Ce("upload-img"),m=t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("div",{style:{marginTop:8}},p("qm.uploadCropper.dragableText"))),h=t().createElement(O.Upload,il({className:d},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,onPreview:this.handlePreview}),this.showUploadButton?m:null);return t().createElement(t().Fragment,null,c?t().createElement(al,{fixedSize:i,quality:l,fileTypes:o,fileSize:s,beforeCrop:u},h):h,t().createElement("div",{style:{display:"none"}},t().createElement(O.Image.PreviewGroup,{preview:{visible:e,onVisibleChange:e=>{this.setState({previewVisible:e})}}},a?.map((e=>t().createElement(O.Image,{key:e.uid,src:e.url,alt:""}))))))}}ll(ol,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const sl=ol,cl=(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=cl(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))),dl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...dl(e.children,t)),t(e)&&r.push(e)})),r},pl=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=pl(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},ml=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:ml(e.children,t,r,n)}:e)),hl=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...hl(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},fl=(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=fl(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},gl=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...gl(e,t)))),r},bl=t().forwardRef(((e,r)=>{const{filterable:n=!0,multiple:a,draggable:i,dataSource:o,fetch:s,asyncLoad:c,checkStrictly:u,checkStrategy:d="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),I=t().useMemo((()=>e.size??T??""),[e.size,T]),N=h?.valueKey||"value",R=h?.textKey||"text",P=(h?.children,t().useRef(null)),A=Et(P),[F,H]=t().useState(g),[k,L]=t().useState(!1),q=St((()=>{H(P.current.offsetHeight-Y.current.offsetHeight-10)}),5);De((()=>{g||q()}),[A.height]);const[$,_]=t().useState([]),[D,j]=t().useState({}),[K,V]=t().useState([]),[M,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),V(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=pl($,(t=>e===t[N]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],Z([...$]))},REMOVE_RECORD:e=>{const t=cl($,e,N);if(void 0===t&&$.find((t=>t[N]===e)))Z($.filter((t=>t[N]!==e)));else{const r=pl($,(e=>t===e[N]));if(!r)return;const n=r.children?.findIndex((t=>e===t[N]));n>=0&&(r.children.splice(n,1),Z([...$]))}},UPDATE_RECORD:(e,t)=>{const r=pl($,(t=>e===t[N]));r&&((0,J.merge)(r,t),Z([...$]))}})));const Z=e=>{_(e),X.current=e,Q.current=hl(e,N)},ee=e=>{if(a)return b;const t=dl(e,(e=>b.includes(e[R])));return 1===t.length?[t[0][N]]:[]},te=e=>fl($,e,N)?.slice(0,-1)||[],re=()=>{if(y)return Q.current;const e=[];return K.forEach((t=>{if(a){if("SHOW_ALL"===d&&!Q.current.includes(t)&&e.push(...te(t)),"SHOW_CHILD"===d&&e.push(...te(t)),"SHOW_PARENT"===d){const r=Or($,t);if(r){const n=te(t),a=gl(r,N);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),V(ee(e)),j({}),n?.(e)}}catch(e){}L(!1)},ae=e=>`${e}|${Na.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"===I,[`${ie}--sm`]:"small"===I};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:I,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(hl(t,N)):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(ht,{spinning:k},t().createElement(O.Tree,{fieldNames:{title:R,key:N,children:"children"},multiple:a,draggable:i,blockNode:i,checkable:a,selectable:!a,height:F,disabled:e.disabled,checkStrictly:u,selectedKeys:f??K,checkedKeys:f??K,expandedKeys:M,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,[N]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=ml(X.current,t,N,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][N]===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=>{V(e);const t=dl(X.current,(t=>e.includes((0,J.get)(t,N))));E?.(a?t:t[0])},onCheck:e=>{u&&(e=e.checked),V(e),"SHOW_CHILD"===d&&(e=e.filter((e=>!Q.current.includes(e)))),"SHOW_PARENT"===d&&(e=e.filter(((e,t,r)=>!r.includes(cl($,e,N)))));const t=dl(X.current,(t=>e.includes((0,J.get)(t,N))));S?.(a?t:t[0])}})))}));bl.displayName="QmSearchTree";const yl=bl,vl=(0,e.createContext)(void 0),xl={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,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},El=(i().arrayOf(i().shape(xl)).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),Sl="1",Cl="0",wl="YYYY-MM-DD",Tl="YYYY-MM-DD HH:mm:ss",Il="YYYYMMDDHHmmss",Nl={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 Rl=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Pl=[];const Ol={getFocusInstance:function(){return Pl[0]??null},getInstance:function(e){return Pl.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Pl.findIndex((e=>e===t))&&(this.deregister(e),Pl=[t,...Pl])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Pl=[{id:e,vm:t},...Pl])},deregister:function(e){e&&(Pl=Pl.filter((t=>t.id!==e)))}},Al=["&&","||","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++)Al.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"],kl=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(" ")},Ll=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,ql=["string","number","boolean","symbol"],$l=e=>ql.includes(typeof e),_l=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Dl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Ll,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Dl(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(Dl(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=(_l(e)?e.slice(0,10):e)!=r;break;case"<":n=(_l(e)?e.slice(0,10):e)<r;break;case"<=":n=(_l(e)?e.slice(0,10):e)<=r;break;case">":n=(_l(e)?e.slice(0,10):e)>r;break;case">=":n=(_l(e)?e.slice(0,10):e)>=r;break;default:n=(_l(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 jl=Fl.stringify,Kl=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},Ml=(e,t,r)=>{let n=[];t=Fl.replace_symbols(t);try{if(r){const r=new Function("record",`return ${kl(t,"record")};`);n=vo(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${kl(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},zl=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...zl(e.children)):t.push(e)})),t},Ul=e=>{const t=[];return e.forEach((e=>{let r=e;e.children&&(r={...e},r.children=Ul(e.children)),e.hidden||e.noAuth||t.push(r)})),t},Bl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Bl(e.children))})),t},Wl=(e,t)=>e.map((e=>(e.children&&(e.children=Wl(e.children,t)),t?.(e),e))),Gl=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Gl(r.children,t);if(e)return e}}return null},Yl=e=>{const t=e.children;return t?t[0].children?Yl(t[0]):t[0]:e},Xl=e=>{const t=e.children;return t?t[t.length-1].children?Xl(t[t.length-1]):t[t.length-1]:e},Ql=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Zl=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Zl(r.children,t);if(e)return e}}return null},Jl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Jl(e.children))})),t},eo=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 Bl(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},to=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 to(e.offsetParent,t,r)}return r},ro=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,no=(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])?no(r,t[n]):r)})),ao=(e,t)=>(0,J.intersection)(e,t).length===t.length,io=(e,t)=>(0,J.get)(e,t)??"",lo=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,J.set)(e,t,r??"")},oo=(e,t)=>{if(!t.includes("|"))return io(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(io(e,t))})),r.every((e=>!e))?"":r.join(" | ")},so=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},co=(e,t)=>e?s()(e,t):null,uo=(e,t)=>e?s()(e).format(t):"",po=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)}))},mo=e=>{const t=[];if(te(e)){const{children:r}=e.props;Array.isArray(r)?r.forEach((e=>t.push(...mo(e)))):r&&t.push(...mo(r))}else t.push(e);return t},ho=e=>e.filter((e=>!e._group)),fo=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)?Kl(i.condition):jl(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])?Kl(l[e]):jl(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},go=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(io(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},bo=(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=bo(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},yo=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=yo(r.children,t);if(e)return e}if(t(r))return r}return null},vo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&vo(e.children,t),t(e)||e.children&&e.children.length)));function xo(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 Eo=class{constructor(){xo(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),xo(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),xo(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)})),xo(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),xo(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)})),xo(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),xo(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)})),xo(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),xo(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),xo(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),xo(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),xo(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),xo(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),xo(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),xo(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},So={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 Co;const wo=()=>{if(ee)return 0;if(void 0!==Co)return Co;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),Co=t-n,Co},To=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=To(e.children)),e))),Io=(e,r)=>{const{fetch:n,columns:a,height:i,minHeight:l,maxHeight:o,border:s=!0,rowSelection:c,summation:u,expandable:d,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:I,sorter:N,filters:R,superFilters:P,pagination:O}=r,{selectionRows:A,summaries:F}=w.current,{expandIconColumn:H=""}=m||{},k=t().useMemo((()=>!!n?.api),[n?.api]),L=t().useMemo((()=>!k&&!!h),[k,h]),q=t().useMemo((()=>k&&!!f),[k,f]),$=t().useMemo((()=>(k||L)&&!q),[k,L,q]),_=t().useMemo((()=>!!(i||l||o)),[i,l,o]),D=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]})(To(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:So.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:So.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=d,a?.expandedRowRender?{dataIndex:So.expandableColumn,title:"",width:So.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),Ul(t)})(a)),[a]),j=t().useMemo((()=>zl(D)),[D]),K=t().useMemo((()=>j.filter((e=>"function"==typeof e.editRender))),[j]),V=t().useMemo((()=>j.filter((e=>!!e.summation))),[j]),M=t().useMemo((()=>j.filter((e=>"left"===e.fixed))),[j]),z=t().useMemo((()=>j.filter((e=>"right"===e.fixed))),[j]),U=t().useMemo((()=>{const e=j.filter((e=>![So.expandableColumn,So.selectionColumn,So.operationColumn].includes(e.dataIndex)));return H&&e.some((e=>e.dataIndex===H))?H:e[0]?.dataIndex??""}),[j,H]),B=t().useMemo((()=>V.length>0),[V]),W=t().useMemo((()=>!!C||B),[C,B]),G=t().useMemo((()=>eo(D).length>1),[D]),Y=t().useMemo((()=>s||G),[s,G]),X=t().useMemo((()=>j.some((e=>e.sorter))),[j]),Q=t().useMemo((()=>j.some((e=>e.filter))),[j]),Z=t().useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),J=t().useMemo((()=>!k&&!!x),[k,x]),ee=t().useMemo((()=>!!E&&K.length>0),[E,K]),te=t().useMemo((()=>!!S&&"checkbox"===c?.type),[S,c]),re=t().useMemo((()=>!!b&&Q),[b,Q]),ne=t().useMemo((()=>!k&&!!y&&Q),[k,y,Q]),ae=t().useMemo((()=>!!v&&j.some((e=>!!e.groupSummary))),[j]),ie=t().useMemo((()=>!!u?.groupItems?.length),[u]),le=t().useMemo((()=>!!g&&!k&&!h),[g,k,h]),oe=t().useMemo((()=>T.some((e=>Array.isArray(e.children)&&e.children.length))),[T]),se=t().useMemo((()=>!I.length),[I]),ce=t().useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:r,precision:n,summation:a}=t,{sumBySelection:i,displayWhenNotSelect:l,unit:o}=a,s=ie?ho(w.current.tableFullData):w.current.tableFullData,c=!A.length&&!!l;let u=(!i||c?s:A).reduce(((e,t)=>{if(t?.[So.summaryIgnore])return e;const n=Number(io(t,r));return Number.isNaN(n)?e:new(Xr())(e).plus(n).toNumber()}),0);!Object.keys(F).includes(r)||i&&!c||(u=Number(io(F,r))),lo(e,r,u);let d=n>=0?u.toFixed(n):u;d=so(d),lo(e,`${r}_text`,o?`${d} ${o}`:d)})),[e]})()),[T,A,F]),ue=t().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),de=t().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(N),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=So.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:So.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})(R,P);return{...e?{[So.sorterFieldName]:e}:null,...t.length?{[So.filterFieldName]:t}:null,...ue?{[So.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...n?.params??null,[So.currentPageName]:O.current,[So.pageSizeName]:O.pageSize}}),[n?.params,O.current,O.pageSize,N,R,P,ue]);return{isFetch:k,isWebPagination:L,isScrollPagination:q,showPagination:$,shouldUpdateHeight:_,tableColumns:D,flattenColumns:j,editableColumns:K,summationColumns:V,leftFixedColumns:M,rightFixedColumns:z,treeExpandIndex:U,showSummary:B,showFooter:W,isHeadGroup:G,bordered:Y,isHeadSorter:X,isHeadFilter:Q,isServiceSummation:Z,isSelectCollection:te,isTableImport:J,isTableClipboard:ee,isSuperSearch:re,isFastSearch:ne,isGroupSummary:ae,isGroupSubtotal:ie,isDragMergeCell:le,isTreeTable:oe,isTableEmpty:se,summationRows:ce,fetchParams:de}},No=(e,r)=>{const{rowKey:n,dataSource:a,summation:i,fetch:l,initialSorter:o,initialFilter:s,rowSelection:c,expandable:u,treeConfig:d,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:I,tableFullData:N,pagination:R,layout:P,filters:O,sorter:A,superFilters:F,fetchParams:H,selectionKeys:k,rowExpandedKeys:L,highlightKey:q,summationColumns:$,shouldUpdateHeight:_,isFetch:D,isTreeTable:j,isWebPagination:K,isScrollPagination:V,isServiceSummation:M,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:ue,setScrollYStore:de,setFieldAuth:pe,setResizeState:me,setSummaries:he,setPermission:fe,setRecordsMap:ge,resetTableScroll:be,clearElementStore:ye,clearRecordsMap:ve}=r,{store:xe}=S.current,Ee=Et(C),Se=t().useRef({...H}),Ce=t().useRef(new Map);De((()=>{U()}),[I,T,P.tableAutoHeight]),De((()=>{we()}),[Ee]),De((()=>{nt(),at(),it(),D||(K&&Ge(),Ve(a)),o&&te(o),s&&re(s)}),[a,l?.params]),De((()=>{const e=_e(H,Se.current);e||D&&c?.clearableAfterFetched&<(),!e&&H[So.currentPageName]>1&&!l?.stopToFirst?Ge():D&&Ke(),Se.current=H}),[H]),De((()=>{K&&Je(),V||be(),Le()}),[R.current,R.pageSize]),De((()=>{D||Te(N.length),U()}),[N]),De((()=>{j&&d?.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})))},Ie=St((e=>{Ue(),v?.(e)})),Ne=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?go(e,[r.dataIndex]).map((e=>{const a={children:Pe(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&lo(a,n.toString(),po()),r.titleIndex&&lo(a,r.titleIndex,io(e[0],r.titleIndex)),lo(a,r.dataIndex,io(e[0],r.dataIndex)),$.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[So.summaryIgnore])return e;const n=Number(io(r,t));return Number.isNaN(n)?e:e+n}),0);lo(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Oe=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},Ae=e=>{const{type:t,checkStrictly:r=!0}=c||{},n=Array.isArray(e)?e:k;let a=[];return S.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{deriveRowKeys:r}=S.current,n=Zl(r,e);let a=[];if(!n)return a;const i=He(n?.children||[]),l=bo(r,e)?.slice(0,-1).reverse()||[];return a=[...new Set([...t,...i])],l.forEach((e=>{const t=Zl(r,e),n=ao(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},Fe=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:a}=u||{},i=Array.isArray(e)?e:L;if(S.current.treeTable){a&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...k];q&&e.unshift(q);let l=[];return e.forEach((e=>{const t=bo(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 u?n?t.slice(0):[...i]:[]},He=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...He(e[r].children)),t.push(e[r].rowKey);return t},ke=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...ke(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...ke(e,r[r.length-1])),r},Le=St((()=>{ze(),f?.(R,$e(O),qe(A),F,{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[So.showFilterType?`${n}|${a}`:n]=e[r]}return t},_e=(e,t)=>{const r=Object.keys(no(e,t));return 1===r.length&&(r.includes(So.currentPageName)||r.includes(So.pageSizeName))},je=async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=ae,afterFetch:r,callback:n}=l;if(!t(H))return;const a=V&&H[So.currentPageName]>Se.current[So.currentPageName]&&_e(H,Se.current),o=!!i?.fetch?.api;ee(!0);try{const[t,s]=o?await Promise.all([l.api(e(H)),i.fetch.api(e(H))]):[await l.api(e(H))];if(o?200===t.code&&200===s.code:200===t.code){const e=l.dataKey??So.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(/[^.]+$/,So.totalKey))||i.length||0;Ve(a?S.current.tableFullData.concat(i):i),Te(o),Me(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=St(je),Ve=e=>{const t=e=>e.map(((e,r)=>(Array.isArray(e.children)&&e.children.length&&(e.children=t(e.children)),e.index=r,m||(e.pageIndex=(e=>{const{current:t,pageSize:r}=R;return!D||V?e:(t-1)*r+e})(r)),e))),r=Ne(t(e));et(r),tt(r),rt(),ie(Ae()),le(Fe()),ce(Oe(k)),ze(),y?.(r)},Me=e=>{if(!M)return;const t=i?.fetch?.dataKey??So.summationKey,r=(t?(0,J.get)(e,t):e)??{},n={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{lo(n,e.dataIndex,Number(io(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);ie([t])}else ie([])}},Ue=()=>{if(!V)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)},Ge=()=>{Be(Object.assign({},R,{current:1}))},Ye=()=>{if(!S.current.treeTable||!d?.virtual)return;const e=Xe(S.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=S.current,{rowExpandable:r}=u||{},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&&d?.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})()),ue(e.length>So.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=()=>{ie([])};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=Wl(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=Gl(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&&k.length&&w.current.setClickedValues([k[0],""]),D?je():Ve(a)},createTableFullData:et,getTableData:je,handleTableData:Ze,createTableData:Ve,createGroupData:Ne,createSelectionKeys:Ae,createSelectionRows:Oe,createRowExpandedKeys:Fe,findParentRowKeys:ke,getAllChildRowKeys:He,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||(de(Object.assign({},t,{startIndex:s,endIndex:c})),Je()))}(e)},scrollBottomDebouncer:Ie,clearTableSorter:nt,clearTableFilter:at,clearSuperFilters:it,clearRowSelection:lt,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{xe.clearAllLog()},destroy:()=>{ye(),xe.destroy(),Ol.deregister(S.current.uid)}}},Ro=(e,r)=>{const{height:n,minHeight:a,maxHeight:i,resizable:l,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:u,$size:d,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:I,setShouldToTop:N}=r,R=t().useRef(g),P=t().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=f,r={};return a&&Object.assign(r,{minHeight:`${ro(a)}px`}),i&&Object.assign(r,{maxHeight:`${ro(i)}px`}),E?{...r,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...r,height:"auto"!==n?`${ro(n)}px`:`${t}px`}:r}),[n,i,a,E,f]),O=(e,t)=>{const{elementStore:r,scrollYStore:n,allTableData:a}=u.current,i=r.$tableBody.parentNode.parentNode;if(void 0!==t&&t>=0)i.scrollTop=t*n.rowHeight;else{const t=(x?Jl(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}=u.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=Yl(Gl(p,e)).dataIndex);let t=0;for(let r=0;r<m.length;r++){const n=m[r];if(n.dataIndex===e)break;t+=ro(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{m.findIndex((t=>t.dataIndex===e))<0&&(e=Xl(Gl(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+=ro(n.width||n.renderWidth||0)}return t},scrollXToColumn:(e,t)=>{const{elementStore:r}=u.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||So.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}=u.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}=u.current,r=t.winHeight-e.$table.getBoundingClientRect().top-(v?an["small"!==d?"middle":d]+El:0)-El;S((e=>Object.assign({},e,{tableAutoHeight:r})))},resetTableScroll:()=>{const{shouldToTop:e}=u.current;e&&O("",0),N(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=u.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+El:0,n=e.$pager?e.$pager.offsetHeight+El:0;p=r.winHeight-t-n-20}l!==f.viewportHeight&&(e=>{const{scrollYStore:t,isIE:r}=u.current,{startIndex:n,endIndex:a}=t,i=So.rowHeightMaps[d],l=Math.max(8,Math.ceil(e/i)+2),o=r?5:0;I(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}=u.current,t=e.$table.clientWidth,r=R.current?f.gutterWidth:0,{defaultColumnWidth:n}=So,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 Po(){const[,t]=e.useReducer((e=>e+1),0);return t}const Oo=e=>{const{total:r}=e,{tableRef:n,tableProps:a,selectionKeys:i,isHeadSorter:l,isHeadFilter:o,isTreeTable:s,clearTableSorter:c,clearTableFilter:u,clearSuperFilters:d,clearRowSelection:m,clearRowHighlight:h}=t().useContext(vl),{infoBarConfig:f,rowSelection:g,rowHighlight:b}=a,{allTableData:y}=n.current,{hideAlert:v,hideClearButton:x}=f||{},E=t().useMemo((()=>!v),[v]),S=t().useMemo((()=>!x&&!!(l||o||g||b)),[x,l,o,g,b]),C={[`${Ce("table")}__alert`]:!0};return E?t().createElement("div",{className:Se()(C)},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})}`:""),S&&t().createElement("em",{onClick:()=>{c(),u(),d(),m(),h()}},p("qm.table.alert.clear"))):null},Ao=t().forwardRef(((e,r)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:i}=t().useContext(vl),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}));Ao.displayName="FullScreen";const Fo=Ao,Ho=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(vl),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 ko=Ho,Lo=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:s,tableProps:c,flattenColumns:u,summationRows:d,showSummary:m,getSpan:h}=t().useContext(vl),{tablePrint:f,showHeader:g}=c,b=i?.print?.leftLogo??"",y=i?.print?.rightLogo??"",v=!(!b&&!y),x=t().useMemo((()=>ce(Ql(n,[So.expandableColumn,So.selectionColumn,So.operationColumn]))),[n]),E=t().useMemo((()=>ce(Ql(u,[So.expandableColumn,So.selectionColumn,So.operationColumn]))),[u]),S=t().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),C=(e,t)=>{const r=Object.assign({},Gl(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||So.defaultColumnWidth,n<=So.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=So.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(eo(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+=I(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},I=(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||So.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&&d.length&&(a+=["<tfoot>",d.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(r):io(e,`${a}_text`);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},N=()=>{((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});At(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:N})));const R=Ce("table");return a?t().createElement("span",{className:`${R}-print`,title:p("qm.table.print.text"),onClick:()=>N()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PrinterOutlined,null))):null}));Lo.displayName="TablePrint";const qo=Lo,$o=require("exceljs");var _o=n.n($o);const Do="606060",jo="thin",Ko="d4d4d4",Vo=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Mo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},zo=()=>({top:{style:jo,color:{argb:Ko}},left:{style:jo,color:{argb:Ko}},bottom:{style:jo,color:{argb:Ko}},right:{style:jo,color:{argb:Ko}}}),Uo=e=>{const{children:t}=e;return t&&t.length?Uo(t[0]):e},Bo=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},Wo=()=>{const{tableRef:e,tableProps:r,getSpan:n,showSummary:a,isHeadGroup:i}=t().useContext(vl),{spanMethod:l,showHeader:o}=r,s=(e,t)=>e.find((e=>e.text==t))?.value??"";return{exportXLSX:async(t,r,s,c)=>{const{columns:u,footSummation:d}=t,{scrollYStore:{rowHeight:m}}=e.current,h=zl(u),f=eo(u),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||So.defaultColumnWidth)/8})})),o&&(i?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Uo(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?io(e,i.dataIndex):c(e,t,i,o)})),a}));x+=S.length,a&&d&&s(h,r).forEach(((e,t)=>{const n={};h.forEach(((t,a)=>{const{dataIndex:i,summation:l}=t,o=l?.render?l.render(r):io(e,i);n[i]=0===a&&""===o?p("qm.table.config.summaryText"):te(o)?mo(o).join(""):o})),b.push(n)}));const{sheetName:C,useStyle:w}=t,T=new(_o().Workbook),I=T.addWorksheet(C);I.columns=y,o&&I.addRows(g).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),r=Gl(u,t.key),{align:n,theadAlign:a}=r;Mo(e,a||n),w&&Object.assign(e,{font:{bold:!0,color:{argb:Do}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:zo()})}))})),I.addRows(S).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),r=Gl(u,t.key),{align:n}=r;Mo(e,n),Object.assign(e,Bo(r)),w&&Object.assign(e,{font:{color:{argb:Do}},border:zo()})}))})),a&&d&&I.addRows(b).forEach((e=>{w&&Vo(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),r=Gl(u,t.key),{align:n}=r;Mo(e,n),Object.assign(e,Bo(r)),w&&Object.assign(e,{font:{color:{argb:Do}},border:zo()})}))})),v.forEach((e=>{let{s:t,e:r}=e;I.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const N=await T.xlsx.writeBuffer();return new Blob([N],{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=zl(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(_o().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=uo(e,Tl)),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])),lo(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)}}},Go=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 u="";if(!n)for(let e=0;e<s.length;e++){const{type:r}=o(s[e]);if(t.type!==r){u=r;break}}u?(O.message.warning(p("qm.upload.notType",{type:u})),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"))},Yo=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableProps:i,createTableData:l,dataChange:o}=t().useContext(vl),{beforeTableImport:s}=i,{importXLSX:c}=Wo(),u=t().useRef(null),[d,m]=t().useState(!1),[h,f]=t().useState(!0),g=e=>e.filter((e=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.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(Go,{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:u,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:d,disabled:h,onClick:()=>(async()=>{const[e,t]=await u.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"))))},Xo=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(sr,c,t().createElement(Yo,{columns:n,onClose:()=>l(!1)})))}));Xo.displayName="TableImport";const Qo=Xo,Zo=e=>{const{columns:r,onChange:n}=e,{$size:a}=t().useContext(vl),i=t().useRef([]),[l,o]=t().useState(!1),[s,c]=t().useState(r);De((()=>{d()}),[s]),t().useEffect((()=>{u()}),[r]);const u=()=>{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},d=()=>{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(bn(),{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(qr.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:Nl,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"))))},Jo=e=>{const{defaultValue:r,onClose:n,onOk:a}=e,{tableProps:i,pagination:l,showSummary:o}=t().useContext(vl),{rowSelection:c}=i,u=t().useRef(null),[d,m]=t().useState(!1),h=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(Il)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:"all","startIndex|endIndex":[1,l.total],footSummation:o?1:0,useStyle:0},r,{columns:ce(r.columns||[])})),[]),[f,g]=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"!==c?.type},{text:p("qm.table.export.custom"),value:"custom"}]},onChange:e=>{f.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,g([...f])}},options:{min:1},disabled:!0},{type:"INPUT",label:p("qm.table.columnFilter.text"),fieldName:"columns",render:(e,r)=>t().createElement(Zo,{columns:r.state.formData.columns,onChange:e=>{r.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:p("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!o,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:p("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),b=Ce("table");return t().createElement("div",{className:`${b}-export__setting`},t().createElement(Ii,{ref:u,initialValues:h,items:f,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:d,onClick:()=>(async()=>{const[e,t]=await u.current.GET_FORM_DATA();if(!e){m(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);a(t),await ie(1e3),m(!1),n()}})()},p("qm.table.export.text"))))},es=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:c,tableProps:u,flattenColumns:d,pagination:m,fetchParams:h,isFetch:f,isGroupSubtotal:g,showSummary:b,getSpan:y}=t().useContext(vl),{exportExcel:v,fetch:x,showHeader:E}=u,[S,C]=t().useState(!1),[w,T]=t().useState(!1),I=t().useMemo((()=>!!v?.fetch?.api),[v]),N=t().useMemo((()=>!m.total||w),[m.total,w]),R=t().useMemo((()=>Ql(n,[So.expandableColumn,So.selectionColumn,So.operationColumn])),[n]),P=t().useMemo((()=>Ql(d,[So.expandableColumn,So.selectionColumn,So.operationColumn])),[d]),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(g?ho(t):t).reduce(((e,t)=>{if(t?.[So.summaryIgnore])return e;const r=Number(io(t,n));return Number.isNaN(r)?e:e+r}),0);lo(r,n,a)})),[r]},F=(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:H,exportCSV:k}=Wo(),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),[So.currentPageName]:1,[So.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=Jl(e.map(((e,t)=>{const r={...e,index:t,pageIndex:t};return P.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&lo(r,n,io(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(N)return O.message.warning(p("qm.table.export.warnText"));I?(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,[So.currentPageName]:void 0,[So.pageSizeName]:void 0});n.data&&(At(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)},V={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(sr,K,t().createElement(Jo,{defaultValue:V,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 H(e,c,A,F);At(r,`${t}.xlsx`),q(`${t}.xlsx`)}if("csv"===r){const r=k(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=eo(r),i=zl(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||So.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}">${F(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):io(e,a);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):te(l)?mo(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));At(r,`${t}.csv`),q(`${t}.csv`)}})(Object.assign({},e,{columns:Ul(e.columns)}))}})))}));es.displayName="TableExport";const ts=es,rs=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableBodyRef:i,tableProps:l,dataChange:o}=t().useContext(vl),{beforeClipboard:s}=l,c=t().useRef(null),[u,d]=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:u,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:u}=a.current;h(!0);const d=t.content.trim().replace(/(\r|\n)$/,"");let m=d.replace(/"[^"]+"/g,"^");(d.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&&(lo(o,s.dataIndex,e),u.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"))))},ns=t().forwardRef(((e,r)=>{const{flattenColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:s})));const c={[`${Ce("table")}-clipboard`]:!0},u={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(sr,u,t().createElement(rs,{columns:o,onClose:()=>l(!1)})))}));ns.displayName="TableClipboard";const as=ns,is=e=>{const{columns:r,onClose:n}=e,{tableProps:a,tableRef:i,$size:l,selectionKeys:o,setSelectionKeys:s}=t().useContext(vl),{rowKey:c}=a,u=t().useRef(null),d=Et(u),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=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.operationColumn].includes(e.dataIndex))))]),[g]=t().useState(i.current.selectionRows.map((e=>({...e,children:void 0})))),[b,y]=t().useState(300),v=St((()=>{const e=u.current;y(e.offsetHeight-2*an[l]-30)}),5);return De((()=>{v()}),[d.width]),t().createElement("div",{ref:u,style:{height:"100%"}},t().createElement(ec,{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"))))},ls=t().forwardRef(((e,r)=>{const{columns:n,open:a=!0}=e,{tableProps:i,getRowKey:l,isFetch:o,isTableEmpty:s,setSelectionKeys:c,setSelectionRows:u}=t().useContext(vl),{rowSelection:d}=i,[m,h]=t().useState(!1),f=t().useRef(!1);De((()=>{!f.current&&g()}),[s]);const g=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=d;if(o&&e)try{const r=await e.api(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))),u(n),c(n.map(((e,t)=>l(e,t)))),f.current=!0}}catch(e){}},b=()=>{h(!0)};t().useImperativeHandle(r,(()=>({clickHandle:b})));const y=Ce("table"),v={visible:m,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>h(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:`${y}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>b()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CheckSquareOutlined,null))),t().createElement(sr,v,t().createElement(is,{columns:n,onClose:()=>h(!1)})))}));ls.displayName="SelectCollection";const os=ls,ss=require("localforage");var cs=n.n(ss);const us=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),ds=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,tableRef:i,getRowKey:o,$size:s,flattenColumns:c,pagination:u,setPagination:d,scrollYToRecord:m,setHighlightKey:h,setShouldToTop:f,isTreeTable:b,isWebPagination:y}=t().useContext(vl),{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}=u,r=i.current.tableFullData.slice((e-1)*t,e*t),n=Jl(r).findIndex((e=>o(e,e.index)===C.current));m("",n)}),[u.current]);const I=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},N=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:I(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);F(a)}}))),R={case:0,fullchar:0},P=t().useMemo((()=>c.filter((e=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[A,F]=t().useState({}),[H,k]=t().useState(R),[L]=t().useState(N([P[0]])),[q]=t().useState(N(P.slice(1))),[$,_]=t().useState(0),D=t().useMemo((()=>!Object.keys(A).length),[A]);De((()=>{T.current="ready"}),[A,H]);const j=e=>{k(Object.assign({},H,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()}})})),V=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=io(a,t),l=!0;if("text"===r||"textarea"===r?l=new RegExp(H.fullchar?`^${e[t]}$`:e[t],H.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=bo(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}=u,r=Math.ceil((t+1)/e);f(!1),d(Object.assign({},u,{current:r}))}else m(e)})(r,n),h(r)},M=()=>{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)))),F(e),k(t)}else M(),F({}),k(R)}),[Y]),t().useEffect((()=>{Q()}),[]);const Q=async()=>{if(!z)return;let e=await cs().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await cs().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(Zt,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t().createElement("span",null,p("qm.table.alert.total",{total:$}))},t().createElement(Zt.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(Zt.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=po(),t=[...U,{text:W,value:e,list:{filters:A,config:H}}];B(t),X(e),G(""),await cs().setItem(z,t),await te(z,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${So.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 cs().setItem(z,t),await te(z,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!U.length&&t().createElement("div",{style:{padding:El}},t().createElement(pt,null)))))),t().createElement("div",{className:"bottom"},t().createElement("div",null,t().createElement(O.Checkbox,{checked:!!H.case,onChange:e=>j({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t().createElement(O.Checkbox,{checked:!!H.fullchar,onChange:e=>j({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t().createElement("div",null,t().createElement(he,{onClick:()=>M()},p("qm.table.fastSearch.clear"))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${an[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:()=>V("prev")},p("qm.table.fastSearch.queryPrev")),t().createElement(he,{type:"primary",onClick:()=>V("next")},p("qm.table.fastSearch.queryNext"))))},ps=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{$size:a}=t().useContext(vl),[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:`${an[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(sr,c,t().createElement(ds,{onClose:()=>l(!1)})))}));ps.displayName="FastSearch";const ms=ps,hs=e=>{const{columns:r,group:n,summary:a}=e,{tableRef:i,tableProps:l,$size:o,pagination:c,fetchParams:u,isFetch:d}=t().useContext(vl),{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===So.groupSummary.total.value?{dataIndex:e.summary,title:So.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...h(e.summary),formula:e.formula})),b=t().useMemo((()=>Object.assign({},u,{[So.sorterFieldName]:void 0,[So.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[So.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[So.currentPageName]:1})),[u,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===So.groupSummary.total.value&&(n={dataIndex:So.groupSummary.recordTotalIndex,summation:{render:()=>c.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(f,g)),[x]=t().useState(d?[]:(e=>{const t=go(e,n.map((e=>e.group))),r=[];return t.forEach((e=>{const t={};y.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&lo(t,n,io(e[0],n))})),a.forEach((r=>{const n=r.summary!==So.groupSummary.total.value?r.summary:So.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&lo(t,n,e.length),"sum"===a&&lo(t,n,(0,J.sumBy)(e,n)),"max"===a&&lo(t,n,(0,J.maxBy)(e,n)[n]),"min"===a&&lo(t,n,(0,J.minBy)(e,n)[n]),"avg"===a&&lo(t,n,((0,J.sumBy)(e,n)/e.length).toFixed(2))})),r.push(t)})),r})(i.current.tableFullData)),E={size:o,height:400,...d?{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(ec,E)},fs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o}=t().useContext(vl),{uniqueKey:s}=a,c=t().useRef(null),u=t().useRef(null),[d,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;N(e),F(t)}else{const e=q();N(e?.group||[]),F(e?.summary||[])}}),[v]),t().useEffect((()=>{$()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),S=t().useMemo((()=>o.filter((e=>![So.expandableColumn,So.selectionColumn,"index","pageIndex",So.operationColumn].includes(e.dataIndex)))),[o]),C=S.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[So.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"}],[I,N]=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:I.findIndex((t=>t.group===e.value))>-1})))})}]),[A,F]=t().useState([]),[H,k]=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:()=>{u.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===So.groupSummary.total.value?T.slice(T.length-1):T})}]),L=t().useMemo((()=>{const e=I.length&&I.every((e=>Object.values(e).every((e=>""!==e)))),t=A.length&&A.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[I,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;N(t),F(r)}let t=await cs().getItem(E);t||(t=await _(E),Array.isArray(t)&&await cs().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:d,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(ec,{ref:c,size:i,columns:R,dataSource:I,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{N(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(ec,{ref:u,size:i,columns:H,dataSource:A,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{F(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{u.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=po(),t=[...h,{text:b,value:e,list:{group:I.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))}}];f(t),x(e),y(""),await cs().setItem(E,t),await D(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${So.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 cs().setItem(E,t),await D(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!h.length&&t().createElement("div",{style:{padding:El}},t().createElement(pt,null)))))),t().createElement(sr,K,t().createElement(hs,{columns:S,group:I,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:I.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))})),void m(!0))},p("qm.table.groupSummary.confirmButton"))))},gs=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(sr,s,t().createElement(fs,{onClose:()=>i(!1)})))}));gs.displayName="GroupSummary";const bs=gs,ys=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableProps:a,$size:i,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(vl),{uniqueKey:u}=a,d=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((()=>u?`superSearch_${u}`:""),[u]),C=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=fo(m),T=t().useMemo((()=>!(w&&Vl(w))),[w]),I=t().useMemo((()=>!!m.length&&T),[m,T]),N=[{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},F=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},[H,k]=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:()=>{d.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=F(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:F(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:N,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 cs().getItem(S);t||(t=await _(S),Array.isArray(t)&&await cs().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(ec,{ref:d,size:i,columns:H,dataSource:m,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(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:()=>{d.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),So.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=po(),t=[...f,{text:y,value:e,list:m.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await cs().setItem(S,t),await D(S,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${So.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 cs().setItem(S,t),await D(S,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:El}},t().createElement(pt,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:I,onClick:()=>(c(),s(m.map((e=>Z()(e,["index","pageIndex"])))),L(),void r())},p("qm.table.highSearch.searchButton"))))},vs=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.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(sr,s,t().createElement(ys,{onClose:()=>i(!1)})))}));vs.displayName="SuperSearch";const xs=vs,Es=t().forwardRef(((e,r)=>{const{tableColumns:n,showFullScreen:a,showReload:i,showPrint:o,showImport:s,showExport:c,showClipboard:u,showCollection:d,showFastSearch:m,showSuperSearch:h,showGroupSummary:f,showToolBox:b}=e,{global:y}=t().useContext(l),{tableProps:v,flattenColumns:x,isFullScreen:E,$size:S}=t().useContext(vl),{uniqueKey:C,exportExcel:w}=v,T=t().useRef(null),I=t().useRef(null),N=t().useRef(null),R=t().useRef(null),P=t().useRef(null),A=t().useRef(null),F=t().useRef(null),H=t().useRef(null),k=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:u,collection:d,fastSearch:m,superSearch:h,groupSummary:f},[K,V]=t().useState(!1);De((()=>{q.current&&(z(),q.current=!1)}),[_]),t().useEffect((()=>{M()}),[]),t().useImperativeHandle(r,(()=>({exportHandle:()=>{if(!P.current)return g("Table","执行导出需要配置 `exportExcel` 参数");P.current.clickHandle()}})));const M=()=>{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=>{V(!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(ko,{ref:I,open:!b||_.reload}),o&&t().createElement(qo,{ref:N,tableColumns:n,open:!b||_.print}),s&&t().createElement(Qo,{ref:R,tableColumns:n,open:!b||_.import}),c&&t().createElement(ts,{ref:P,tableColumns:n,open:(!b||_.export)&&!w?.hideIcon}),u&&t().createElement(as,{ref:A,flattenColumns:x,open:!b||_.clipboard}),d&&t().createElement(os,{ref:F,columns:n,open:!b||_.collection}),m&&t().createElement(ms,{ref:H,open:!b||_.fastSearch}),f&&t().createElement(bs,{ref:k,open:!b||_.groupSummary}),h&&t().createElement(xs,{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(I)},{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(N)},{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(F)},{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(H)},{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(k)},{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=>{V(e)}},t().createElement("span",{className:`${Y}-toolbox`,title:p("qm.table.toolbox.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.AppstoreAddOutlined,null)))))}));Es.displayName="ToolBox";const Ss=Es,Cs=e=>{const{columns:r}=e,{global:n}=t().useContext(l),{tableProps:a,tableRef:i,$size:o}=t().useContext(vl),{uniqueKey:s,onlyShowIcon:c,columnsChange:u}=a,d=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),N(r)}),[r]),t().useEffect((()=>{R()}),[]);const I=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=I(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}})),N=e=>{if(!w)return;const t=I(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 N(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?Wl(r,(t=>{const r=Gl(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),u?.(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))})),d.current=t},F=()=>{const e=[];T.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=d.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...d.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)})),u?.(e)},H=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const n=P(r);u?.(n)},k=(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),F()}}),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:()=>H(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>H(e,"right")},t().createElement(we.StepForwardOutlined,null))):t().createElement("span",{className:Se()("fixed",i?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>H(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(bn(),{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),u?.(e)}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement(qr.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:()=>F()},y.map((e=>k(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement(qr.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:()=>F()},S.map((e=>k(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement(qr.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:()=>F()},x.map((e=>k(e,"right")))))),popupClassName:Se()(q),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{b(e)},builtinPlacements:Nl,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"))))},ws=()=>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 Ts(){return Ts=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},Ts.apply(this,arguments)}const Is=e=>{const{column:r,filters:n}=e,{$size:a,setFilters:i,clearSuperFilters:l}=t().useContext(vl),o=t().useRef(null),s=t().useRef(null),c=t().useRef(null),[u,d]=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((()=>{u&&setTimeout((()=>x()),50)}),[u]),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})),d(!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,Ts({ref:s},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(O.InputNumber,Ts({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(O.InputNumber,Ts({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(O.InputNumber,Ts({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const r=e=>({value:co(f[y]?.[e],wl),format:wl,size:a,onChange:t=>{b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:uo(t,wl)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(_,Ts({},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(_,Ts({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(_,Ts({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(_,Ts({},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(yl,{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:u,actived:v}];return t().createElement(bn(),{action:["click"],popupVisible:u,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=>{d(e)},builtinPlacements:Nl,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(ws,null))))},Ns=e=>{const{column:r}=e,{tableProps:n,tableRef:a,bordered:i}=t().useContext(vl),{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,u=to(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+o;n.$table.classList.add("c--resize"),i.style.left=`${u}px`,i.style.display="block";const d=r.width||r.renderWidth;let p=d;return document.onmousemove=function(e){if("number"!=typeof d)return;const t=e.clientX-c,n=d+t;n<(r.minWidth||So.defaultColumnWidth)||(p=Math.floor(n),i.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),i.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Gl(l,r.dataIndex).width=p,s([...l]))},!1}})},Rs=e=>{const{selectionKeys:r}=e,{tableRef:n,tableProps:a,getRowKey:i,pagination:l,fetchParams:o,setSelectionKeys:s,setSpinning:c,isWebPagination:u}=t().useContext(vl),{rowSelection:d}=a,{fetchAllRowKeys:m,onSelectAll:h}=d,f=t().useRef([]),g=t().useMemo((()=>d.selectAllOnCurrentPage??!1),[d]),b=t().useMemo((()=>(d.filterable??!0)&&!g),[d,g]),y=(()=>{const{allTableData:e,allRowKeys:t}=n.current,{disabled:a=(e=>!1)}=d;return g?(0,J.union)((()=>{const{tableFullData:e}=n.current,{current:t,pageSize:r}=l;return u?e.slice((t-1)*r,t*r):e})().filter((e=>!a(e))).map((e=>i(e,e.index))),r):t.filter(((t,r)=>!a(e[r])))})(),v=r.length>0&&r.length<(m||g?l.total:n.current.allRowKeys.length),x=!!r.length&&r.length===(f.current.length||y.length),E=async()=>{const e=m;let t=[];c(!0);try{const r=await e.api(o);200===r.code&&(t=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[],f.current=t)}catch(e){}return c(!1),t},S=async e=>{let t=[];t=m?e?await E():[]:e?y.slice(0):[],s(t),h?.(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(O.Checkbox,{checked:x,indeterminate:v,disabled:!y.length,onChange:e=>S(e.target.checked)}),b&&t().createElement(O.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{S(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=m?(0,J.xor)(r,await E()):(0,J.xor)(r,y),s(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{S(!1)}}];return t().createElement(O.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),g&&t().createElement(O.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},Ps=e=>{const{style:r}=e,{tableProps:n,tableRef:a,isTreeTable:i,setRowExpandedKeys:l}=t().useContext(vl),{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 u={[`${Ce("expand")}--icon`]:!0,expanded:s,collapsed:!s};return t().createElement("span",{className:Se()(u),title:"",onClick:e=>{e.stopPropagation(),c(!s)},style:r})},Os=()=>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"})),As=()=>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:u,superFilters:d,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:I}=t().useContext(vl),{ellipsis:N,resizable:R,multipleSort:P,rowSelection:A,expandable:F}=o,[H,k]=So.sortDirections,L=t().useRef(null),q=t().useMemo((()=>!g),[g]),$=t().useMemo((()=>!g),[g]),_=t().useMemo((()=>!F?.hideExpandAll),[F]),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()}),[d]),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===So.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},D?t().createElement(Rs,{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(Ps,null):null,r===So.expandableColumn&&_?t().createElement(Ps,null):l)),o&&s.push(t().createElement(O.Tooltip,{key:1,placement:"top",title:o},t().createElement(we.InfoCircleOutlined,{className:"tip"}))),i&&s.push(V(a[r])),s},V=e=>{const r=["svgicon cell--sorter__asc",{actived:e===H}],n=["svgicon cell--sorter__desc",{actived:e===k}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Se()(r)},t().createElement(Os,null)),t().createElement("span",{className:Se()(n)},t().createElement(As,null)))},M=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===k?null:k:H;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"},H)},W=(e,t)=>{const{tableFullData:r}=s.current,{dataIndex:n,sorter:a}=e,i=(e,r)=>{const a=io(e,n),i=io(r,n);return Number.isNaN(a-i)?t===H?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===H?a-i:i-a},l=y?T(ho(r).sort("function"==typeof a?a:i)):r.sort("function"==typeof a?a:i).slice(0);I(l)},G=()=>{$&&Y()},Y=()=>{const{tableOriginData:e}=s.current,t=d.length?fo(d):fo(i),r=""!==t?y?T(Ml(ho(e),t,b)):Ml(e,t,b):e;I(r),B(!0)},X=eo(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`}})})),u&&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:d,rowSpan:p,fixed:m,align:h,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===d)return null;const E=f||h,S=["header--column",{"col--ellipsis":e.ellipsis??N,"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)+(u?l:0)}px`:""},I=R&&![So.expandableColumn,So.selectionColumn].includes(o);return t().createElement("th",{key:o,className:Se()(S),colSpan:d,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?M(e):null)),I&&t().createElement(Ns,{column:e}))})(r,n,e))),u&&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(vl),{rowSelection:u}=l,d=t().useMemo((()=>n.type||""),[n.type]),p=e=>{const t=u.checkStrictly??!0;if(!s||t)return!1;const n=Zl(o.current.deriveRowKeys,e),a=c(n?.children??[]);return!(!Array.isArray(n?.children)||ao(r,n?.children.map((e=>e.rowKey))||[]))&&a.some((e=>r.includes(e)))};return"radio"===d?(()=>{const e=u.disabled,n=e?.(a),l=!n&&r[0]===i;return t().createElement(O.Radio,{checked:l,disabled:n})})():(()=>{const e=u.disabled,n=e?.(a),l=!!r.includes(i);return t().createElement(O.Checkbox,{checked:l,indeterminate:p(i),disabled:n})})()},ks=e=>{const{record:r,rowKey:n,style:a}=e,{tableProps:i,rowExpandedKeys:l,setRowExpandedKeys:o}=t().useContext(vl),{expandable:s={}}=i,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(r)),u=t().useMemo((()=>l.includes(n)),[l,n]);De((()=>{s.onExpand?.(u,r)}),[u]);const d={[`${Ce("expand")}--icon`]:!0,expanded:u,collapsed:!u,disabled:c};return t().createElement("span",{className:Se()(d),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=u?l.filter((e=>e!==n)):[...l,n];o(t)},style:a})},Ls=t().forwardRef(((e,r)=>{const{size:n,defaultValue:a,value:i,min:l,max:o,prefix:s,suffix:c,placeholder:u,maxLength:d,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(Xr())(t).toFixed(p)),t},E=void 0!==i,[S,C]=t().useState(a??""),w=b(E?i:S),T=y(w),I=t=>{E?e.onChange?.(t):C(t)};return De((()=>{e.onChange?.(T)}),[S]),t().createElement(O.Input,{ref:r,size:n,value:w,maxLength:d,prefix:s,suffix:c,placeholder:u,allowClear:h,readOnly:f,disabled:g,onChange:e=>{const t=y(e.target.value);let r=/^-?\d*(\.\d*)?$/.test(t)||""===t||"-"===t;if(0===p&&t.includes(".")&&(r=!1),l>=0&&t.startsWith("-")&&(r=!1),r){if(!m&&t.replace(/^-|\./g,"").length>17)return;I(t)}},onFocus:v,onBlur:()=>{const t=x(T);t!==T&&I(t),e.onBlur?.(t,T)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(T),T)}})}));Ls.displayName="InputNumber";const qs=Ls;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:_s}=O.Input,Ds=e=>{const{column:r,record:n,rowKey:a,columnKey:i,clicked:l,text:o}=e,{tableRef:s,tableBodyRef:c,$size:u,flattenColumns:d,doFieldValidate:m,dataChange:h}=t().useContext(vl),f=t().useRef(null),b=t().useRef(null),y=t().useRef(null),v=t().useRef(null),x=t().useRef(null),E=t().useRef(!1),S=t().useRef([]),C=t().useRef({}),w=Po(),{store:T,fieldAuth:I}=s.current,N=r.editRender?.(n,r)||{},[R,P]=t().useState(!1),[A,F]=t().useState(!1),[H,k]=t().useState(!1),[L,q]=t().useState(N.items||[]),[$,D]=t().useState(),j=(N.editable||(0,J.isEqual)(l,[a,i]))&&!N.disabled&&!I[i]?.disabled,K=`${a}|${i}`,M=2===l.length?`${l[0]}|${l[1]}`:"",z=![...T.state.required,...T.state.validate].some((e=>{let{x:t,y:r}=e;return t===a&&r===i})),U=T.state.required.find((e=>{let{x:t,y:r}=e;return t===a&&r===i}))?.text||"",B=T.state.validate.find((e=>{let{x:t,y:r}=e;return t===a&&r===i}))?.text||"",W=T.state.edited.some((e=>{let{x:t,y:r}=e;return t===a&&r===i})),G=j||!z||R||H||A,Y=!!N.helper?.combinedDataIndex&&("search-helper"===N.type||"tree-helper"===N.type),X=()=>{h()};t().useEffect((()=>{G&&M===K&&ee()}),[l]);const Q=(e,t)=>{P(e),t?.()},Z=e=>{S.current=e},ee=()=>{const{type:e}=N;switch(e){case"text":b.current?.focus();break;case"number":y.current?.select();break;case"search-helper":v.current?.focus();break;case"tree-helper":x.current?.focus()}},te=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0}))},re=(e,t,r)=>{const{cornerSign:n=!0}=N.extra||{};T.addToUpdated(e),n&&T.addToEdited({x:t,y:r})},ne=e=>""!==e?Number(e):"",ie={text:(e,r,n)=>{const{dataIndex:l}=r,{type:o,extra:s={},rules:c=[],onInput:d,onChange:h,onEnter:f,onBlur:g}=N,y=io(e,l),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:b,size:u,value:y,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??"";lo(e,l,r),m(c,r,a,i),w(),d?.({[K]:r}),E.current=!0},onFocus:()=>F(!0),onBlur:t=>{F(!1);const r=t.target.value??"";E.current&&(E.current=!1,re(e,a,i),h?.({[K]:r},e),g?.({[K]:r},e),X())},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";f?.({[K]:r},e)}},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||e.preventDefault()}}))},textarea:(e,t)=>ie.text(e,t,!0),number:(e,r)=>{const{dataIndex:n,precision:l,formatType:o}=r,{type:s,extra:c={},rules:d=[],onInput:h,onChange:f,onEnter:g,onBlur:b}=N,v=io(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(Xr())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Xr())(e).times(.01).toString()),t().createElement(qs,{ref:y,size:u,value:v,min:c.min,max:c.max,precision:l,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=>{lo(e,n,t),m(d,t,a,i),w(),h?.({[K]:t}),E.current=!0},onFocus:()=>F(!0),onBlur:(t,r)=>{if(F(!1),!E.current)return;E.current=!1;let l=c.stringMode?t:ne(t);"percent"===o&&"."===r.charAt(r.length-1)&&(l=Number(t)/100),lo(e,n,l),re(e,a,i),f?.({[K]:l},e),b?.({[K]:l},e),X()},onEnter:(t,r)=>{let n=c.stringMode?t:ne(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),g?.({[K]:n},e)}})},select:(e,r,n)=>{const{dataIndex:l,dictItems:o=[]}=r,{type:c,extra:d={},rules:h=[],items:f,onChange:g,onEnter:b}=N,{elementStore:y}=s.current,v=f||o,x=io(e,l);let E=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}|${Na.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{lo(e,l,t),m(h,t,a,i),re(e,a,i),w(),g?.({[K]:t},e),X()},onSelect:e=>{E=e},onInputKeyDown:t=>{13===t.keyCode&&le((()=>b?.({[K]:E},e)))}},v.map((e=>t().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ie.select(e,t,!0),date:(e,r,n)=>{const{dataIndex:l}=r,{type:o,extra:s={},rules:c=[],onChange:d}=N,h=n?Tl:wl,f=io(e,l);return t().createElement(_,{showTime:n,size:u,popupClassName:"table-editable__popper",value:co(f,h)??void 0,format:h,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=uo(t,h);lo(e,l,r),m(c,r,a,i),re(e,a,i),w(),d?.({[K]:r},e),X()}})},datetime:(e,t)=>ie.date(e,t,!0),time:(e,r)=>{const{dataIndex:n}=r,{type:l,extra:o={},rules:s=[],onChange:c}=N,d=o.format||"HH:mm:ss",h=io(e,n);return t().createElement(V,{size:u,popupClassName:"table-editable__popper",value:co(h,d)??void 0,format:d,placeholder:p("qm.table.editable.datetimePlaceholder"),allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=uo(t,d);lo(e,n,r),m(s,r,a,i),re(e,a,i),w(),c?.({[K]:r},e),X()}})},checkbox:(e,r)=>{const{dataIndex:n}=r,{type:l,extra:o={},onChange:s}=N,{trueValue:c=Sl,falseValue:u=Cl,disabled:d}=o,p=io(e,n);return t().createElement(O.Checkbox,{checked:p===c,disabled:d,onChange:t=>{const r=t.target.checked?c:u;lo(e,n,r),re(e,a,i),w(),s?.({[K]:r},e),X()}})},switch:(e,r)=>{const{dataIndex:n}=r,{type:l,extra:o={},onChange:s}=N,{trueValue:c=Sl,falseValue:u=Cl,disabled:d}=o,p=io(e,n);return t().createElement(O.Switch,{checked:p===c,disabled:d,onChange:t=>{const r=t?c:u;lo(e,n,r),re(e,a,i),w(),s?.({[K]:r},e),X()}})},"search-helper":(e,r)=>{const{dataIndex:n,precision:l}=r,{type:o,extra:s={},rules:h=[],helper:b={},onInput:y,onChange:x,onEnter:S}=N,w=oo(e,Y?b.combinedDataIndex:n),T=b.fieldAliasMap;T||g("Table","helper 需要配置 `fieldAliasMap` 选项");const I="function"==typeof T?T():T||{};Object.keys(I).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Y&&(b.combinedDataIndex.split("|").every((e=>Object.keys(I).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),I[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const O=e=>{const{filterAliasMap:t}=b,r=""!==e?e:void 0,a="function"==typeof t?t():t??[],i={[n]:r};return a.forEach((e=>i[e]=r)),i},A=e=>{const{autoQueryAssign:t=!0}=b;t&&(C.current=O(e)),P(!0)},F=(t,n)=>{const{beforeOpen:a}=b,i=(a??ae)({[K]:w},e,r);i?.then?i.then((()=>{A(t),n?.()})).catch((()=>{})):!1!==i&&(A(t),n?.())},H=e=>{const t={};for(const r in I){const a=I[r];r!==n&&(t[r]=oo(e,a))}const r=I[n]?oo(e,I[n]):"";q(r,t);const{closed:a}=b;Q(!1,(()=>te(f.current))),ee(),a?.(e)},L=()=>{const{onlySelect:e=!0}=b;E.current&&q(e?"":w),Q(!1,(()=>te(f.current)))},q=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],i=d.find((e=>e.dataIndex===t));if(i){lo(e,t,n,i.precision);const r=i.editRender?.(e,i);r&&Array.isArray(r.rules)&&m(r.rules,n,a,t)}else lo(e,t,n)}c.current.forceUpdate()}lo(e,n,t,l),m(h,t,a,i),re(e,a,i),x?.({[K]:t},e),X(),C.current={},E.current=!1,D(void 0)},_={visible:R,title:p("qm.searchHelper.text"),width:b.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${an[u]+20}px`},onClose:()=>{L()}},j={...b,size:u,initialValue:Object.assign({},C.current,b.initialValue),onClose:e=>{e?H(e):L()}};return t().createElement(t().Fragment,null,t().createElement(_s,{ref:v,value:$??w,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}=b;if(E.current&&!R)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=b,{beforeFetch:n=ae}=t.fetch;return k(!0),new Promise((async(a,i)=>{const l=(0,J.merge)({},t.fetch.params,{...r,...O(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()}k(!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=>oo(t,I[n]).toString().includes(e)));if(1===t.length)return H(t[0]);F(e)}(e,t))).catch((()=>q(""))):void q(t)},onChange:e=>{const{value:t}=e.target;y?.({[K]:t}),E.current=!0,D(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";S?.({[K]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;F(t)},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?F(e):q(""))}}),t().createElement(sr,_,t().createElement(ac,j)))},"search-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:l,items:o=[],extra:s={},rules:c=[],helper:d={},onInput:h,onChange:b,onEnter:y}=N,v=io(e,n),x=d.fieldAliasMap;x||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`");const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[K]:v},e,r);a?.then?a.then((()=>{P(!0),t?.()})).catch((()=>{})):!1!==a&&(P(!0),t?.())},T=()=>{Q(!1,(()=>te(f.current)))},I=t=>{lo(e,n,t),m(c,t,a,i),re(e,a,i),b?.({[K]:t},e,S.current),X()},A={visible:R,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${an[u]+20}px`},onClose:()=>{T()}},F={...d,size:u,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:v,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=E;Z((0,J.uniqBy)([...S.current.filter((e=>t.includes(e[n]))),...e],n));const a=S.current.map((e=>({text:e[r],value:e[n]}))),i=(0,J.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));q(i),I(i.map((e=>e.value)));const{closed:l}=d;Q(!1,(()=>te(f.current))),l?.(S.current)})(e,t):T()}};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:v,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&&y?.({[K]:v},e)},onDoubleClick:()=>{s.disabled||C()},onChange:e=>{const{valueKey:t}=E;Z(S.current.filter((r=>e.includes(r[t])))),I(e),w()}},L.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(sr,A,t().createElement(ac,F)))},"tree-helper":(e,r)=>{const{dataIndex:n,precision:l}=r,{type:o,extra:s={},rules:h=[],helper:b={},onChange:y,onEnter:v}=N,E=oo(e,Y?b.combinedDataIndex:n),S=b.fieldAliasMap;S||g("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof S?S():S||{};Object.keys(C).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Y&&(b.combinedDataIndex.split("|").every((e=>Object.keys(C).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),C[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const T=t=>{const{beforeOpen:n}=b,a=(n??ae)({[K]:E},e,r);a?.then?a.then((()=>{P(!0),t?.()})).catch((()=>{})):!1!==a&&(P(!0),t?.())},I=()=>{Q(!1,(()=>te(f.current)))},O=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],i=d.find((e=>e.dataIndex===t));if(i){lo(e,t,n,i.precision);const r=i.editRender?.(e,i);r&&Array.isArray(r.rules)&&m(r.rules,n,a,t)}else lo(e,t,n)}c.current.forceUpdate()}lo(e,n,t,l),m(h,t,a,i),re(e,a,i),y?.({[K]:t},e),X()},A={visible:R,title:p("qm.searchHelper.text"),width:b.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${an[u]+20}px`},onClose:()=>{I()}},F={...b,defaultSelectedKeys:[E],size:u,onClose:e=>{e?(e=>{const t={};for(const r in C){const a=C[r];r!==n&&(t[r]=oo(e,a))}const r=C[n]?oo(e,C[n]):"";O(r,t);const{closed:a}=b;Q(!1,(()=>te(f.current))),ee(),a?.(e)})(e):I()}};return t().createElement(t().Fragment,null,t().createElement(_s,{ref:x,value:E,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;t||w()},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";v?.({[K]:r},e)}},onDoubleClick:()=>{T()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?T():O(""))}}),t().createElement(sr,A,t().createElement(pc,F)))},"tree-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:l,extra:o={},items:s=[],rules:c=[],helper:d={},onInput:h,onChange:b,onEnter:y}=N,v=io(e,n),x=d.fieldAliasMap;x||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`");const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[K]:v},e,r);a?.then?a.then((()=>{P(!0),t?.()})).catch((()=>{})):!1!==a&&(P(!0),t?.())},T=()=>{Q(!1,(()=>te(f.current)))},I=t=>{lo(e,n,t),m(c,t,a,i),re(e,a,i),b?.({[K]:t},e,S.current),X()},A={visible:R,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${an[u]+20}px`},onClose:()=>{T()}},F={...d,size:u,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:v,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=E;Z(e);const n=S.current.map((e=>({text:e[t],value:e[r]})));q(n),I(n.map((e=>e.value)));const{closed:a}=d;Q(!1,(()=>te(f.current))),a?.(S.current)})(e):T()}};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:v,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&&y?.({[K]:v},e)},onDoubleClick:()=>{o.disabled||C()},onChange:e=>{const{valueKey:t}=E;Z(S.current.filter((r=>e.includes(r[t])))),I(e),w()}},L.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(sr,A,t().createElement(pc,F)))}};return t().createElement(t().Fragment,null,G?(()=>{const{type:e}=N,a=ie[e];if(!a)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!z}];return t().createElement("div",{ref:f,className:Se()(i)},a(n,r),!z&&t().createElement("div",{className:"cell-error"},U||B))})():(()=>{const{extra:e={}}=N,r=Y?oo(n,N.helper.combinedDataIndex):o;return e.disabledColor?t().createElement("span",{style:{color:e.disabledColor}},r):t().createElement(t().Fragment,null,r)})(),W&&t().createElement("i",{className:"cell--sign"}))},js=require("copy-to-clipboard");var Ks=n.n(js);const Vs=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)},Ms=e=>{const{text:r,options:n,showMessage:a=!0,onCopy:i}=e;return Vs(e.children,{onClick:l=>{const o=t().Children.only(e.children),s=Ks()(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)}})};Ms.displayName="QmCopyToClipboard";const zs=Ms;function Us(){return Us=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},Us.apply(this,arguments)}const Bs=t().forwardRef(((r,n)=>{const{tableData:a,flattenColumns:i}=r,{getRowKey:l,tableProps:o,tableRef:c,editableColumns:u,leftFixedColumns:d,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:I,isTreeTable:N,isGroupSubtotal:R,isWebPagination:P,isDragMergeCell:O,setElementStore:A,createTableFullData:F,setSelectionKeys:H,setHighlightKey:k,getStickyLeft:L,getStickyRight:q,scrollXToColumn:$,scrollYToRecord:_,rowInViewport:D,dataChange:j,setPingLeft:K,setPingRight:V,setFullScreen:M,findParentRowKeys:z,getAllChildRowKeys:U,triggerScrollYEvent:B,scrollBottomDebouncer:W}=t().useContext(vl),{height:G,minHeight:Y,maxHeight:X,rowSelection:Q,rowHighlight:Z,treeConfig:re,expandable:ie,stripe:le,summation:se,rowStyle:ce,cellStyle:ue,spanMethod:de,nativeScrollBar:pe,ellipsis:me,showHeader:fe,rowDraggable:ge,onRowClick:be,onRowDblclick:ye,onRowContextmenu:ve,onRowEnter:xe}=o,Ee=t().useRef(null),Te=t().useRef(null),Ie=t().useRef({prevST:0,prevSL:0}),{dragStart:Ne,renderDragPanel:Re,closeDragPanel:Pe}=(()=>{const{tableProps:e,tableRef:r,layout:n,flattenColumns:a,isDragMergeCell:i}=t().useContext(vl),{mergeCells:l=[],onMergeChange:o}=e,[s,c]=t().useState(!1),u=t().useRef(null),d=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(u.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},d.current&&!S(d.current)||(d.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,d=t-a,p=r-i;return d<0&&(d=Math.abs(d),s=l-d,Be(u.current,{left:`${s}px`})),p<0&&(p=Math.abs(p),c=o-p,Be(u.current,{top:`${c+n.headerHeight}px`})),Be(u.current,{width:`${d}px`,height:`${p}px`}),v(s,c,d,p),!1},v=St(((e,t,n,i)=>{const{allTableData:l,scrollYStore:o}=r.current;let s=-1,c=-1,u=-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])&&(u=t),e+n>m&&e+n<m+C(a[t])&&(p=t),m+=C(a[t]);const h={row:s,col:u,rowSpan:c-s+1,colSpan:p-u+1};(0,J.isEqual)(d,h)||(d.current=h,x(s,c,u,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||So.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;d.current=null,m.current={x:t,y:a,disX:t+s-l,disY:a+p-(o+n.headerHeight)},Be(u.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:u,className:`${h}--merge-cell`,onMouseDown:e=>e.stopPropagation()},s&&t().createElement(t().Fragment,null,t().createElement(he,{size:"small",className:"btn cancel",onClick:()=>{if(d.current&&!S(d.current)){const e=g(d.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(d.current&&!S(d.current)){const e=g(d.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,d.current])}f()}},p("qm.table.mergeCell.confirm")))),closeDragPanel:f}})(),Oe={dateFormat:e=>{const t=e?s()(e).format(wl):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(Tl):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(Tl.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(Number(e))?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>so(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 I&&Object.assign(i,{minHeight:"100px"}),Y&&Object.assign(i,{minHeight:ro(Y)-e-r+"px"}),X&&Object.assign(i,{maxHeight:ro(X)-e-r+"px"}),G||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[G,X,Y,I,b]),Fe=t().useMemo((()=>{const{tableBodyWidth:e,gutterWidth:t}=b;return e&&x?e-t:e}),[b,x]),He=t().useMemo((()=>{const{scrollYStore:e}=c.current,{viewportHeight:t,gutterWidth:r}=b;return Math.floor((v?t-r:t)/e.rowHeight)}),[b,v]),[ke,Le]=t().useState([]),qe=Po(),$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,u=r?.map((e=>document.querySelector(e))),d=u?.some((e=>e?.contains(i)))||u?.includes(l);a(!(o||s||c||d))})(t,e)};return n&&(Ve(document,"mousedown",i),Ve(document,"mouseup",l)),()=>{n&&(Me(document,"mousedown",i),Me(document,"mouseup",l))}}),[t]),n}(Ee,[".table-editable__popper"]);t().useImperativeHandle(n,(()=>({renderCellTitle:Je,setClickedValues:Ke,forceUpdate:qe}))),De((()=>{$e&&(Ke([]),O&&Pe())}),[$e]),De((()=>{ke.length&&Ol.focus(c.current.uid)}),[ke]),t().useEffect((()=>{je()}),[]);const _e=t().useCallback((e=>{const{keyCode:t}=e;if(c.current.uid===Ol.getFocusInstance()?.id&&(27===t&&(Ke([]),k(""),M(!1)),ke.length&&(((e,t)=>{if(ee||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1})(document.activeElement,Ee.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&&xe?.(r,e)}if(38===t||40===t){Ue(e);const{allTableData:r}=c.current,n=P?Jl(a):r,i=n.length;let o=n.findIndex((e=>l(e,e.index)===ke[0]));const s=38===t?(--o+i)%i:++o%i,u=n[s],d=l(u,u.index);"radio"!==Q?.type||Q.disabled?.(u)||H([d]),Z&&!Z.disabled?.(u)&&k(d),D(s)||(38===t&&_(d,s),40===t&&_(d,He>s+1?0:s+1-He)),Ke([d,ke[1]])}if(9===t){if(Ue(e),!u.length)return Ke([]);const t=u.length;let r=u.findIndex((e=>e.dataIndex===ke[1]));const n=++r%t,a=u[n].dataIndex;Ke([ke[0],a]),$(a)}}}),[ke,a,E,u,He]);t().useEffect((()=>{const e=$t()(document,"keydown",_e);return()=>e.remove()}),[_e]);const je=()=>{A("$tableBody",Ee.current),A("$tableYspace",Te.current)},Ke=e=>{(0,J.isEqual)(e,ke)||Le(e)},ze=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),We=(e,t,r)=>{const{deriveRowKeys:n}=c.current,a=Zl(n,e);let i=[];const l=U(a?.children||[]),o=bo(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=Zl(n,e),r=ao(i,t?.children?.map((e=>e.rowKey))||[]);i=r?[...i,e]:i.filter((t=>t!==e))})),i},Ge=e=>Array.isArray(e.children)&&e.children.length>0,Ye=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(Xe(e,a,o,r)),ie?.expandedRowRender){const{expandedRowClassName:r,rowExpandable:l=ae}=ie;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?"100px":"50px"}},t().createElement("div",{className:Se()("cell",r)},ie.expandedRowRender(e,a)))))}if(!re?.virtual&&Ge(e)){const t="function"!=typeof ie?.rowExpandable||ie.rowExpandable(e);S.includes(o)&&t&&n.push(...Ye(e.children,r+1))}})),n},Xe=function(e,r,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const l=["body--row",{"body--row-striped":le&&r%2!=0,"body--row-selected":E.includes(n),"body--row-current":C===n,...R?at(e._group):null}];return t().createElement("tr",{key:n,className:Se()(l)},i.map(((t,i)=>Qe(t,i,e,r,n,a))))},Qe=(e,r,n,a,i,o)=>{const{isIE:s}=c.current,{dataIndex:u,fixed:p,align:h,className:g=""}=e,{rowSpan:b,colSpan:y}=tt(n,e,a,r);if(!b||!y)return null;const v=e.ellipsis??me,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[u],"cell-fix-left":x,"cell-fix-right":S,"cell-fix-left-last":x&&d[d.length-1].dataIndex===u,"cell-fix-right-first":S&&m[0].dataIndex===u,[g]:!!g}],w=s?null:{left:x?`${L(u)}px`:"",right:S?`${q(u)}px`:""},T=ce?"function"==typeof ce?ce(n,a):ce:null,I=ue?"function"==typeof ue?ue(n,e,a,r):ue:null,P=R?nt(n._group):null,O=Je(e,n,a,r);return t().createElement("td",{key:u,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,...I},onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([So.expandableColumn,So.operationColumn].includes(n))return;const a=l(t,t.index);Ke([a,n]);const i=r.editRender?.(t,r),o=i&&!i.disabled,{type:s,selectByClickRow:c=!0,disabled:u=ne}=Q||{};!s||u(t)||o||(c||n===So.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=Q||{};if("radio"===r&&H([e]),"checkbox"===r){const r=!E.includes(e),i=N&&!n?We(e,E,r):ze(e,E,r);H(i),a?.(r,t,i)}})(a,t),[So.selectionColumn].includes(n)||(!Z||Z.disabled?.(t)||o||k(a),be?.(t,r,e))})(t,n,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[So.expandableColumn,So.selectionColumn,So.operationColumn].includes(n)||ye?.(t,r,e)})(t,n,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[So.expandableColumn,So.selectionColumn,So.operationColumn].includes(n)||ve?.(t,r,e)})(t,n,e)},t().createElement("div",{className:"cell"},Ze(e,n,a,r,O,i,o)))},Ze=(e,r,n,a,i,l,o)=>{const{dataIndex:s,canCopy:c,editRender:u,render:d}=e,m=io(r,s);if(s===So.expandableColumn)return t().createElement(ks,{record:r,rowKey:l});if(s===So.selectionColumn)return t().createElement(Hs,{selectionKeys:E,column:e,record:r,rowKey:l});const f=et(m,e,r);if(u)return t().createElement(Ds,{column:e,record:r,rowKey:l,columnKey:s,clicked:ke,text:f});const g=d?d(m,r,e,n,a):f;return N&&s===h?[rt(re?.virtual?r._level:o),t().createElement(ks,{key:"expand",record:r,rowKey:l,style:Ge(r)?{}:{visibility:"hidden"}}),g]:c?t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},g),i&&t().createElement(zs,{text:i},t().createElement(we.CopyOutlined,{className:"icon",title:p("qm.table.config.copyText"),onClick:e=>e.stopPropagation()}))):g},Je=(e,t,r,n)=>{const{dataIndex:a,render:i}=e;if([So.expandableColumn,So.selectionColumn,So.operationColumn].includes(a))return"";let l="";const o=io(t,a);if("function"==typeof i){const a=i(o,t,e,r,n);l=te(a)?mo(a).join(""):a}else l=et(o,e,t).toString();return l},et=(e,t,r)=>{const{dictItems:n,precision:a,formatType:i,editRender:l}=t,o=n||l?.(r,t)?.items||[],s=o.find((t=>t.value==e));let c=s?.text??e??"";if(Array.isArray(e)&&(c=e.map((e=>{const t=o.find((t=>t.value==e));return t?.text??e})).join(",")),a>=0&&""!==c&&(c=Number(c).toFixed(a)),i){const e=Oe[`${oe(i)}Format`];e?c=e(c):g("Table","字段的格式化类型 `formatType` 配置不正确")}return c},tt=(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}=tt(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}},rt=e=>e?t().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*So.treeTable.textIndent+"px"}}):null,nt=e=>{const{backgroundColor:t,color:r}=se.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},at=e=>{const t=se.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},it=Ce("table"),lt=O?{onMouseDown:Ne}:null;return t().createElement(t().Fragment,null,t().createElement(Rt,{wrapClassName:`${it}--body-wrapper`,wrapStyle:Ae,native:pe,onScroll:e=>{const{elementStore:t,scrollYLoad:r}=c.current,{prevST:n,prevSL:a}=Ie.current,i=x?b.gutterWidth:0,{scrollTop:l,scrollLeft:o}=e;if(o!==a){fe&&(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&&V(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})}Ie.current.prevST=l,Ie.current.prevSL=o}},t().createElement("div",{ref:Te,className:"body--y-space"}),t().createElement("div",{className:"body--x-space",style:{width:Fe?`${Fe}px`:""}}),t().createElement("table",Us({ref:Ee,className:`${it}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},lt,{style:{width:Fe?`${Fe}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`}})}))),ge?t().createElement(qr.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)})),F(n),j()}},a.map((e=>Xe(e,e.index,l(e,e.index))))):t().createElement("tbody",null,Ye(a)))),O&&Re())}));Bs.displayName="TableBody";const Ws=Bs,Gs=e=>{const{summationRows:r,flattenColumns:n}=e,{getRowKey:a,tableProps:i,tableRef:l,sorter:o,layout:s,scrollY:c,leftFixedColumns:u,rightFixedColumns:d,setElementStore:m,getStickyLeft:h,getStickyRight:f}=t().useContext(vl),{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":!!d.length}],i=e?null:{right:d.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&&u[u.length-1].dataIndex===m,"cell-fix-right-first":!a&&"right"===g&&d[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):io(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 Ys=function(e){return e.small="small",e.middle="default",e.large="default",e}(Ys||{});const Xs=e=>{const{current:r,pageSize:n,total:a,onChange:i}=e,{global:o}=t().useContext(l),{tableProps:s,$size:c,setElementStore:u}=t().useContext(vl),{uniqueKey:d,paginationConfig:p,infoBarConfig:m}=s,h=t().useRef(null),f=t().useMemo((()=>d?`tablePager_${d}`:""),[d]);t().useEffect((()=>{g(),x()}),[]);const g=()=>{u("$pager",h.current)},b=p?.showSizeChanger??So.pagination.showSizeChanger,y=p?.showQuickJumper??So.pagination.showQuickJumper,v=p?.pageSizeOptions||o?.table?.pagination?.pageSizeOptions||So.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(Oo,{total:a})),t().createElement(O.Pagination,{size:Ys[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}`))}}))},Qs=()=>{const{layout:e}=t().useContext(vl),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(pt,null))};function Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zs.apply(this,arguments)}const Js=t().forwardRef(((e,r)=>{const{rowKey:n,columns:a,loading:i,stripe:o,resizable:s,customClass:c,tablePrint:u,exportExcel:d,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),I=t().useRef(null),N=t().useRef(null),R=Po(),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:F,setOriginColumns:H,setTableFullData:k,setTableOriginData:L,setAllTableData:q,setDeriveRowKeys:$,setFieldAuth:_,setMergeCells:D,setScrollYStore:j,setScrollYLoad:K,setResizeState:V,setHandleState:M,setSummaries:z,setSelectionRows:U,setShouldToTop:B,setRecordsMap:W,setHandleChange:G,clearElementStore:Y,clearRecordsMap:X}=((e,r)=>{let{getRowKey:n,$size:a}=r;const i=t().useRef({uid:po(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],fieldAuth:{},mergeCells:[],scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:So.rowHeightMaps[a]},store:new Eo,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,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}`,u={level:i,rowKey:o,rowKeyPath:s,indexPath:c};return e.indexPath=c,e._level=i,e.children&&(u.children=l(e.children,o,s,c,i+1)),t?Object.assign({},u,{parentRowKey:t}):u}))},o=e=>{const t=[];return e.forEach((e=>{e.children?.length?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=Jl(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)&&e.children.length)),i.current.treeTable&&(i.current.deriveRowKeys=l(e,""),i.current.flattenRowKeys=o(i.current.deriveRowKeys))},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)},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:Q,setTableData:Z,filters:te,setFilters:re,sorter:ne,setSorter:ae,superFilters:ie,setSuperFilters:le,pagination:oe,setPagination:se,selectionKeys:ue,setSelectionKeys:de,rowExpandedKeys:pe,setRowExpandedKeys:me,highlightKey:he,setHighlightKey:fe,layout:ge,setLayout:be,permission:ye,setPermission:ve,spinning:xe,setSpinning:Ee,scrollX:we,setScrollX:Te,scrollY:Ie,setScrollY:Ne,isPingLeft:Re,setPingLeft:Pe,isPingRight:Oe,setPingRight:Ae,isFullScreen:Fe,setFullScreen:He}=(e=>{const{uniqueKey:r,nativeScrollBar:n,initialSorter:a={},initialFilter:i={},paginationConfig:o,rowSelection:s,expandable:c,rowHighlight:u}=e,{global:d}=t().useContext(l),p={current:So.pagination.current,pageSize:(()=>{if(r)return Number(localStorage.getItem(`tablePager_${r}`))||void 0})()??o?.pageSize??d?.table?.pagination?.pageSize??So.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,I]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),m),[N,R]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),h),[P,O]=t().useState(u?.currentRowKey??""),[A,F]=t().useState({gutterWidth:n?wo():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[H,k]=t().useState({export:!0,import:!0,print:!0}),[L,q]=t().useState(!1),[$,_]=t().useState(!1),[D,j]=t().useState(!1),[K,V]=t().useState(!1),[M,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:I,rowExpandedKeys:N,setRowExpandedKeys:R,highlightKey:P,setHighlightKey:O,layout:A,permission:H,setPermission:k,setLayout:F,spinning:L,setSpinning:q,scrollX:$,setScrollX:_,scrollY:D,setScrollY:j,isPingLeft:K,setPingLeft:V,isPingRight:M,setPingRight:z,isFullScreen:U,setFullScreen:B}})(e),{isFetch:ke,isWebPagination:Le,isScrollPagination:qe,showPagination:$e,shouldUpdateHeight:_e,tableColumns:je,flattenColumns:Ke,editableColumns:Ve,summationColumns:Me,leftFixedColumns:ze,rightFixedColumns:Ue,treeExpandIndex:Be,showSummary:We,showFooter:Ge,isHeadGroup:Ye,bordered:Xe,isHeadSorter:Qe,isHeadFilter:Ze,isServiceSummation:Je,isSelectCollection:et,isTableImport:tt,isTableClipboard:rt,isSuperSearch:nt,isFastSearch:at,isGroupSummary:it,isGroupSubtotal:lt,isDragMergeCell:ot,isTreeTable:st,isTableEmpty:ct,summationRows:ut,fetchParams:dt}=Io(e,{getRowKey:P,tableRef:O,tableFullData:A,tableData:Q,sorter:ne,filters:te,superFilters:ie,pagination:oe}),{createElementStore:pt,tableStyles:mt,getSpan:ft,getStickyLeft:gt,getStickyRight:bt,scrollXToColumn:yt,scrollYToRecord:vt,rowInViewport:xt,calcTableHeight:Et,resetTableScroll:St,doLayout:Ct}=Ro(e,{getRowKey:P,tableRef:O,$size:S,tableColumns:je,flattenColumns:Ke,leftFixedColumns:ze,layout:ge,scrollY:Ie,tableData:Q,showFooter:Ge,showPagination:$e,isWebPagination:Le,isFullScreen:Fe,setLayout:be,setScrollX:Te,setScrollY:Ne,setElementStore:F,setScrollYStore:j,setShouldToTop:B}),{initialTable:wt,createTableFullData:Tt,getTableData:It,handleTableData:Nt,createTableData:Rt,createGroupData:Pt,createSelectionKeys:Ot,createSelectionRows:At,createRowExpandedKeys:Ft,findParentRowKeys:Ht,getAllChildRowKeys:kt,doFieldValidate:Lt,getTableLog:qt,dataChange:$t,tableChange:_t,toLastPage:Dt,toFirstPage:jt,getPageCount:Kt,pagerChangeHandle:Vt,triggerScrollYEvent:Mt,scrollBottomDebouncer:zt,clearTableSorter:Ut,clearTableFilter:Bt,clearSuperFilters:Wt,clearRowSelection:Gt,clearRowHighlight:Yt,clearTableLog:Xt,destroy:Qt}=No(e,{getRowKey:P,tableRef:O,tableElementRef:w,tableBodyRef:T,$size:S,tableColumns:je,tableFullData:A,pagination:oe,layout:ge,filters:te,sorter:ne,superFilters:ie,fetchParams:dt,selectionKeys:ue,rowExpandedKeys:pe,highlightKey:he,summationColumns:Me,shouldUpdateHeight:_e,isFetch:ke,isTreeTable:st,isWebPagination:Le,isScrollPagination:qe,isServiceSummation:Je,isGroupSubtotal:lt,doLayout:Ct,setTableData:Z,setTableFullData:k,setTableOriginData:L,setAllTableData:q,setDeriveRowKeys:$,setPagination:se,setSpinning:Ee,setSorter:ae,setFilters:re,setSuperFilters:le,setSelectionKeys:de,setRowExpandedKeys:me,setHighlightKey:fe,setSelectionRows:U,setScrollYLoad:K,setScrollYStore:j,setFieldAuth:_,setResizeState:V,setSummaries:z,setPermission:ve,setRecordsMap:W,resetTableScroll:St,clearElementStore:Y,clearRecordsMap:X});((e,r)=>{const{columns:n,summation:a,rowSelection:i,expandable:l,rowHighlight:o,mergeCells:s=[]}=e,{tableRef:c,topElementRef:u,tableElementRef:d,tableBodyRef:p,resizableBarRef:m,$size:h,scrollX:f,pagination:b,selectionKeys:y,rowExpandedKeys:v,highlightKey:x,summationRows:E,summationColumns:S,showSummary:C,isWebPagination:w,isScrollPagination:T,isTreeTable:I,toLastPage:N,toFirstPage:R,getPageCount:P,setHandleState:O,scrollYToRecord:A,setSelectionKeys:F,setOriginColumns:H,setSelectionRows:k,setRowExpandedKeys:L,setHighlightKey:q,setResizeState:$,setMergeCells:_,setPingRight:D,setHandleChange:j,calcTableHeight:K,createSelectionKeys:V,createSelectionRows:M,createRowExpandedKeys:z,createElementStore:U,triggerScrollYEvent:B,forceUpdate:W,initialTable:G,destroy:Y}=r,{elementStore:X,handleState:Q,scrollYLoad:Z}=c.current,ee=t().useRef(E);De((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&p.current.setClickedValues(y.length?[y[0],""]:[]),k(M(y)),c.current.isHandleChange&&e?.(y,c.current.selectionRows),j(!0),C&&S.some((e=>e.summation.sumBySelection))&&W()}),[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;I&&L(z()),o&&(p.current.setClickedValues(x?[x,""]:[]),o.onChange?.(x,e[t.findIndex((e=>e===x))]??null))}),[x]),De((()=>{(0,J.isEqual)(E,ee.current)||(ee.current=E,C&&a&&a.onChange?.(E))}),[E]),De((()=>{const e=V(i.selectedRowKeys);(0,J.isEqual)(e,y)||(F(e),I&&L(z()))}),[i?.selectedRowKeys]),De((()=>{const e=z(l.expandedRowKeys);(0,J.isEqual)(e,v)||L(e)}),[l?.expandedRowKeys]),De((()=>{const{currentRowKey:e}=o;e!==x&&q(e??"")}),[o?.currentRowKey]),De((()=>{const{insert:e,remove:t}=Q;e&&(w&&("after"===e?N():R()),A("","after"===e?1e5:0)),t&&b.current>P()&&N(),(e||t)&&O({insert:null,remove:!1})}),[b.total]),De((()=>{Z&&B(X.$tableBody.parentNode.parentNode.scrollTop)}),[Z]),De((()=>{D(f)}),[f]),De((()=>{K()}),[h]),De((()=>{_(s),p.current.forceUpdate()}),[s]),De((()=>{Z&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),T&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Z,T]);const te=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&($(Object.assign({},e,{winHeight:r})),K())};t().useEffect((()=>(U({$toper:u.current,$table:d.current,$resizableBar:m.current}),H(ce(n)),G(),_(s),window.addEventListener("resize",te,!1),K(),()=>{Y(),window.removeEventListener("resize",te)})),[])})(e,{tableRef:O,topElementRef:C,tableElementRef:w,tableBodyRef:T,resizableBarRef:N,$size:S,scrollX:we,pagination:oe,selectionKeys:ue,rowExpandedKeys:pe,highlightKey:he,showSummary:We,summationRows:ut,summationColumns:Me,isWebPagination:Le,isScrollPagination:qe,isTreeTable:st,toLastPage:Dt,toFirstPage:jt,getPageCount:Kt,setHandleState:M,scrollYToRecord:vt,setOriginColumns:H,setSelectionKeys:de,setSelectionRows:U,setRowExpandedKeys:me,setHighlightKey:fe,setResizeState:V,setMergeCells:D,setPingRight:Ae,setHandleChange:G,calcTableHeight:Et,createSelectionKeys:Ot,createSelectionRows:At,createRowExpandedKeys:Ft,createElementStore:pt,triggerScrollYEvent:Mt,forceUpdate:R,initialTable:wt,destroy:Qt});const Zt=t().useMemo((()=>({getRowKey:P,tableProps:e,tableRef:O,tableBodyRef:T,$size:S,flattenColumns:Ke,editableColumns:Ve,leftFixedColumns:ze,rightFixedColumns:Ue,treeExpandIndex:Be,sorter:ne,filters:te,superFilters:ie,layout:ge,bordered:Xe,showFooter:Ge,showSummary:We,summationRows:ut,scrollX:we,scrollY:Ie,pagination:oe,fetchParams:dt,selectionKeys:ue,rowExpandedKeys:pe,highlightKey:he,isFetch:ke,isPingLeft:Re,isPingRight:Oe,isHeadSorter:Qe,isHeadFilter:Ze,isFullScreen:Fe,isTableEmpty:ct,isHeadGroup:Ye,isTreeTable:st,isGroupSubtotal:lt,isWebPagination:Le,isDragMergeCell:ot,dataChange:$t,tableChange:_t,getTableData:It,setElementStore:F,createTableFullData:Tt,setSorter:ae,setFilters:re,setSuperFilters:le,setSelectionKeys:de,setHighlightKey:fe,setRowExpandedKeys:me,setSelectionRows:U,getSpan:ft,getStickyLeft:gt,getStickyRight:bt,scrollXToColumn:yt,scrollYToRecord:vt,rowInViewport:xt,setPagination:se,setPingLeft:Pe,setPingRight:Ae,setSpinning:Ee,setFullScreen:He,setShouldToTop:B,doFieldValidate:Lt,createTableData:Rt,createGroupData:Pt,findParentRowKeys:Ht,getAllChildRowKeys:kt,triggerScrollYEvent:Mt,scrollBottomDebouncer:zt,resetTableScroll:St,clearTableSorter:Ut,clearTableFilter:Bt,clearSuperFilters:Wt,clearRowSelection:Gt,clearRowHighlight:Yt})),[e,S,Ke,Ve,ze,Ue,Be,ne,te,ie,ge,Xe,Ge,We,ut,we,Ie,oe,dt,ue,pe,he,ke,Re,Oe,Qe,Ze,Fe,ct,Ye,st,lt,Le,ot]);((e,r)=>{const{getRowKey:n,tableProps:a,tableRef:i,toolBoxRef:l,flattenColumns:o,editableColumns:s,pagination:c,fetchParams:u,selectionKeys:d,rowExpandedKeys:p,highlightKey:m,isFetch:h,dataChange:f,getTableData:b,handleTableData:y,createTableData:v,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:S,doFieldValidate:C,setHandleState:w,setSelectionKeys:T,setRowExpandedKeys:I,setHighlightKey:N,setSelectionRows:R,setOriginColumns:P,setHandleChange:O,forceUpdate:A,getTableLog:F,clearRowSelection:H,clearRowHighlight:k,clearTableSorter:L,clearTableFilter:q,clearSuperFilters:$,clearTableLog:_}=r,{columns:D,columnsChange:j}=a,K=(e,t,r)=>{for(let a=0;a<e.length;a++){const i=e[a],l=n(i,i.index);Array.isArray(i.children)&&K(i.children,t,r),t.includes(l)&&(r?.(i,l),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:async e=>{h&&(await b(),e?.())},GET_LOG:()=>F(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(c).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{h||(H(),k(),L(),q(),$(),_(),v([]))},CLEAR_LOG:()=>{_()},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{S(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,J.isEqual)(e,d)&&O(!1),T(e)},SET_HIGHLIGHT:e=>{N(e)},SET_EXPANDABLE:e=>{I(e)},SET_SELECTION_ROWS:e=>{R(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{P(e)},SET_TABLE_COLUMN:(e,t,r)=>{const n=Gl(D,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&&(j?j([...D]):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=>{o.forEach((t=>{const{dataIndex:r}=t;[So.expandableColumn,So.selectionColumn,So.operationColumn].includes(r)||lo(e,r,io(e,r))})),r.addToInserted(e)}));const s="before"===t?.mode,c=void 0===t?.parentRowKey;let u=a;if(c)u=s?[...l,...u]:u.concat(l);else{const e=yo(a,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?s?e.children.unshift(...l):e.children.push(...l):e.children=l)}v(u),c&&w(Object.assign({},i.current.handleState,{insert:s?"before":"after"})),f()},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;K(r,a,((e,r)=>{t.addToRemoved(e),s.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&&(v(r),T(d.filter((e=>!a.includes(e)))),a.includes(m)&&k(),I(p.filter((e=>!a.includes(e)))),w(Object.assign({},i.current.handleState,{remove:!0})),f())},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((r=>{s.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:u}=o;!u&&c.length&&C(c,io(r,i),s,i)}))}));const{required:r,validate:a}=F(),l=[...r,...a];return l.length&&S(l[0].rowKey),A(),{required:r,validate:a}}})))})(r,{getRowKey:P,tableProps:e,tableRef:O,toolBoxRef:I,flattenColumns:Ke,editableColumns:Ve,pagination:oe,fetchParams:dt,selectionKeys:ue,rowExpandedKeys:pe,highlightKey:he,isFetch:ke,dataChange:$t,getTableData:It,handleTableData:Nt,createTableData:Rt,calcTableHeight:Et,scrollXToColumn:yt,scrollYToRecord:vt,doFieldValidate:Lt,setHandleState:M,setSelectionKeys:de,setRowExpandedKeys:me,setHighlightKey:fe,setSelectionRows:U,setOriginColumns:H,setHandleChange:G,forceUpdate:R,getTableLog:qt,clearRowSelection:Gt,clearRowHighlight:Yt,clearTableSorter:Ut,clearTableFilter:Bt,clearSuperFilters:Wt,clearTableLog:Xt}),t().useEffect((()=>{Ol.register(O.current.uid,r??{current:null})}),[]);const Jt=Ce("table"),er={[`${Jt}--wrapper`]:!0,[`${Jt}--lg`]:"large"===S,[`${Jt}--sm`]:"small"===S,[`${Jt}--maximize`]:Fe,[c]:!!c},tr={[Jt]:!0,"is--border":Xe,"is--striped":o,"is--fixed":ze.length||Ue.length,"is--sortable":Qe,"is--filterable":Ze,"is--head-group":Ye,"is--merge-cell":ot,"is--empty":ct,"show--head":x,"show--foot":Ge,"ping--left":Re,"ping--right":Oe,"scroll--x":we,"scroll--y":Ie};return t().createElement(vl.Provider,{value:Zt},t().createElement("div",{className:Se()(er)},h&&t().createElement("div",{ref:C,className:`${Jt}-top`},t().createElement("div",{className:`${Jt}-top__space`},"bottom"!==p?.position&&t().createElement(Oo,{total:oe.total}),t().createElement("div",{className:`${Jt}-top__space-slot`,style:{justifyContent:Rl[m]}},e.children)),t().createElement("div",{className:`${Jt}-top__actions`},t().createElement(Ss,{ref:I,showFullScreen:f,showReload:b&&ke,showPrint:ye.print&&!!u,showImport:ye.import&&tt,showExport:ye.export&&!!d,showClipboard:rt,showCollection:et,showFastSearch:at,showSuperSearch:nt,showGroupSummary:it,showToolBox:y,tableColumns:je}),v&&t().createElement(Cs,{columns:a}))),t().createElement(ht,{spinning:i??xe},t().createElement("div",{ref:w,className:Se()(tr),style:mt},t().createElement("div",{className:`${Jt}--main-wrapper`},x&&t().createElement(Fs,{tableColumns:je,flattenColumns:Ke,sorter:ne,filters:te}),t().createElement(Ws,{ref:T,tableData:Q,flattenColumns:Ke}),Ge&&t().createElement(Gs,{summationRows:ut,flattenColumns:Ke})),Xe&&t().createElement("div",{className:`${Jt}--border-line`}),ct&&t().createElement(Qs,null),s&&t().createElement("div",{ref:N,className:`${Jt}--resizable-bar`}))),$e&&t().createElement(Xs,Zs({},oe,{onChange:(e,t)=>Vt({current:e,pageSize:t})}))))}));Js.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},Js.displayName="QmTable";const ec=Js,tc=ec;function rc(){return rc=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},rc.apply(this,arguments)}const nc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},onClose:u}=e,{size:d}=t().useContext(l),m=t().useMemo((()=>e.size??d??""),[e.size,d]),h=t().useRef(null),f=t().useRef(null),g=t().useRef(null),b=Et(h),[y,v]=t().useState(c),[x,E]=t().useState(),[S,C]=t().useState(o),[w,T]=t().useState(!1),[I,N]=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||[]]),[F,H]=t().useState((0,J.merge)({},c.fetch?.params,a)),[k,L]=t().useState([]),q=()=>{const e=h.current,t=e.querySelector(".form-wrap");N(e.offsetHeight-t.offsetHeight-2*an[m]-30)},$=St(q,5);De((()=>{$()}),[b.width]),De((()=>{(0,J.isEqual)(s,R)||P(s)}),[s]),t().useEffect((()=>{_()}),[F]),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:n,beforeFetch:a=ae}=t;if(a(F)){T(!0);try{const e=await r(F);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[];C([]),await ie(0),L(t)}}catch(e){}T(!1)}},D=e=>{n||(E(e),u(e))},j=e=>{H(Object.assign({},F,e))},K=Ce("search-helper"),V=y.webPagination?{dataSource:k,loading:w,webPagination:!0}:{fetch:{...y.fetch,params:F}};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(tc,rc({ref:g,uniqueKey:r,height:I,columns:O,rowKey:y.rowKey||"pageIndex"},V,{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:`${an[m]+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:!x,onClick:()=>u(x,n?S:void 0)},p("qm.dialog.confirm"))))};nc.displayName="SearchHelper";const ac=nc;function ic(){return ic=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ic.apply(this,arguments)}const lc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...lc(e.children)),e.children&&t.push(e.value)})),t},oc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=oc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},sc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&sc(e.children,t),t(e)||e.children&&e.children.length))),cc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:u={},onClose:d}=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=Et(f),[x,E]=t().useState(c),[S,C]=t().useState(),[w,T]=t().useState(o),[I,N]=t().useState(!1),[R,P]=t().useState(300),[A,F]=t().useState(300),[H,k]=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),F(e.offsetHeight-t.offsetHeight-2*an[h]-30)},V=St(K,5);De((()=>{V()}),[v.width]),De((()=>{(0,J.isEqual)(s,H)||k(s)}),[s]),t().useEffect((()=>{M()}),[$]),t().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&b.current?.SET_FIELDS_VALUE(a),te()}),[]);const M=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=ae}=t;if(a($)){N(!0);try{const e=await r($);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[];T([]),await ie(0),j(t)}}catch(e){}N(!1)}},z=e=>{n||(C(e),d(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(lc(B))}),[B]);const te=async()=>{if(!u.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=u.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=Pr(e,n,a);W(t),Z.current=t,ee.current=e}}catch(e){}},re=e=>`${e}|${Na.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:I,webPagination:!0}:{fetch:{...x.fetch,params:$}};return t().createElement("div",{ref:f,className:`${ne}--wrapper`},t().createElement(rt,{defaultValue:200,style:{height:"100%"}},t().createElement(rt.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=sc(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"}=u.fetch;(e=>{if(!u.tableParamsMap)return g("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof u.tableParamsMap?u.tableParamsMap():u.tableParamsMap,r={};for(const n in t)r[n]=(0,J.get)(e,t[n]);U(r)})(oc(ee.current,(r=>(0,J.get)(r,t)===e[0]))||{})}})),t().createElement(rt.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},H.length?t().createElement(Ii,{ref:b,items:H,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(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(tc,ic({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:`${an[h]+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:!S,onClick:()=>d(S,n?w:void 0)},p("qm.dialog.confirm"))))};cc.displayName="TreeTableHelper";const uc=cc,dc=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,u]=t().useState(),[d]=t().useState(n.fetch?.params),m=Ce("tree-helper"),h=n.fetch?{...Z()(n.fetch,["params","valueKey","textKey"]),params:d}:void 0;return t().createElement("div",{className:`${m}--wrapper`},t().createElement(yl,{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=>u(e),onCheckChange:e=>u(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${an[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"))))};dc.displayName="TreeHelper";const pc=dc;function mc(){return mc=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},mc.apply(this,arguments)}const hc="_startSign",fc="_endSign",gc=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]),u=t().useRef(null),d=t().useRef(null),m=t().useRef(null),h=Et(u),[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,I]=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:hc,width:80,align:"right",render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:fc,fixed:"right",width:80,render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)}]),[N,R]=t().useState((0,J.merge)({},i.fetch?.params,n)),[P,A]=t().useState([]),F=t().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),H=t().useMemo((()=>2===F.length&&F.every((e=>void 0!==e))),[F]),k=()=>{const e=u.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*an[c]-30)},L=St(k,5);De((()=>{L()}),[h.width]),De((()=>{(0,J.isEqual)(a,C)||w(a)}),[a]),t().useEffect((()=>{q()}),[N]);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(N)){y(!0);try{const e=await r(N);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,hc),$(e,fc))})),x([])},D=e=>{_(),R(Object.assign({},N,e))},j=Ce("range-helper"),K=f.webPagination?{dataSource:P,loading:b,webPagination:!0}:{fetch:{...f.fetch,params:N}};return t().createElement("div",{ref:u,className:`${j}--wrapper`},t().createElement("div",{className:"form-wrap"},C.length?t().createElement(Ii,{ref:d,items:C,initialValues:n,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>k(),onFinish:e=>D(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||D(t)}}):null),t().createElement("div",null,t().createElement(tc,mc({ref:m,height:E,columns:T,rowKey:f.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=F[0]&&e.pageIndex<=F[1]?{backgroundColor:"#f5f5f5"}:{}},K,{columnsChange:e=>I(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[hc,fc].includes(r)&&(r===hc&&(e[r]?($(e,r),x([void 0,v[1]])):e.pageIndex>F[1]?O.message.warning(p("qm.searchHelper.rangeStartTip")):(v[0]&&$(v[0],r),e[r]="[",x([e,v[1]]))),r===fc&&(e[r]?($(e,r),x([v[0],void 0])):e.pageIndex<F[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===F[0]&&(e[hc]="["),e.pageIndex===F[1]&&(e[fc]="]")}))}}),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:`${an[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:!H,onClick:()=>o(v.map((e=>(e=>{const t={};for(const r in e)[hc,fc].includes(r)||(t[r]=e[r]);return t})(e))))},p("qm.dialog.confirm"))))};gc.displayName="RangeTableHelper";const bc=gc,yc={previewWidth:1100,defaultDistance:.45,logoHeight:60},vc=(0,e.createContext)(void 0);var xc=null;function Ec(){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 Sc(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(Ec()){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:xc?r=xc:((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),xc=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&Ec(),r}catch(e){O.message.error("getLodop 出错:"+e)}}Ec();const Cc=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)},wc=t().forwardRef(((e,r)=>{const{templateRender:n,directPrint:a}=e,{global:i}=t().useContext(l),{$$preview:o}=t().useContext(vc),{state:s,isWindowsPrinter:c,pageSize:u}=o,d=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:H,createPrintHtml:F,SHOW_PREVIEW:k,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=d.current.querySelector(".origin-template").children[0],p.current.previewEl=d.current.querySelector(".workspace")}),[]);const v=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*yc.defaultDistance+10*yc.defaultDistance:0;return("vertical"===e?u[0]:u[1])-t}),[s,c,u]),x=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*yc.defaultDistance+10*yc.defaultDistance:0;return("vertical"===e?u[1]:u[0])-t}),[s,c,u]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Cc(v-10*(e.left-yc.defaultDistance)-10*(e.right-yc.defaultDistance))}),[s,v]),S=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Cc(x-10*(e.top-yc.defaultDistance)-10*(e.bottom-yc.defaultDistance))}),[s,x]),C=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:Cc(10*e.left),right:Cc(10*e.right),top:Cc(10*e.top),bottom:Cc(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=yc.previewWidth-i<=0?0:(yc.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>yc.previewWidth?0:l>0?o:(yc.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]),I=(m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=i?.print?.leftLogo??"",t=i?.print?.rightLogo??"";return[`<tr style="height: ${yc.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("")}),N=()=>{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=N().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([N(),I(),...m.current]);const r=e.fixedLogo?S-yc.logoHeight:S;let n=[];if(f.current=[],"stylus"===t)f.current.push([N(),...e.fixedLogo?[I()]:[],...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+=yc.logoHeight),t+=o,t<=r?n.push(l):(f.current.push([N(),...e.fixedLogo?[I()]:[],...n]),n=[],t=0,a-=1),a===i-1&&n.length&&f.current.push([N(),...e.fixedLogo?[I()]:[],...n])}}e.fixedLogo||f.current[0]?.splice(1,0,I());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},F=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},H=()=>{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>"+I()+N()+e.join("")+"</table>"},k=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(F()),await ie(0),o.doClose()},q=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},$={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:d,className:Se()($)},t().createElement(ht,{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}))))}));wc.displayName="Container";const Tc=wc;function Ic(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 Nc extends e.Component{constructor(){super(...arguments),Ic(this,"formRef",t().createRef()),Ic(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:yc.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:yc.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:yc.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:yc.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),Ic(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})})),Ic(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")}))),Ic(this,"state",{formList:this.createFormList()}),Ic(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())})),Ic(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"))))}}Ic(Nc,"contextType",l);const Rc=Nc;function Pc(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 Oc extends e.Component{constructor(){super(...arguments),Pc(this,"provide",{$$preview:this}),Pc(this,"containRef",t().createRef()),Pc(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:yc.defaultDistance,right:yc.defaultDistance,top:yc.defaultDistance,bottom:yc.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Pc(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Pc(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Pc(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 cs().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Pc(this,"doClose",(()=>{this.props.onClose?.()})),Pc(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){}})),Pc(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Pc(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 ')),Pc(this,"doPrint",(e=>{const t=Sc();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}=yc,{left:u,right:d,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*(u-c)+"mm",`RightMargin: ${10*(d-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()})),Pc(this,"doExport",(e=>{const t=Sc();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=Sc(),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 cs().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(e)&&await cs().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})}},u={[s]:!0};return e?t().createElement(t().Fragment,null,t().createElement("div",{className:Se()(u)},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(vc.Provider,{value:this.provide},t().createElement(Tc,{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(sr,c,t().createElement(Rc,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(vc.Provider,{value:this.provide},t().createElement(Tc,{ref:this.containRef,templateRender:r,directPrint:!0}))}}Pc(Oc,"contextType",l);const Ac=Oc;function Fc(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 Hc extends e.Component{constructor(){super(...arguments),Fc(this,"previewRef",t().createRef()),Fc(this,"state",{visible:!1,loading:!1}),Fc(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})})),Fc(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:`${yc.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(sr,o,t().createElement(Ac,s)):e?t().createElement(Ac,s):null})),Fc(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())}}Fc(Hc,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:i().elementType}),Fc(Hc,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),Fc(Hc,"contextType",l);const kc=Hc,Lc=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],qc=e=>({_s:e,status:Lc[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),$c=e=>e?6:5,_c=(e,t,r,n,a)=>{clearTimeout(n.current);const i=qc(e);t(i),r.current=i,a?.({current:i})},Dc=r=>{const{name:n,in:a,timeout:i,preEnter:l=!0,preExit:o}=r,s=t().useRef(!1),[c,u]=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:u}=t||{},[d,p]=(0,e.useState)((()=>qc(o?2:$c(s)))),m=(0,e.useRef)(d),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 $c(t)}})(m.current._s,c);e&&_c(e,p,m,h,u)}),[u,c]),y=(0,e.useCallback)((e=>{const t=e=>{switch(_c(e,p,m,h,u),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:$c(c))}),[b,u,r,n,a,i,f,g,c]);return(0,e.useEffect)((()=>()=>clearTimeout(h.current)),[]),[d,y,b]}({timeout:i,preEnter:l,preExit:o,initialEntered:a});return t().useLayoutEffect((()=>{s.current?u():s.current=!0}),[a]),t().createElement(t().Fragment,null,t().Children.map(r.children,(e=>t().isValidElement(e)?Vs(e,{className:Se()(e.props.className,n,c.status)}):e)))},jc="1.7.21"})(),a})()));
|