dcp-design-react 1.12.10 → 1.12.11
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/_utils/types.d.ts +1 -1
- package/lib/config-provider/context.d.ts +2 -2
- package/lib/config-provider/src/config-provider.d.ts +2 -6
- package/lib/hooks/useLocale.d.ts +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/lib/table/src/filter/context.d.ts +0 -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={442:t=>{t.exports=e}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};r.r(a),r.d(a,{Affix:()=>R.Affix,Alert:()=>R.Alert,Anchor:()=>R.Anchor,AutoComplete:()=>R.AutoComplete,Avatar:()=>R.Avatar,BackTop:()=>R.BackTop,Badge:()=>R.Badge,Breadcrumb:()=>R.Breadcrumb,Button:()=>R.Button,Calendar:()=>P,Card:()=>R.Card,Carousel:()=>R.Carousel,Cascader:()=>R.Cascader,Checkbox:()=>R.Checkbox,Col:()=>R.Col,Collapse:()=>R.Collapse,Comment:()=>R.Comment,ConfigProvider:()=>R.ConfigProvider,DatePicker:()=>F,DcpAnchor:()=>tn,DcpButton:()=>fe,DcpCollapse:()=>_e,DcpColorPicker:()=>Pl,DcpConfigProvider:()=>B,DcpCopyToClipboard:()=>uc,DcpCountup:()=>ot,DcpCropper:()=>Wu,DcpDivider:()=>Se,DcpDownload:()=>Wt,DcpDrawer:()=>dn,DcpEmpty:()=>dt,DcpForm:()=>Nm,DcpGuideTracker:()=>Cp,DcpLazyLoad:()=>Op,DcpModal:()=>yn,DcpPivotGrid:()=>Oo,DcpPrint:()=>ep,DcpRangeTableHelper:()=>md,DcpScrollbar:()=>At,DcpSearchHelper:()=>kc,DcpSearchTree:()=>gs,DcpSignature:()=>$p,DcpSpace:()=>be,DcpSpin:()=>mt,DcpSplit:()=>nt,DcpTable:()=>Ic,DcpTabs:()=>on,DcpTinymce:()=>bm,DcpTour:()=>Dm,DcpTransition:()=>It,DcpTreeHelper:()=>Js,DcpTreeTableHelper:()=>Xc,DcpUploadFile:()=>Du,DcpUploadImg:()=>Yu,DcpVirtualList:()=>Yo,DcpWatermark:()=>Sp,Descriptions:()=>R.Descriptions,Divider:()=>R.Divider,Drawer:()=>R.Drawer,Dropdown:()=>R.Dropdown,Empty:()=>R.Empty,Form:()=>R.Form,Grid:()=>R.Grid,Image:()=>R.Image,Input:()=>R.Input,InputNumber:()=>R.InputNumber,Layout:()=>R.Layout,List:()=>R.List,Mentions:()=>R.Mentions,Menu:()=>R.Menu,Modal:()=>R.Modal,PageHeader:()=>R.PageHeader,Pagination:()=>R.Pagination,Popconfirm:()=>R.Popconfirm,Popover:()=>R.Popover,Progress:()=>R.Progress,QmAnchor:()=>tn,QmButton:()=>fe,QmCollapse:()=>_e,QmColorPicker:()=>Pl,QmConfigProvider:()=>B,QmCopyToClipboard:()=>uc,QmCountup:()=>ot,QmCropper:()=>Wu,QmDivider:()=>Se,QmDownload:()=>Wt,QmDrawer:()=>dn,QmEmpty:()=>dt,QmForm:()=>Nm,QmGuideTracker:()=>Cp,QmLazyLoad:()=>Op,QmModal:()=>yn,QmPivotGrid:()=>Oo,QmPrint:()=>ep,QmRangeTableHelper:()=>md,QmScrollbar:()=>At,QmSearchHelper:()=>kc,QmSearchTree:()=>gs,QmSignature:()=>$p,QmSpace:()=>be,QmSpin:()=>mt,QmSplit:()=>nt,QmTable:()=>Ic,QmTabs:()=>on,QmTinymce:()=>bm,QmTour:()=>Dm,QmTransition:()=>It,QmTreeHelper:()=>Js,QmTreeTableHelper:()=>Xc,QmUploadFile:()=>Du,QmUploadImg:()=>Yu,QmVirtualList:()=>Yo,QmWatermark:()=>Sp,Radio:()=>R.Radio,Rate:()=>R.Rate,Result:()=>R.Result,Row:()=>R.Row,Segmented:()=>R.Segmented,Select:()=>R.Select,Skeleton:()=>R.Skeleton,Slider:()=>R.Slider,Space:()=>R.Space,Spin:()=>R.Spin,Statistic:()=>R.Statistic,Steps:()=>R.Steps,Switch:()=>R.Switch,Table:()=>R.Table,Tabs:()=>R.Tabs,Tag:()=>R.Tag,TimePicker:()=>H,Timeline:()=>R.Timeline,Tooltip:()=>R.Tooltip,Transfer:()=>R.Transfer,Tree:()=>R.Tree,TreeSelect:()=>R.TreeSelect,Typography:()=>R.Typography,Upload:()=>R.Upload,message:()=>R.message,notification:()=>R.notification,pinyin:()=>ra,version:()=>Mp});var i=r(442),l=r.n(i);const o=(0,i.createContext)({locale:"zh-cn",size:"middle"}),s=require("dayjs");var c=r.n(s);const d={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?",shortcutKey:"快捷键"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传",remove:"删除文件",batchDownload:"批量下载"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"过滤{text}",searchAreaText:"过滤{text},用逗号隔开",text:"筛选",selectAll:"全选",invert:"反选",onlyItem:"仅此项",keywordSearch:"关键词搜索"},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 数据"},areaSelect:{mergeCell:"合并单元格",cancelMerge:"取消合并"},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:"不包含",nullText:"空值",notNullText:"非空值",startsWithText:"开头是",endsWithText:"结尾是",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",matchCase:"大小写匹配",matchFullchar:"全字符匹配",queryLabel:"查找内容",queryPrev:"查找上一个",queryNext:"查找下一个",queryAll:"查找全部",findTotal:"查找到 {total} 个单元格",cellText:"单元格",valText:"值"},pivotGrid:{text:"多维表",settingTitle:"多维表看板"}},pivotGrid:{saved:{text:"配置",add:"添加配置项",title:"已保存的配置信息"},export:{text:"导出",group:"导出分组",list:"导出列表"},count:{statistic:"统计",records:"记录数",unique:"唯一值",empty:"空值",notEmpty:"非空值",sum:"合计值",max:"最大值",min:"最小值",avg:"平均值"},field:{text:"字段管理",title:"字段自定义设置"},fillColor:{text:"填色",add:"添加条件",title:"设置填色条件",cell:"单元格",row:"整行",col:"整列"},filter:{text:"筛选",title:"设置筛选条件",matchAll:"满足所有条件",matchAny:"满足任一条件"},group:{text:"分组",title:"设置分组条件",foldAll:"折叠所有",unfoldAll:"展开所有",empty:"(内容为空)",ascend:"选项顺序",descend:"选项倒序"},lineHeight:{text:"行高",size:["常规","中等","高"]},search:{text:"查找",title:"设置查找条件"},sorter:{text:"排序",title:"设置排序条件",ascend:"字段升序",descend:"字段降序"},viewMode:{table:"表格视图",gantt:"甘特视图",card:"看板视图"}}}};require("dayjs/locale/zh-cn");let u=d;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const p=(...e)=>{const[t,n]=e;let r;const a=t.split(".");let i=u;for(let e=0,t=a.length;e<t;e++){if(r=i[a[e]],e===t-1)return m(r,n);if(!r)return"";i=r}return""},h=(e,t)=>({...e,...Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})});function f(e,t){((t,n)=>{const r=i.useRef(!0);i.useLayoutEffect((()=>(t=>{if(!t)return e()})(r.current)),n),i.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})(0,t)}const g=require("dayjs/plugin/localeData");var y=r.n(g);const b=require("dayjs/plugin/advancedFormat");var v=r.n(b);const x=require("dayjs/plugin/customParseFormat");var E=r.n(x);const w=require("dayjs/plugin/quarterOfYear");var C=r.n(w);const S=require("dayjs/plugin/weekOfYear");var N=r.n(S);const T=require("dayjs/plugin/weekday");var I=r.n(T);c().extend(y()),c().extend(v()),c().extend(E()),c().extend(C()),c().extend(N()),c().extend(I());const R=require("antd"),O=require("rc-picker/es/generate/dayjs");var k=r.n(O);const L=require("antd/es/calendar/generateCalendar"),P=r.n(L)()(k()),A=require("antd/es/date-picker/generatePicker"),F=r.n(A)()(k());function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_.apply(null,arguments)}const q=i.forwardRef(((e,t)=>i.createElement(F,_({},e,{picker:"time",mode:void 0,ref:t}))));q.displayName="TimePicker";const D=i.forwardRef(((e,t)=>i.createElement(F.RangePicker,_({},e,{picker:"time",mode:void 0,ref:t}))));D.displayName="RangePicker",q.RangePicker=D;const H=q,$={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?",shortcutKey:"Shortcut Key"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload",remove:"Delete files",batchDownload:"Batch download"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Filter {text}",searchAreaText:"Filter {text}, separated by commas",text:"Filter",selectAll:"Select all",invert:"Invert",onlyItem:"Only item",keywordSearch:"Keyword Search"},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"},areaSelect:{mergeCell:"Cell Merge",cancelMerge:"Cancel 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",nullText:"null value",notNullText:"not null value",startsWithText:"beginning is",endsWithText:"ending is",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?",matchCase:"Case matching",matchFullchar:"Full character matching",queryLabel:"Find content",queryPrev:"Find previous",queryNext:"Find next",queryAll:"Find all",findTotal:"Found {total} cells",cellText:"Cell",valText:"Value"},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}},pivotGrid:{saved:{text:"Config",add:"Add configuration",title:"Saved configuration list"},export:{text:"Export",group:"Export group",list:"Export list"},count:{statistic:"Statistics",records:"count",unique:"unique",empty:"empty",notEmpty:"not empty",sum:"sum value",max:"max value",min:"min value",avg:"avg value"},field:{text:"Field manage",title:"Field customization settings"},fillColor:{text:"Fill color",add:"Add condition",title:"Set fill color conditions",cell:"Cell",row:"Row",col:"Col"},filter:{text:"Filter",title:"Set filter conditions",matchAll:"Meet all conditions",matchAny:"Meet any conditions"},group:{text:"Group",title:"Set group conditions",foldAll:"Fold all",unfoldAll:"unfold all",empty:"(Empty content)",ascend:"Order ascend",descend:"Order descend"},lineHeight:{text:"Line height",size:["Common size","Middle size","Large size"]},search:{text:"Search",title:"Set search conditions"},sorter:{text:"Sorter",title:"Set sorter conditions",ascend:"Field ascend",descend:"Field descend"},viewMode:{table:"Table view",gantt:"Gantt view",card:"Card view"}}}},M=require("antd/es/locale/zh_CN");var K=r.n(M);const z=require("antd/es/locale/en_GB");var V=r.n(z);const j={[$.name]:{qm:$,antd:V()},[d.name]:{qm:d,antd:K()}},W=e=>{const t=h({locale:"zh-cn",size:"middle"},e),{locale:n,size:r,global:a}=t;l().useMemo((()=>{return e=Object.assign({},j,a?.langPackage)[n].qm,u=e||u,void(u.name&&c().locale(u.name));var e}),[n]);const i=l().useMemo((()=>Object.assign({},j,a?.langPackage)),[a]),[s,d]=l().useState({locale:n,size:r,global:a});return f((()=>{d((e=>Object.assign({},e,{locale:n,size:r})))}),[r,n]),l().createElement(o.Provider,{value:s},l().createElement(R.ConfigProvider,{locale:i[s.locale].antd,componentSize:s.size,autoInsertSpaceInButton:a?.autoInsertSpaceInButton},t.children))};W.displayName="QmConfigProvider";const B=W;function U(){const{locale:e}=i.useContext(o);return{t:p,$locale:e}}function G(e){const t=i.useRef();return t.current=e,i.useCallback(((...e)=>t.current?.(...e)),[])}function Y(e){const{size:t}=i.useContext(o);return{$size:i.useMemo((()=>e.size??t??""),[e.size,t])}}const X=require("lodash-es"),Q="undefined"==typeof window,Z=e=>l().isValidElement(e),J=e=>Z(e)&&e.type===l().Fragment,ee=()=>{},te=()=>!0,ne=async e=>new Promise((t=>setTimeout(t,e))),re=e=>{Promise.resolve().then(e)},ae=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),ie=e=>!!(!e&&0!==e||(0,X.isArray)(e)&&!e.length||(0,X.isPlainObject)(e)&&!Object.keys(e).length),le=(e,t)=>t.split(".").reduce(((e,t)=>e?.[t]),e),oe=(e,t)=>{const n={...e};for(const e of t)delete n[e];return n},se=(e,t=new WeakMap)=>{if((0,X.isPlainObject)(e)||(0,X.isArray)(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const a=n?void 0:Object.keys(e);return function(n){let i=-1;const l=n.length;for(;++i<l;)o=n[i],s=i,a&&(s=o),r[s]=se(e[s],t);var o,s}(a||e),r}return e},ce=e=>(0,X.isNumber)(e)?`${e}px`:e.toString();class de extends Error{constructor(e){super(e),this.name="QmDesignError"}}function ue(e,t){throw new de(`[${e}] ${t}`)}function me(e,t){console.warn(new de(`[${e}] ${t}`))}function pe(){return pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pe.apply(null,arguments)}const he=e=>{const{loading:t,shortcutKey:n,authConfig:r,click:a,confirm:i}=e,{t:o}=U(),{$size:s}=Y(e);l().useEffect((()=>(n&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=l().useState(!1),u=G((e=>{const t=n.split("+").map((e=>e.trim().toLowerCase())),r=t.includes("alt"),a=t.includes("ctrl"),i=t.includes("shift"),l=t[t.length-1];r&&!e.altKey||a&&!e.ctrlKey||i&&!e.shiftKey||e.key.toLowerCase()!==l||(e.preventDefault(),p.disabled||p.onClick?.(e))})),m=(0,X.isFunction)(a)?{onClick:async t=>{d(!0);try{await(e.click?.(t))}catch(e){me("Button","`click`方法执行出错")}d(!1)}}:null,p={...oe(e,["shortcutKey","authConfig","click","confirm"]),size:s,loading:c||t||!1,...m};if(r){const{visible:e=1,disabled:t}=r||{};if(!e)return null;t&&(p.disabled=!0)}const h=l().createElement(R.Button,p,e.children);return i?l().createElement(R.Popconfirm,{title:i.title||o("qm.button.confirmTitle"),disabled:p.disabled,onConfirm:e=>{i.onConfirm?.(),p.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},l().createElement(R.Button,pe({},p,{onClick:ee}),e.children)):!n||p.disabled?h:l().createElement(R.Tooltip,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${n}`},h)};he.displayName="QmButton";const fe=he;var ge=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ge||{});const ye=e=>{const{$size:t}=Y(e),n=(0,X.isNumber)(e.size)?e.size:ge[t||"default"],r={...oe(e,["size"]),size:n};return l().createElement(R.Space,r,e.children)};ye.displayName="QmSpace";const be=ye,ve=require("classnames");var xe=r.n(ve);const Ee=e=>`qm-${e}`,we=require("@ant-design/icons"),Ce=e=>{const{label:t,extra:n,collapse:r,bordered:a=!0,disabled:i,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=Y(e),{t:m}=U(),p=Ee("divider"),h={[p]:!0,[`${p}-borderless`]:!a,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return l().createElement("div",{id:o,className:xe()(h,s),style:c},l().createElement("span",{className:`${p}__title`},t),l().createElement("div",{className:`${p}__extra`},n),void 0!==r&&l().createElement(R.Button,{type:"link",className:`${p}__collapse`,disabled:i,onClick:()=>{d?.(!r)}},m(r?"qm.divider.collect":"qm.divider.spread"),r?l().createElement(we.UpOutlined,null):l().createElement(we.DownOutlined,null)))};Ce.displayName="QmDivider";const Se=Ce,Ne=()=>({height:0,opacity:0}),Te=e=>({height:e.scrollHeight,opacity:1}),Ie=e=>({height:e?e.offsetHeight:0}),Re=(e,t)=>!0===t?.deadline||"height"===t.propertyName,Oe=require("rc-motion");var ke=r.n(Oe);const Le=l().forwardRef(((e,t)=>{const{forceRender:n,className:r,style:a,boxStyle:i,isActive:o}=e,[s,c]=l().useState(o||n);if(l().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const d=Ee("collapse");return l().createElement("div",{ref:t,className:xe()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},r),style:a},l().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));Le.displayName="PanelContent";const Pe=Le;function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ae.apply(null,arguments)}const Fe=e=>{const{defaultActive:t,label:n,extra:r,className:a,style:i,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[p,h]=l().useState(!!t),f=Ee("collapse"),g=xe()({[`${f}`]:!0,[`${f}-active`]:p,[`${f}-disabled`]:c},a);return l().createElement("div",{className:g,style:i},l().createElement(Se,{label:n,extra:r,collapse:p,bordered:s,disabled:c,onCollapseChange:e=>{h(e),m?.(e)}}),l().createElement(ke(),Ae({visible:p},((e=Ee("motion-collapse"))=>({motionName:e,onAppearStart:Ne,onEnterStart:Ne,onAppearActive:Te,onEnterActive:Te,onLeaveStart:Ie,onLeaveActive:Ne,onAppearEnd:Re,onEnterEnd:Re,onLeaveEnd:Re,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:t,style:n},r)=>l().createElement(Pe,{ref:r,prefixCls:f,className:t,style:n,boxStyle:o,isActive:p,forceRender:d},e.children))))};Fe.displayName="QmCollapse";const _e=Fe,qe=l().createContext(void 0);function De(e,t){((t,n)=>{const r=i.useRef(!0);i.useEffect((()=>(t=>{if(!t)return e()})(r.current)),n),i.useEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})(0,t)}const He=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},$e=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Me=e=>e.preventDefault(),Ke=(e,t)=>{if(Q||!e||!t)return null;"float"===(t=ae(t))&&(t="cssFloat");try{const n=e.style[t];if(n)return n;const r=window.getComputedStyle(e);return r?r[t]:""}catch(n){return e.style[t]}},ze=(e,t,n)=>{!Q&&e&&t&&((0,X.isPlainObject)(t)?Object.keys(t).forEach((n=>{ze(e,n,t[n])})):(t=ae(t),e.style[t]=n))},Ve=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},je=(e,t)=>Math.abs(Ve(e)-Ve(t)),We=e=>{let t=0,n=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:n}},Be=(e,t)=>{let n=e;for(;n;){if(n.classList?.contains(t))return n;n=n.parentNode}return null},Ue=(e,t)=>{if(Q||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Ge=e=>Math.pow(e,3),Ye=e=>e<.5?Ge(2*e)/2:1-Ge(2*(1-e))/2,Xe=e=>{const{minValues:t,onDragChange:n,onDragging:r}=e,{splitRef:a,direction:i}=l().useContext(qe),{t:o}=U(),s=l().useRef(Q?null:document.onselectstart),c=l().useMemo((()=>"horizontal"===i),[i]),d=l().useMemo((()=>c?"X":"Y"),[c]),u=l().useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const n=e[`page${d}`]-u.current[`start${d}`],a=[t[0],u.current[`containerSize${d}`]-t[1]];let i=u.current[`firstElementSize${d}`]+n;i=Math.max(a[0],i),i=Math.min(a[1],i),r(i)},h=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),n(!1),$e(document,"mousemove",p),$e(document,"mouseup",h),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g=Ee("split"),y={[`${g}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return l().createElement("div",{className:xe()(y),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,r=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:r.offsetWidth,firstElementSizeY:r.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),He(document,"mousemove",p),He(document,"mouseup",h),n(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Xe.displayName="ResizeBar";const Qe=Xe,Ze=l().forwardRef(((e,t)=>{const{offset:n,className:r,style:a}=e,{direction:i,dragging:o}=l().useContext(qe),s="vertical"===i?"height":"width",c=Ee("split-pane"),d={[c]:!0,isLocked:o,horizontal:"horizontal"===i,vertical:"vertical"===i,[r]:!!r},u=void 0!==n?{[s]:ce(n)}:{flex:1,[s]:0};return l().createElement("div",{ref:t,className:xe()(d),style:{...u,...a}},e.children)}));Ze.displayName="SplitPane";const Je=Ze;function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},et.apply(null,arguments)}const tt=e=>{const{direction:t="horizontal",defaultValue:n="50%",uniqueKey:r,className:a,style:i,onDragStart:s,onDrag:c=ee,onDragEnd:d}=e,{global:u}=l().useContext(o),m=l().useRef(null),p=l().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},y=l().useMemo((()=>r?`split_${r}`:""),[r]),[b,v]=l().useState(!1),[x,E]=l().useState(h(n));De((()=>{b?s?.(f(x)):(d?.(f(x)),localStorage.setItem(y,x),S(y,x))}),[b]),l().useEffect((()=>{w()}),[]);const w=()=>{if(!y)return;const e=localStorage.getItem(y);e?E(h(e)):C(y).then((e=>{localStorage.setItem(y,h(e||n)),w()})).catch((()=>{}))},C=async e=>{const t=u?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},S=async(e,t)=>{const n=u?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},N=l().useMemo((()=>({splitRef:m,direction:t,dragging:b})),[t,b]),T=[];l().Children.map(e.children,(e=>{Z(e)&&!J(e)&&"SplitPane"===e.type?.displayName&&T.push(e)}));const[I,R]=T,O=l().useMemo((()=>[g(I),g(R)]),[I,R]),k=Ee("split"),L={[k]:!0,vertical:"vertical"===t};return l().createElement(qe.Provider,{value:N},l().createElement("div",{ref:m,className:xe()(L,a),style:i},l().createElement(Je,et({},I.props,{ref:p,offset:x})),l().createElement(Qe,{minValues:O,onDragChange:e=>v(e),onDragging:e=>{E(`${e}px`),c(e)}}),l().createElement(Je,R.props)))};tt.displayName="QmSplit",tt.Pane=Je;const nt=tt,rt=require("react-countup");var at=r.n(rt);function it(){return it=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},it.apply(null,arguments)}const lt=e=>{const{className:t,style:n}=e,{$size:r}=Y(e),a=Ee("countup"),i={[a]:!0,[`${a}--lg`]:"large"===r,[`${a}--sm`]:"small"===r};return l().createElement(at(),it({},e,{className:xe()(i,t),style:n}),e.children)};lt.displayName="QmCountup";const ot=lt;function st(){return st=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},st.apply(null,arguments)}const ct=e=>{const{className:t}=e,{$size:n}=Y(e),r=Ee("empty"),a={...e,image:R.Empty.PRESENTED_IMAGE_SIMPLE},i={[r]:!0,[`${r}--lg`]:"large"===n,[`${r}--sm`]:"small"===n};return l().createElement(R.Empty,st({},a,{className:xe()(i,t)}))};ct.displayName="QmEmpty";const dt=ct,ut=e=>{const t=h({tip:"Loading..."},e),{fullHeight:n,className:r,style:a}=t,i=Ee("spin"),o={[i]:!0,[`${i}-fullHeight`]:!!n},s={wrapperClassName:xe()(o,r),...oe(t,["fullHeight"]),style:{...a,maxHeight:"none"}};return l().createElement(R.Spin,s,t.children)};ut.displayName="QmSpin";const mt=ut,pt=l().createContext(void 0),ht=require("resize-observer-polyfill");var ft=r.n(ht);const gt=new Map,yt=new(ft())((function(e){e.forEach((e=>{const{target:t}=e;gt.get(t)?.forEach((e=>e(t)))}))}));function bt(e,t){gt.has(e)||(gt.set(e,new Set),yt.observe(e)),gt.get(e).add(t)}function vt(e,t){gt.has(e)&&(gt.get(e).delete(t),gt.get(e).size||(yt.unobserve(e),gt.delete(e)))}function xt(e){const[t,n]=i.useState({width:0,height:0});return i.useLayoutEffect((()=>{const t=e.current,r=e=>{n({width:e.offsetWidth,height:e.offsetHeight})};return t&&bt(t,r),()=>{t&&vt(t,r)}}),[e]),t}function Et(e,t){const n=i.useRef(null);return i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]),i.useCallback(((...r)=>{n.current&&clearTimeout(n.current),n.current=setTimeout((()=>e.apply(this,r)),t)}),[e,t])}const wt=(e,...t)=>l().isValidElement(e)?l().cloneElement(e,...t):null,Ct=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],St=e=>({_s:e,status:Ct[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Nt=e=>e?6:5,Tt=(e,t,n,r,a)=>{clearTimeout(r.current);const i=St(e);t(i),n.current=i,a?.({current:i})},It=e=>{const{name:t,in:n,timeout:r,preEnter:a=!0,preExit:o}=e,[s,c]=((e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:a,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,m]=(0,i.useState)((()=>St(o?2:Nt(s)))),p=(0,i.useRef)(u),h=(0,i.useRef)(),[f,g]=(e=>(0,X.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(l),y=(0,i.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return Nt(t)}})(p.current._s,c);e&&Tt(e,m,p,h,d)}),[d,c]),b=(0,i.useCallback)((e=>{const i=e=>{switch(Tt(e,m,p,h,d),e){case 1:f>=0&&(h.current=setTimeout(y,f));break;case 4:g>=0&&(h.current=setTimeout(y,g));break;case 0:case 3:h.current=setTimeout((()=>i(e+1)),0)}},l=p.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&i(t?r?0:1:2):l&&i(n?a?3:4:Nt(c))}),[y,d,t,n,r,a,f,g,c]);return(0,i.useEffect)((()=>()=>clearTimeout(h.current)),[]),[u,b,y]})({timeout:r,preEnter:a,preExit:o,initialEntered:n});return f((()=>{c()}),[n]),l().createElement(l().Fragment,null,l().Children.map(e.children,(e=>l().isValidElement(e)?wt(e,{className:xe()(e.props.className,t,s.status)}):e)))},Rt=6,Ot={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"}},kt=e=>{const{thumb:t,always:n,className:r,barSize:a=Rt,direction:i="vertical",onDrag:o=ee}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=l().useContext(pt),u=Ot[i],m=l().useRef(null),p=l().useRef(null),h=l().useRef({}),f=l().useRef(!1),g=l().useRef(!1),y=l().useRef(Q?null:document.onselectstart),[b,v]=l().useState(!1);l().useEffect((()=>{const e=c.current;return He(e,"mousemove",C),He(e,"mouseleave",S),()=>{w(),$e(document,"mouseup",E),$e(e,"mousemove",C),$e(e,"mouseleave",S)}}),[]);const x=e=>{if(!m.current||!p.current)return;if(!f.current)return;const t=h.current[u.axis];if(!t)return;const n=100*(-1*(m.current.getBoundingClientRect()[u.direction]-e[u.client])-(p.current[u.offset]-t))/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},E=()=>{f.current=!1,h.current={[u.axis]:0},$e(document,"mousemove",x),$e(document,"mouseup",E),w(),g.current&&v(!1),o(!1)},w=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},C=G((()=>{g.current=!1,v(!!t.size)})),S=G((()=>{g.current=!0,v(f.current)})),N=Ee("scrollbar"),T={[`${N}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},I={[u.reverse]:a},R={[u.size]:t.size,transform:`translate${u.axis}(${t.offset}%)`};return l().createElement(It,{name:"fade",in:n||s||b,timeout:300},l().createElement("div",{ref:m,className:xe()(T,r),style:I,onMouseDown:e=>{const t=e.target;if(!t)return;const n=100*(Math.abs(t.getBoundingClientRect()[u.direction]-e[u.client])-p.current[u.offset]/2)/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100}},l().createElement("div",{ref:p,className:`${N}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),He(document,"mousemove",x),He(document,"mouseup",E),f.current=!0,y.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])})}})))},Lt=20,Pt=l().forwardRef(((e,t)=>{const{wrapClassName:n,wrapStyle:r,innerStyle:a,barWidth:i,always:o,native:s,showTopScrollbar:c,minSize:d=Lt,onScroll:u,onReachedEnd:m}=e,p=l().useRef(null),h=l().useRef(null),g=l().useRef(null),y=l().useRef({prevTop:0,prevLeft:0}),[b,v]=l().useState({size:0,offset:0,ratio:1}),[x,E]=l().useState({size:0,offset:0,ratio:1}),[w,C]=l().useState(!1),S=xt(p),N=xt(g);f((()=>{!s&&T()}),[N.width,N.height,S.width,S.height]);const T=Et((()=>{if(!h.current)return;const e=h.current.offsetHeight-4,t=h.current.offsetWidth-4,n=e**2/h.current.scrollHeight,r=t**2/h.current.scrollWidth,a=Math.max(n,d),i=Math.max(r,d),l=n/(e-n)/(a/(e-a)),o=r/(t-r)/(i/(t-i)),s=a+4<e?a:0,c=i+4<t?i:0,u=100*h.current.scrollTop/e*l,m=100*h.current.scrollLeft/t*o;v(Object.assign({},b,{size:c,ratio:o,offset:m})),E(Object.assign({},x,{size:s,ratio:l,offset:u}))}),5),I=e=>{C(e)},R=(e,t)=>{(0,X.isNumber)(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollTop=r+(t-r)*Ye(l),a(i)):e.scrollTop=t};a(i)})(h.current,e):h.current.scrollTop=e:me("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},O=(e,t)=>{(0,X.isNumber)(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollLeft=r+(t-r)*Ye(l),a(i)):e.scrollLeft=t};a(i)})(h.current,e):h.current.scrollLeft=e:me("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};l().useImperativeHandle(t,(()=>({container:p.current,scrollElement:h.current,scrollTop:h.current?.scrollTop||0,scrollLeft:h.current?.scrollLeft||0,SET_SCROLL_TOP:R,SET_SCROLL_LEFT:O})));const k=l().useMemo((()=>({dragging:w,scrollbarElement:p,wrapElement:h})),[w]),L=Ee("scrollbar"),P={[`${L}__wrap`]:!0,[`${L}__wrap--hidden`]:!s};return l().createElement("div",{ref:p,className:xe()(L,e.className),style:e.style},l().createElement("div",{ref:h,className:xe()(P,n),style:r,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(({scrollTop:e,scrollLeft:t})=>{if(!h.current)return;const n=h.current.offsetHeight-4,r=h.current.offsetWidth-4,a=100*e/n*x.ratio,i=100*t/r*b.ratio;v(Object.assign({},b,{offset:i})),E(Object.assign({},x,{offset:a}))})({scrollTop:t,scrollLeft:n}),u?.({scrollTop:t,scrollLeft:n});const{prevTop:r,prevLeft:a}=y.current,i={bottom:t+h.current.clientHeight>=h.current.scrollHeight,top:t<=0&&0!==r,right:n+h.current.clientWidth>=h.current.scrollWidth&&a!==n,left:n<=0&&0!==a};let l;var o;r!==t&&(l=t>r?"bottom":"top"),a!==n&&(l=n>a?"right":"left"),l&&i[l]&&m?.(l,{scrollTop:t,scrollLeft:n}),o={prevTop:t,prevLeft:n},y.current=o}},l().createElement("div",{ref:g,className:`${L}__view`,style:a},e.children)),!s&&l().createElement(pt.Provider,{value:k},c&&l().createElement(kt,{className:"top",direction:"horizontal",thumb:b,barSize:i,always:o,onDrag:I}),l().createElement(kt,{direction:"horizontal",thumb:b,barSize:i,always:o,onDrag:I}),l().createElement(kt,{direction:"vertical",thumb:x,barSize:i,always:o,onDrag:I})))}));Pt.displayName="QmScrollbar";const At=Pt,Ft=require("sortablejs");var _t=r.n(Ft);const qt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const n=window.URL.createObjectURL(e);let r=document.createElement("a");r.href=n,r.download=decodeURI(t),r.click(),r=null}};function Dt(){return Dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dt.apply(null,arguments)}const Ht=async(e,{fileName:t,headers:n,params:r})=>{const a=r?new URLSearchParams(r).toString():"",i=a?e.includes("?")?"&":"?":"",l=await fetch(e+`${i+a}`,{method:"GET",headers:n});if(!l.ok)throw new Error(p("qm.download.error"));const o=await l.blob(),s=l.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));qt(o,c)},$t=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},Mt=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Kt=e=>{const t=h({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:n=[],fileDirection:r="vertical",batchDownload:a,draggable:i,editable:o,disabled:s,readOnly:c,button:d={},className:u,onPreview:m,onSortChange:p,onEditChange:f,onDownload:g,onChange:y}=t,{t:b}=U(),{$size:v}=Y(t),x=l().useRef(null),E=l().useRef(null),[w,C]=l().useState({}),S=l().useMemo((()=>s||c),[s,c]);l().useEffect((()=>(I(),()=>E.current?.destroy())),[]);const N=(e,t)=>{C((n=>Object.assign({},n,{[e]:t??!n[e]})))},T=G((e=>{const{oldIndex:t,newIndex:r}=e;if(t!==r){const e=[...n],[a]=e.splice(t,1);e.splice(r,0,a),p?.(e),y?.({file:n[t],fileList:e})}})),I=()=>{i&&(E.current=_t().create(Be(x.current,Ee("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:T}))},O=async e=>{if(g)return void await g(e);const{downloadWithHeaders:n,headers:r}=t;try{e.url&&await Ht(e.url,{fileName:e.name,...n?{headers:r}:null})}catch(e){R.message.error(b("qm.download.error"))}},k=Ee("upload-file"),L={[k]:!0,[`${k}--lg`]:"large"===v,[`${k}--sm`]:"small"===v,[`${k}--horizontal`]:"horizontal"===r};return l().createElement(R.Upload,Dt({className:xe()(L,u)},oe(t,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,n)=>new Promise((async(r,a)=>{const{fileTypes:i=[],fileSize:l,maxCount:o,fileList:s=[],beforeUpload:c}=t,d=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!l||e.size/1024/1024<l,m=!(o>1)||s.length<o,p=d&&u&&m;if(d||R.message.warning(b("qm.upload.tooltip",{type:i.join(",")})),u||R.message.warning(b("qm.upload.sizeLimit",{size:l})),m||R.message.warning(b("qm.upload.countLimit",{count:o})),!p)return R.Upload.LIST_IGNORE;if(c){const t=c(e,n);if(!0===t)return r(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{r(await t)}catch(e){a(e)}}else r(e)})),disabled:S,onChange:y,onPreview:async e=>{if("function"==typeof m)return m(e,(t=>O(t||e)));s||await O(e)},onDownload:async e=>{await O(e)},itemRender:(e,r,a,c)=>((e,r)=>{const{iconRender:a}=t,{uid:c,name:d,url:u,status:m="done"}=e,p="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return l().createElement("div",{className:xe()("ant-upload-list-item",`ant-upload-list-item-${m}`,"ant-upload-list-item-list-type-text",{handle:i})},l().createElement("div",{className:"ant-upload-list-item-info"},l().createElement("span",{className:"ant-upload-span"},l().createElement("div",{className:"ant-upload-text-icon"},a?a(e):l().createElement(we.LinkOutlined,null)),l().createElement("div",{className:"ant-upload-list-item-name"},w[c]?l().createElement(R.Input,{size:"small",autoFocus:!0,defaultValue:$t(d),onBlur:t=>{const{value:r}=t.target;if(r!==$t(d)){const t=Object.assign({},e,{name:`${r}.${Mt(d)}`}),a=n.map((e=>e.uid!==c?e:t));f?.(t,a),y?.({file:t,fileList:a})}N(c,!1)}}):l().createElement("a",{rel:"noreferrer",target:"_blank",title:d,href:u,onClick:e=>{e.preventDefault(),o?S||N(c,!0):r.preview()}},d)),l().createElement("span",{className:"ant-upload-list-item-card-actions"},o&&!S&&l().createElement("button",{type:"button",className:p,onClick:()=>N(c)},w[c]?l().createElement(we.CheckOutlined,null):l().createElement(we.EditOutlined,null)),o&&l().createElement("button",{type:"button",className:xe()(p,"preview"),onClick:()=>r.preview()},l().createElement(we.EyeOutlined,null)),l().createElement("button",{type:"button",className:xe()(p,"download"),disabled:s,onClick:()=>r.download()},l().createElement(we.DownloadOutlined,null)),l().createElement("button",{type:"button",className:xe()(p,"delete"),disabled:S,onClick:()=>r.remove()},l().createElement(we.DeleteOutlined,null))))))})(r,c)}),l().createElement("span",{className:"inner",ref:x},t.children||c&&n.length?t.children:l().createElement(R.Button,{type:d.type??"default",icon:d.icon??l().createElement(we.UploadOutlined,null),disabled:S},d.text||b("qm.upload.text")),a&&!!n.length&&l().createElement(R.Button,{disabled:s,style:{marginLeft:8},onClick:async e=>{if(e.stopPropagation(),"function"==typeof a)await a(n);else for(const e of n)await O(e)}},b("qm.upload.batchDownload"))))};Kt.displayName="QmUploadFile";const zt=Kt;function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(null,arguments)}const jt=e=>{const t=h({icon:l().createElement(we.DownloadOutlined,null),withCredentials:!1},e),{$size:n}=Y(t),{t:r}=U(),[a,i]=l().useState(!1),o=oe(t,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return l().createElement(R.Button,Vt({},o,{size:n,loading:a,onClick:async()=>{i(!0);try{const{action:e,fileName:n,headers:a,params:i,beforeDownload:l=te,onSuccess:o}=t,s=(0,X.isString)(e)?e:await(async()=>{const e=t.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""})();if(!s)return me("Download","参数 `action` 有误!");if(!l(s))return;await Ht(s,{fileName:n,headers:a,params:i}),await ne(100),o?.(),R.message.success(r("qm.download.success"))}catch(e){t.onError?.(e),R.message.error(r("qm.download.error"))}i(!1)}}),t.children||r("qm.download.text"))};jt.displayName="QmDownload";const Wt=jt,Bt=require("add-dom-event-listener");var Ut=r.n(Bt);const Gt=require("scroll-into-view-if-needed");var Yt=r.n(Gt);function Xt(e,t){const n=i.useRef(null),r=i.useRef(0);return i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]),i.useCallback(((...n)=>{const a=Date.now();(!r.current||a-r.current>t)&&(e.apply(this,n),r.current=a)}),[e,t])}const Qt=e=>{const{activeKey:t,labels:n,onTabClick:r}=e;return l().createElement(l().Fragment,null,n.map(((e,n)=>{const a={item:!0,actived:n===t};return l().createElement("div",{key:n,className:xe()(a),onClick:e=>r(n,e)},l().createElement("span",null,e))})))},Zt=e=>{const{label:t,showDivider:n,className:r,style:a}=e,i=Ee("anchor-item"),o={[i]:!0};return l().createElement("div",{className:xe()(o,r),style:a},n&&l().createElement(Se,{label:t,style:{marginBottom:10}}),e.children)};Zt.displayName="AnchorItem";const Jt=Zt,en=l().forwardRef(((e,t)=>{const{labelList:n=[],defaultActiveIndex:r,labelWidth:a,tabPosition:i="left",onTabClick:o,className:s,style:c}=e,{$size:d}=Y(e),u=l().useRef(null),m=l().useRef(),p=l().useRef("ready"),h=l().useRef(0),[f,g]=l().useState(r||0),y=l().useMemo((()=>!!n?.length),[n]);l().useEffect((()=>{b();const e=Ut()(u.current,"scroll",x);return()=>{e.remove()}}),[]);const b=()=>{f>0&&(u.current.scrollTop=je(v(f),u.current))},v=e=>y?document.getElementById(n[e].id):u.current.children[e],x=Xt((e=>{if("ready"!==p.current)return;const t=(e=>{const t=Math.abs(e),r=(y?n.map((e=>document.getElementById(e.id))):Array.from(u.current?.children||[])).map((e=>je(e,u.current)));let a=-1;for(let e=0;e<r.length;e++){const n=r[e],i=r[e+1]||1e4;t>=n-1&&t<i&&(a=e)}return a})(e.target.scrollTop);-1!==t&&g(t)}),60),E=e=>{const t=v(e);t&&(g(e),p.current="stop",m.current&&clearTimeout(m.current),Yt()(t,{block:"start",behavior:"smooth",boundary:u.current}),m.current=setTimeout((()=>p.current="ready"),500))};l().useImperativeHandle(t,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>h.current?h.current:e,E(e)}})));const w=Ee("anchor"),C={[w]:!0,[`${w}-left`]:"left"===i,[`${w}-top`]:"top"===i,[`${w}--lg`]:"large"===d,[`${w}--sm`]:"small"===d},S=[];l().Children.map(e.children,(e=>{Z(e)&&!J(e)&&"AnchorItem"===e.type?.displayName&&S.push(e)}));const N=y?n.map((e=>e.label)):S.map((e=>e.props.label)),T=y?n.map((e=>e.id)):S.map(((e,t)=>e.props["data-id"]||t.toString()));return h.current=N.length,l().createElement("div",{className:xe()(C,s),style:c},l().createElement("div",{className:xe()("anchor-nav"),style:{width:a?ce(a):""}},l().createElement(Qt,{activeKey:f,labels:N,onTabClick:(e,t)=>{E(e),o?.({label:N[e],id:T[e]},t)}})),l().createElement("div",{ref:u,className:xe()("anchor-container")},y?e.children:S))}));en.displayName="QmAnchor",en.Item=Jt;const tn=en,nn=e=>l().createElement(R.Tabs.TabPane,e,e.children);nn.displayName="TabPane";const rn=nn;function an(){return an=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},an.apply(null,arguments)}const ln=e=>{const t=h({tabPosition:"top"},e),{items:n,tabPosition:r,tabBarGutter:a,className:i,authConfig:o}=t,{$size:s}=Y(t),c=Ee("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u={...oe(t,["items","authConfig"]),size:s,tabBarGutter:a??(["top","bottom"].includes(r)?30:0)},m=[];l().Children.map(t.children,(e=>{Z(e)&&!J(e)&&"TabPane"===e.type?.displayName&&m.push(e)}));const p=n?[...n]:m.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<p.length;t++){const n=p[t],r=e.find((e=>e.dataIndex===n.key)),{visible:a=1,disabled:i}=r||{};a?i&&(n.disabled=!0):(p.splice(t,1),t--)}}return l().createElement(R.Tabs,an({},u,{items:p,className:xe()(d,i)}))};ln.displayName="QmTabs",ln.TabPane=rn;const on=ln;function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sn.apply(null,arguments)}const cn=l().forwardRef(((e,t)=>{const n=h({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:r,open:a,className:i,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:p,onClosed:f,onFullChange:g}=n,{global:y}=l().useContext(o),{$size:b}=Y(n),v=l().useRef(null),x=l().useRef(null),E=l().useRef(!1),[w,C]=l().useState(!1),[S,N]=l().useState(!1),[T,I]=l().useState(!1);De((()=>{(a??r)&&(!m&&E.current||(0,X.isUndefined)(s)&&N(!0))}),[a??r]),De((()=>{x.current&&ze(x.current,w?{width:"100%"}:{width:ce(n.width||"72%")})}),[w]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>I(!0),STOP_LOADING:()=>I(!1)})));const O=Ee("drawer"),k={[O]:!0,"no-header":!c,[`${O}--lg`]:"large"===b,[`${O}--sm`]:"small"===b};return l().createElement(R.Drawer,sn({},oe(n,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??r,maskClosable:u??y?.maskClosable??!1,className:xe()(k,i),title:l().createElement(l().Fragment,null,l().createElement("span",{ref:v,className:"text"},c&&n.title),d&&l().createElement("button",{type:"button",className:"full-screen",onClick:()=>{x.current=Be(v.current,"ant-drawer-content-wrapper"),C(!w),g?.(!w)}},l().createElement(w?we.FullscreenExitOutlined:we.FullscreenOutlined))),footer:null,afterOpenChange:e=>{e?(E.current=!0,(0,X.isUndefined)(s)&&setTimeout((()=>N(!1)),100)):(C(!1),f?.())},onClose:p}),n.children,(s||T||S)&&l().createElement(mt,{spinning:!0,className:xe()("spinning")}))}));cn.displayName="QmDrawer";const dn=cn,un=require("react-draggable");var mn=r.n(un);function pn(){return pn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pn.apply(null,arguments)}const hn="10vh";var fn=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(fn||{});const gn=l().forwardRef(((e,t)=>{const n=h({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:hn}},e),{visible:r,open:a,width:i,height:s,className:c,loading:d,draggable:u,showHeader:m,showFullScreen:p,maskClosable:f,destroyOnClose:g,bodyStyle:y,onFullChange:b,onClose:v,onClosed:x}=n,{global:E}=l().useContext(o),{$size:w}=Y(n),C=l().createRef(),S=l().useRef(!1),N=l().useMemo((()=>`calc(100vh - ${hn} - ${hn} - ${fn[m?w:"none"]}px)`),[w,m]),[T,I]=l().useState(!1),[O,k]=l().useState(!1),[L,P]=l().useState(!1),[A,F]=l().useState(!0),[_,q]=l().useState({left:0,top:0,bottom:0,right:0}),[D,H]=l().useState();De((()=>{if(a??r){if(!g&&S.current||(0,X.isUndefined)(d)&&k(!0),!g&&S.current)return;setTimeout((()=>{S.current=!0,(0,X.isUndefined)(d)&&k(!1)}),400)}}),[a??r]),De((()=>{H(T?{x:0,y:0}:void 0)}),[T]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>P(!0),STOP_LOADING:()=>P(!1)})));const $=Ee("modal"),M={height:s?ce(s):N,maxHeight:"auto"===s?N:"",overflow:"auto"},K={[$]:!0,"no-header":!m,[`${$}--lg`]:"large"===w,[`${$}--sm`]:"small"===w};return l().createElement(R.Modal,pn({},oe(n,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:a??r,maskClosable:f??E?.maskClosable??!1,className:xe()(K,c),title:l().createElement("div",{onMouseOver:()=>{A&&F(!1)},onMouseOut:()=>{F(!0)}},l().createElement("span",{className:"text"},m&&n.title),p&&l().createElement("button",{type:"button",className:"full-screen",onClick:e=>{const t=Be(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");T?(ze(t,{width:ce(i||"60%"),height:"auto",top:hn}),ze(n,{height:s?ce(s):N,maxHeight:"auto"===s?N:""})):(ze(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),ze(n,{height:`calc(100vh - ${fn[m?w:"none"]}px)`,maxHeight:""})),I(!T),b?.(!T)}},l().createElement(T?we.FullscreenExitOutlined:we.FullscreenOutlined))),footer:null,bodyStyle:Object.assign({},M,y),onCancel:v,afterClose:()=>{x?.(),I(!1)},modalRender:e=>l().createElement(mn(),{nodeRef:C,bounds:_,position:D,disabled:!u||A||T,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,a=C.current.getBoundingClientRect();a&&q({left:-a.left+t.x,right:n-(a.right-t.x)-1,top:-a.top+t.y,bottom:r-(a.bottom-t.y)-1})})(0,t)},l().createElement("div",{ref:C},e))}),n.children,(d||L||O)&&l().createElement(mt,{spinning:!0,className:xe()("spinning")}))}));gn.displayName="QmModal";const yn=gn,bn=require("memoize-one");var vn=r.n(bn);const xn=(0,i.createContext)(void 0),En={string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e,t){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 n=0,r=(e=Array.isArray(e)?e:[e]).length;n<r;n++)t+="number"==typeof e[n]?e[n]:"'"+e[n]+"'",n<r-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,n){return e.split(t).join(n)},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 "," || "),this.find_replace(e," <> "," != ")}},wn=["==","<",">","<=",">=","!=","like","nlike","likes","in","nin","^=","=$","nil","nnil"],Cn=function(e,t){let n="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?n+=" "+e[t]+" ":n+=e[t];const r=n.split(" ").filter((e=>""!==e));for(let e=0;e<r.length;e++)wn.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),wn.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return r.join(" ")},Sn=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Nn=["string","number","boolean","symbol"],Tn=e=>Nn.includes(typeof e),In=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Rn=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(new RegExp(dr,"g")," ").replace(Sn,"\\$1"),"i"),On=(e,t,n)=>{e=e??"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Rn(n));break;case"nlike":r=null===e.toString().match(Rn(n));break;case"likes":r=n.split(/,|,/).some((t=>On(e,"like",t)));break;case"in":Tn(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Tn(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"^=":r=e.toString().startsWith(n);break;case"=$":r=e.toString().endsWith(n);break;case"nil":r=""===e||null==e;break;case"nnil":r=!On(e,"nil",null);break;case"!=":case"<>":r=(In(e)?e.slice(0,10):e)!=n;break;case"<":r=(In(e)?e.slice(0,10):e)<n;break;case"<=":r=(In(e)?e.slice(0,10):e)<=n;break;case">":r=(In(e)?e.slice(0,10):e)>n;break;case">=":r=(In(e)?e.slice(0,10):e)>=n;break;default:r=(In(e)?e.slice(0,10):e)==n}return r};window.__query__=(...e)=>On(e[0],e[1],e[2]);const kn=En.stringify,Ln=En.array_format,Pn=function(e){let t=0;const n=e.length;for(let r=0;r<n;r++){const n=e.charAt(r);"("===n&&t++,")"===n&&t--}return 0===t},An=(e,t,n)=>{if(!t)return e;let r=[];t=En.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Cn(t,"record")};`);r=gr(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Cn(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)n(e,t)&&r.push(e[t])}}catch(t){me("Table","组件 `initialFilter` 参数有误!"),r=e}return r},Fn=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Fn(e.children)):t.push(e)})),t},_n=e=>e.filter((e=>(e.children&&(e.children=_n(e.children)),!e.hidden&&!e.noAuth))),qn=e=>e.map((e=>{const t={dataIndex:e.dataIndex};return Array.isArray(e.children)&&(t.children=qn(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),t})),Dn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Dn(e.children))})),t},Hn=(e,t)=>e.map((e=>(e.children&&(e.children=Hn(e.children,t)),t?.(e),e))),$n=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=$n(n.children,t);if(e)return e}}return null},Mn=e=>{const t=e.children;return t?t[0].children?Mn(t[0]):t[0]:e},Kn=e=>{const t=e.children;return t?t[t.length-1].children?Kn(t[t.length-1]):t[t.length-1]:e},zn=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Vn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Vn(e.children))})),t},jn=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...jn(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},Wn=(e,t)=>{const n=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&n.push(...Wn(e[r].children,t)),n.push(t(e[r]));return n},Bn=e=>{let t=1;const n=(e,r)=>{if(r&&(e.level=r.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((r=>{e.fixed?r.fixed=e.fixed:delete r.fixed,n(r,e),t+=r.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return Dn(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Un=e=>Object.assign(e,{__prevent__:!0}),Gn=e=>e.__prevent__,Yn=e=>{delete e.__prevent__},Xn=(e,t,n={left:0,top:0})=>{if(e){const r=e.parentNode;if(n.top+=e.offsetTop,n.left+=e.offsetLeft,r&&r!==document.documentElement&&r!==document.body&&(n.top-=r.scrollTop,n.left-=r.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Xn(e.offsetParent,t,n)}return n},Qn=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Zn=(e,t)=>(0,X.transform)(e,((e,n,r)=>{(0,X.isEqual)(n,t[r])||(e[r]=(0,X.isPlainObject)(n)&&(0,X.isPlainObject)(t[r])?Zn(n,t[r]):n)})),Jn=(e,t)=>(0,X.get)(e,t)??"",er=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),(0,X.set)(e,t,n??"")},tr=(e,t)=>{if(!t.includes("|"))return Jn(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(Jn(e,t))})),n.every((e=>!e))?"":n.join(" | ")},nr=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),rr=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],a="";for(;r.length>3;)a=`,${r.slice(-3)}${a}`,r=r.slice(0,r.length-3);return r&&(a=r+a),`${n}${a}${t[1]?`.${t[1]}`:""}`},ar=(e,t)=>{const n=e.toString();if(!nr(n)||0===t)return e;const r=Number.parseFloat(n).toString(),a=r.indexOf(".");if(-1===a)return r+"."+"0".repeat(t);const i=Math.max(0,t-(r.length-a-1));return r+"0".repeat(i)},ir=(e,t)=>e?c()(e,t):null,lr=(e,t)=>e?c()(e).format(t):"",or=(e="")=>{let t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},sr=e=>{const t=[];return function e(n){if(null!=n&&"boolean"!=typeof n)if("string"!=typeof n&&"number"!=typeof n)if("function"!=typeof n){if(Array.isArray(n))n.forEach(e);else if(l().isValidElement(n)){const{type:t,props:r}=n;if("function"==typeof t)try{e(t.prototype?.isReactComponent?new t(r).render():t(r))}catch{e(r.children)}else e(r.children)}}else try{e(n())}catch{}else t.push(n)}(e),t},cr=e=>sr(e).join(""),dr="",ur=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=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)?Ln(i.condition):kn(i.condition,dr);n+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,r=i.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[a,i]=r.includes("|")?r.split("|"):[r,""],l=e[r];for(const e in l)n+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?Ln(l[e]):kn(l[e],dr)} and `}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},mr=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(Jn(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},pr=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].dataIndex===t)return[e[n]];if(Array.isArray(e[n].children)){const r=pr(e[n].children,t);if(r)return[e[n],r].flat()}}},hr=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=hr(n.children,t);if(e)return e}if(t(n))return n}return null},fr=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n]._rowKey===t)return[t];if(Array.isArray(e[n].children)){const r=fr(e[n].children,t);if(r)return[e[n]._rowKey,r].flat()}}},gr=(e,t)=>e.reduce(((e,n)=>{const r={...n};return Array.isArray(n.children)&&(r.children=gr(n.children,t)),(t(r)||r.children&&r.children.length>0)&&e.push(r),e}),[]),yr=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),br=(e,t,n=!1)=>{const r=new Set;return function e(t,a,i=1){if(r.has(t))return!1;if(t===a)return!0;if(n&&i>1)return!1;r.add(t);const l=i+1;if(Array.isArray(t)){if(!Array.isArray(a)||t.length!==a.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],a[n],l))return!1;return!0}if(t&&a&&"object"==typeof t&&"object"==typeof a){const n=Object.keys(t);return n.length===Object.keys(a).length&&n.every((n=>e(t[n],a[n],l)))}return!1}(e,t)},vr=(e,t)=>e===t,xr=e=>["nil","nnil"].includes(e);function Er(e,t){for(const n in t){const r=t[n],a=Jn(e,n);if(r&&!r.includes(a))return!1}return!0}const wr=(e,t,n)=>Object.keys(t).length&&e.length?n?gr(e,(e=>Er(e,t))):e.filter((e=>Er(e,t))):e,Cr=require("prop-types");var Sr=r.n(Cr);const Nr=e=>["","small","middle","large"].includes(e),Tr=80,Ir="1",Rr="0",Or=400,kr=["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"],Lr={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 Pr=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}({}),Ar=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}({}),Fr=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const _r={items:Sr().arrayOf(Sr().shape({type:Sr().string.isRequired,fieldName:Sr().string.isRequired})),initialValues:Sr().object,initialExtras:Sr().object,layout:Sr().oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!Nr(e[t]||""))return ue("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Sr().number,className:Sr().string,style:Sr().object,compactMode:Sr().bool,labelWidth:Sr().oneOfType([Sr().number,Sr().string]),labelAlign:Sr().oneOf(["left","right"]),labelWrap:Sr().bool,formType:Sr().oneOf(["default","search","onlyShow"]),disabled:Sr().bool,uniqueKey:Sr().string,defaultRows:Sr().number,defaultExpand:Sr().bool,searchButtonCols:Sr().number,scrollToFirstError:Sr().bool,authConfig:Sr().object,isAutoFocus:Sr().bool,isCollapse:Sr().bool,isFieldsDefine:Sr().bool,isSearchBtn:Sr().bool,isSubmitBtn:Sr().bool,fieldsChange:Sr().func,onValuesChange:Sr().func,onFieldsChange:Sr().func,onFinish:Sr().func,onFinishFailed:Sr().func,onReset:Sr().func,onCollapse:Sr().func},qr={layout:"horizontal",labelWidth:Tr,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:ee,onFieldsChange:ee,onFinish:ee,onFinishFailed:ee,onReset:ee,onCollapse:ee},Dr=(e,t)=>{if(!e)return null;if(t===Ar.week){const t=e.match(/^(\d{4})-(\d+)/);return t?c()().year(Number(t[1])).week(Number(t[2])):null}if(t===Ar.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?c()().year(Number(t[1])).quarter(Number(t[2])):null}return c()(e,t)},Hr=(e,t)=>e?c()(e).format(t):"",$r=e=>""===e||null==e,Mr=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const n=t.split("|");let r="";for(let t=0,a=n.length;t<a;t++)r+=(e[n[t].trim()]??"")+(t===a-1?"":" | ");return r},Kr=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const a=t[r].split("|"),i=n[r].split("|");a.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},zr=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const a=t[r].split("|"),i=n[r].split("|");a.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},Vr=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),(0,X.isUndefined)(e.isLeaf)||(r.isLeaf=!!e.isLeaf),(0,X.isUndefined)(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=Vr(e.children,t,n)),r})),jr=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=jr(n.children,t);if(e)return e}}return null},Wr=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...Wr(e.children,t,n+1))})),r},Br=e=>Z(e)||"string"==typeof e,Ur=e=>sr(e).join(""),Gr=(e,t,n,r)=>{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={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:n(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={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:n(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:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Yr={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"}};let Xr,Qr=null;function Zr(e){return e||null===Qr?("object"==typeof Intl&&Intl.Collator?(Xr=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Qr=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Qr=!1,Qr):Qr}function Jr(e){const t=Yr.UNIHANS,n=Yr.PINYINS,r=Yr.EXCEPTIONS,a={source:e};if(e in r)return a.type=2,a.target=r[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=1,a.target=e,a;if(i=Xr.compare(e,"阿"),i<0)return a.type=3,a.target=e,a;if(0===i)a.type=2,l=0;else{if(i=Xr.compare(e,"鿿"),i>0)return a.type=3,a.target=e,a;0===i&&(a.type=2,l=t.length-1)}if(a.type=2,l<0){let n=0,r=t.length-1;for(;n<=r;){l=~~((n+r)/2);const a=t[l];if(i=Xr.compare(e,a),0===i)break;i>0?n=l+1:r=l-1}}return i<0&&l--,a.target=n[l],a.target||(a.type=3,a.target=a.source),a}function ea(e){return"string"==typeof e&&Zr()?e.split("").map((e=>Jr(e))):e}const ta={isSupported:Zr,parse:ea,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Yr)})))},genToken:Jr,convertToPinyin:(e,t,n)=>ea(e).map((e=>t&&2===e.type?e.target.toLowerCase():e.target)).join(n||"")},na={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()&&na.shouldPatch(ta.genToken)&&ta.patchDict(na);const ra=ta,aa=e=>{const{value:t,bordered:n}=e;return l().createElement(R.Input,{value:t,title:t,bordered:n,readOnly:!0})};aa.displayName="FormItemView";const ia=aa;function la(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oa(){return oa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},oa.apply(null,arguments)}const{Option:sa}=R.Select,ca=e=>{const{$$form:t}=l().useContext(xn),{value:n,items:r,multiple:a,loading:i,onChange:o,onValuesChange:s}=e,{t:c}=U(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,readOnly:g,disabled:y,onClear:b}=e.option,{itemList:v=[],filterable:x=!0,listHeight:E=Or,collapseTags:w,maxTagTextLength:C,dropdownStyle:S,openPyt:N=!0}=u,T=ie(v)?r:v,I=e=>T.find((t=>t.value===e))?.text||e?.toString()||"",O=e=>a?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?l().createElement(ia,{value:O(n),bordered:h}):l().createElement(R.Select,oa({value:n,mode:a?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:p,style:m,loading:i,bordered:h,allowClear:f,disabled:y,showSearch:x,listHeight:E,maxTagCount:w?"responsive":void 0,maxTagTextLength:C},a?{title:O(n)}:null,{filterOption:(e,t)=>{const n=t?.children?.toString()||"",r=ra.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,O(e),T)})(e)},onClear:b}),T.map((e=>l().createElement(sa,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class da extends i.Component{constructor(...e){super(...e),la(this,"context",void 0),la(this,"state",{itemList:[],loading:!1}),la(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,X.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,X.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:n}=this.state,{type:r,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,buttonAfter:p,validateTrigger:h,rules:f=[],onChange:g=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:xe()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(f)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(ca,{option:this.props.option,items:t,loading:n,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),p&&l().createElement(R.Col,null,e.renderFormItemButton(o,p)),m&&l().createElement(R.Col,{flex:ce(m.labelWidth||Tr)},e.renderFormItemExtra({fieldName:o,...m}))))}}la(da,"contextType",xn);const ua=da;function ma(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pa=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=Rr,trueValue:p=Ir}=o,{t:h}=U();return l().createElement(R.Checkbox,{checked:n===p,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{r?.(e),a(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(t?p:m)}},u?i:null)};class ha extends i.Component{constructor(...e){super(...e),ma(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option,{labelToCheckbox:h}=o;return l().createElement(R.Form.Item,{label:h?" ":e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(pa,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}ma(ha,"contextType",xn);const fa=ha,ga=require("react-sortablejs"),ya=e=>{const{uniqueKey:t,items:n,fieldsChange:r}=e,{global:a}=l().useContext(o),{$$form:i}=l().useContext(xn),{$size:s}=Y(e),{t:c}=U(),d=l().useRef(null),[u,m]=l().useState(!1),p=l().useMemo((()=>t?`form_${t}`:""),[t]);l().useLayoutEffect((()=>{f()}),[]);const h=e=>{if(!p)return;const t=e.map((e=>{const t={};return(0,X.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),n=JSON.parse(localStorage.getItem(p));(0,X.isEqual)(t,n)||(localStorage.setItem(p,JSON.stringify(t)),(async(e,t)=>{const n=a?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(p,t))},f=()=>{const e=(()=>{if(!p)return;const e=JSON.parse(localStorage.getItem(p));return e||(async e=>{const t=a?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(p).then((e=>{e?(localStorage.setItem(p,JSON.stringify(e)),f()):a?.getComponentConfigApi&&h(n)})).catch((()=>{})),e?(0,X.xor)(e.map((e=>e.fieldName)),n.map((e=>e.fieldName))).length>0?n.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?((0,X.isUndefined)(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>({...n.find((t=>t.fieldName===e.fieldName)),...e}))):void 0})();e&&g(e)},g=e=>{r?.([...e])},y=Ee("form-fields-filter"),b={[y]:!0,[`${y}--lg`]:"large"===s,[`${y}--sm`]:"small"===s};return l().createElement(R.Dropdown,{open:u,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","fields-list")},l().createElement("div",{className:"reset"},l().createElement(fe,{type:"text",size:"small",onClick:()=>(e=>{const t=e.filter((e=>n.find((t=>t.fieldName===e.fieldName)))).map((e=>{const t=n.find((t=>t.fieldName===e.fieldName));return Object.assign({},t,{hidden:e.hidden})}));g(t),h(t)})(i.getOriginItems())},c("qm.table.columnFilter.reset"))),l().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));if((0,X.isEqual)(t,r))return;i.setExpandHandle(!0);const a=yr(e);g(a),h(a)}},n.map((e=>l().createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},l().createElement(R.Checkbox,{disabled:e.rules?.findIndex((e=>e.required))>-1,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,g(n),h(n)}}),l().createElement(we.HolderOutlined,{className:"handle",title:c("qm.form.draggable")}),l().createElement("span",{className:"title"},i.getFormItemLabel(e.label))))))),overlayClassName:xe()(b),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>d.current,onOpenChange:e=>{m(e)}},l().createElement("a",{ref:d,style:{padding:"5px 0"}},l().createElement(we.UnorderedListOutlined,null)))};ya.displayName="FieldsFilter";const ba=ya;function va(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xa=l().forwardRef(((e,t)=>{const{$$form:n}=l().useContext(xn),{value:r,onChange:a,onValuesChange:i}=e,{t:o}=U(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h,onFocus:f,onBlur:g,onEnter:y,onClear:b}=e.option,{prefix:v,suffix:x,password:E,maxLength:w,pattern:C,toUpper:S,toTrim:N,autoFocus:T,autoComplete:I,secretType:O}=s,k=O&&(p||h),L=l().useRef(),P=l().useRef(!1);l().useEffect((()=>{const e=()=>b?.(),t=L.current?.input.parentNode.querySelector("span[class*='clear-icon']");return m&&t&&t.addEventListener("click",e),()=>{t?.removeEventListener("click",e)}}),[]);const A=e=>{a?.(e),i(e)},F=E?R.Input.Password:R.Input,_=k?((e="",t)=>(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))(r,O):r;return n.isOnlyShow?l().createElement(ia,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(_),bordered:u}):l().createElement(F,{ref:e=>{L.current=e,"function"==typeof t&&t(e)},value:_,autoComplete:E?"new-password":I,autoFocus:T,placeholder:d,style:c,title:E?"":_,prefix:v,suffix:x,maxLength:w,bordered:u,allowClear:m,readOnly:p,disabled:h,onFocus:e=>{f?.(e.target.value,e)},onBlur:t=>{let n=t.target.value??"";if(N){const e=n.trim();n!==e&&(n=e,A(n))}(t=>{const{onBlur:n}=e;n?.(t)})(n),g?.(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;y?.(t,e),n.isFilterType&&(n.SUBMIT_FORM(),L.current?.blur())}},onCompositionStart:()=>{P.current=!0},onCompositionEnd:()=>{P.current=!1},onChange:e=>{let t=e.target.value;(0,X.isRegExp)(C)&&(t=C.test(t)?t:r??""),S&&!P.current&&(t=t.toUpperCase()),A(t)}})}));xa.displayName="VInput";class Ea extends i.Component{constructor(...e){super(...e),va(this,"context",void 0),va(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(xa,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),u&&l().createElement(R.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}va(Ea,"contextType",xn);const wa=Ea;function Ca(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sa=e=>{const{$$form:t}=l().useContext(xn),{value:n=[],onChange:r,onValuesChange:a}=e,{t:i}=U(),{options:o={},placeholder:s=i("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{prefix:p,suffix:h,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;r?.(t),a(t,y(t))},y=e=>e.join(" - ");return t.isOnlyShow?l().createElement(ia,{value:y(n),bordered:c}):l().createElement(R.Input.Group,null,l().createElement(R.Input,{value:n[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:p,suffix:h,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([t,n[1]])}}),l().createElement(R.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),l().createElement(R.Input,{value:n[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:p,suffix:h,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class Na extends i.Component{constructor(...e){super(...e),Ca(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(s),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(o)},required:e.getFormItemRequired(u)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Sa,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(a,n)}}))),c&&l().createElement(R.Col,{flex:ce(c.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...c}))))}}Ca(Na,"contextType",xn);const Ta=Na,Ia=require("big.js");var Ra=r.n(Ia);function Oa(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ka=l().forwardRef(((e,t)=>{const{$$form:n}=l().useContext(xn),{value:r,onChange:a,onValuesChange:i}=e,{t:o}=U(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:g}=e.option,{step:y=1,min:b,max:v,precision:x,autoFocus:E,stringMode:w,textAlign:C="left",controls:S=!0,formatter:N,parser:T}=s,I=l().useRef(),O=l().useRef(r),k=e=>{const t=$r(e)?"":(0,X.isNumber)(e)?e.toFixed(x):new(Ra())(e).toFixed(x);return"function"==typeof N?N(t):t},L={[C]:!0,controls:S};return n.isOnlyShow?l().createElement(ia,{value:k(r),bordered:u}):l().createElement(R.InputNumber,{ref:e=>{I.current=e,"function"==typeof t&&t(e)},value:r,className:xe()(L),placeholder:d,style:{width:"100%",...c},step:y,min:b,max:v,controls:S,precision:x,autoFocus:E,stringMode:w,formatter:N,parser:T,bordered:u,readOnly:m,disabled:p,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{re((()=>{(t=>{const{onBlur:n}=e;n?.(t)})(O.current),f?.(O.current,t)}))},onKeyUp:e=>{13===e.keyCode&&(g?.(r,e),n.isFilterType&&(n.SUBMIT_FORM(),I.current?.blur()))},onChange:e=>{const t=e??"";!w&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{O.current=e,a?.(e),i(e,k(e))})(t)}})}));ka.displayName="VInputNumber";class La extends i.Component{constructor(...e){super(...e),Oa(this,"context",void 0),Oa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(ka,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&l().createElement(R.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Oa(La,"contextType",xn);const Pa=La;function Aa(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fa=e=>{const{$$form:t}=l().useContext(xn),{value:n=[],onChange:r,onValuesChange:a}=e,{t:i}=U(),{options:o={},placeholder:s=i("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{step:p=1,min:h=0,max:f,textAlign:g="left",controls:y=!0,precision:b,formatter:v,parser:x}=o,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),w(e)},w=e=>{const t=e.every((e=>null===e))?[]:[...e];r?.(t),a(t,C(t))},C=e=>$r(e)?"":e.map((e=>$r(e)?"":Number(e).toFixed(b))),S={[g]:!0,controls:y};return t.isOnlyShow?l().createElement(ia,{value:C(n),bordered:c}):l().createElement(R.Input.Group,null,l().createElement(R.InputNumber,{value:n[0],className:xe()("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:p,min:h,max:f,controls:y,precision:b,formatter:v,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([e,n[1]])},onBlur:()=>{E(n)}}),l().createElement(R.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),l().createElement(R.InputNumber,{value:n[1],className:xe()("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:p,min:h,max:f,controls:y,precision:b,formatter:v,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([n[0],e])},onBlur:()=>{E(n)}}))};class _a extends i.Component{constructor(...e){super(...e),Aa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(s),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(o)},required:e.getFormItemRequired(u)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Fa,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(a,n)}}))),c&&l().createElement(R.Col,{flex:ce(c.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...c}))))}}Aa(_a,"contextType",xn);const qa=_a;let Da=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});const Ha=(0,i.createContext)(void 0),$a={dataIndex:Sr().string.isRequired,title:Sr().string.isRequired,description:Sr().string,colSpan:Sr().number,width:Sr().number,minWidth:Sr().number,fixed:Sr().oneOf(["left","right"]),align:Sr().oneOf(["left","center","right"]),theadAlign:Sr().oneOf(["left","center","right"]),printFixed:Sr().bool,hidden:Sr().bool,noAuth:Sr().bool,noFixed:Sr().bool,ellipsis:Sr().bool,className:Sr().string,theadClassName:Sr().string,children:Sr().array,sorter:Sr().oneOfType([Sr().bool,Sr().func]),filter:Sr().shape({type:Sr().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Sr().arrayOf(Sr().shape({text:Sr().string,value:Sr().oneOfType([Sr().string,Sr().number])})),style:Sr().object,openFilterList:Sr().bool}),precision:Sr().number,displayPrecision:Sr().number,formatType:Sr().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Sr().bool,canCopy:Sr().bool,editRender:Sr().func,dictItems:Sr().arrayOf(Sr().shape({text:Sr().string,value:Sr().oneOfType([Sr().string,Sr().number])})),summation:Sr().shape({sumBySelection:Sr().bool,displayWhenNotSelect:Sr().bool,dataKey:Sr().string,unit:Sr().string,render:Sr().func}),groupSummary:Sr().shape({dataKey:Sr().string,unit:Sr().string,render:Sr().func}),shouldCellUpdate:Sr().func,headRender:Sr().func,render:Sr().func,outputRender:Sr().func},Ma=(Sr().arrayOf(Sr().shape($a)).isRequired,Sr().func,Sr().array,Sr().oneOfType([Sr().string,Sr().func]).isRequired,Sr().number,Sr().bool,Sr().bool,Sr().shape({api:Sr().func.isRequired,params:Sr().object.isRequired,formatter:Sr().func,beforeFetch:Sr().func,afterFetch:Sr().func,stopToFirst:Sr().bool,dataKey:Sr().string,callback:Sr().func}),Sr().bool,Sr().bool,Sr().string,Sr().string,Sr().object,Sr().bool,Sr().bool,Sr().bool,Sr().oneOfType([Sr().object,Sr().func]),Sr().oneOfType([Sr().object,Sr().func]),Sr().array,Sr().func,Sr().bool,Sr().object,Sr().object,Sr().shape({type:Sr().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Sr().array,selectedRowKeys:Sr().array,hideSelectAll:Sr().bool,checkStrictly:Sr().bool,filterable:Sr().bool,selectByClickRow:Sr().bool,selectFirstRowOnChange:Sr().bool,clearableAfterFetched:Sr().bool,selectAllOnCurrentPage:Sr().bool,fetchSelectedRows:Sr().shape({api:Sr().func.isRequired,params:Sr().object,dataKey:Sr().string}),fetchAllRowKeys:Sr().shape({api:Sr().func.isRequired,params:Sr().object,dataKey:Sr().string}),disabled:Sr().func,onChange:Sr().func,onSelect:Sr().func,onSelectAll:Sr().func}),Sr().shape({currentRowKey:Sr().oneOfType([Sr().number,Sr().string]),disabled:Sr().func,onChange:Sr().func}),Sr().shape({virtual:Sr().bool,overscan:Sr().number,doubleXScrollbar:Sr().bool}),Sr().shape({expandIconColumn:Sr().string}),Sr().shape({defaultExpandAllRows:Sr().bool,defaultExpandedRowKeys:Sr().array,expandedRowKeys:Sr().array,hideExpandAll:Sr().bool,rowExpandable:Sr().func,expandedRowClassName:Sr().string,expandedRowRender:Sr().func,onExpand:Sr().func,onChange:Sr().func}),Sr().shape({cellMerge:Sr().bool,onCellMerge:Sr().func,onSelectChange:Sr().func}),Sr().shape({groupItems:Sr().arrayOf(Sr().shape({dataIndex:Sr().string.isRequired,titleIndex:Sr().string,color:Sr().string,backgroundColor:Sr().string})),fetch:Sr().shape({api:Sr().func.isRequired,params:Sr().object,dataKey:Sr().string}),onChange:Sr().func}),Sr().func,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().shape({current:Sr().number,pageSize:Sr().number,pageSizeOptions:Sr().array,showSizeChanger:Sr().bool,showQuickJumper:Sr().bool}),Sr().shape({fileName:Sr().string,fetch:Sr().shape({api:Sr().func.isRequired,params:Sr().object}),beforeExport:Sr().func,cellStyle:Sr().bool,hideIcon:Sr().bool}),Sr().shape({showLogo:Sr().bool}),Sr().shape({fetch:Sr().shape({api:Sr().func.isRequired,params:Sr().object,dataKey:Sr().string}),fieldList:Sr().arrayOf(Sr().object)}),Sr().shape({position:Sr().oneOf(["top","bottom"]),hideAlert:Sr().bool,hideClearButton:Sr().bool}),Sr().oneOf(["left","right"]),Sr().func,Sr().func,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,{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}),Ka=10,za="1",Va="0",ja="YYYY-MM-DD",Wa="YYYY-MM-DD HH:mm:ss",Ba="YYYYMMDDHHmmss",Ua={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 Ga=function(e){return e.left="flex-start",e.right="flex-end",e}({});const Ya={...i}.useId;let Xa=0;const Qa=Ya?function(e){const t=Ya();return e||t}:function(e){const[t]=i.useState(`qm_unique_${Xa}`);return i.useEffect((()=>{Xa+=1}),[]),e||t};let Za=[];const Ja={_getInstance:function(e){return Za.find((t=>t.id===e))??null},getFocusInstance:function(){return Za[0]??null},focus:function(e){const t=this._getInstance(e);t&&0!==Za.findIndex((e=>e===t))&&(this.deregister(e),Za=[t,...Za])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),Za=[{id:e,vm:t},...Za])},deregister:function(e){e&&(Za=Za.filter((t=>t.id!==e)))}};function ei(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ti=class{constructor(e){ei(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),ei(this,"getRowKey",void 0),ei(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),ei(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)})),ei(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),ei(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)})),ei(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),ei(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)})),ei(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),ei(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),ei(this,"addToUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e||this.getRowKey(t,t.index)===this.getRowKey(e,e.index)));-1===t?this.state.updated.push(e):this.state.updated.splice(t,1,e)})),ei(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),ei(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),ei(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),ei(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),this.getRowKey=e.getRowKey}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}};function ni(e){return void 0!==e}function ri(e,t){const{defaultValue:n,value:r,onChange:a,postState:l}=t||{},[o,s]=i.useState((()=>ni(r)?r:ni(n)?"function"==typeof n?n():n:"function"==typeof e?e():e)),c=ni(r)?r:o,d=l?l(c):c,u=G(a),[m,p]=i.useState([c]);return f((()=>{const e=m[0];o!==e&&u(o,e)}),[m]),f((()=>{ni(r)||s(r)}),[r]),[d,G((e=>{s(e),p([c])}))]}const ai={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",virtualScrollX:50,virtualScrollY:100,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored",popupClassName:"table-editable__popper"},ii=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=ii(t.children)),t})),li=(e,t)=>{const{fetch:n,columns:r,border:a,rowHeight:i,rowSelection:o,summation:s,expandable:c,treeConfig:d,webPagination:u,scrollPagination:m,showSuperSearch:p,showFastSearch:h,showGroupSummary:f,showTableImport:g,showClipboard:y,showSelectCollection:b,showPivotGrid:v,footRender:x}=e,{tableRef:E,getRowKey:w,$size:C,tableFullData:S,tableFlatData:N,updateMark:T,selectionKeys:I,sorter:R,filters:O,superFilters:k,pagination:L,mergedTdCells:P}=t,{selectionRows:A,summaries:F}=E.current,{expandIconColumn:_=""}=d||{},{t:q}=U(),D=(e,t,n,r,a)=>{const i=`${t},${n}`;e.has(i)||e.set(i,{row:t,col:n,rowSpan:r,colSpan:a})},H=l().useMemo((()=>!!n?.api),[n?.api]),$=l().useMemo((()=>!H&&!!u),[H,u]),M=l().useMemo((()=>H&&!!m),[H,m]),K=l().useMemo((()=>(H||$)&&!M),[H,$,M]),z=l().useMemo((()=>(e=>{const t=(e=>{const t=[],n=[],r=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?n.push(i):r.push(i)}return[...t,...r,...n]})(ii(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:ai.selectionColumn,title:"radio"===t?q("qm.table.config.selectionText"):"",width:ai.selectionColumnWidth,fixed:"left",type:t}})(o),r=(a=c,a?.expandedRowRender?{dataIndex:ai.expandableColumn,title:"",width:ai.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return n&&t.unshift(n),r&&t.unshift(r),_n(t)})(r)),[r]),V=l().useMemo((()=>Fn(z)),[z]),j=l().useMemo((()=>V.filter((e=>"function"==typeof e.editRender))),[V]),W=l().useMemo((()=>V.filter((e=>!!e.summation))),[V]),B=l().useMemo((()=>V.filter((e=>"left"===e.fixed))),[V]),G=l().useMemo((()=>V.filter((e=>"right"===e.fixed))),[V]),Y=l().useMemo((()=>i||ai.rowHeightMaps[C]),[i,C]),X=l().useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=N.findIndex((t=>w(t,t.index)===e.rowKey)),r=V.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){D(t,n,r,e.rowSpan,e.colSpan);for(let a=0;a<e.rowSpan;a++)for(let i=0;i<e.colSpan;i++)0===a&&0===i||D(t,n+a,r+i,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(P)),[P,V,S]),Q=l().useMemo((()=>{const e=V.filter((e=>![ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(e.dataIndex)));return _&&e.some((e=>e.dataIndex===_))?_:e[0]?.dataIndex??""}),[V,_]),Z=l().useMemo((()=>W.length>0),[W]),J=l().useMemo((()=>!!x||Z),[x,Z]),ee=l().useMemo((()=>Bn(z).length>1),[z]),te=l().useMemo((()=>a||ee),[a,ee]),ne=l().useMemo((()=>V.some((e=>e.sorter))),[V]),re=l().useMemo((()=>V.some((e=>e.filter))),[V]),ae=l().useMemo((()=>W.some((e=>!!e.summation.dataKey))),[W]),ie=l().useMemo((()=>!H&&!!g),[H,g]),le=l().useMemo((()=>!!y&&j.length>0),[y,j]),oe=l().useMemo((()=>!!b&&"checkbox"===o?.type),[b,o]),se=l().useMemo((()=>!!p&&re),[p,re]),ce=l().useMemo((()=>!H&&!!h),[H,h]),de=l().useMemo((()=>!H&&!!v),[H,v]),ue=l().useMemo((()=>!!f&&V.some((e=>!!e.groupSummary))),[V]),me=l().useMemo((()=>!!s?.groupItems?.length),[s]),pe=l().useMemo((()=>!N.length),[N]),he=l().useMemo((()=>(()=>{const e={};return W.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=!A.length&&!!o;let d=(!l||c?E.current.tableFullData:A).reduce(((e,t)=>{if(t?.[ai.summaryIgnore])return e;const r=Jn(t,n);return nr(r)?e.plus(r):e}),new(Ra())(0));!Object.keys(F).includes(n)||l&&!c||(d=new(Ra())(Jn(F,n))),er(e,n,d.toNumber());let u=r>=0?d.toFixed(r):d.toString();a>=0&&""!==u&&(u=ar(u,a)),u=rr(u),er(e,`${n}_text`,s?`${u} ${s}`:u)})),[e]})()),[N,T,I,F]),fe=l().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(W)),[W]),ge=l().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(R),t=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,a]=ai.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{n.push({type:["radio","tree"].includes(a)?"checkbox":a,bracketLeft:"",fieldName:r,expression:e,value:xr(e)?null:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{const t=ai.showFilterType?e.fieldType:"";n.push({type:["radio","tree"].includes(t)?"checkbox":t,bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:xr(e.expression)?null:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(O,k);return{...e?{[ai.sorterFieldName]:e}:null,...t.length?{[ai.filterFieldName]:t}:null,...fe?{[ai.groupSummary.summaryFieldName]:fe,usedJH:1}:null,...n?.params??null,[ai.currentPageName]:L.current,[ai.pageSizeName]:L.pageSize}}),[n?.params,L.current,L.pageSize,R,O,k,fe]);return{isFetch:H,isWebPagination:$,isScrollPagination:M,showPagination:K,tableColumns:z,flattenColumns:V,editableColumns:j,summationColumns:W,leftFixedColumns:B,rightFixedColumns:G,tableRowHeight:Y,derivedMergeCells:X,treeExpandIndex:Q,showSummary:Z,showFooter:J,isHeadGroup:ee,bordered:te,isHeadSorter:ne,isHeadFilter:re,isServiceSummation:ae,isSelectCollection:oe,isTableImport:ie,isTableClipboard:le,isSuperSearch:se,isFastSearch:ce,isPivotGrid:de,isGroupSummary:ue,isGroupSubtotal:me,isTableEmpty:pe,summationRows:he,fetchParams:ge}},oi=(e,t)=>{const{rowKey:n,height:r,dataSource:a,summation:i,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:m,authConfig:p,ignorePageIndex:h,columnsChange:g,onChange:y,onDataChange:b,onDataLoad:v,onScrollEnd:x,onFetchError:E}=e,{getRowKey:w,tableRef:C,tableElementRef:S,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:k,filters:L,sorter:P,superFilters:A,pagerFilter:F,fetchParams:_,selectionKeys:q,rowExpandedKeys:D,highlightKey:H,summationColumns:$,isFetch:M,isWebPagination:K,isScrollPagination:z,isServiceSummation:V,isGroupSubtotal:j,doLayout:W,setTableFullData:B,setTableOriginData:Y,setTableFlatData:Q,setTableDataMaps:Z,setPagination:J,setPingRight:ee,setPingLeft:ne,setSpinning:re,setSorter:ae,setFilters:le,setSuperFilters:se,setPagerFilter:ce,setSelectionKeys:de,setRowExpandedKeys:ue,setHighlightKey:pe,setSelectionRows:he,setScrollXLoad:fe,setScrollYLoad:ge,setFieldAuth:ye,setResizeState:be,setSummaries:ve,setPermission:xe,resetTableScroll:Ee,createTableFocus:we,clearElementStore:Ce}=t,{t:Se}=U(),{store:Ne}=C.current,Te=l().useRef({..._}),Ie=l().useRef(!1),Re=e=>Ie.current=e,Oe=xt(S);f((()=>{He(),W()}),[T]),f((()=>{ke()}),[Oe.width,Oe.height,N,r,k.tableAutoHeight]),De((()=>{ot(),st(),ct(),dt(),M||(K&&Fe(),et(a)),s&&ae(s),c&&le(c)}),[a,o?.params]),De((()=>{const e=_e(_,Te.current);var t;e||M&&d?.clearableAfterFetched&&ut(),!e&&_[ai.currentPageName]>1&&!o?.stopToFirst?Fe():M&&Ye(),t=_,Te.current=t}),[_]),De((()=>{K&&(it(),Qe()),z||Ee(),We()}),[O.current,O.pageSize]),De((()=>{M||Le(R.length),C.current.isTreeTable&&!M&&nt(),W()}),[R]),De((()=>{C.current.isTreeTable&&it()}),[D]);const ke=()=>{const{scrollBarRef:e,resizeState:t}=C.current,{width:n,height:r}=Oe;W(),k.tableBodyWidth>n&&ee(!0),e.current.scrollLeft>0&&ne(!0),be(Object.assign({},t,{width:n,height:r}))},Le=e=>{e!==O.total&&J((t=>Object.assign({},t,{total:e})))},Pe=({current:e,pageSize:t})=>{J((n=>Object.assign({},n,{current:e,pageSize:t})))},Ae=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},Fe=()=>{Pe(Object.assign({},O,{current:1}))},_e=(e,t)=>{const n=Object.keys(Zn(e,t));return 1===n.length&&(n.includes(ai.currentPageName)||n.includes(ai.pageSizeName))},qe=Et((e=>{Ze(),x?.(e)})),He=()=>{fe(I.length>ai.virtualScrollX)},$e=(e=[])=>{let t=e.length>ai.virtualScrollY;C.current.isTreeTable&&(t=!0),m?.virtual&&(t=!0),ge(t)},Me=e=>j?Ke(ze(e)):e,Ke=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ke(e.children)),delete e.children,t.push(e)})),t},ze=(e,t=0)=>{const r=i.groupItems?.[t];return r?mr(e,[r.dataIndex]).map((e=>{const a={children:ze(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&er(a,n.toString(),or()),r.titleIndex&&er(a,r.titleIndex,Jn(e[0],r.titleIndex)),er(a,r.dataIndex,Jn(e[0],r.dataIndex)),$.forEach((e=>{const{dataIndex:t}=e,n=a.children?.reduce(((e,n)=>{if(n[ai.summaryIgnore])return e;const r=Number(Jn(n,t));return Number.isNaN(r)?e:e+r}),0);er(a,t,n)})),a})):(e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e)},Ve=e=>{de(e),he((e=>{const{selectionRows:t,recordsMap:n}=C.current,r=new Map;t.forEach((e=>r.set(w(e,e.index),e)));const a=[];for(let t=0,i=e.length;t<i;t++){const i=r.get(e[t])||n.get(e[t]);i&&a.push(i)}return a})(e))},je=()=>{const{isTreeTable:e,tableFullData:t,recordsMap:n}=C.current;return e?jn(t,(e=>e._rowKey)):Array.from(n.keys())},We=Et((()=>{y?.(O,Ue(L),Be(P),A,{currentDataSource:at()})})),Be=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},Ue=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,a]=n.split("|");t[ai.showFilterType?`${r}|${a}`:r]=e[n]}return t},Ge=G((async()=>{if(!o)return;const{formatter:e=e=>e,beforeFetch:t=te,afterFetch:n,callback:r}=o;if(!t(_))return;const a=!!i?.fetch?.api;re(!0);try{const[t,l]=a?await Promise.all([o.api(e(_)),i.fetch.api(e(_))]):[await o.api(e(_))];if(C.current.unMounted)return;if(a?200===t.code&&200===l.code:200===t.code){const e=o.dataKey??ai.dataKey;let a=(0,X.get)(t.data,e)??[];a="function"==typeof n?await n(a):a;const i=(0,X.get)(t.data,e.replace(/[^.]+$/,ai.totalKey))||a.length||0,s=Math.max(Math.ceil(i/O.pageSize),1);if(_[ai.currentPageName]>s)return Pe({...O,current:s});et(Ie.current?C.current.tableFullData.concat(a):a),Le(i),Xe(l?.data||t.data),r?.(t.data,t)}}catch(e){E?.(e)}var l;l=o,Object.prototype.hasOwnProperty.call(l,"stopToFirst")&&(o.stopToFirst=!1),re(!1),Re(!1)})),Ye=Et(Ge),Xe=e=>{if(!V)return;const t=i?.fetch?.dataKey??ai.summationKey,n=(t?(0,X.get)(e,t):e)??{},r={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{er(r,e.dataIndex,Number(Jn(n,e.summation.dataKey)))})),ve(r)},Qe=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=at();if(e.length){const t=w(e[0],e[0].index);Ve([t])}else Ve([])}},Ze=()=>{if(!z)return;const e=Ae();Ie.current||O.current>=e||(Re(!0),Pe({...O,current:O.current+1}))},Je=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Je(e.children)),e.index=t,h||(e.pageIndex=(e=>{const{current:t,pageSize:n}=O;return!M||z?e:(t-1)*n+e})(t)),e))),et=e=>{const t=tt(e,(e=>wr(e,F,C.current.isOriginTree)));Ve((e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:q;let a=[];return C.current.isTreeTable&&!n&&r.forEach((e=>{a.push(...((e,t)=>{const{disabled:n}=d||{},{tableFullData:r,recordsMap:a}=C.current,i=hr(r,(t=>t._rowKey===e));let l=[];if(!i)return l;let o=Wn(i?.children||[],(e=>e._rowKey));return n&&(o=o.filter((e=>!a.has(e)||!n(a.get(e))))),l=[...new Set([...t,...o])],(fr(r,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=hr(r,(t=>t._rowKey===e)),n=t?.children?.every((e=>l.includes(e._rowKey)));l=n?[...l,e]:l.filter((t=>t!==e))})),l})(e,r))})),a="radio"===t?r.slice(0,1):[...new Set([...r,...a])],a})()),ue((e=>{const{isTreeTable:t,tableFullData:n,recordsMap:r}=C.current,{defaultExpandAllRows:a,rowExpandable:i,expandedRowRender:l}=u||{};let o=Array.isArray(e)?e:[...D];if(a)o=je();else if(t){l&&me("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...q];H&&e.unshift(H),e.forEach((e=>{const t=fr(n,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=[...new Set(o)]}return i&&o.filter((e=>{const t=r.get(e);return!!t&&i(t)})),o})()),Qe(),v?.(t)},tt=(e,t)=>{const n=Je(e);return Y(n),lt(t?.(n)||n),n},nt=()=>{const{updated:e}=Ne.state;e.length&&function t(n){n.forEach((n=>{n.children&&t(n.children);const r=e.find((e=>e._rowKey===w(n,n.index)));r&&Object.assign(n,oe(r,["children"]))}))}(C.current.tableOriginData)},rt=()=>{const{current:e,pageSize:t}=O;return C.current.tableFullData.slice((e-1)*t,e*t)},at=()=>K?rt():C.current.tableFullData,it=()=>{const{recordsMap:e,isTreeTable:t}=C.current;let n=K?Vn(rt()):Array.from(e.values());n=t?(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=w(e,e.index);if(!e._parentRowKey)return n.push(e),t.set(r,!0);D.includes(e._parentRowKey)&&t.get(e._parentRowKey)&&(n.push(e),t.set(r,!0))})),t.clear(),n})(n):Me(n),$e(n),Q(n)},lt=e=>{B(e),Z(e),it()},ot=()=>{ae({})},st=()=>{le({})},ct=()=>{se([])},dt=()=>{ce({})},ut=()=>{Ve([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=oe(p,["fetch"]);if(p.fetch){const{api:e,params:n,dataKey:r}=p.fetch;try{const a=await e(n);200===a.code&&(t=(r?(0,X.get)(a.data,r):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:n=1,isPrint:r=1}=t;xe((t=>Object.assign({},t,{export:!!e,import:!!n,print:!!r})))}if(Array.isArray(t.fieldList)){const n=Hn(e.columns,(e=>{const{dataIndex:n}=e,r=t.fieldList.find((e=>e.dataIndex===n));if(r){const{visible:t=1,disabled:a,secretName:i}=r,l=$n(C.current.originColumns,n);ye(n,{visible:t,disabled:a,secretName:i}),t||(e.noAuth=!0,l.noAuth=!0),i&&(e.formatType=`secret-${i}`,l.formatType=`secret-${i}`)}}));g?.(n)}})(),we(),He(),$e(),M?Ge():et(a)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&me("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:lt,createWebPageData:rt,getTableData:Ge,createTableData:tt,createGroupData:Me,createAllExpandedKeys:je,setSelectionKeysEffect:Ve,doFieldValidate:(e,t,n,r,a)=>{if(!Array.isArray(e))return me("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ne.removeFromRequired({x:n,y:r}),Ne.removeFromValidate({x:n,y:r}),e.forEach((e=>{e.required&&ie(t)&&Ne.addToRequired({x:n,y:r,text:e.message||a+Se("qm.form.requiredTips")}),"function"!=typeof e.validator||e.validator?.(t)||Ne.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:a}=Ne.state,i=(0,X.intersection)(n,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:n.filter((e=>!i.includes(e))),updated:r.filter((e=>![...(0,X.intersection)(r,n),...(0,X.intersection)(r,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{b?.(C.current.tableFullData)},tableChange:We,toLastPage:()=>{const e=Ae();O.current!==e&&Pe(Object.assign({},O,{current:e}))},toFirstPage:Fe,getPageCount:Ae,pagerChangeHandle:Pe,scrollBottomDebouncer:qe,clearTableSorter:ot,clearTableFilter:st,clearSuperFilters:ct,clearPagerFilter:dt,clearRowSelection:ut,clearRowHighlight:()=>{pe("")},clearTableLog:()=>{Ne.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;Ce(),Ne.destroy(),e.deregister(t)}}};function si({handler:e,delay:t=0}){const n=Xt(e,t),r=G(t>0?n:e);i.useEffect((()=>(window.addEventListener("resize",r),()=>window.removeEventListener("resize",r))),[r])}const ci=e=>{const{total:t}=e,{tableRef:n,prefixCls:r,selectionKeys:a,isHeadSorter:i,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearPagerFilter:u,clearRowSelection:m,clearRowHighlight:p,setActivedCell:h}=l().useContext(Ha),{infoBarConfig:f,rowSelection:g,rowHighlight:y}=n.current.props,{isTreeTable:b,recordsMap:v,invalidRowKeys:x}=n.current,{hideAlert:E,hideClearButton:w}=f||{},{t:C}=U(),[S,N]=l().useState(a.length-x.length);l().useEffect((()=>{re((()=>N(a.length-x.length)))}),[a,x]);const T=l().useMemo((()=>!E),[E]),I=l().useMemo((()=>!w&&!!(i||o||g||y)),[w,i,o,g,y]),R={[`${r}__alert`]:!0};return T?l().createElement("div",{className:xe()(R)},l().createElement("i",{className:"svgicon icon"},l().createElement(we.InfoCircleFilled,null)),l().createElement("span",null,C("qm.table.alert.total",{total:b?v.size:t}),g?`,${C("qm.table.alert.selected",{total:Math.max(S,0)})}`:""),I&&l().createElement("em",{onClick:()=>{c(),d(),u(),m(),p(),re((()=>s())),h({})}},C("qm.table.alert.clear"))):null},di=l().forwardRef(((e,t)=>{const{isFullScreen:n,open:r=!0}=e,{prefixCls:a,setFullScreen:i}=l().useContext(Ha),{t:o}=U(),s=()=>{i(!n)};return l().useImperativeHandle(t,(()=>({clickHandle:s}))),r?l().createElement("span",{className:`${a}-full-screen`,title:o(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},n?l().createElement(we.FullscreenExitOutlined,null):l().createElement(we.FullscreenOutlined,null))):null}));di.displayName="FullScreen";const ui=di,mi=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,getTableData:a}=l().useContext(Ha),{t:i}=U(),o=()=>{a()};return l().useImperativeHandle(t,(()=>({clickHandle:o}))),n?l().createElement("span",{className:`${r}-reload`,title:i("qm.table.refresh.text"),onClick:()=>o()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.ReloadOutlined,null))):null}));mi.displayName="Reload";const pi=mi,hi=()=>{const e={dateFormat:e=>{const t=e?c()(e).format(ja):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?c()(e).format(Wa):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?c()(e).format(Wa.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>nr(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>rr(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")},t=(t,n,r)=>{const{dictItems:a,precision:i,displayPrecision:l,formatType:o,editRender:s}=n,c=a||s?.(r,n)?.items||[];let d=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(d=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),i>=0&&""!==d&&(d=nr(d)?new(Ra())(d).toFixed(i):d),l>=0&&""!==d&&(d=ar(d,l)),o){const t=e[`${ae(o)}Format`];t?d=t(d):me("Table","字段的格式化类型 `formatType` 配置不正确")}return d},n=e=>sr(e).join("");return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,a,i)=>{const l=Jn(e,r.dataIndex),o=r.render?r.render(l,e,r,a,i):t(l,r,e);return n(o)}}},fi=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{global:a}=l().useContext(o),{tableRef:i,prefixCls:s,flattenColumns:c,summationRows:d,showSummary:u,createGroupData:m,getSpan:p}=l().useContext(Ha),{tablePrint:h,showHeader:f}=i.current.props,{t:g}=U(),{getTitleFromCellValue:y}=hi(),b=a?.print?.leftLogo??"",v=a?.print?.rightLogo??"",x=!(!b&&!v),E=l().useMemo((()=>se(zn(n,[ai.expandableColumn,ai.selectionColumn,ai.operationColumn]))),[n]),w=l().useMemo((()=>se(zn(c,[ai.expandableColumn,ai.selectionColumn,ai.operationColumn]))),[c]),C=l().useMemo((()=>se(n.filter((e=>e.printFixed)))),[n]),S=e=>{const t=Object.assign({},pr(E,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?S(t):t},N=(e,t)=>(0,X.map)((0,X.groupBy)((0,X.flatten)(e),t),(0,X.spread)(((...e)=>(0,X.mergeWith)(...e,((e,n)=>{if(Array.isArray(e))return N(e.concat(n),t)}))))),T=()=>{const e=(e=>{const t=[];let n=[],r=0,a=0;for(;a<e.length;){const i=e[a],l=c.find((e=>e.dataIndex===i.dataIndex));i.width=l.width||l.renderWidth||ai.defaultColumnWidth,r+=i.width||i.renderWidth,r<=ai.printWidth?(n.push(i),a===e.length-1&&t.push(n),a++):a>0?(e.splice(0,a),C.length&&e.unshift(...C),t.push(n),n=[],r=0,a=0):(i.width=ai.printWidth,n.push(i),t.push(n),a++)}return t})([...w]),t=(e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(S(e))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const n=e.filter((e=>e.dataIndex===t));return n.length<=1?n[0]:N(n,"dataIndex")[0]})))(n),t.push(Bn(n))})),t})(e);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("");const{isTreeTable:r,tableFullData:a}=i.current;for(let i=0;i<e.length;i++)n+=I(t[i],e[i],r?a:m(a)),n+='<div class="page-break"></div>';return n+"</body></html>"},I=(e,t,n)=>{const{showLogo:r=!0}=h;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,f&&(a+=["<thead>",r&&x?`<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">',v?`<img src="${v}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${cr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(a+=`<tbody>${Vn(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:a,colSpan:i}=p(e,t,e.index,r,n);if(!a||!i)return null;const{dataIndex:l,outputRender:o}=t;return`<td rowspan="${a}" colspan="${i}">${0===r&&e._level?`<span style="padding-left:${e._level*ai.treeTable.textIndent}px"></span>`:""}${o?o(Jn(e,l),e,t,e.index,r):y(e,t,e.index,r)}</td>`})).join("")}</tr>`)).join("")}</tbody>`),u&&d.length&&(a+=["<tfoot>",d.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(n):Jn(e,`${a}_text`);return`<td>${0===r&&""===l?g("qm.table.config.summaryText"):Z(l)?sr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},R=()=>{((e,t)=>{const{filename:n,type:r,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!a)return Promise.resolve({type:r,content:t,blob:e});qt(e,i)}})(0,T())?.then((({content:e,blob:t})=>{let n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),i.current.isIE?(n.contentDocument.write(e),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(t))}))};return l().useImperativeHandle(t,(()=>({clickHandle:R}))),r?l().createElement("span",{className:`${s}-print`,title:g("qm.table.print.text"),onClick:()=>R()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.PrinterOutlined,null))):null}));fi.displayName="TablePrint";const gi=fi,yi=require("exceljs");var bi=r.n(yi);const vi="606060",xi="thin",Ei="d4d4d4",wi=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Ci=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Si=()=>({top:{style:xi,color:{argb:Ei}},left:{style:xi,color:{argb:Ei}},bottom:{style:xi,color:{argb:Ei}},right:{style:xi,color:{argb:Ei}}}),Ni=e=>{const{children:t}=e;return t&&t.length?Ni(t[0]):e},Ti=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},Ii=()=>{const{tableRef:e,tableRowHeight:t,getSpan:n,showSummary:r,isHeadGroup:a}=l().useContext(Ha),{spanMethod:i,showHeader:o}=e.current.props,{t:s}=U(),c=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(e,l,c,d)=>{const{columns:u,footSummation:m}=e,p=Fn(u),h=Bn(u),f=[],g=[],y=[],b=[];let v=0;const x={};p.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;x[t]=cr(e.title),y.push({key:t,width:(n||r||ai.defaultColumnWidth)/8})})),o&&(a?h.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:a}=e,i=Ni(e),l=p.findIndex((({dataIndex:e})=>e===i.dataIndex));n[i.dataIndex]=cr(e.title),0!==r&&(r>1||a>1)&&b.push({s:{r:t,c:l},e:{r:t+a-1,c:l+r-1}})})),f.push(n)})):(p.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&b.push({s:{r:v,c:t},e:{r:v+r-1,c:t+n-1}})})),f.push(x)),v+=f.length);const E=Vn(l).map(((e,t)=>{const r={};return p.forEach(((a,o)=>{if("function"==typeof i){const{rowSpan:r,colSpan:i}=n(e,a,t,o,l);(i>1||r>1)&&b.push({s:{r:t+v,c:o},e:{r:t+v+r-1,c:o+i-1}})}const s=["percent","finance"].includes(a.formatType);r[a.dataIndex]=s?Jn(e,a.dataIndex):d(e,t,a,o)})),r._level=e._level,r}));v+=E.length,r&&m&&c(p,l).forEach(((e,t)=>{const n={};p.forEach(((t,r)=>{const{dataIndex:a,summation:i}=t,o=i?.render?i.render(l):Jn(e,a);n[a]=0===r&&""===o?s("qm.table.config.summaryText"):Z(o)?sr(o).join(""):o})),g.push(n)}));const{sheetName:w,useStyle:C}=e,S=new(bi().Workbook),N=S.addWorksheet(w);N.columns=y,o&&N.addRows(f).forEach((e=>{C&&wi(e,t),e.eachCell((e=>{const t=N.getColumn(e.col),n=$n(u,t.key),{align:r,theadAlign:a}=n;Ci(e,a||r),C&&Object.assign(e,{font:{bold:!0,color:{argb:vi}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Si()})}))})),N.addRows(E).forEach(((e,n)=>{const{_level:r}=E[n];C&&wi(e,t),e.eachCell((e=>{const t=N.getColumn(e.col),n=$n(u,t.key),{align:a}=n;Ci(e,a),Object.assign(e,Ti(n)),C&&Object.assign(e,{font:{color:{argb:vi}},border:Si()}),1===Number(e.col)&&r&&(e.alignment={...e.alignment,indent:r})}))})),r&&m&&N.addRows(g).forEach((e=>{C&&wi(e,t),e.eachCell((e=>{const t=N.getColumn(e.col),n=$n(u,t.key),{align:r}=n;Ci(e,r),Object.assign(e,Ti(n)),C&&Object.assign(e,{font:{color:{argb:vi}},border:Si()})}))})),b.forEach((({s:e,e:t})=>{N.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const T=await S.xlsx.writeBuffer();return new Blob([T],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const n=(e=>{const t=document.createElement("div");t.innerHTML=e.trim();const n=t.querySelector("table");if(!n)throw new Error("Invalid table HTML input.");return n})(t),r="\ufeff"+(e=>Array.from(e.rows).map((e=>Array.from(e.cells).map((e=>((e,t)=>{const n=e.replace(/"/g,'""');return"string"===t?`"=""${n}"""`:"number"===t?n:n.includes(",")||n.includes("\r")||n.includes("\n")?`"${n}"`:n})(e.textContent?.trim()??"",e.getAttribute("data-type")))).join(","))).join("\r\n"))(n);return new Blob([r],{type:"text/csv;charset=utf-8"})},importXLSX:(e,t)=>{const{columns:n,file:r}=e,a=Fn(n),i=new FileReader;i.onerror=()=>{R.message.error(s("qm.table.import.error"))},i.onload=e=>{const n=a.map((e=>cr(e.title))),r=new(bi().Workbook),i=e.target;i?r.xlsx.load(i.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],o=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,l);if(o){const r=e.slice(i+1).map((e=>{const t={};e.forEach(((e,n)=>{let r=e;Array.isArray(r?.richText)&&(r=r.richText.map((e=>e.text)).join("")),(0,X.isPlainObject)(r)&&"text"in r&&(r=r.text),(0,X.isDate)(r)&&(r=lr(r,Wa)),r?.formula&&(r=r.result??r.value),t[l[n]]=r}));const r={};return n.forEach(((e,n)=>{const{dataIndex:i,dictItems:l}=a[n];Array.isArray(l)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>c(l,e))).filter((e=>""!==e)):t[e]=c(l,t[e])),er(r,i,t[e])})),r}));t?.(r)}else R.message.error(s("qm.table.import.error"))}else R.message.error(s("qm.table.import.error"))})):R.message.error(s("qm.table.import.error"))},i.readAsArrayBuffer(r)}}},Ri=e=>{const{fileType:t,onChange:n}=e,{prefixCls:r}=l().useContext(Ha),{t:a}=U();let i,o;const s=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}};return l().createElement(fe,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return i||(i=document.createElement("form"),o=document.createElement("input"),i.className=`${r}--file-form`,o.name="file",o.type="file",i.appendChild(o),document.body.appendChild(i)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=l=>{const{files:c}=l.target,d=c[0];let u="";if(!r)for(let e=0;e<c.length;e++){const{type:n}=s(c[e]);if(t.type!==n){u=n;break}}u?(R.message.warning(a("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(i),i=null,o=null},i.reset(),o.click()}))})({type:t});n?.(e.name,e)}catch(e){}})()},a("qm.upload.text"))},Oi=e=>{const{columns:t,onClose:n}=e,{tableRef:r,prefixCls:a,createTableData:i,dataChange:o}=l().useContext(Ha),{beforeTableImport:s}=r.current.props,{t:c}=U(),{importXLSX:d}=Ii(),u=l().useRef(null),[m,p]=l().useState(!1),[h,f]=l().useState(!0),g=e=>e.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(e.dataIndex))),y={posIndex:"条"},[b,v]=l().useState([{type:"INPUT",label:c("qm.table.export.fileName"),fieldName:"fileName",render:(e,t)=>{const{fileName:n}=t.GET_FIELDS_VALUE(["fileName"]);return l().createElement(l().Fragment,null,n?l().createElement("span",null,n):l().createElement(Ri,{fileType:t.state.formData.fileType,onChange:(e,n)=>{t.SET_FIELDS_VALUE({fileName:e,file:n}),n&&f(!1)}}))}},{type:"SELECT",label:c("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:c("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:c("qm.table.import.fillText"),value:"fill"},{text:c("qm.table.import.addText"),value:"add"},{text:c("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{b.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,"insert"===e&&u.current.SET_FIELDS_EXTRA(y),v([...b])}},{type:"INPUT_NUMBER",label:c("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:0,max:r.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]);return l().createElement("div",{className:`${a}-import__setting`},l().createElement(Nm,{ref:u,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:y,items:b,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:m,disabled:h,onClick:()=>(async()=>{const[e,a]=await u.current.GET_FORM_DATA();e||(p(!0),d({columns:g(t),file:a.file},(async e=>{const{tableFullData:t,store:l}=r.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=await s(e)}catch(e){}if("fill"===a.importType&&i(e),"add"===a.importType&&i([...t,...e]),"insert"===a.importType){const n=a.posIndex,r=t.slice(0,n).concat(e).concat(t.slice(n));i(r)}e.forEach((e=>{l.addToInserted(e)})),o(),R.message.success(c("qm.table.import.success",{total:e.length})),p(!1),n()})))})()},c("qm.table.import.text"))))},ki=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{prefixCls:a}=l().useContext(Ha),{t:i}=U(),[o,s]=l().useState(!1),c=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:c})));const d={[`${a}-import`]:!0},u={visible:o,title:i("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:xe()(d),title:i("qm.table.import.textNoSpace"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.ImportOutlined,null))),l().createElement(yn,u,l().createElement(Oi,{columns:n,onClose:()=>s(!1)})))}));ki.displayName="TableImport";const Li=ki,Pi=require("rc-trigger");var Ai=r.n(Pi);const Fi=e=>{const{columns:t,onChange:n}=e,{prefixCls:r,$size:a}=l().useContext(Ha),{t:i}=U(),o=l().useRef([]),[s,c]=l().useState(!1),[d,u]=l().useState(t);De((()=>{p()}),[d]),l().useEffect((()=>{m()}),[t]);const m=()=>{const e=[];t.forEach(((n,r)=>{const a=n.colSpan;a>1&&t.slice(r+1,r+a).every((({colSpan:e})=>0===e))&&e.push(t.slice(r,r+a))})),o.current=e},p=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const a=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===a)return e.push(t);e.push(...o.current[a].map((({dataIndex:e},n)=>{const r=d.find((t=>t.dataIndex===e));return n>0&&void 0!==t.hidden&&(r.hidden=t.hidden),r})))})),n?.(e)},h={[`${r}__popper`]:!0,"column-filter__popper":!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a},f=[`${r}-column-filter`,{selected:s}];return l().createElement(Ai(),{action:["click"],popupVisible:s,popup:l().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"main"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:d,setList:e=>{const t=e.map((e=>e.dataIndex)),n=d.map((e=>e.dataIndex));(0,X.isEqual)(t,n)||u(yr(e))}},d.map((e=>(e=>{const{colSpan:t}=e;if(0===t)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const n=["svgicon","handle","main-handle"];return l().createElement("li",{key:e.dataIndex,className:"item"},l().createElement(R.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,u([...d])}}),l().createElement("i",{className:xe()(n),title:i("qm.table.columnFilter.draggable")},l().createElement(we.HolderOutlined,null)),l().createElement("span",{className:"text"},cr(e.title)))})(e)))))),popupClassName:xe()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Ua,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:xe()(f),title:i("qm.table.columnFilter.text")},l().createElement("i",{className:"svgicon icon"},l().createElement(we.SettingOutlined,null)),l().createElement("span",null,i("qm.table.columnFilter.text"))))},_i=e=>{const{defaultValue:t,onClose:n,onOk:r}=e,{tableRef:a,prefixCls:i,selectionKeys:o,pagination:s,showSummary:d}=l().useContext(Ha),{rowSelection:u}=a.current.props,{t:m}=U(),p=l().useRef(null),[h,f]=l().useState(!1),g=l().useMemo((()=>Object.assign({},{fileName:`${c()().format(Ba)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:d?1:0,useStyle:0},t,{columns:se(t.columns||[])})),[]),[y,b]=l().useState([{type:"INPUT",label:m("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:m("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:m("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:m("qm.table.export.all"),value:"all"},{text:m("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==u?.type},{text:m("qm.table.export.custom"),value:"custom"}]},onChange:e=>{y.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...y])}},options:{min:1},disabled:!0},{type:"INPUT",label:m("qm.table.columnFilter.text"),fieldName:"columns",render:(e,t)=>l().createElement(Fi,{columns:t.state.formData.columns,onChange:e=>{t.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:m("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!d,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:m("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return l().createElement("div",{className:`${i}-export__setting`},l().createElement(Nm,{ref:p,initialValues:g,items:y,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>n(),style:{marginRight:8}},m("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:h,onClick:()=>(async()=>{const[e,t]=await p.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);r(t),await ne(1e3),f(!1),n()}})()},m("qm.table.export.text"))))},qi=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{global:a}=l().useContext(o),{tableRef:i,prefixCls:s,flattenColumns:d,pagination:u,fetchParams:m,isFetch:p,showSummary:h,getSpan:f}=l().useContext(Ha),{exportExcel:g,fetch:y,showHeader:b}=i.current.props,{t:v}=U(),{getTitleFromCellValue:x}=hi(),[E,w]=l().useState(!1),[C,S]=l().useState(!1),N=l().useMemo((()=>!!g?.fetch?.api),[g]),T=l().useMemo((()=>!u.total||C),[u.total,C]),I=l().useMemo((()=>zn(n,[ai.expandableColumn,ai.selectionColumn,ai.operationColumn])),[n]),O=l().useMemo((()=>zn(d,[ai.expandableColumn,ai.selectionColumn,ai.operationColumn])),[d]),k=(e,t="",n=0)=>e.map(((e,r)=>{const a={...e,index:r,pageIndex:r},i=t?`${t}.${a.index+1}`:`${a.index+1}`;return a.indexPath=i,a._level=n,Array.isArray(e.children)&&(a.children=k(e.children,i,n+1)),O.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&er(a,t,Jn(a,t))})),a})),L=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,a=t.reduce(((e,t)=>{if(t?.[ai.summaryIgnore])return e;const n=Number(Jn(t,r));return Number.isNaN(n)?e:e+n}),0);er(n,r,a)})),[n]},P=(e,t,n,r)=>{const{dataIndex:a,precision:i,formatType:l,outputRender:o}=n;if(o)return o(Jn(e,a),e,n,t,r);let s=x(e,n,t,r);return i>=0&&!l&&""!==s&&(s=Number(s)),s},{exportXLSX:A,exportCSV:F}=Ii(),_=async e=>{const{api:t,formatter:n=e=>e,afterFetch:r,dataKey:a}=y;let i=[];try{S(!0);const l={[ai.currentPageName]:1,[ai.pageSizeName]:e??u.total},o=await t({...n({...m,...l}),...l});if(200===o.code){let e=Array.isArray(o.data)?o.data:(0,X.get)(o.data,a)??[];e="function"==typeof r?await r(e):e,i=k(e)}}catch(e){}return S(!1),i},q=e=>{const t=a?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},D=(e,t)=>{const n={text:"string",textarea:"string",number:"number",date:"date"};return t&&n[t]?n[t]:typeof e},H=g?.fileName??`${c()().format(Ba)}.xlsx`,$=H.slice(H.lastIndexOf(".")+1).toLowerCase(),M=()=>{if(T)return R.message.warning(v("qm.table.export.warnText"));N?(async e=>{S(!0);try{const{api:t,params:n}=g.fetch,r=await t({columns:O.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:a}=e.filter||{};return{title:t,dataIndex:n,type:a,hidden:r}})),...m,...n,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[ai.currentPageName]:void 0,[ai.pageSizeName]:void 0});r.data&&(qt(r.data,e),q(e))}catch(e){}S(!1)})(H):w(!0)};l().useImperativeHandle(t,(()=>({clickHandle:M})));const K={[`${s}-export`]:!0},z={visible:E,title:v("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>w(!1)},V={fileName:H.slice(0,H.lastIndexOf(".")),fileType:$,columns:I,useStyle:g?.cellStyle?1:0};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:xe()(K),title:v("qm.table.export.textNoSpace"),onClick:()=>M()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.DownloadOutlined,null))),l().createElement(yn,z,l().createElement(_i,{defaultValue:V,onClose:()=>w(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:n,exportType:r,startIndex:a=1,endIndex:l}=e,{tableFullData:o,selectionRows:s}=i.current;let c=[];if(p?("all"===r&&(c=await _()),"custom"===r&&(c=await _(l),c=c.slice(a-1))):("all"===r&&(c=o.slice(0)),"custom"===r&&(c=o.slice(a-1,l||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof g?.beforeExport)try{c=g?.beforeExport(c)}catch(e){}if("xlsx"===n){const n=await A(e,c,L,P);qt(n,`${t}.xlsx`),q(`${t}.xlsx`)}if("csv"===n){const n=F(e,((e,t)=>{const{columns:n,footSummation:r}=e,a=Fn(n);let i='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${a.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,b&&(i+=["<thead>","<tr>",a.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${cr(e.title)}</th>`})).join(""),"</tr>","</thead>"].join("")),t.length&&(i+=`<tbody>${Vn(t).map((e=>`<tr>${a.map(((n,r)=>{const{rowSpan:a,colSpan:i}=f(e,n,e.index,r,t);if(!a||!i)return null;const l=P(e,e.index,n,r);return`<td rowspan="${a}" colspan="${i}" data-type="${D(l,n.filter?.type)}">${l}</td>`})).join("")}</tr>`)).join("")}</tbody>`),h&&r&&(i+=["<tfoot>",L(a,t).map((e=>`<tr>${a.map(((n,r)=>{const{dataIndex:a,summation:i}=n,l=i?.render?i.render(t):Jn(e,a);return`<td>${0===r&&""===l?v("qm.table.config.summaryText"):Z(l)?sr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i})(e,c));qt(n,`${t}.csv`),q(`${t}.csv`)}})(Object.assign({},e,{columns:_n(e.columns)}))}})))}));qi.displayName="TableExport";const Di=qi,Hi=e=>{const{columns:t,onClose:n}=e,{tableRef:r,tableBodyRef:a,prefixCls:i,dataChange:o}=l().useContext(Ha),{beforeClipboard:s}=r.current.props,{t:c}=U(),d=l().useRef(null),[u,m]=l().useState([{type:"INPUT_NUMBER",label:c("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:c("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:t.map(((e,t)=>({value:t,text:cr(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:c("qm.table.clipboard.content"),fieldName:"content",placeholder:c("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[p,h]=l().useState(!1);return l().createElement("div",{className:`${i}-clipboard__setting`},l().createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),l().createElement(Nm,{ref:d,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:u,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,i]=await d.current.GET_FORM_DATA();if(e)return;const{tableFullData:l,store:u,fieldAuth:m}=r.current;h(!0);const p=i.content.trim().replace(/(\r|\n)$/,"");let f=p.replace(/"[^"]+"/g,"^");(p.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{f=f.replace(/\^/,e)}));let g=f.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{g=await s(g,g[0].map(((e,n)=>t[i.colIndex+n].dataIndex)))}catch(e){}g.forEach(((e,n)=>{e.forEach(((e,r)=>{const a=l[i.rowIndex-1+n],o=t[i.colIndex+r];if(a&&o){let t=!1;if(o.editRender){const e=o.editRender(a,o);t=!(e.disabled||e.extra?.disabled||m[o.dataIndex]?.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&(er(a,o.dataIndex,e),u.addToUpdated(a))}}))})),a.current.forceUpdate(),o(),R.message.success(c("qm.table.clipboard.success",{total:g.length})),h(!1),n()})()},c("qm.table.clipboard.text"))))},$i=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,flattenColumns:a}=l().useContext(Ha),{t:i}=U(),[o,s]=l().useState(!1),c=l().useMemo((()=>(e=>e.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(e.dataIndex))))(a)),[a]),d=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:d})));const u={[`${r}-clipboard`]:!0},m={visible:o,title:i("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:xe()(u),title:i("qm.table.clipboard.textNoSpace"),onClick:()=>d()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.CopyOutlined,null))),l().createElement(yn,m,l().createElement(Hi,{columns:c,onClose:()=>s(!1)})))}));$i.displayName="TableClipboard";const Mi=$i,Ki=e=>{const{columns:t,onClose:n}=e,{tableRef:r,$size:a,selectionKeys:i,setSelectionKeysEffect:o}=l().useContext(Ha),{rowKey:s,rowSelection:c}=r.current.props,{t:d}=U(),u=l().useRef(null),m=xt(u),p=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=p(e.children)),t})),[h,g]=l().useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(t.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(e.dataIndex))))]),[y]=l().useState((()=>{const{disabled:e}=c||{},t=r.current.selectionRows.map((e=>({...e,children:void 0})));return e?t.filter((t=>!e(t))):t})()),[b,v]=l().useState(300),x=Et((()=>{const e=u.current;v(e.offsetHeight-2*Da[a]-30)}),5);return f((()=>{x()}),[m.width]),l().createElement("div",{ref:u,style:{height:"100%"}},l().createElement(Tc,{size:a,columns:h,dataSource:y,rowKey:s,height:b,rowSelection:{type:"checkbox",selectedRowKeys:i,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>g(e)}),l().createElement("div",{style:{height:10}}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>n()},d("qm.table.selectCollection.closeButton"))))},zi=l().forwardRef(((e,t)=>{const{columns:n,open:r=!0}=e,{tableRef:a,getRowKey:i,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=l().useContext(Ha),{rowSelection:p}=a.current.props,{t:h}=U(),[f,g]=l().useState(!1),y=l().useRef(!1);De((()=>{!y.current&&b()}),[d]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=e=>!1}=p;if(c&&e)try{const n=await e.api(Object.assign({},{selectedKeys:s},e.params));if(200===n.code){let r=Array.isArray(n.data)?n.data:(0,X.get)(n.data,e.dataKey)??[];r=r.filter((e=>!t(e))),u(r.map(((e,t)=>i(e,t)))),m(r),y.current=!0}}catch(e){}},v=()=>{g(!0)};l().useImperativeHandle(t,(()=>({clickHandle:v})));const x={visible:f,title:h("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>g(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${o}-select-collection`,title:h("qm.table.selectCollection.text"),onClick:()=>v()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.CheckSquareOutlined,null))),l().createElement(yn,x,l().createElement(Ki,{columns:n,onClose:()=>g(!1)})))}));zi.displayName="SelectCollection";const Vi=zi,ji=require("localforage");var Wi=r.n(ji);const Bi=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,getRowKey:a,prefixCls:i,$size:s,tableFlatData:c,flattenColumns:d,setActivedCell:u,scrollXToColumn:m,scrollYToRecord:p}=l().useContext(Ha),{uniqueKey:h}=r.current.props,{t:f}=U(),{getTitleFromCellValue:g}=hi(),y=l().useRef(""),[b,v]=l().useState(""),[x,E]=l().useState([]),[w,C]=l().useState(0),[S,N]=l().useState(!1),[T,I]=l().useState({case:0,fullchar:0}),O=l().useMemo((()=>`${x.length>0?w+1:w}/${x.length}`),[w,x]);De((()=>{F(x[w])}),[w,x]);const k=e=>{I(Object.assign({},T,e))},L=(e,t,n)=>new Promise(((r,a)=>{R.Modal.confirm({title:f("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),P=G((async e=>{if(!b)return y.current=b,A();const t=((e,t)=>{const n=new RegExp(T.fullchar?`^${t}$`:t,T.case?"":"i"),r=[];return e.forEach(((e,t)=>{d.forEach(((i,l)=>{const{dataIndex:o}=i;if([ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(o))return;const s=g(e,i,e.index,l);n.test(s)&&r.push({value:s,rowKey:a(e,e.index),dataIndex:o,rowIndex:t,colIndex:l})}))})),r})(c,b);if(!t.length)return R.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.notMatch")});if(E(t),"all"===e&&N(!0),b!==y.current)return y.current=b,C(0);if("next"===e){const e=w+1;e>t.length-1?await L(f("qm.table.fastSearch.toTheEnd"),(()=>C(0)),(()=>{})):C(e)}if("prev"===e){const e=w-1;e<0?await L(f("qm.table.fastSearch.toStart"),(()=>C(t.length-1)),(()=>{})):C(e)}})),A=()=>{C(0),E([]),u({})},F=e=>{e&&(p(e.rowKey),m(e.dataIndex),u(e))},_=l().useMemo((()=>h?`fastSearch_${h}`:""),[h]),[q,D]=l().useState([]),[H,$]=l().useState(""),[M,K]=l().useState("");De((()=>{if(M){const{input:e,config:t}=q.find((e=>e.value===M)).condition;v(e),I(t),setTimeout((()=>P()))}}),[M]),l().useEffect((()=>{z()}),[]);const z=async()=>{if(!_)return;let e=await Wi().getItem(_);e||(e=await V(_),Array.isArray(e)&&await Wi().setItem(_,e)),Array.isArray(e)&&e.length&&D(e)},V=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},j=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}};return l().createElement("div",{className:`${i}-fast-search__setting`},l().createElement("div",{className:"main"},l().createElement("div",{className:"container"},l().createElement("div",{className:"search-box"},l().createElement("span",{className:"label"},f("qm.table.fastSearch.queryLabel"),":"),l().createElement(R.Input,{value:b,placeholder:f("qm.table.fastSearch.queryCondition"),allowClear:!0,style:{flex:"auto",width:"auto"},onChange:e=>v(e.target.value)})),l().createElement("div",{className:"condition"},l().createElement(R.Checkbox,{checked:!!T.case,onChange:e=>k({case:e.target.checked})},f("qm.table.fastSearch.matchCase")),l().createElement(R.Checkbox,{checked:!!T.fullchar,onChange:e=>k({fullchar:e.target.checked})},f("qm.table.fastSearch.matchFullchar"))),l().createElement("div",{className:"all-list"},S&&l().createElement("table",{className:"rtable",tabIndex:-1,cellSpacing:"0",cellPadding:"0"},l().createElement("thead",null,l().createElement("tr",null,l().createElement("th",{style:{width:40,minWidth:40}},"#"),l().createElement("th",{style:{width:130,minWidth:130}},f("qm.table.fastSearch.cellText")),l().createElement("th",null,f("qm.table.fastSearch.valText")))),l().createElement("tbody",null,x.map(((e,t)=>l().createElement("tr",{key:t,className:xe()({active:w===t}),onClick:()=>C(t)},l().createElement("td",null,t+1),l().createElement("td",null,"Row:",e.rowIndex+1,", Col:",e.colIndex+1),l().createElement("td",null,e.value)))))))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(R.Input,{size:s,value:H,placeholder:f("qm.table.highSearch.configText"),disabled:!b,onChange:e=>{const{value:t}=e.target;$(t)}}),l().createElement(fe,{type:"primary",disabled:!H||!b,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!_)return me("Table","必须设置组件参数 `uniqueKey` 才能保存");if(!b)return;const e=or(),t=[...q,{text:H,value:e,condition:{input:b,config:T}}];D(t),$(""),await Wi().setItem(_,t),await j(_,t)})()},f("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${ai.rowHeightMaps[s]}px`}},l().createElement("span",null,f("qm.table.fastSearch.savedSetting"))),l().createElement("ul",null,q.map((e=>l().createElement("li",{key:e.value,className:xe()({selected:e.value===M}),title:e.text,onClick:()=>{return t=e.value,void K(t!==M?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=q.filter((t=>t.value!==e));D(t),await Wi().setItem(_,t),await j(_,t)})(e.value)}},l().createElement(we.CloseCircleOutlined,null))))),!q.length&&l().createElement("div",{style:{padding:Ka}},l().createElement(dt,null)))))),l().createElement("div",{className:"bottom-bar",style:{position:"absolute",left:0,bottom:0,right:0,height:`${Da[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",boxSizing:"border-box"}},l().createElement("div",null,f("qm.table.fastSearch.findTotal",{total:O})),l().createElement("div",null,l().createElement(fe,{onClick:()=>P("all"),style:{marginRight:8}},f("qm.table.fastSearch.queryAll")),l().createElement(fe,{type:"primary",onClick:()=>P("prev"),style:{marginRight:8}},f("qm.table.fastSearch.queryPrev")),l().createElement(fe,{type:"primary",onClick:()=>P("next"),style:{marginRight:8}},f("qm.table.fastSearch.queryNext")),l().createElement(fe,{onClick:()=>t()},f("qm.table.fastSearch.closeButton")))))},Ui=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,$size:a}=l().useContext(Ha),{t:i}=U(),[o,s]=l().useState(!1),c=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:c})));const d={visible:o,title:i("qm.table.fastSearch.settingTitle"),width:650,loading:!1,bodyStyle:{paddingBottom:`${Da[a]+20}px`},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${r}-super-search`,title:i("qm.table.fastSearch.text"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.MonitorOutlined,null))),l().createElement(yn,d,l().createElement(Bi,{onClose:()=>s(!1)})))}));Ui.displayName="FastSearch";const Gi=Ui,Yi={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:60,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"},Xi=e=>[Yi.selectionColumnDefine,...e].filter((e=>!e.hidden)),Qi=e=>e.some((e=>Array.isArray(e.children))),Zi=e=>void 0!==e._groupLevel,Ji=(e,t)=>t.split(Yi.separator).reduce(((e,t)=>e?.[t]),e),el=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(el)):0,tl=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const a=t?`${t}${Yi.separator}${r}`:r;if(n.push(a),Array.isArray(e[r]))return n;const i=tl(e[r],a);return n.concat(i)}),[]),nl={sum:e=>e.reduce(((e,t)=>isNaN(Number(t))?e:e+Number(t)),0),avg:e=>e.length?(e.reduce(((e,t)=>isNaN(Number(t))?e:e+Number(t)),0)/e.length).toFixed(2):"",max:e=>e.length?Math.max(...e):"",min:e=>e.length?Math.min(...e):"",count:e=>e.length,unique:e=>new Set(e).size,empty:e=>e.filter((e=>ie(e))).length,notEmpty:e=>e.filter((e=>!ie(e))).length},rl=l().createContext(void 0),al=e=>{const{prefixCls:t,pivotProps:n,size:r,getRowKey:a,flatColumns:i,tableData:o}=e,{initialGroup:s,initialCount:c,initialFilter:d,initialSorter:u}=n,m=e=>{const t=new Map;return Vn(e).forEach((e=>t.set(a(e,e.index),e))),t},p=l().useRef({props:n,originGridData:o,flatGroupData:[],isTree:Qi(o),keyRecordMap:m(o)}),[h,g]=l().useState({pivotRef:p,prefixCls:t,size:r,viewMode:"table",columns:i,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=i.map((e=>e.dataIndex));return e.forEach((e=>{n.includes(e.fieldName)&&["ascend","descend"].includes(e.order)&&t.push(e)})),t})(s):[],filterList:d?(e=>{const t=[],n=i.map((e=>e.dataIndex));for(const r in e){const[a,i]=r.split("|");if(n.includes(a)&&i){const n=e[r]||{};Object.keys(n).forEach((e=>{t.push({type:i,bracketLeft:"",fieldName:a,expression:e,value:xr(e)?null:n[e],bracketRight:"",logic:"and"})}))}}return t})(d):[],sorterList:u?(e=>{const t=[],n=i.map((e=>e.dataIndex));for(const r in e)n.includes(r)&&["ascend","descend"].includes(e[r])&&t.push({fieldName:r,order:e[r]});return t})(u):[],colorList:[],expandedKeys:[],searchResults:[],switchIndex:0,fillColorCells:new Map,countMethod:c?(e=>{const t=["count","unique","empty","notEmpty","sum","max","min","avg"],n=i.map((e=>e.dataIndex)),r={};for(const a in e)n.includes(a)&&t.includes(e[a])&&(r[a]=e[a]);return r})(c):{},summationData:{}}),y=e=>{g((t=>{const n={...t};let r=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};f((()=>{x(o),b("originGridData",o),b("isTree",Qi(o)),b("keyRecordMap",m(o))}),[o]),f((()=>{v(i)}),[i]),f((()=>{y({size:r})}),[r]);const b=(e,t)=>{h.pivotRef.current[e]=t};b("props",n);const v=e=>{y({columns:e})},x=e=>{y({gridData:e})},E=e=>{y({groupGridData:e})},w=e=>{y({groupList:e})},C=e=>{y({filterList:e})},S=e=>{y({sorterList:e})},N=e=>{y({colorList:e})},T=e=>{y({expandedKeys:e})},I=e=>{y({searchResults:e})},R=e=>{y({switchIndex:e})},O=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),y({fillColorCells:t})},k=e=>{var t;y({countMethod:(t=Object.assign({},h.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},L=e=>{y({summationData:e})},P=l().useMemo((()=>({...h,setContext:y,getRowKey:a,setPivotGridRef:b,setColumns:v,setGridData:x,setGroupGridData:E,setGroupList:w,setFilterList:C,setSorterList:S,setColorList:N,setExpandedKeys:T,setSearchResults:I,setSwitchIndex:R,setFillColor:O,setCountMethod:k,setSummationData:L})),[h]);return l().createElement(rl.Provider,{value:P},e.children)},il=()=>l().useContext(rl),ll=()=>{const{prefixCls:e,pivotRef:t,groupList:n,columns:r,gridData:a,setGroupList:i,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=il(),{originGridData:d}=t.current,{onGroupChange:u,onDataChange:m}=t.current.props,{t:p}=U(),h=l().useRef([]),f=l().useRef([]),g=l().useMemo((()=>n.filter((e=>e.fieldName&&e.order))),[n]),y=l().useMemo((()=>r.map((e=>({label:cr(e.title),value:e.dataIndex,disabled:n.some((t=>t.fieldName===e.dataIndex))})))),[n,r]),b=l().useMemo((()=>{const e=g.map((e=>({[e.fieldName]:e.order})));return(0,X.isEqual)(e,h.current)?h.current:(h.current=e,e)}),[g]),v=[{label:p("qm.pivotGrid.group.ascend"),value:"ascend"},{label:p("qm.pivotGrid.group.descend"),value:"descend"}];l().useEffect((()=>{o(f.current)}),[b,d]),l().useLayoutEffect((()=>{const e=((e,t=[],n)=>{const r=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:a}]=t,i=Object.keys(t[0])[0],l=t.slice(1),o=Object.groupBy(e,(e=>n(e,i))),s=Object.keys(o).sort(((e,t)=>{const n=(r=e,i=t,Number.isNaN(r-i)?r.toString().localeCompare(i.toString()):r-i);var r,i;return"ascend"===a?n:-n})),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],l)})),c};return r(e,t)})(a,b,((e,t)=>{let n=Jn(e,t);return(0,X.isPlainObject)(n)&&(n=Object.values(n)),Array.isArray(n)&&(n=n.join(",")),ie(n)?p("qm.pivotGrid.group.empty"):n}));var t;s(e),t=tl(e),f.current=t,c("flatGroupData",((e,t=[])=>{const n=[];return function e(r,a,i=""){if(Array.isArray(r))r.forEach(((e,t)=>{e._varIndex=t,i?e._parentRowKey=i:delete e._parentRowKey})),n.push(...Vn(r));else for(const l in r){const o=i?`${i}${Yi.separator}${l}`:l,s=Object.keys(t[a])[0];n.push({id:o,_fieldName:s,_groupLevel:a}),e(r[l],a+1,o)}}(e,0),n})(e,b))}),[b,a]),De((()=>{u?.(g)}),[b]),De((()=>{m?.(a)}),[a]);const x=()=>{i([...n,{fieldName:"",order:"ascend"}])},E=(e,t,r)=>{Object.assign(t,{[e]:r}),i([...n])};return l().createElement(R.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,p("qm.pivotGrid.group.title")),!!g.length&&l().createElement("div",null,l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},p("qm.pivotGrid.group.foldAll")),l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(f.current)},p("qm.pivotGrid.group.unfoldAll")))),l().createElement("div",{className:"list"},l().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));(0,X.isEqual)(t,r)||i(e)}},n.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(r=e,l().createElement(l().Fragment,null,l().createElement(we.HolderOutlined,{className:"icon handle"}),l().createElement(R.Select,{value:r.fieldName||void 0,placeholder:p("qm.table.editable.selectPlaceholder"),options:y,style:{width:160,margin:"0 10px"},onChange:e=>E("fieldName",r,e)}),l().createElement(R.Select,{value:r.order,options:v,placeholder:p("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:e=>E("order",r,e)}),l().createElement(we.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(n.filter((t=>t!==e)))})(r)}))));var r})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:x},l().createElement(we.PlusOutlined,{className:"icon"}),p("qm.pivotGrid.fillColor.add")))),className:xe()("action-btn",{active:!!g.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(we.FolderOpenOutlined,{className:"icon"}),p("qm.pivotGrid.group.text"),g.length?`(${g.length})`:null))},ol=()=>{const{prefixCls:e,pivotRef:t,columns:n,filterList:r,setFilterList:a,setGridData:i}=il(),{originGridData:o,isTree:s}=t.current,{onFilterChange:c}=t.current.props,{t:d}=U(),u=l().useRef([]),m=l().useMemo((()=>r.filter((e=>e.fieldName&&(xr(e.expression)||!ie(e.value))))),[r]),p=l().useMemo((()=>n.map((e=>({label:cr(e.title),value:e.dataIndex})))),[n]),[h,f]=l().useState("and"),g=l().useMemo((()=>{const e=m.map((e=>`${e.fieldName},${e.expression},${e.value??""}`));return(0,X.isEqual)(e,u.current)?u.current:(u.current=e,e)}),[m]);De((()=>{a(r.map((e=>({...e,logic:h}))))}),[h]),De((()=>{b(),c?.(m)}),[g]),l().useEffect((()=>{m.length&&y()}),[]);const y=()=>{const e=ur(m.map((e=>({...oe(e,["value"]),condition:e.value}))));i(e?An(o,e,s):o)},b=Et(y,200),v=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],x=()=>{a([...r,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:h}])},E=(e,t,i)=>{if(Object.assign(t,{[e]:i}),"fieldName"===e){const e=n.find((e=>e.dataIndex===i)).filter?.type||"text";Object.assign(t,{type:e,expression:w(e)[0].value,value:""})}"expression"===e&&xr(i)&&Object.assign(t,{value:""}),a([...r])},w=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:d("qm.table.highSearch.gtText")},{value:"<",label:d("qm.table.highSearch.ltText")},{value:">=",label:d("qm.table.highSearch.gteText")},{value:"<=",label:d("qm.table.highSearch.lteText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:d("qm.table.highSearch.inText")},{value:"nin",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:d("qm.table.highSearch.inText")},{value:"nlike",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"^=",label:d("qm.table.highSearch.startsWithText")},{value:"=$",label:d("qm.table.highSearch.endsWithText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}]}return t},C=e=>{switch(e.type){case"number":return l().createElement(R.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{E("value",e,ie(t)?"":t)}});case"date":return l().createElement(F,{popupClassName:ai.popupClassName,defaultValue:ir(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{E("value",e,lr(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const t=n.find((t=>t.dataIndex===e.fieldName))?.dictItems||[];return l().createElement(R.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{E("value",e,t)}},t.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return l().createElement(R.Input,{value:e.value,style:{width:150},disabled:xr(e.expression),onChange:t=>{E("value",e,t.target.value)}})}};return l().createElement(R.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,d("qm.pivotGrid.filter.title")),!!m.length&&l().createElement(R.Select,{value:h,options:v,style:{width:130},onChange:e=>f(e)})),l().createElement("div",{className:"list"},r.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(R.Select,{value:n.fieldName||void 0,options:p,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:e=>E("fieldName",n,e)}),l().createElement(R.Select,{value:n.expression||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),options:w(n.type),style:{width:100,margin:"0 10px"},onChange:e=>E("expression",n,e)}),C(n),l().createElement(we.CloseOutlined,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(n)}))));var n}))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:x},l().createElement(we.PlusOutlined,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:xe()("action-btn",{active:!!m.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(we.FilterOutlined,{className:"icon"}),d("qm.pivotGrid.filter.text"),m.length?`(${m.length})`:null))},sl=()=>{const{prefixCls:e,pivotRef:t,columns:n,gridData:r,sorterList:a,setSorterList:i,setGridData:o}=il(),{onSorterChange:s}=t.current.props,{t:c}=U(),d=l().useMemo((()=>a.filter((e=>e.fieldName&&e.order))),[a]),u=l().useMemo((()=>n.map((e=>({label:cr(e.title),value:e.dataIndex,disabled:a.some((t=>t.fieldName===e.dataIndex))})))),[a,n]);De((()=>{h(),s?.(d)}),[l().useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]),l().useLayoutEffect((()=>{d.length&&h()}),[]);const m=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],p=(e,t)=>"number"==typeof e&&"number"==typeof t?e-t:"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():0,h=()=>{var e,t;o((e=r,(t=d).length||(t=[{fieldName:"index",order:"ascend"}]),e.sort(((e,n)=>{for(const r of t){const{fieldName:t,order:a}=r,i=Jn(e,t),l=Jn(n,t),o=p(i,l);if(0!==o)return"ascend"===a?o:-o}return 0})).slice(0)))},f=()=>{i([...a,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),i([...a])};return l().createElement(R.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.sorter.title"))),l().createElement("div",{className:"list"},l().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.fieldName)),n=a.map((e=>e.fieldName));(0,X.isEqual)(t,n)||i(e)}},a.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(we.HolderOutlined,{className:"icon handle"}),l().createElement(R.Select,{value:n.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:e=>g("fieldName",n,e)}),l().createElement(R.Select,{value:n.order,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:e=>g("order",n,e)}),l().createElement(we.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(a.filter((t=>t!==e)))})(n)}))));var n})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:f},l().createElement(we.PlusOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:xe()("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(we.SortAscendingOutlined,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},cl=()=>{const{prefixCls:e,getRowKey:t,gridData:n,columns:r,searchResults:a,switchIndex:i,setSearchResults:o,setSwitchIndex:s}=il(),{t:c}=U(),{getTitleFromCellValue:d}=hi(),[u,m]=l().useState(!1),p=l().useMemo((()=>a.length),[a]);De((()=>{u||setTimeout((()=>{s(0),o([])}),200)}),[u]);const h=(e,n)=>{const a=[];return e.forEach(((e,i)=>{r.forEach(((r,l)=>{const o=d(e,r,i,l)+"";o.includes(n)&&a.push({value:o,rowKey:t(e,e.index),dataIndex:r.dataIndex})})),Array.isArray(e.children)&&a.push(...h(e.children,n))})),a},f=Et((e=>{const t=e.target.value.trim();s(0),o(t?h(n,t):[])}),200),g=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&y()},y=()=>{p&&s((i+1)%p)};return l().createElement(R.Dropdown,{open:u,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.search.title")),l().createElement("button",{className:"button-icon",onClick:()=>m(!1)},l().createElement(we.CloseOutlined,null))),l().createElement("div",{className:"list search",style:{margin:"10px 0"}},l().createElement(R.Input,{autoFocus:!0,style:{width:280},suffix:l().createElement("div",{className:"search-switch"},l().createElement("button",{className:"button-icon",onClick:()=>{p&&s((i-1+p)%p)}},l().createElement(we.LeftOutlined,null)),l().createElement("span",{className:"num"},p>0?i+1:i,"/",p),l().createElement("button",{className:"button-icon",onClick:()=>y()},l().createElement(we.RightOutlined,null))),onChange:f,onKeyUp:g}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},l().createElement("span",{onClick:()=>m(!u)},l().createElement(we.MonitorOutlined,{className:"icon"}),c("qm.pivotGrid.search.text")))},dl=(e,t)=>e.map((e=>(e.children&&(e.children=dl(e.children,t)),t(e)))),ul=()=>{const{prefixCls:e,pivotRef:t,columns:n,setColumns:r}=il(),{uniqueKey:a,onColumnsChange:i}=t.current.props,{t:o}=U(),s=l().useMemo((()=>a?`grid_field_${a}`:""),[a]);l().useLayoutEffect((()=>{c()}),[]),De((()=>{u(n)}),[n]);const c=()=>{const e=m();e&&i?.(e)},d=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=d(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}})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));(0,X.isEqual)(t,n)||localStorage.setItem(s,JSON.stringify(t))},m=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));return e?(0,X.xor)(e.map((e=>e.dataIndex)),n.map((e=>e.dataIndex))).length>0?dl(n,(t=>{const n=e.find((e=>e.dataIndex===t.dataIndex));return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):dl(e,(e=>{const t=n.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0},p=l().useMemo((()=>{let e=0;for(let t=0;t<n.length-1&&("left"!==n[t].fixed||n[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let r=0;r<n.length;r++)r===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(n[r]);return t}),[n]);return l().createElement(R.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},l().createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},l().createElement("span",null,o("qm.pivotGrid.field.title"))),l().createElement("div",{className:"list"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:p,setList:e=>{const t=e.map((e=>e.dataIndex)),n=p.map((e=>e.dataIndex));(0,X.isEqual)(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const a=e[r];r<t?a.fixed="left":delete a.fixed,r!==t&&n.push(a)}i?i(n):r(n)})(yr(e))}},p.map((e=>"__divider__"!==e.dataIndex?l().createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},l().createElement(we.HolderOutlined,{className:"handle"}),l().createElement("span",{className:"label"},l().createElement("span",{className:"title"},cr(e.title)),l().createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...n];i?i(t):r(t)})(e)},e.hidden?l().createElement(we.EyeInvisibleOutlined,null):l().createElement(we.EyeOutlined,null)))):l().createElement("li",{key:e.dataIndex,className:"divider"})))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},l().createElement("span",null,l().createElement(we.SettingOutlined,{className:"icon"}),o("qm.pivotGrid.field.text")))},ml=()=>{const{prefixCls:e,size:t,setContext:n}=il(),{t:r}=U(),a=[{label:r("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:r("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:r("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return l().createElement(R.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},a.map((e=>l().createElement("li",{key:e.value,className:xe()("ant-dropdown-menu-item check-item",{active:t===e.value}),onClick:()=>n({size:e.value})},l().createElement("span",{className:"label"},e.label),l().createElement("i",{className:"icon"},l().createElement(we.CheckOutlined,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},l().createElement("span",null,l().createElement(we.ColumnHeightOutlined,{className:"icon"}),r("qm.pivotGrid.lineHeight.text")))},pl="606060",hl="thin",fl="d4d4d4",gl=(e,t)=>{t&&(e.height=Math.floor(.75*t))},yl=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},bl=()=>({top:{style:hl,color:{argb:fl}},left:{style:hl,color:{argb:fl}},bottom:{style:hl,color:{argb:fl}},right:{style:hl,color:{argb:fl}}}),vl=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},xl=()=>{const{prefixCls:e,pivotRef:t,columns:n,countMethod:r,summationData:a}=il(),{t:i}=U(),{exportXLSX:o}=(()=>{const{size:e}=il(),{t}=U(),{rowHeightMaps:n}=ai,r=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(r,a,i,l)=>{const{columns:o,footSummation:s}=r,c=n[e],d=Fn(o),u=[],m=[],p=[];let h=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=cr(e.title),p.push({key:t,width:(n||r)/8})})),u.push(f),h+=u.length;const g=a.map(((e,t)=>{const n={};return d.forEach(((r,a)=>{const i=["percent","finance"].includes(r.formatType);n[r.dataIndex]=i?Jn(e,r.dataIndex):l(e,t,r,a)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));h+=g.length,s&&i(d,a).forEach(((e,n)=>{const r={};d.forEach(((n,i)=>{const{dataIndex:l,summation:o}=n,s=o?.render?o.render(a):Jn(e,l);r[l]=0===i&&""===s?t("qm.table.config.summaryText"):Z(s)?sr(s).join(""):s})),m.push(r)}));const{sheetName:y,useStyle:b}=r,v=new(bi().Workbook),x=v.addWorksheet(y);x.columns=p,x.addRows(u).forEach((e=>{b&&gl(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=$n(o,t.key),{align:r,theadAlign:a}=n;yl(e,a||r),b&&Object.assign(e,{font:{bold:!0,color:{argb:pl}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:bl()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];b&&gl(e,c),e.eachCell(((e,t)=>{const a=x.getColumn(e.col),i=$n(o,a.key),{align:l}=i;yl(e,1===t||void 0===r?l:"right"),Object.assign(e,vl(i)),b&&Object.assign(e,{font:{color:{argb:pl}},border:bl()}),1===Number(e.col)&&n&&(e.alignment={...e.alignment,indent:n})}))})),s&&x.addRows(m).forEach((e=>{b&&gl(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=$n(o,n.key),{align:a}=r;yl(e,1===t?a:"right"),Object.assign(e,vl(r)),b&&Object.assign(e,{font:{color:{argb:pl}},border:bl()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=await v.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})},importXLSX:(e,n)=>{const{columns:a,file:i}=e,l=Fn(a),o=new FileReader;o.onerror=()=>{R.message.error(t("qm.table.import.error"))},o.onload=e=>{const a=l.map((e=>cr(e.title))),i=new(bi().Workbook),o=e.target;o?i.xlsx.load(o.result).then((e=>{const i=e.worksheets[0];if(i){const e=i.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(a,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{let r=e;Array.isArray(r?.richText)&&(r=r.richText.map((e=>e.text)).join("")),(0,X.isPlainObject)(r)&&"text"in r&&(r=r.text),(0,X.isDate)(r)&&(r=lr(r,Wa)),r?.formula&&(r=r.result??r.value),t[s[n]]=r}));const n={};return a.forEach(((e,a)=>{const{dataIndex:i,dictItems:o}=l[a];Array.isArray(o)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>r(o,e))).filter((e=>""!==e)):t[e]=r(o,t[e])),er(n,i,t[e])})),n}));n?.(t)}else R.message.error(t("qm.table.import.error"))}else R.message.error(t("qm.table.import.error"))})):R.message.error(t("qm.table.import.error"))},o.readAsArrayBuffer(i)}}})(),{getTitleFromCellValue:s}=hi(),d=[{text:i("qm.pivotGrid.count.records"),value:"count"},{text:i("qm.pivotGrid.count.unique"),value:"unique"},{text:i("qm.pivotGrid.count.empty"),value:"empty"},{text:i("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:i("qm.pivotGrid.count.sum"),value:"sum"},{text:i("qm.pivotGrid.count.max"),value:"max"},{text:i("qm.pivotGrid.count.min"),value:"min"},{text:i("qm.pivotGrid.count.avg"),value:"avg"}],u={columns:_n(n),fileName:c()().format(Ba),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},m=(e,t,n,r)=>{const{dataIndex:a,precision:i,formatType:l,outputRender:o}=n;if(Zi(e))return Jn(e,a);if(o)return o(Jn(e,a),e,n,t,r);let c=s(e,n,t,r);return i>=0&&!l&&""!==c&&(c=Number(c)),c},p=()=>{if(!r||!Object.keys(r).length)return[];const e={};return u.columns.map((e=>e.dataIndex)).forEach(((t,n)=>{if(n>0){let n="";r?.[t]&&(n=d.find((e=>e.value===r[t])).text+" "+a.total[t]),er(e,t,n)}})),[e]},h=async e=>{const t=await o({...u,footSummation:!!Object.keys(r).length},e,p,m);qt(t,`${c()().format(Ba)}.xlsx`)},f=[{key:"1",label:l().createElement(l().Fragment,null,l().createElement(we.FolderOutlined,{style:{marginRight:4}})," ",i("qm.pivotGrid.export.group")),onClick:()=>{h((()=>{const e=[];let i=0;return t.current.flatGroupData.forEach((t=>{const l={...t};Zi(t)?(l._level=t._groupLevel,u.columns.map((e=>e.dataIndex)).forEach(((e,i)=>{if(0===i){const r=n.find((e=>e.dataIndex===t._fieldName)),a=r.outputRender?r.outputRender(Jn(t._record,r.dataIndex),t._record,r,0,0):s(t._record,r,0,0);er(l,e,a)}else{let n="";r?.[e]&&(n=d.find((t=>t.value===r[e])).text+" "+Ji(a,t.id).subtotal[e]),er(l,e,n)}})),i=t._groupLevel):i>0&&(l._level=t._level+i+1),e.push(l)})),e})())}},{key:"2",label:l().createElement(l().Fragment,null,l().createElement(we.BarsOutlined,{style:{marginRight:4}})," ",i("qm.pivotGrid.export.list")),onClick:()=>{h(Array.from(t.current.keyRecordMap.values()))}}];return l().createElement(R.Dropdown,{trigger:["click"],menu:{items:f},className:xe()("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},l().createElement("span",null,l().createElement(we.DownloadOutlined,{className:"icon"}),i("qm.pivotGrid.export.text")))},El=()=>{const{prefixCls:e,pivotRef:t,groupList:n,filterList:r,sorterList:a,colorList:i,countMethod:o,setContext:s}=il(),{uniqueKey:d}=t.current.props,{t:u}=U(),m=l().useMemo((()=>d?`grid_conf_${d}`:""),[d]),p=l().useRef({}),[h,f]=l().useState([]),[g,y]=l().useState({}),[b,v]=l().useState(""),x=(e,t)=>{y((n=>Object.assign({},n,{[e]:t??!n[e]})))};l().useLayoutEffect((()=>{E()}),[]),De((()=>{w()}),[h]);const E=async()=>{try{if(!m)return;const e=await Wi().getItem(m);Array.isArray(e)&&(f(e),y(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}},w=async()=>{try{if(!m)return;await Wi().setItem(m,h)}catch(e){}},C=()=>{const e=or();f([{id:e,label:c()().format(Ba),value:{groupList:n,filterList:r,sorterList:a,colorList:i,countMethod:o}},...h]),re((()=>x(e,!0)))};return l().createElement(R.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},l().createElement("span",null,u("qm.pivotGrid.saved.title"))),l().createElement("div",{className:"list"},l().createElement("ul",null,h.map((e=>l().createElement("li",{key:e.id,className:xe()("ant-dropdown-menu-item sort-item",{active:e.id===b}),onClick:()=>(e=>{if(g[e.id])return;const t=b!==e.id,n=t?e.value:p.current;s({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList,colorList:n.colorList,countMethod:n.countMethod}),v(t?e.id:"")})(e)},l().createElement("div",{className:"label",style:{width:200}},g[e.id]?l().createElement(R.Input,{size:"small",autoFocus:!0,defaultValue:e.label,style:{width:"100%",marginLeft:-8},onBlur:t=>{const{value:n}=t.target;n!==e.label&&(e.label=n,f([...h])),x(e.id,!1)}}):l().createElement("span",null,e.label)),l().createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),x(e.id)}},g[e.id]?l().createElement(we.CheckOutlined,null):l().createElement(we.EditOutlined,null)),l().createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,f(h.filter((e=>e.id!==n)))}},l().createElement(we.CloseOutlined,null))))))),l().createElement("div",{className:"add-record",style:{padding:10}},l().createElement("span",{className:"insert",onClick:C},l().createElement(we.PlusOutlined,{className:"icon"}),u("qm.pivotGrid.saved.add")))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomRight",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:n,filterList:r,sorterList:a,colorList:i,countMethod:o}:{},p.current=t}},l().createElement("span",null,l().createElement(we.SaveOutlined,{className:"icon"}),u("qm.pivotGrid.saved.text")))},wl=()=>{const{gridData:e}=il(),{t}=U();return l().createElement("div",{className:"alert-info"},l().createElement(we.InfoCircleOutlined,{className:"icon"}),t("qm.table.alert.total",{total:(()=>{let t=0;return function e(n){n.forEach((n=>{Array.isArray(n.children)&&e(n.children),t+=1}))}(e),t})()}))},Cl={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},Sl={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},Nl=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Tl(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(Cl).forEach((e=>{const c={...r&&Sl[e]||Cl[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,Nl.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-o-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=o+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-o-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=o+a}const d=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?8:r}}({contentRadius:i,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":c.offset[0]=d.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":c.offset[1]=2*-d.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":c.offset[1]=2*d.arrowOffsetHorizontal-o}c.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const a=r&&"object"==typeof r?r:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+n,i.shiftX=!0,i.adjustX=!0}const l={...i,...a};return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,d,t,n),l&&(c.htmlRegion="visibleFirst")})),s}const Il=require("@rc-component/trigger");var Rl=r.n(Il);const Ol=require("@rc-component/color-picker");var kl=r.n(Ol);const Ll=e=>{const{value:t,defaultValue:n,disabled:r,disabledAlpha:a,className:i,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=ri("",{value:t,defaultValue:n}),m=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),p=Tl({offset:0,arrowWidth:16,borderRadius:6}),h=Ee("color-picker");return l().createElement(Rl(),{action:["click"],prefixCls:h,popupPlacement:"bottomLeft",builtinPlacements:p,popup:()=>l().createElement(kl(),{prefixCls:h,value:d,disabled:r,disabledAlpha:a,onChange:(e,t)=>{u(e.toRgbString()),s?.(m(e),t)},onChangeComplete:(e,t)=>{c?.(m(e),t)}})},l().createElement("div",{className:xe()(`${h}-btn`,i),style:o},l().createElement(Ol.ColorBlock,{color:d,prefixCls:h})))};Ll.displayName="ColorPicker";const Pl=Ll,Al=()=>{const{prefixCls:e,pivotRef:t,getRowKey:n,columns:r,colorList:a,setColorList:i,setFillColor:o}=il(),{flatGroupData:s}=t.current,{t:c}=U(),d=l().useRef([]),u=l().useMemo((()=>a.filter((e=>e.fieldName&&e.color&&(xr(e.expression)||!ie(e.value)||"col"===e.mode)))),[a]),m=l().useMemo((()=>r.map((e=>({label:cr(e.title),value:e.dataIndex})))),[r]),p=l().useMemo((()=>Xi(r)),[r]),h=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"},{label:c("qm.pivotGrid.fillColor.col"),value:"col"}];De((()=>{f()}),[l().useMemo((()=>{const e=u.map((e=>({[e.color]:`${e.mode},${e.fieldName},${e.expression},${e.value??""}`})));return(0,X.isEqual)(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=Et((()=>{const e=[];u.forEach((t=>{const r=ur([{...oe(t,["value"]),condition:t.value}]),a=An(s.filter((e=>!Zi(e))),"col"!==t.mode?r:"");if("cell"===t.mode||"col"===t.mode)for(let r=0;r<a.length;r++)e.push({color:t.color,rowKey:n(a[r],a[r].index),dataIndex:t.fieldName});if("row"===t.mode)for(let r=0;r<a.length;r++){const i=n(a[r],a[r].index);for(let n=0;n<p.length;n++)e.push({color:t.color,rowKey:i,dataIndex:p[n].dataIndex})}})),o(e)}),200),g=()=>{i([...a,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},y=(e,t,n)=>{if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=r.find((e=>e.dataIndex===n)).filter?.type||"text";Object.assign(t,{type:e,expression:b(e)[0].value,value:""})}"expression"===e&&xr(n)&&Object.assign(t,{value:""}),i([...a])},b=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:c("qm.table.highSearch.gtText")},{value:"<",label:c("qm.table.highSearch.ltText")},{value:">=",label:c("qm.table.highSearch.gteText")},{value:"<=",label:c("qm.table.highSearch.lteText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:c("qm.table.highSearch.inText")},{value:"nin",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:c("qm.table.highSearch.inText")},{value:"nlike",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"^=",label:c("qm.table.highSearch.startsWithText")},{value:"=$",label:c("qm.table.highSearch.endsWithText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}]}return t};return l().createElement(R.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.fillColor.title"))),l().createElement("div",{className:"list"},l().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.fieldName)),n=a.map((e=>e.fieldName));(0,X.isEqual)(t,n)||i(e)}},a.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(we.HolderOutlined,{className:"icon handle"}),l().createElement(Pl,{defaultValue:n.color,style:{marginLeft:5},onChangeComplete:e=>y("color",n,e.hex)}),l().createElement(R.Select,{value:n.mode,options:h,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:e=>y("mode",n,e)}),l().createElement(R.Select,{value:n.fieldName||void 0,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:e=>y("fieldName",n,e)}),"col"!==n.mode&&l().createElement(R.Select,{value:n.expression||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:b(n.type),style:{width:100,margin:"0 10px"},onChange:e=>y("expression",n,e)}),"col"!==n.mode&&(e=>{switch(e.type){case"number":return l().createElement(R.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{y("value",e,ie(t)?"":t)}});case"date":return l().createElement(F,{popupClassName:ai.popupClassName,defaultValue:ir(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{y("value",e,lr(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const t=r.find((t=>t.dataIndex===e.fieldName))?.dictItems||[];return l().createElement(R.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{y("value",e,t)}},t.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return l().createElement(R.Input,{value:e.value,style:{width:150},disabled:xr(e.expression),onChange:t=>{y("value",e,t.target.value)}})}})(n),l().createElement(we.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(a.filter((t=>t!==e)))})(n)}))));var n})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:g},l().createElement(we.PlusOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:xe()("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(we.BgColorsOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Fl=()=>l().createElement("div",{className:"top-bar"},l().createElement(be,{size:4},l().createElement(wl,null),l().createElement(R.Divider,{type:"vertical"}),l().createElement(ul,null),l().createElement(ll,null),l().createElement(ol,null),l().createElement(sl,null),l().createElement(R.Divider,{type:"vertical"}),l().createElement(Al,null),l().createElement(ml,null),l().createElement(cl,null),l().createElement(R.Divider,{type:"vertical"}),l().createElement(xl,null)),l().createElement(be,{size:4},l().createElement(El,null))),_l=l().createContext(void 0),ql=e=>{const{scrollbar:t}=e,{pivotRef:n,getRowKey:r,columns:a,groupGridData:i,setPivotGridRef:o}=il(),{rowSelection:s,treeExpandable:c,rowHighlight:d}=n.current.props,u=c?.defaultExpandAllRows??!0,m=l().useRef({bodyEl:null,rowVirtualizer:null}),[p,h]=l().useState({gridRef:m,scrollbarRef:t,selectionKeys:s?.defaultSelectedRowKeys??[],treeExpandKeys:u?jn(n.current.originGridData,(e=>r(e,e.index))):[],highlightKey:"",checkedColumnKey:"",clicked:[],isPingLeft:!1}),f=l().useMemo((()=>Math.max(0,el(i)-1)),[i]),g=l().useMemo((()=>Xi(a)),[a]),y=l().useMemo((()=>g.filter((e=>"left"===e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0)+f*Yi.indentWidth),[f,g]),b=e=>{h((t=>{const n={...t};let r=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))},v=(e,t)=>{p.gridRef.current[e]=t};l().useLayoutEffect((()=>{T()}),[a]),l().useLayoutEffect((()=>{s?.selectedRowKeys&&b({selectionKeys:s.selectedRowKeys})}),[s?.selectedRowKeys]),l().useLayoutEffect((()=>{void 0!==d?.currentRowKey&&b({highlightKey:d.currentRowKey})}),[d?.currentRowKey]);const x=e=>{Array.isArray(s?.selectedRowKeys)||b({selectionKeys:e})},E=e=>{b({treeExpandKeys:e})},w=e=>{void 0===d?.currentRowKey&&b({highlightKey:e})},C=e=>{b({checkedColumnKey:e})},S=e=>{br(e,p.clicked,!0)||b({clicked:e})},N=e=>{b({isPingLeft:e})},T=()=>{const e=t.current.container.clientWidth,{defaultColumnWidth:n}=ai,r=[];let i=0;if(a.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,r.push(e))})),r.length>0){const t=a.reduce(((e,t)=>e+(t.width||t.minWidth||n)),0);if(t<=e){const a=e-t;if(1===r.length)r[0].renderWidth=(r[0].minWidth||n)+a;else{const e=a/r.reduce(((e,t)=>e+(t.minWidth||n)),0);let t=0;r.forEach(((r,a)=>{if(0===a)return;const i=Math.floor((r.minWidth||n)*e);t+=i,r.renderWidth=(r.minWidth||n)+i})),r[0].renderWidth=(r[0].minWidth||n)+a-t}}else r.forEach((e=>{e.renderWidth=e.minWidth||n}))}else i=a.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||n)),0)},I=l().useMemo((()=>({...p,indentDepth:f,fixedWidth:y,gridColumns:g,setContext:b,setGridLayoutRef:v,setSelectionKeys:x,setTreeExpandKeys:E,setHighlightKey:w,setCheckColumnKey:C,setClicked:S,setPingLeft:N,updateColumnsWidth:T})),[p,f,g]);return l().createElement(_l.Provider,{value:I},e.children)},Dl=()=>l().useContext(_l),Hl=require("@rc-component/portal");var $l=r.n(Hl);const Ml=e=>{const{column:t}=e,{pivotRef:n,columns:r,setColumns:a}=il(),{scrollbarRef:i}=Dl(),{onColumnsChange:o}=n.current.props,s=l().useRef(null),[c,d]=l().useState(!1),u=l().useRef(document.onselectstart),m=l().useRef({startX:0,originSizeX:0,columnWidth:0}),p=e=>{m.current=Object.assign({},m.current,e)},h=e=>{if(1!==e.buttons)return f();const n=e.clientX-m.current.startX,r=(t.width||t.renderWidth)+n;r<(t.minWidth||ai.defaultColumnWidth)||(p({columnWidth:r}),s.current.style.left=`${m.current.originSizeX+n}px`)},f=()=>{i.current.container.classList.remove("col-resize"),t.width=m.current.columnWidth;const e=[...r];o?o(e):a(e),re((()=>d(!1))),$e(document,"mousemove",h),$e(document,"mouseup",f),p({startX:0,originSizeX:0,columnWidth:0}),g()},g=()=>{document.onselectstart!==u.current&&(document.onselectstart=u.current)};return l().createElement(l().Fragment,null,l().createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault(),i.current.container.classList.add("col-resize");const n=Xn(e.target,i.current.container).left-i.current.scrollLeft+3;p({startX:e.clientX,originSizeX:n,columnWidth:t.width||t.renderWidth||0}),He(document,"mousemove",h),He(document,"mouseup",f),d(!0),re((()=>s.current.style.left=`${n}px`)),u.current=document.onselectstart,document.onselectstart=()=>!1}}),l().createElement($l(),{open:c,getContainer:i.current?.container},l().createElement("div",{ref:s,className:"resize-line"})))},Kl=e=>{const{left:t}=e,{pivotRef:n,columns:r,setColumns:a}=il(),{scrollbarRef:i,gridColumns:o,indentDepth:s,isPingLeft:c,setPingLeft:d}=Dl(),{onColumnsChange:u}=n.current.props,{indentWidth:m}=Yi,p=l().useRef(document.onselectstart),h=l().useRef({startX:0,originSizeX:0}),f=e=>{h.current=Object.assign({},h.current,e)},g=()=>{x(t),R(t)},[y,b]=l().useState(0),[v,x]=l().useState(t),[E,w]=l().useState(t),C=l().useRef(!1),S=e=>C.current=e;De((()=>{C.current||g()}),[t]);const N=e=>e.width||e.renderWidth||0,T=e=>o.slice(0,e).reduce(((e,t)=>e+N(t)),0)+s*m,I=e=>{let t=-1;for(let n=1;n<o.length;n++){const r=T(n-1)+N(o[n-1])/2,a=T(n)+N(o[n])/2;if(e>r&&e<a){T(n)<i.current.container.offsetWidth&&(t=n);break}}return t},R=Xt((e=>{const t=I(e);t<0||w(T(t))}),60);l().useEffect((()=>{const e=e=>d(e.target.scrollLeft>1),t=i.current.scrollElement;return t.addEventListener("scroll",e),He(t,"scroll",e),()=>$e(t,"scroll",e)}),[]);const O=G((e=>{if(1!==e.buttons)return k();const t=e.clientX-h.current.startX,n=h.current.originSizeX+t;x(n),R(n)})),k=G((()=>{i.current.container.classList.remove("col-resize"),S(!1),(e=>{const t=I(e);if(t<0)return g();r.forEach(((e,n)=>{n<t-1?e.fixed="left":delete e.fixed})),x(T(t)),R(e),u?u([...r]):a([...r])})(v),$e(document,"mousemove",O),$e(document,"mouseup",k),f({startX:0,originSizeX:0}),L()})),L=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)};return l().createElement($l(),{open:!0,getContainer:i.current?.container},l().createElement("div",{className:xe()("fixed-line",{leave:c}),style:{left:t}}),l().createElement("div",{className:xe()("fixed-bar",{active:C.current}),style:{left:v},onMouseMove:e=>{const{top:t,height:n}=e.target.getBoundingClientRect(),r=e.clientY-t;let a=Math.max(0,r-16);a=Math.min(a,n-32),b(a)},onMouseDown:e=>{e.preventDefault(),i.current.container.classList.add("col-resize"),i.current.SET_SCROLL_LEFT(0),S(!0),f({startX:e.clientX,originSizeX:e.target.offsetLeft}),He(document,"mousemove",O),He(document,"mouseup",k),p.current=document.onselectstart,document.onselectstart=()=>!1}},l().createElement("span",{className:"thumb",style:{top:y}})),C.current&&l().createElement("div",{className:"fixed-line active",style:{left:E}}))},zl=()=>{const{pivotRef:e}=il(),{indentDepth:t,fixedWidth:n,gridColumns:r,checkedColumnKey:a,selectionKeys:i,setSelectionKeys:o,setCheckColumnKey:s}=Dl(),{rowSelection:c}=e.current.props,{selectionColumn:d}=ai,{indentWidth:u,selectionColumnDefine:m}=Yi,p=l().useMemo((()=>r.filter((e=>"left"===e.fixed))),[r]),h=l().useMemo((()=>r.filter((e=>"left"!==e.fixed))),[r]),f=l().useMemo((()=>"radio"!==c?.type),[c]),g=l().useMemo((()=>i.length>0&&i.length===e.current.keyRecordMap.size),[i]),y=l().useMemo((()=>i.length>0&&i.length<e.current.keyRecordMap.size),[i]),b=(r,i)=>l().createElement("div",{className:xe()(i?"fixed-left":"no-fixed"),style:{width:i?n:""}},r.map(((n,p)=>{const{dataIndex:h,title:b,align:v,width:x,renderWidth:E}=n,w={"selection-column":h===d,"col--center":"center"===v,"col--right":"right"===v,"col--checked":a===h},C=p===(i?r.length>1?1:0:r.length-1)?t*u:0,S={width:`${(x||E||0)+C}px`,minWidth:`${(x||E||0)+C}px`};return l().createElement("div",{key:h,className:xe()("table-cell",w),style:S,onClick:()=>{return e=h,void([m.dataIndex].includes(e)||s(a!==e?e:""));var e}},h!==d?l().createElement("span",{className:"cell"},b):c&&f?l().createElement(R.Checkbox,{checked:g,indeterminate:y,onChange:t=>(t=>{const n=t?Array.from(e.current.keyRecordMap.keys()):[];o(n),c?.onChange?.(n,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}):"#",h!==d&&l().createElement(Ml,{column:n}))})));return l().createElement("div",{className:"header"},b(p,!0),b(h),l().createElement(Kl,{left:n}))},Vl=require("react-dom");function jl(e,t,n){let r,a=n.initialDeps??[];function i(){let i;n.key&&n.debug?.()&&(i=Date.now());const l=e(),o=l.length!==a.length||l.some(((e,t)=>a[t]!==e));if(!n.noCache?.()&&!o)return r;let s;if(a=l,n.key&&n.debug?.()&&(s=Date.now()),r=t(...l),n.key&&n.debug?.()){const e=Math.round(100*(Date.now()-i))/100,t=Math.round(100*(Date.now()-s))/100,r=t/16,a=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${a(t,5)} /${a(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange?.(r),r}return i.updateDeps=e=>{a=e},i}function Wl(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const Bl=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,a)),n)}};function Ul(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gl=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Yl=e=>e,Xl=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},Ql=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const a=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(a(Gl(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver((t=>{const r=()=>{const e=t[0];if(e?.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void a({width:t.inlineSize,height:t.blockSize})}a(Gl(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()}));return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Zl={passive:!0},Jl="undefined"==typeof window||"onscrollend"in window,eo=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let a=0;const i=e.options.useScrollendEvent&&Jl?()=>{}:Bl(r,(()=>{t(a,!1)}),e.options.isScrollingResetDelay),l=r=>()=>{const{horizontal:l,isRtl:o}=e.options;a=l?n.scrollLeft*(o?-1:1):n.scrollTop,i(),t(a,r)},o=l(!0),s=l(!1);s(),n.addEventListener("scroll",o,Zl);const c=e.options.useScrollendEvent&&Jl;return c&&n.addEventListener("scrollend",s,Zl),()=>{n.removeEventListener("scroll",o),c&&n.removeEventListener("scrollend",s)}},to=(e,t,n)=>{if(t?.borderBoxSize){const e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},no=(e,{adjustments:t=0,behavior:n},r)=>{const a=e+t;r.scrollElement?.scrollTo?.({[r.options.horizontal?"left":"top"]:a,behavior:n})};class ro{constructor(e){Ul(this,"unsubs",[]),Ul(this,"options",void 0),Ul(this,"scrollElement",null),Ul(this,"targetWindow",null),Ul(this,"isScrolling",!1),Ul(this,"measurementsCache",[]),Ul(this,"itemSizeCache",new Map),Ul(this,"pendingMeasuredCacheIndexes",[]),Ul(this,"scrollRect",null),Ul(this,"scrollOffset",null),Ul(this,"scrollDirection",null),Ul(this,"scrollAdjustments",0),Ul(this,"shouldAdjustScrollPositionOnItemSizeChange",void 0),Ul(this,"elementsCache",new Map),Ul(this,"observer",(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver((e=>{e.forEach((e=>{const t=()=>{this._measureElement(e.target,e)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()}))})):null);return{disconnect:()=>{t()?.disconnect(),e=null},observe:e=>t()?.observe(e,{box:"border-box"}),unobserve:e=>t()?.unobserve(e)}})()),Ul(this,"range",null),Ul(this,"setOptions",(e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options={debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Yl,rangeExtractor:Xl,onChange:()=>{},measureElement:to,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}})),Ul(this,"notify",(e=>{this.options.onChange?.(this,e)})),Ul(this,"maybeNotify",jl((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:!1,noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]})),Ul(this,"cleanup",(()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null})),Ul(this,"_didMount",(()=>()=>{this.cleanup()})),Ul(this,"_willUpdate",(()=>{const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e)return void this.maybeNotify();this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach((e=>{this.observer.observe(e)})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,(e=>{this.scrollRect=e,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})))}})),Ul(this,"getSize",(()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0))),Ul(this,"getScrollOffset",(()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0))),Ul(this,"getFurthestMeasurement",((e,t)=>{const n=new Map,r=new Map;for(let a=t-1;a>=0;a--){const t=e[a];if(n.has(t.lane))continue;const i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort(((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end))[0]:void 0})),Ul(this,"getMeasurementOptions",jl((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,a)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a})),{key:!1})),Ul(this,"getMeasurements",jl((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((e=>{this.itemSizeCache.set(e.key,e.size)})));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,l);for(let a=l;a<e;a++){const e=r(a),l=1===this.options.lanes?o[a-1]:this.getFurthestMeasurement(o,a),s=l?l.end+this.options.gap:t+n,c=i.get(e),d="number"==typeof c?c:this.options.estimateSize(a),u=s+d,m=l?l.lane:a%this.options.lanes;o[a]={index:a,start:s,size:d,end:u,key:e,lane:m}}return this.measurementsCache=o,o}),{key:!1,debug:()=>this.options.debug})),Ul(this,"calculateRange",jl((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};let i=ao(0,a,(t=>e[t].start),n),l=i;if(1===r)for(;l<a&&e[l].end<n+t;)l++;else if(r>1){const o=Array(r).fill(0);for(;l<a&&o.some((e=>e<n+t));){const t=e[l];o[t.lane]=t.end,l++}const s=Array(r).fill(n+t);for(;i>=0&&s.some((e=>e>=n));){const t=e[i];s[t.lane]=t.start,i--}i=Math.max(0,i-i%r),l=Math.min(a,l+(r-1-l%r))}return{startIndex:i,endIndex:l}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null),{key:!1,debug:()=>this.options.debug})),Ul(this,"getVirtualIndexes",jl((()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]}),((e,t,n,r,a)=>null===r||null===a?[]:e({startIndex:r,endIndex:a,overscan:t,count:n,offset:this.getScrollOffset()})),{key:!1,debug:()=>this.options.debug})),Ul(this,"indexFromElement",(e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)})),Ul(this,"_measureElement",((e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const a=r.key,i=this.elementsCache.get(a);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(a,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))})),Ul(this,"resizeItem",((e,t)=>{const n=this.measurementsCache[e];if(!n)return;const r=t-(this.itemSizeCache.get(n.key)??n.size);0!==r&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))})),Ul(this,"measureElement",(e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach(((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))}))})),Ul(this,"getVirtualItems",jl((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,a=e.length;r<a;r++){const a=t[e[r]];n.push(a)}return n}),{key:!1,debug:()=>this.options.debug})),Ul(this,"getVirtualItemForOffset",(e=>{const t=this.getMeasurements();if(0!==t.length)return Wl(t[ao(0,t.length-1,(e=>Wl(t[e]).start),e)])})),Ul(this,"getOffsetForAlignment",((e,t,n=0)=>{const r=this.getSize(),a=this.getScrollOffset();"auto"===t&&(t=e>=a+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r);const i=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(i,e),0)})),Ul(this,"getOffsetForIndex",((e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),a=this.getScrollOffset();if("auto"===t)if(n.end>=a+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=a+this.options.scrollPaddingStart))return[a,t];t="start"}const i="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,n.size),t]})),Ul(this,"isDynamicMode",(()=>this.elementsCache.size>0)),Ul(this,"scrollToOffset",((e,{align:t="start",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})})),Ul(this,"scrollToIndex",((e,{align:t="auto",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const a=t=>{if(!this.targetWindow)return;const r=this.getOffsetForIndex(e,t);if(!r)return void console.warn("Failed to get offset for index:",e);const[a,l]=r;this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame((()=>{const t=this.getScrollOffset(),n=this.getOffsetForIndex(e,l);var r,a;n?(r=n[0],a=t,Math.abs(r-a)<1.01||i(l)):console.warn("Failed to get offset for index:",e)}))},i=t=>{this.targetWindow&&(r++,r<10?this.targetWindow.requestAnimationFrame((()=>a(t))):console.warn(`Failed to scroll to index ${e} after 10 attempts.`))};a(t)})),Ul(this,"scrollBy",((e,{behavior:t}={})=>{"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})})),Ul(this,"getTotalSize",(()=>{const e=this.getMeasurements();let t;if(0===e.length)t=this.options.paddingStart;else if(1===this.options.lanes)t=e[e.length-1]?.end??0;else{const n=Array(this.options.lanes).fill(null);let r=e.length-1;for(;r>=0&&n.some((e=>null===e));){const t=e[r];null===n[t.lane]&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter((e=>null!==e)))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)})),Ul(this,"_scrollToOffset",((e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)})),Ul(this,"measure",(()=>{this.itemSizeCache=new Map,this.notify(!1)})),this.setOptions(e)}}const ao=(e,t,n,r)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else{if(!(i>r))return a;t=a-1}}return e>0?e-1:0},io="undefined"!=typeof document?i.useLayoutEffect:i.useEffect;function lo(e){return function(e){const t=i.useReducer((()=>({})),{})[1],n={...e,onChange:(n,r)=>{r?(0,Vl.flushSync)(t):t(),e.onChange?.(n,r)}},[r]=i.useState((()=>new ro(n)));return r.setOptions(n),io((()=>r._didMount()),[]),io((()=>r._willUpdate())),r}({observeElementRect:Ql,observeElementOffset:eo,scrollToFn:no,...e})}const oo=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,so=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>t?.contains(e.target))),co=(e,t)=>{const n=e.target;return!("button"in e&&e.button>0||n&&!oo(n).contains(n)||t.current?.contains(n))};function uo({ref:e,handler:t,enabled:n=!0,omitClassNames:r=[]}){const a=G(t),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});i.useEffect((()=>{if(!n)return;const i=t=>{co(t,e)&&(l.current.isPointerDown=!0)},o=n=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:t&&l.current.isPointerDown&&co(n,e)&&so(n,r)&&(l.current.isPointerDown=!1,a(n))},s=n=>{l.current.ignoreEmulatedMouseEvents=!0,t&&l.current.isPointerDown&&co(n,e)&&so(n,r)&&(l.current.isPointerDown=!1,a(n))},c=oo(e.current);return c.addEventListener("mousedown",i,!0),c.addEventListener("mouseup",o,!0),c.addEventListener("touchstart",i,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",i,!0),c.removeEventListener("mouseup",o,!0),c.removeEventListener("touchstart",i,!0),c.removeEventListener("touchend",s,!0)}}),[t,e,a,l,n])}const mo=e=>{const{pivotRef:t,getRowKey:n,size:r}=il(),{scrollbarRef:a,clicked:i,setHighlightKey:o,setClicked:s}=Dl(),{flatGroupData:c}=t.current,{rowHighlight:d}=t.current.props,u=l().useMemo((()=>2*ai.rowHeightMaps[r]),[r]),m=l().useMemo((()=>c.filter((e=>!Zi(e)))),[c]),p=G((t=>{const{keyCode:r}=t;if(!ie(i)&&(27===r&&(o(""),s([])),38===r||40===r)){Me(t);const l=m.length;let c=m.findIndex((e=>n(e,e.index)===i[0]));const p=38===r?(--c+l)%l:++c%l,h=m[p],f=n(h,h.index);d&&!d.disabled?.(h)&&(o(f),d.onChange?.(f,h)),((t,n,r)=>{const i=m.length,l=e.find((e=>e.key===r)),o=a.current.scrollTop,s=a.current.container.offsetHeight,c=l.top,d=l.height;"top"===t?c<o?a.current.SET_SCROLL_TOP(c):n===i-1&&a.current.SET_SCROLL_TOP(c-(s-d)):c+d>o+(s-u)?a.current.SET_SCROLL_TOP(c-(s-u-d)):0===n&&a.current.SET_SCROLL_TOP(c)})(38===r?"top":"bottom",p,f),s([f,i[1]])}}));l().useLayoutEffect((()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p))),[])},po=()=>l().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"})),ho=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M839.111111 269.198222V122.908444A9.159111 9.159111 0 0 0 829.980444 113.777778H208.213333A9.159111 9.159111 0 0 0 199.111111 122.908444v146.289778c0 5.034667 4.124444 9.159111 9.130667 9.159111h64a9.159111 9.159111 0 0 0 9.159111-9.159111V196.067556h192v640h-105.159111a9.159111 9.159111 0 0 0-9.130667 9.130666v64c0 5.034667 4.124444 9.159111 9.130667 9.159111h301.738666a9.159111 9.159111 0 0 0 9.130667-9.159111v-64a9.159111 9.159111 0 0 0-9.130667-9.130666h-105.159111v-640h192v73.130666c0 5.034667 4.124444 9.159111 9.159111 9.159111h64a9.159111 9.159111 0 0 0 9.130667-9.159111z"})),fo=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M887.65217391 606.59279489a31.26857185 31.26857185 0 0 1-31.26857185-31.26857087v-363.48819946L158.38608696 909.83354065a31.26857185 31.26857185 0 1 1-44.21962762-44.21962761l697.99751609-698.06906805h-363.48819945a31.26857185 31.26857185 0 0 1 0-62.46559075h439.04795087c17.17267109 0 31.26857185 13.95279489 31.26857086 31.19701891v439.04795087a31.26857185 31.26857185 0 0 1-31.3401238 31.26857087z"})),go=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M606.4 103.424a64 64 0 0 1 0.704 0.64l320.256 280.32a64 64 0 0 1 7.104 89.024l-330.432 398.72 320.448 0.128a32 32 0 0 1 0 64.064H397.632a32.128 32.128 0 0 1-6.208-0.64h-20.736a64 64 0 0 1-42.304-16.064l-238.08-210.112A64 64 0 0 1 83.84 620.16l432.32-509.312a64 64 0 0 1 90.24-7.36zM242.048 537.536l-87.04 101.76a32 32 0 0 0 3.584 45.248l213.12 180.672a32 32 0 0 0 20.736 7.616l-0.64-0.064a32.192 32.192 0 0 1 5.76-0.512h102.016a32 32 0 0 0 18.176-10.496l40.96-47.232-316.672-276.992zM592.96 177.28a32 32 0 0 0-45.12 3.456L283.712 488.96l316.928 277.248 264.512-304.96a32 32 0 0 0 1.024-40.704l-3.904-4.16-268.928-238.72a32 32 0 0 0-0.384-0.32z"})),yo=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M607.75537778 291.05948444H223.6416l115.34336-115.41617778a36.37248 36.37248 0 1 0-51.48216889-51.44576L132.61937778 279.04455111c-13.54410667 13.50769778-21.04433778 31.67573333-21.11715556 50.97244444a71.72551111 71.72551111 0 0 0 21.11715556 51.51857778l154.88341333 154.91982222a36.29966222 36.29966222 0 0 0 51.48216889 0 36.37248 36.37248 0 0 0 0-51.48216889l-121.46005333-121.16878222H607.75537778c130.70791111 0 237.02186667 106.16832 237.02186667 236.65777777s-106.31395555 236.65777778-237.02186667 236.65777778h-254.13404445a36.40888889 36.40888889 0 0 0 0 72.81777779h254.13404445c170.83050667 0 309.83964445-138.82709333 309.83964444-309.47555557 0-170.64846222-139.00913778-309.47555555-309.83964444-309.47555555"})),bo=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M512 680.20451555l354.04003555-354.04003556a48.54556445 48.54556445 0 0 1 68.64213334 68.64213334L546.32220445 783.16999111a48.54556445 48.54556445 0 0 1-68.64213334 0L89.31555555 394.80775111a48.54556445 48.54556445 0 0 1 68.64327112-68.64327112L512 680.20451555z"})),vo=e=>{const{column:t,keyPath:n,type:r}=e,{prefixCls:a,countMethod:i,summationData:o,setCountMethod:s}=il(),{t:c}=U(),{dataIndex:d,filter:u}=t,[m,p]=l().useState(!1),h=l().useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:nl.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:nl.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:nl.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:nl.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:nl.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:nl.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:nl.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:nl.avg}];return"number"===u?.type?e:e.slice(0,-4)}),[]),f=l().useMemo((()=>{const e=i[d];if(!e)return c("qm.pivotGrid.count.statistic");const t=h.find((t=>t.value===e)).text,a=((e,t)=>t?Ji(e,t):e)(o,n)?.[r]?.[d]??"";return t+" "+rr(a)}),[o,i]);return l().createElement(R.Dropdown,{open:m,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},h.map((e=>{const t=e.value===i[d];return l().createElement("li",{key:e.value,className:xe()("ant-dropdown-menu-item check-item",{active:t}),onClick:()=>{s({[d]:t?void 0:e.value}),p(!1)}},l().createElement("span",{className:"label"},e.text),l().createElement("i",{className:"icon"},l().createElement(we.CheckOutlined,null)))})))),className:xe()("count-select",{show:!!i[d]}),overlayClassName:`${a}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},l().createElement("span",null,f," ",l().createElement(we.CaretDownOutlined,{className:"icon"})))},xo=(e,t)=>{const{pivotRef:n,columns:r,expandedKeys:a,searchResults:i,switchIndex:o,fillColorCells:s,setExpandedKeys:c}=il(),{gridRef:d,indentDepth:u,highlightKey:m,checkedColumnKey:p,selectionKeys:h,treeExpandKeys:f,setSelectionKeys:g,setTreeExpandKeys:y,setHighlightKey:b,setClicked:v}=Dl(),{keyRecordMap:x,isTree:E}=n.current,{bodyEl:w,rowVirtualizer:C}=d.current,{rowSelection:S,treeExpandable:N,rowHighlight:T,openRowDraggable:I,onRowEdit:O,onRowClick:k}=n.current.props,{t:L}=U(),{renderText:P,getTitleFromCellNode:A}=hi(),{selectionColumn:F,operationColumn:_,treeTable:q}=ai,{indentWidth:D}=Yi,H=l().useMemo((()=>t?0:Xi(r).length-e.length),[r,e]),$=l().useMemo((()=>"radio"!==S?.type),[S]),M=(e,t)=>{const n=$?e?[...h,t]:h.filter((e=>e!==t)):[t];g(n),S?.onSelect?.(e,x.get(t)),S?.onChange?.(n,K(n))},K=e=>{const t=[];return e.forEach((e=>t.push(x.get(e)))),t},z=(e,t)=>i[o]?.rowKey===e&&i[o]?.dataIndex===t,V=(e,t)=>{const n=w.querySelectorAll(`li.table-row[data-row-key='${e}']`);Array.from(n).forEach((e=>{e.classList[t&&!C?.isScrolling?"add":"remove"]("row--hover")}))},j=(n,i,o,s)=>{const{dataIndex:d,width:m,renderWidth:p}=n,h={"expandable-column":d===F},f=i===(t?e.length>1?1:0:-1)?(u-o._groupLevel)*D:0,g={width:`${(m||p||0)+f}px`,minWidth:`${(m||p||0)+f}px`};return l().createElement("div",{key:d,className:xe()("label-cell",h),style:g},d!==F?l().createElement(l().Fragment,null,1===i&&l().createElement("span",{className:"title"},(e=>{const{_record:t,_fieldName:n}=e,a=Jn(t,n),i=r.find((e=>e.dataIndex===n));return ie(a)||!i?l().createElement("span",{className:"empty"},L("qm.pivotGrid.group.empty")):i.render?i.render(a,t,i,0,0):P(a,i,t)})(o)),d!==_&&l().createElement(vo,{column:n,keyPath:o.id,type:"subtotal"})):(e=>l().createElement("button",{className:xe()("button-icon",{expand:a.includes(e.id)}),onClick:()=>{return t=e.id,void c(a.includes(t)?a.filter((e=>e!==t)):[...a,t]);var t}},l().createElement(we.CaretRightOutlined,null)))(o))},W=(e,t,n,r,a)=>{const{dataIndex:i,width:o,renderWidth:c,align:d,render:u}=e,m=Jn(n,i),g=u?u(m,n,e,n.index,t):P(m,e,n),w=A(g),C=h.includes(a),L={"selection-column":i===F,"col--center":"center"===d,"col--right":"right"===d,"col--checked":p===i,active:z(a,i)},D={width:`${o||c||0}px`,minWidth:`${o||c||0}px`,backgroundColor:s.get(`${a}|${i}`)};return l().createElement("div",{key:i,"data-col-index":t,title:w,className:xe()("table-cell",L),style:D,onClick:t=>{[F,_].includes(i)||(v([a,i]),T&&!T.disabled?.(n)&&(b(a),T.onChange?.(a,n)),k?.(n,e,t))}},i!==F?l().createElement(l().Fragment,null,E&&1===t&&l().createElement(l().Fragment,null,(H=n._level)?l().createElement("span",{key:H,className:`cell--indent indent-level-${H}`,style:{marginTop:-1,width:H*q.textIndent}},new Array(H).fill(null).map(((e,t)=>l().createElement("i",{key:t,className:"line"})))):null,((e,t)=>{const n=N?.rowExpandable?.(e);return e.children?.length?l().createElement("span",{className:xe()("cell--expand",{fold:!f.includes(t),disabled:n}),onClick:()=>{n||(e=>{const t=f.includes(e),n=t?f.filter((t=>t!==e)):[...f,e];y(n),N?.onExpand?.(!t,x.get(e)),N?.onChange?.(n)})(t)}},l().createElement("span",{className:"anticon icon"},l().createElement(bo,null))):l().createElement("span",{className:"cell--indent",style:{marginTop:-1,width:q.textIndent}})})(n,a)),l().createElement("span",{className:"cell"},g)):l().createElement("div",{className:"action"},I?l().createElement("span",{className:"drag-icon"},l().createElement(we.HolderOutlined,null)):l().createElement("span",{style:{width:20}}),l().createElement("div",{className:"middle"},l().createElement("span",{className:"order"},((e,t)=>E?0===e._level?e._varIndex+1:null:t+1)(n,r)),S&&l().createElement(l().Fragment,null,$?l().createElement(R.Checkbox,{className:"checkbox",checked:C,disabled:S?.disabled?.(n),onChange:e=>M(e.target.checked,a)}):l().createElement(R.Radio,{className:"checkbox",checked:C,disabled:S?.disabled?.(n),onChange:e=>M(e.target.checked,a)}))),O?l().createElement("span",{className:"expand-icon",onClick:()=>O(n,r)},l().createElement(we.ExpandAltOutlined,null)):l().createElement("span",{style:{width:20}})));var H};return{renderGroupRow:(t,n)=>l().createElement("div",{className:"label-row"},e.map(((e,n)=>j(e,H+n,t)))),renderRow:(t,n,r)=>{const a={"row--selection":h.includes(r),"row--highlight":m===r};return l().createElement("li",{key:r,"data-row-key":r,className:xe()("table-row",a),onMouseEnter:()=>V(r,!0),onMouseLeave:()=>V(r)},e.map(((e,a)=>W(e,H+a,t,n,r))))}}},Eo=e=>{const{layout:t,displayList:n,virtualRows:r,notGroup:a}=e,{fixedWidth:i,gridColumns:o}=Dl(),s=l().useMemo((()=>o.filter((e=>"left"===e.fixed))),[o]),{renderGroupRow:c,renderRow:d}=xo(s,!0);return l().createElement("div",{className:"left-panel",style:{width:i}},l().createElement("div",{className:xe()("container",{"no-group":a})},r.map((e=>{const r=e.index,a=t[r],i=n[r];if(Zi(i))return l().createElement("div",{key:i.id,className:xe()("group-label",`level${i._groupLevel}`),style:{top:a.top,left:a.left,right:0,height:a.height}},c(i,a.key));const o=r===t.length-1||Zi(n[r+1]);return l().createElement("div",{key:a.key,className:xe()("row-item",{"is-leaf":i._level,last:o}),style:{top:a.top,left:a.left,right:0,height:a.height}},d(i,i._varIndex,a.key))}))))},wo=e=>{const{layout:t,displayList:n,virtualRows:r,notGroup:a}=e,{pivotRef:i}=il(),{gridColumns:o}=Dl(),s=l().useMemo((()=>o.filter((e=>"left"!==e.fixed))),[o]),{renderGroupRow:c,renderRow:d}=xo(s);return l().createElement("div",{className:"main-panel"},l().createElement("div",{className:xe()("container",{"no-group":a})},r.map((e=>{const r=e.index,a=t[r],i=n[r];if(Zi(i))return l().createElement("div",{key:i.id,className:xe()("group-label",`level${i._groupLevel}`),style:{top:a.top,left:0,right:a.right,height:a.height}},c(i,a.key));const o=r===t.length-1||Zi(n[r+1]);return l().createElement("div",{key:a.key,className:xe()("row-item",{last:o}),style:{top:a.top,left:0,right:a.right,height:a.height}},d(i,i._varIndex,a.key))}))))},Co=()=>{const{pivotRef:e,getRowKey:t,prefixCls:n,size:r,groupGridData:a,expandedKeys:i,searchResults:o,switchIndex:s}=il(),{scrollbarRef:c,gridColumns:d,treeExpandKeys:u,setGridLayoutRef:m}=Dl(),{flatGroupData:p}=e.current,{contextMenues:h}=e.current.props,{groupMargin:f}=Yi,{rowHeightMaps:g}=ai,y=l().useRef(null),b=l().useMemo((()=>Array.isArray(a)),[a]),{contextMenu:v,closeMenu:x}=(({ref:e,popup:t,getTriggerContainer:n,prevent:r,prefixCls:a="",enabled:i=!0})=>{const o=l().useRef(null),s=l().useRef(null),c=e=>{s.current=e},[d,u]=l().useState(!1),[m,p]=l().useState(null),h={width:150,height:200,zIndex:9999};uo({ref:o,handler:()=>f()});const f=()=>{u(!1),p(null),c(null)},g=G((e=>{if(e.preventDefault(),r?.(e.target))return f();c(e),u(!0),re((()=>{const{width:t,height:n}=o.current?.getBoundingClientRect()||h,r=t,a=n,i=window.innerWidth,l=window.innerHeight;let s=e.clientX,c=e.clientY;s+r>i&&(s=Math.max(s-r,0)),c+a>l&&(c=Math.max(c-a,0)),p({x:s,y:c})}))}));l().useEffect((()=>{const t=n?.(e.current)||e.current;return i&&t&&t.addEventListener("contextmenu",g),()=>{t&&t.removeEventListener("contextmenu",g)}}),[e]);const y={position:"fixed",top:`${m?.y||0}px`,left:`${m?.x||0}px`,zIndex:h.zIndex};return{contextMenu:l().createElement($l(),{open:d},l().createElement("div",{ref:o,className:`${a}__context-menu`,style:y},s.current?t(s.current):null)),closeMenu:f}})({ref:y,prevent:e=>e.offsetParent.classList.contains("group-label"),prefixCls:n,enabled:!!h,popup:e=>{const n=Be(e.target,"table-cell"),r=n?.parentNode?.getAttribute("data-row-key")||"",a=p.find((e=>t(e,e.index)==r)),i=Number(n?.getAttribute("data-col-index")||-1),o=d[i];return l().createElement("ul",{className:"ant-dropdown-menu",style:{padding:5}},h.map((e=>{const t=e.disabled?.(a,o)||!1;return l().createElement("li",{key:e.key,className:xe()("ant-dropdown-menu-item",{"ant-dropdown-menu-item-disabled":t}),onClick:()=>{t||(re((()=>x())),e.onClick?.(a,o))}},e.prefix&&l().createElement("span",{className:"prefix"},e.prefix),l().createElement("span",{className:"label"},e.label),e.suffix&&l().createElement("span",{className:"suffix"},e.suffix))})))}}),E=e=>{const t=p[e];for(let n=e+1;n<p.length;n++)if(p[n]._parentRowKey?.startsWith(t.id)){Object.assign(t,{_record:p[n]});break}},w=l().useMemo((()=>{const e=new Map,n=[];return p.forEach(((r,a)=>{if(Zi(r)){if(0===r._groupLevel)return e.set(r.id,i.includes(r.id)),E(a),void n.push(r);const t=r.id.slice(0,r.id.lastIndexOf(Yi.separator));return void(i.includes(t)&&e.get(t)&&(e.set(r.id,i.includes(r.id)),E(a),n.push(r)))}const l=t(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(l,u.includes(l)),n.push(r))})),e.clear(),n}),[a,i,u]),C=l().useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],a=[],i=n,l=Yi.indentWidth,o=Yi.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;a.length>0&&a[a.length-1]._level>=e._groupLevel;){const e=a.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,a.length>0){const t=a[a.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}a[a.length-1];const t={key:e.id,top:s,left:l*e._groupLevel,right:l*e._groupLevel,height:i,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),a.push(t),s+=i}else{const n=a[a.length-1]||{left:0,right:0},l={key:t(e,e.index),top:s,left:n.left,right:n.right,height:i};r.push(l),s+=i,a.length>0&&(n._childHeight+=i)}}));a.length>0;){const e=a.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,a.length>0){const t=a[a.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(w,{getRowKey:t,rowHeight:g[r]})),[w,r]);mo(C);const S=l().useMemo((()=>!w.length),[w]),N=l().useMemo((()=>{if(S)return 106;if(b)return C.reduce(((e,t)=>e+t.height),0)+2*f;const e=C.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*f+2*f}),[S,b,C]),{rowVirtualizer:T,virtualRows:I}=(e=>{const{layout:t,isGroup:n}=e,{size:r}=il(),{scrollbarRef:a}=Dl(),{rowHeightMaps:i}=ai,o=l().useMemo((()=>a.current?.scrollElement||null),[a.current]),s=lo({count:t.length,getScrollElement:()=>o,estimateSize:e=>t[e].height,overscan:1,noCache:n,rangeExtractor:e=>{if(!n)return Xl(e);const a=e.offset,l=s.scrollElement.offsetHeight,o=[];for(let n=0;n<e.count;n++){const e=t[n];a>e.top+e.height+i[r]||a+l+i[r]<e.top||o.push(n)}return o}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:C,isGroup:!b});De((()=>{const e=p.findIndex((e=>t(e,e.index)===o[s]?.rowKey));e>=0&&c.current.SET_SCROLL_TOP(e*g[r]);const n=d.findIndex((e=>e.dataIndex===o[s]?.dataIndex));if(n>=0){const e=d.slice(0,n).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);c.current.SET_SCROLL_LEFT(e)}}),[s,o]),l().useLayoutEffect((()=>{m("bodyEl",y.current),m("rowVirtualizer",T)}),[]);const R={layout:C,displayList:w,virtualRows:I,notGroup:b};return l().createElement("div",{ref:y,className:"body",style:{height:N}},S?l().createElement(dt,{className:"content-empty"}):l().createElement(l().Fragment,null,l().createElement(Eo,R),l().createElement(wo,R),v))},So=()=>{const{groupGridData:e,countMethod:t,setSummationData:n}=il(),{indentDepth:r,fixedWidth:a,gridColumns:i}=Dl(),{selectionColumn:o}=ai,{indentWidth:s}=Yi,c=l().useMemo((()=>i.filter((e=>"left"===e.fixed))),[i]),d=l().useMemo((()=>i.filter((e=>"left"!==e.fixed))),[i]);De((()=>{n(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const a=e.map((e=>le(e,r)));n[r]=t[r](a)}return n},a=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const i={},l={};Object.keys(t).forEach((e=>{l[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>le(e,n)));e[n]=t[n](r),l[n].push(...r)}i[r]={subtotal:e}}else{const e=a(o);i[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&l[n].push(t)}}}if(0===n.length)return i;const o={};for(const e in t)o[e]=t[e](l[e]);return i.subtotal=o,i},i=Array.isArray(e)?{total:r(e)}:a(e);return n.length>0&&(i.total=r(n)),delete i.subtotal,i})(e,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:nl[e[n]]});return t})(t)))}),[t,e]);const u=(e,t)=>l().createElement("div",{className:xe()(t?"fixed-left":"no-fixed"),style:{width:t?a:""}},e.map(((n,a)=>{const{dataIndex:i,width:c,renderWidth:d}=n,u={"selection-column":i===o,"col--right":!0},m=a===(t?e.length>1?1:0:e.length-1)?r*s:0,p={width:`${(c||d||0)+m}px`,minWidth:`${(c||d||0)+m}px`};return l().createElement("div",{key:i,className:xe()("table-cell",u),style:p},i!==o?l().createElement(vo,{column:n,keyPath:"",type:"total"}):null)})));return l().createElement("div",{className:"footer"},u(c,!0),u(d))},No=()=>{const{prefixCls:e,size:t}=il(),n=l().useRef(null);return l().createElement(ql,{scrollbar:n},l().createElement(At,{ref:n,wrapStyle:{height:"100%",maxHeight:"inherit"},className:xe()(`${e}__layout`,t)},l().createElement(zl,null),l().createElement(Co,null),l().createElement(So,null)))},To=()=>l().createElement("div",{className:"wrapper"},l().createElement(No,null)),Io={rowKey:"id",columns:[],dataSource:[]},Ro=e=>{const t=h(Io,e),{rowKey:n,fromTable:r,columns:a,dataSource:i,height:o,maxHeight:s,className:c,style:d}=t,{$size:u}=Y(t),m=G(((e,t)=>{const r="function"==typeof n?n(e,t):e?.[n];return void 0===r?(me("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r})),p=(e,t="",n=0)=>e.map(((e,r)=>{const a=m(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=p(e.children,a,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),f=l().useMemo((()=>(e=>{let t=(e=>e.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex"].includes(e.dataIndex))))(e).map((e=>({...e,fixed:"left"===e.fixed?"left":void 0,editRender:void 0})));return r&&(t=t.filter((e=>![ai.operationColumn].includes(e.dataIndex)))),t})(a)),[a]),g=l().useMemo((()=>p(i)),[i]),y=Ee("pivot-grid"),b={[y]:!0,"is-from-table":r},v={height:o,maxHeight:s},x={prefixCls:y,size:u,getRowKey:m,flatColumns:f,tableData:g,pivotProps:oe(t,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return l().createElement("div",{className:xe()(b,c),style:{...d,...v}},l().createElement(al,x,l().createElement(Fl,null),l().createElement(To,null)))};Ro.displayName="PivotGrid";const Oo=Ro,ko=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{tableRef:r,prefixCls:a,flattenColumns:i}=l().useContext(Ha),{rowKey:o,uniqueKey:s}=r.current.props,{t:c}=U(),{tableFullData:d}=r.current,[u,m]=l().useState(!1),p=()=>{m(!0)};l().useImperativeHandle(t,(()=>({clickHandle:p})));const h={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>m(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${a}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>p()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.LineChartOutlined,null))),l().createElement(yn,h,l().createElement(Oo,{fromTable:!0,rowKey:o,uniqueKey:s,columns:i,dataSource:d})))}));ko.displayName="PivotGrid";const Lo=ko,Po=e=>{const{columns:t,group:n,summary:r}=e,{tableRef:a,$size:i,pagination:o,fetchParams:s,isFetch:d}=l().useContext(Ha),{fetch:u}=a.current.props,{t:m}=U(),p=e=>{const n=t.find((t=>t.dataIndex===e));return{title:n.title,precision:n.precision,dictItems:n.dictItems??[]}},h=n.map((e=>({dataIndex:e.group,...p(e.group)}))),f=r.map((e=>e.summary===ai.groupSummary.total.value?{dataIndex:e.summary,title:ai.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),g=l().useMemo((()=>Object.assign({},s,{[ai.sorterFieldName]:void 0,[ai.groupSummary.summaryFieldName]:r.map((e=>`${e.formula}|${e.summary}`)).join(","),[ai.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[ai.currentPageName]:1})),[s,n,r]),[y,b]=l().useState(((e,n)=>[{title:m("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...n.map((e=>{const n=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let r=n?{summation:n}:null;return e.dataIndex===ai.groupSummary.total.value&&(r={dataIndex:ai.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),{...e,..."count"===e.formula||"sum"===e.formula?r:null}}))])(h,f)),[v]=l().useState(d?[]:(e=>{const t=mr(e,n.map((e=>e.group))),a=[];return t.forEach((e=>{const t={};y.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&er(t,r,Jn(e[0],r))})),r.forEach((n=>{const r=n.summary!==ai.groupSummary.total.value?n.summary:ai.groupSummary.recordTotalIndex,a=n.formula;"count"===a&&er(t,r,e.length),"sum"===a&&er(t,r,(0,X.sumBy)(e,r)),"max"===a&&er(t,r,(0,X.maxBy)(e,r)[r]),"min"===a&&er(t,r,(0,X.minBy)(e,r)[r]),"avg"===a&&er(t,r,((0,X.sumBy)(e,r)/e.length).toFixed(2))})),a.push(t)})),a})(a.current.tableFullData)),x={size:i,height:400,...d?{fetch:{api:u.api,params:g,dataKey:u?.dataKey}}:{dataSource:v},columns:y,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${c()().format(Ba)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>b(e)};return l().createElement(Tc,x)},Ao=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,prefixCls:a,$size:i,flattenColumns:s}=l().useContext(Ha),{uniqueKey:c}=r.current.props,{t:d}=U(),u=l().useRef(null),m=l().useRef(null),[p,h]=l().useState(!1),[f,g]=l().useState([]),[y,b]=l().useState(""),[v,x]=l().useState("");De((()=>{if(v){const{group:e,summary:t}=f.find((e=>e.value===v)).list;I(e),P(t)}else{const e=q();I(e?.group||[]),P(e?.summary||[])}}),[v]),l().useEffect((()=>{D()}),[]);const E=l().useMemo((()=>c?`summary_${c}`:""),[c]),w=l().useMemo((()=>s.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(e.dataIndex)))),[s]),C=w.filter((e=>!e.groupSummary)).map((e=>({text:cr(e.title),value:e.dataIndex}))),S=[ai.groupSummary.total,...w.filter((e=>!!e.groupSummary)).map((e=>({text:cr(e.title),value:e.dataIndex})))],N=[{text:d("qm.table.groupSummary.sumText"),value:"sum"},{text:d("qm.table.groupSummary.maxText"),value:"max"},{text:d("qm.table.groupSummary.minText"),value:"min"},{text:d("qm.table.groupSummary.avgText"),value:"avg"},{text:d("qm.table.groupSummary.countText"),value:"count"}],[T,I]=l().useState([]),[O,k]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(t)}},d("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:d("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:C.map((e=>({...e,disabled:T.findIndex((t=>t.group===e.value))>-1})))})}]),[L,P]=l().useState([]),[A,F]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{m.current.REMOVE_RECORDS(t)}},d("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:d("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:S.map((e=>({...e,disabled:L.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:d("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===ai.groupSummary.total.value?N.slice(N.length-1):N})}]),_=l().useMemo((()=>{const e=T.length&&T.every((e=>Object.values(e).every((e=>""!==e)))),t=L.length&&L.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[T,L]),q=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},D=async()=>{if(!E)return;const e=q();if(e){const{group:t,summary:n}=e;I(t),P(n)}let t=await Wi().getItem(E);t||(t=await H(E),Array.isArray(t)&&await Wi().setItem(E,t)),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))},H=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},$=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},M={visible:p,title:d("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>h(!1)};return l().createElement("div",{className:`${a}-group-summary__setting`},l().createElement("div",{className:"main"},l().createElement("div",{style:{width:"30%"}},l().createElement(Tc,{ref:u,size:i,columns:O,dataSource:T,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{I(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(we.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"container line"},l().createElement(Tc,{ref:m,size:i,columns:A,dataSource:L,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onDataChange:e=>{P(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(we.PlusOutlined,null),onClick:()=>{m.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(R.Input,{size:i,value:y,placeholder:d("qm.table.groupSummary.configText"),disabled:_,onChange:e=>{const{value:t}=e.target;b(t)}}),l().createElement(fe,{type:"primary",disabled:!y||_,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return me("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=or(),t=[...f,{text:y,value:e,list:{group:T.filter((e=>!!e.group)),summary:L.filter((e=>!!e.summary))}}];g(t),x(e),b(""),await Wi().setItem(E,t),await $(E,t)})()},d("qm.table.groupSummary.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${ai.rowHeightMaps[i]}px`}},l().createElement("span",null,d("qm.table.groupSummary.savedSetting"))),l().createElement("ul",null,f.map((e=>l().createElement("li",{key:e.value,className:xe()({selected:e.value===v}),title:e.text,onClick:()=>{return t=e.value,void x(t!==v?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:d("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));g(t),e===v&&x(""),await Wi().setItem(E,t),await $(E,t)})(e.value)}},l().createElement(we.CloseCircleOutlined,null))))),!f.length&&l().createElement("div",{style:{padding:Ka}},l().createElement(dt,null)))))),l().createElement(yn,M,l().createElement(Po,{columns:w,group:T,summary:L})),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>t(),style:{marginRight:8}},d("qm.table.groupSummary.closeButton")),l().createElement(fe,{type:"primary",disabled:_,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:T.filter((e=>!!e.group)),summary:L.filter((e=>!!e.summary))})),void h(!0))},d("qm.table.groupSummary.confirmButton"))))},Fo=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r}=l().useContext(Ha),{t:a}=U(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c={visible:i,title:a("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${r}-group-summary`,title:a("qm.table.groupSummary.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.PieChartOutlined,null))),l().createElement(yn,c,l().createElement(Ao,{onClose:()=>o(!1)})))}));Fo.displayName="GroupSummary";const _o=Fo,qo=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,$size:a,prefixCls:i,flattenColumns:s,setSuperFilters:c,clearTableFilter:d,clearPagerFilter:u}=l().useContext(Ha),{uniqueKey:m}=r.current.props,{t:p}=U(),h=l().useRef(null),[f,g]=l().useState([]),[y,b]=l().useState([]),[v,x]=l().useState(""),[E,w]=l().useState("");De((()=>{g(E?y.find((e=>e.value===E)).list:D()||[])}),[E]),l().useEffect((()=>{H()}),[]);const C=l().useMemo((()=>m?`superSearch_${m}`:""),[m]),S=l().useMemo((()=>s.filter((e=>!!e.filter))),[s]),N=ur(f),T=l().useMemo((()=>!(N&&Pn(N))),[N]),I=l().useMemo((()=>!!f.length&&T),[f,T]),O=[{value:"and",text:p("qm.table.highSearch.andText")},{value:"or",text:p("qm.table.highSearch.orText")}],k=s.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:cr(e.title)}))),L=e=>["in","nin"].includes(e),P=(e,t)=>{let n;switch(e){case"number":n="number";break;case"date":n="date";break;case"checkbox":case"radio":n=t?"select-multiple":"select";break;default:n="text"}return n},A=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")},{value:"nil",text:p("qm.table.highSearch.nullText")},{value:"nnil",text:p("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":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")},{value:"nil",text:p("qm.table.highSearch.nullText")},{value:"nnil",text:p("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",text:p("qm.table.highSearch.inText")},{value:"nlike",text:p("qm.table.highSearch.ninText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")},{value:"^=",text:p("qm.table.highSearch.startsWithText")},{value:"=$",text:p("qm.table.highSearch.endsWithText")},{value:"nil",text:p("qm.table.highSearch.nullText")},{value:"nnil",text:p("qm.table.highSearch.notNullText")}]}return t},[F,_]=l().useState([{title:p("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{h.current.REMOVE_RECORDS(t)}},p("qm.table.highSearch.removeText")))},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,t)=>l().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:k,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:p("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const n=Object.values(t)[0],r=S.find((e=>e.dataIndex===n))?.filter.type,a=A(r);e.fieldType=r,e.expression=n?a[0]?.value:"",e.condition=L(e.expression)?[]:"",n||(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=S.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:A(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=L(e.expression)?[]:""}}}},{title:p("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=S.find((t=>t.dataIndex===e.fieldName)),n=t?.filter.type,r=t?.filter?.items??t?.dictItems??[];return{type:P(n,L(e.expression)),editable:!0,items:r,extra:{disabled:!e.fieldName||xr(e.expression),cornerSign:!1}}}},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,t)=>l().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:O,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),q=()=>{C&&sessionStorage.setItem(C,JSON.stringify(f.filter((e=>!!e.fieldName))))},D=()=>{if(!C)return;const e=sessionStorage.getItem(C);return e?JSON.parse(e):null},H=async()=>{if(!C)return;const e=D();e&&g(e);let t=await Wi().getItem(C);t||(t=await $(C),Array.isArray(t)&&await Wi().setItem(C,t)),Array.isArray(t)&&t.length&&(b(t),!e&&w(t[0].value))},$=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},M=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}};return l().createElement("div",{className:`${i}-super-search__setting`},l().createElement("div",{className:"main"},l().createElement("div",{className:"container"},l().createElement(Tc,{ref:h,size:a,columns:F,dataSource:f,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>_(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(n)&&("bracketLeft"===n&&(e[n]=e[n]?"":"("),"bracketRight"===n&&(e[n]=e[n]?"":")"),g([...f]))},onDataChange:e=>{g(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(we.PlusOutlined,null),onClick:()=>{h.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),ai.highSearch.showSQL&&N&&l().createElement("code",{className:"lang-js"},N)),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(R.Input,{size:a,value:v,placeholder:p("qm.table.highSearch.configText"),disabled:T,onChange:e=>{const{value:t}=e.target;x(t)}}),l().createElement(fe,{type:"primary",disabled:!v||T,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!C)return me("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=or(),t=[...y,{text:v,value:e,list:f.filter((e=>!!e.fieldName))}];b(t),w(e),x(""),await Wi().setItem(C,t),await M(C,t)})()},p("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${ai.rowHeightMaps[a]}px`}},l().createElement("span",null,p("qm.table.highSearch.savedSetting"))),l().createElement("ul",null,y.map((e=>l().createElement("li",{key:e.value,className:xe()({selected:e.value===E}),title:e.text,onClick:()=>{return t=e.value,void w(t!==E?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=y.filter((t=>t.value!==e));b(t),e===E&&w(""),await Wi().setItem(C,t),await M(C,t)})(e.value)}},l().createElement(we.CloseCircleOutlined,null))))),!y.length&&l().createElement("div",{style:{padding:Ka}},l().createElement(dt,null)))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>t(),style:{marginRight:8}},p("qm.table.highSearch.closeButton")),l().createElement(fe,{type:"primary",disabled:I,onClick:()=>(d(),u(),c(f.map((e=>oe(e,["index","pageIndex"])))),q(),void t())},p("qm.table.highSearch.searchButton"))))},Do=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r}=l().useContext(Ha),{t:a}=U(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c={visible:i,title:a("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${r}-super-search`,title:a("qm.table.highSearch.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(we.FunnelPlotOutlined,null))),l().createElement(yn,c,l().createElement(qo,{onClose:()=>o(!1)})))}));Do.displayName="SuperSearch";const Ho=Do,$o=l().forwardRef(((e,t)=>{const{tableColumns:n,showFullScreen:r,showReload:a,showPrint:i,showImport:s,showExport:c,showClipboard:d,showCollection:u,showFastSearch:m,showSuperSearch:p,showPivotGrid:h,showGroupSummary:f,showToolBox:g}=e,{global:y}=l().useContext(o),{tableRef:b,$size:v,prefixCls:x,isFullScreen:E}=l().useContext(Ha),{uniqueKey:w,exportExcel:C}=b.current.props,{t:S}=U(),N=l().useRef(null),T=l().useRef(null),I=l().useRef(null),O=l().useRef(null),k=l().useRef(null),L=l().useRef(null),P=l().useRef(null),A=l().useRef(null),F=l().useRef(null),_=l().useRef(null),q=l().useRef(null),D=l().useRef(!1),H=l().useMemo((()=>w?`toolBox_${w}`:""),[w]),[$,M]=l().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),K={fullScreen:r,reload:a,print:i,import:s,export:c&&!C?.hideIcon,clipboard:d,collection:u,fastSearch:m,superSearch:p,pivotGrid:h,groupSummary:f},[z,V]=l().useState(!1);De((()=>{D.current&&(W(),D.current=!1)}),[$]),l().useEffect((()=>{j()}),[]),l().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!k.current)return me("Table","执行导出需要配置 `exportExcel` 参数");k.current.clickHandle()}})));const j=()=>{if(!H||!g)return;const e=JSON.parse(localStorage.getItem(H));e||B(H).then((e=>{e&&(M(Object.assign({},$,e)),localStorage.setItem(H,JSON.stringify(e)))})).catch((()=>{})),e&&M(Object.assign({},$,e))},W=()=>{if(!H||!g)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(H,JSON.stringify(e)),G(H,e)},B=async e=>{const t=y?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},G=async(e,t)=>{const n=y?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},Y=async e=>{V(!1),await ne(100),e.current.clickHandle()},X=(e,t)=>{D.current=!0,M(Object.assign({},$,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${x}--lg`]:"large"===v,[`${x}--sm`]:"small"===v};return l().createElement(l().Fragment,null,r&&l().createElement(ui,{ref:N,isFullScreen:E,open:!g||$.fullScreen}),a&&l().createElement(pi,{ref:T,open:!g||$.reload}),i&&l().createElement(gi,{ref:I,tableColumns:n,open:!g||$.print}),s&&l().createElement(Li,{ref:O,tableColumns:n,open:!g||$.import}),c&&l().createElement(Di,{ref:k,tableColumns:n,open:(!g||$.export)&&!C?.hideIcon}),d&&l().createElement(Mi,{ref:L,open:!g||$.clipboard}),u&&l().createElement(Vi,{ref:P,columns:n,open:!g||$.collection}),m&&l().createElement(Gi,{ref:A,open:!g||$.fastSearch}),h&&l().createElement(Lo,{ref:F,open:!g||$.pivotGrid}),f&&l().createElement(_o,{ref:_,open:!g||$.groupSummary}),p&&l().createElement(Ho,{ref:q,open:!g||$.superSearch}),g&&l().createElement(R.Dropdown,{open:z,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.screen.full"))),onClick:()=>Y(N)},{key:"reload",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.refresh.text"))),onClick:()=>Y(T)},{key:"print",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.print.text"))),onClick:()=>Y(I)},{key:"import",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.import.textNoSpace"))),onClick:()=>Y(O)},{key:"export",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.export.textNoSpace"))),onClick:()=>Y(k)},{key:"clipboard",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.clipboard.textNoSpace"))),onClick:()=>Y(L)},{key:"collection",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.selectCollection.text"))),onClick:()=>Y(P)},{key:"fastSearch",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.fastSearch.text"))),onClick:()=>Y(A)},{key:"pivotGrid",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.pivotGrid.text"))),onClick:()=>Y(F)},{key:"groupSummary",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.groupSummary.text"))),onClick:()=>Y(_)},{key:"superSearch",label:l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{checked:$.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.highSearch.text"))),onClick:()=>Y(q)}];return l().createElement(R.Menu,{items:e.filter((e=>K[e.key]))})})(),overlayClassName:xe()(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{V(e)}},l().createElement("span",{className:`${x}-toolbox`,title:S("qm.table.toolbox.text")},l().createElement("i",{className:"svgicon icon"},l().createElement(we.AppstoreAddOutlined,null)))))}));$o.displayName="ToolBox";const Mo=$o,Ko=(e,t)=>e.map((e=>(e.children&&(e.children=Ko(e.children,t)),t(e)))),zo=l().forwardRef(((e,t)=>{const{columns:n}=e,{global:r}=l().useContext(o),{tableRef:a,prefixCls:i,$size:s}=l().useContext(Ha),{showColumnDefine:c,uniqueKey:d,onlyShowIcon:u,columnsChange:m}=a.current.props,{t:p}=U(),h=l().useRef([]),[f,g]=l().useState(!1),y=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(n)),[n]),b=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(n)),[n]),v=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(n)),[n]),x=l().useMemo((()=>d?`table_${d}`:""),[d]);De((()=>{E(n)}),[n]),l().useLayoutEffect((()=>{w()}),[]),l().useImperativeHandle(t,(()=>({initialHandler:w})));const E=e=>{if(!x)return;const t=qn(e),n=JSON.parse(localStorage.getItem(x));a.current.columnsDefined&&!(0,X.isEqual)(t,n)&&(localStorage.setItem(x,JSON.stringify(t)),(async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(x,t))},w=()=>{const e=(()=>{if(!x)return;const e=JSON.parse(localStorage.getItem(x));return e||(async e=>{const t=r?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(x).then((e=>{e?(localStorage.setItem(x,JSON.stringify(e)),w()):r?.getComponentConfigApi&&E(n)})).catch((()=>{})),e?(0,X.xor)(Dn(e).map((e=>e.dataIndex)),Dn(n).map((e=>e.dataIndex))).length>0?Ko(n,(t=>{const n=$n(e,t.dataIndex);return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Ko(e,(e=>{const t=$n(n,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();var t;e&&(t=C(e),h.current=t,m?.(e))},C=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((n,r)=>{const a=n.colSpan;a>1&&e.slice(r+1,r+a).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+a))})),t},S=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:a}=n;if(0===r)return;if(1===r)return t.push(n);const i=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(a)));if(-1===i)return t.push(n);t.push(...h.current[i].map((({dataIndex:t},r)=>{const a=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(a.hidden=n.hidden),void 0!==n.fixed?a.fixed=n.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),m?.(t)},N=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,S(n))},T=(e,t)=>{const{colSpan:r,noFixed:a}=e;if(0===r)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=cr(e.title),o=["svgicon","handle",`${t}-handle`],s=l().createElement("li",{key:e.dataIndex,className:"item"},l().createElement(R.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,S(n)}}),l().createElement("i",{className:xe()(o),title:p("qm.table.columnFilter.draggable")},l().createElement(we.HolderOutlined,null)),l().createElement("span",{className:"text",title:i},i),"main"===t?l().createElement("span",{className:xe()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>N(e,"left")},l().createElement(we.StepBackwardOutlined,null)),l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>N(e,"right")},l().createElement(we.StepForwardOutlined,null))):"sub"!==t?l().createElement("span",{className:xe()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>N(e)},l().createElement(we.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?l().createElement(R.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:I(e.children,e.dataIndex)},s):s},I=(e,t)=>l().createElement("div",{className:"column-filter--wrap"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:r=>{const a=r.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,X.isEqual)(a,i)||((e,t)=>{$n(n,t).children=e,m?.([...n])})(yr(r),t)}},e.map((e=>T(e,"sub"))))),O={[`${i}__popper`]:!0,"column-filter__popper":!0,[`${i}--lg`]:"large"===s,[`${i}--sm`]:"small"===s},k=[`${i}-column-filter`,{selected:f}];return c?l().createElement(Ai(),{action:["click"],popupVisible:f,popup:l().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"reset"},l().createElement(fe,{type:"text",size:"small",onClick:()=>{const e=Dn(n),t=n=>n.filter((t=>e.find((e=>e.dataIndex===t.dataIndex)))).map((n=>{const r=e.find((e=>e.dataIndex===n.dataIndex)),a=Object.assign({},r,n);return delete a.renderWidth,void 0===n.hidden&&delete a.hidden,void 0===n.fixed&&delete a.fixed,void 0===n.width&&delete a.width,n.children&&(a.children=t(n.children)),a}));m?.(t(a.current.originColumns))}},p("qm.table.columnFilter.reset"))),l().createElement("div",{className:"left"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),n=y.map((e=>e.dataIndex));(0,X.isEqual)(t,n)||S([...yr(e),...v,...b])}},y.map((e=>T(e,"left"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"main"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),n=v.map((e=>e.dataIndex));(0,X.isEqual)(t,n)||S([...y,...yr(e),...b])}},v.map((e=>T(e,"main"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"right"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),n=b.map((e=>e.dataIndex));(0,X.isEqual)(t,n)||S([...y,...v,...yr(e)])}},b.map((e=>T(e,"right")))))),popupClassName:xe()(O),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{g(e)},builtinPlacements:Ua,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:xe()(k),title:u?p("qm.table.columnFilter.text"):void 0},l().createElement("i",{className:"svgicon icon"},l().createElement(we.SettingOutlined,null)),!u&&l().createElement("span",null,p("qm.table.columnFilter.text")))):null}));zo.displayName="ColumnFilter";const Vo=zo,jo=l().createContext({}),Wo=()=>l().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().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"})),Bo=l().forwardRef(((e,t)=>{const{dataIndex:n,className:r,style:a}=e;return l().createElement("li",{ref:t,"data-index":n,className:xe()("list-item",r),style:a},e.children)}));Bo.displayName="ListItem";const Uo=Bo,Go=l().forwardRef(((e,t)=>{const{dataSource:n=[],height:r,maxHeight:a,itemHeight:i,renderItem:o,onScroll:s,className:c}=e,d=l().useRef(null),u=lo({count:n.length,getScrollElement:()=>d.current?.scrollElement||null,estimateSize:()=>i||40,overscan:3,onChange:(e,t)=>s?.(e,t)}),m=u.getVirtualItems();l().useImperativeHandle(t,(()=>({SCROLL_TO_INDEX:e=>u.scrollToIndex(e),SCROLL_TO_OFFSET:e=>u.scrollToOffset(e)})));const p=Ee("virtual-list");return l().createElement(At,{ref:d,wrapStyle:{height:r,maxHeight:a},className:xe()(p,c),style:e.style},l().createElement("div",{className:"container",style:{height:u.getTotalSize()}},l().createElement("ul",{style:{transform:`translateY(${m[0]?.start??0}px)`}},m.map((e=>l().createElement(Uo,{ref:u.measureElement,key:e.index,dataIndex:e.index,style:{height:i}},o?.(n[e.index],e.index)))))))}));Go.displayName="VirtualList";const Yo=Go,Xo=e=>{const{column:t,isEnum:n,style:r,onChange:a}=e,{tableRef:i,$size:o,flattenColumns:s,isFetch:c,filters:d,superFilters:u,pagerFilter:m,setPagerFilter:p}=l().useContext(Ha),{dataKey:h,inputCache:f,filterValue:g={}}=l().useContext(jo),{t:y}=U(),{getTitleFromCellValue:b}=hi(),v=h.split("|")[0],{recordsMap:x,tableOriginData:E,isOriginTree:w}=i.current,{[v]:C,...S}=m,N=l().useRef(!1),T=l().useMemo((()=>s.indexOf(t)),[s,t]),I=l().useRef(0),O=e=>n?[{text:y("qm.table.highSearch.nullText"),value:""},...t.filter.items||t.dictItems||[]]:Array.from((e=>{let n=Vn((()=>{if(!(c||ie(d)&&ie(u))){const e=u.length?ur(u):ur(d);return An(E,e,w)}return E})());var r;e||(n=((e,t,n)=>{if(!Object.keys(t).length||!e.length)return e;if(!n)return e.filter((e=>Er(e,t)));const r=new Map,a=new Set;for(const n of e)if(r.set(n._rowKey,n),Er(n,t)){let e=n;for(;e&&!a.has(e._rowKey);)a.add(e._rowKey),e=r.get(e._parentRowKey)}return e.filter((e=>a.has(e._rowKey)))})(n,S,w),r=n.length,I.current=r);const a=new Map;return n.forEach((e=>{const n=Jn(e,v);a.has(n)||a.set(n,b(e,t,e.index,T))})),a})(e).entries()).map((([e,t])=>({text:t,value:e}))),k=l().useMemo((()=>O()),[]),L=l().useMemo((()=>ie(S)?k:O(!0)),[]),[P,A]=l().useState(k),F=l().useMemo((()=>new Map(P.map((e=>[e.value,null])))),[P]),[_,q]=l().useState(f.current||""),[D,H]=l().useState((n?g.in:m[v])||L.map((e=>e.value))),$=l().useMemo((()=>Array.from(F.keys()).every((e=>D.includes(e)))),[D,F]),M=l().useMemo((()=>{const e=Array.from(F.keys()).filter((e=>D.includes(e)));return e.length>0&&e.length<P.length}),[D,P,F]),K=l().useMemo((()=>D.length===L.length),[D]);l().useEffect((()=>{_&&z(_)}),[]),De((()=>{a?.(D,K)}),[D]),De((()=>{const e=K?null:D;if(!(0,X.isEqual)(e,m[v]))return e?void p({...m,[v]:e}):p(S)}),[P,D]);const z=e=>{A(k.filter((t=>t.text.includes(e))))},V=Et(z,200),j=e=>{var t;q(e),t=e,f.current=t,N.current||V(e)};return l().createElement("div",{className:"list-panel",style:r},l().createElement(R.Input,{value:_,size:o,style:{width:200},placeholder:y("qm.table.filter.keywordSearch"),suffix:l().createElement(we.SearchOutlined,null),autoFocus:!0,allowClear:!0,onCompositionStart:()=>{N.current=!0},onCompositionEnd:e=>{N.current=!1,j(e.target.value)},onChange:e=>j(e.target.value)}),l().createElement("div",{className:"select-all"},l().createElement("div",{className:"action"},l().createElement(R.Checkbox,{checked:$,indeterminate:M,disabled:!P.length,onChange:e=>{H((t=>e.target.checked?[...new Set([...t,...Array.from(F.keys())])]:t.filter((e=>!F.has(e)))))}},y("qm.table.filter.selectAll")),l().createElement("i",{className:"divider"},"|"),l().createElement("button",{className:"btn invert",disabled:!P.length,onClick:()=>{H((e=>[...Array.from(F.keys()).filter((t=>!e.includes(t))),...e.filter((e=>!F.has(e)))]))}},y("qm.table.filter.invert"))),l().createElement("div",{className:"total"},n?null:`${x.size}/${I.current}`)),l().createElement(Yo,{className:"select-list",maxHeight:180,itemHeight:26,dataSource:P,renderItem:(e,t)=>l().createElement(l().Fragment,null,l().createElement(R.Checkbox,{key:t,checked:D.includes(e.value),onChange:t=>{H((n=>t.target.checked?[...n,e.value]:n.filter((t=>t!==e.value))))}},e.text),l().createElement("button",{className:"btn right",onClick:()=>{H((t=>{const n=[e.value,...t.filter((e=>!F.has(e)))];return(0,X.isEqual)(t,n)?t:n}))}},y("qm.table.filter.onlyItem")))}))},Qo=l().forwardRef(((e,t)=>{const{value:n,style:r}=e,{$size:a,filters:i,pagerFilter:o,setPagerFilter:s}=l().useContext(Ha),{dataKey:c,onChange:d}=l().useContext(jo),{t:u}=U(),m=c.split("|")[0],p=e=>{if(!e){const{[c]:e,...t}=i;return t}const t={...e};for(const e in t)(""===(n=t[e])||null==n)&&delete t[e];var n;return Object.keys(t).length?Object.assign({},i,{[c]:t}):p()},h=(e,t)=>{d(p(e??n),t??!0)};return l().useImperativeHandle(t,(()=>({doFinish:h}))),l().createElement(R.Space,{className:"footer",style:{...r,justifyContent:"flex-end"}},l().createElement(fe,{size:a,onClick:()=>(()=>{if(o[m]){const{[m]:e,...t}=o;s(t)}d(p(),!0)})()},u("qm.table.filter.reset")),l().createElement(fe,{type:"primary",size:a,onClick:()=>h()},u("qm.table.filter.search")))}));Qo.displayName="FooterPanel";const Zo=Qo,Jo=e=>{const{column:t}=e,{$size:n}=l().useContext(Ha),{filterValue:r={}}=l().useContext(jo),{t:a}=U(),i=l().useRef(null),{openFilterList:o=!0}=t.filter,[s,c]=l().useState(Object.keys(r)[0]||"like"),[d,u]=l().useState(r[s]&&!xr(s)?r[s]:""),m=l().useMemo((()=>d?{[s]:d}:xr(s)?{[s]:1}:null),[s,d]),p=[{value:"like",label:a("qm.table.highSearch.inText")},{value:"nlike",label:a("qm.table.highSearch.ninText")},{value:"==",label:a("qm.table.highSearch.eqText")},{value:"!=",label:a("qm.table.highSearch.neqText")},{value:"^=",label:a("qm.table.highSearch.startsWithText")},{value:"=$",label:a("qm.table.highSearch.endsWithText")},{value:"nil",label:a("qm.table.highSearch.nullText")},{value:"nnil",label:a("qm.table.highSearch.notNullText")}];return l().createElement(l().Fragment,null,l().createElement("div",{className:"filter-box"},l().createElement(R.Select,{value:s,options:p,size:n,className:"condition",style:{width:70,marginRight:6},onChange:e=>{c(e),xr(e)&&u("")}}),l().createElement(R.Input,{value:d,size:n,autoFocus:!0,style:{width:124,paddingLeft:6,paddingRight:2},placeholder:a("qm.table.filter.searchText",{text:cr(t.title)}),disabled:xr(s),onChange:e=>{u(e.target.value)},onKeyDown:e=>{13===e.keyCode&&i.current.doFinish()}})),o&&l().createElement(Xo,{column:t,style:{marginTop:6}}),l().createElement(Zo,{ref:i,value:m}))},es=e=>{const{onChange:t}=e,{filterValue:n={}}=l().useContext(jo),{t:r}=U(),[a,i]=l().useState({nil:n.nil??0,nnil:n.nnil??0});return De((()=>{const e={};for(const t in a)a[t]&&(e[t]=1);t(e)}),[a]),l().createElement("div",{style:e.style},l().createElement(R.Checkbox,{checked:!!a.nil,onChange:e=>{const t=e.target.checked?1:0;i((e=>Object.assign({},e,t?{nnil:0}:null,{nil:t})))}},r("qm.table.highSearch.nullText")),l().createElement(R.Checkbox,{checked:!!a.nnil,onChange:e=>{const t=e.target.checked?1:0;i((e=>Object.assign({},e,t?{nil:0}:null,{nnil:t})))}},r("qm.table.highSearch.notNullText")))},ts=e=>{const{column:t}=e,{$size:n}=l().useContext(Ha),{filterValue:r={}}=l().useContext(jo),{t:a}=U(),i=l().useRef(null),{openFilterList:o=!0}=t.filter,s="likes",[c,d]=l().useState(r[s]??""),[u,m]=l().useState({}),p=l().useMemo((()=>Object.keys(u).length?u:c?{[s]:c}:null),[c,u]);return l().createElement(l().Fragment,null,l().createElement("div",{className:"filter-box"},l().createElement(R.Input.TextArea,{value:c,size:n,autoFocus:!0,placeholder:a("qm.table.filter.searchAreaText",{text:cr(t.title)}),style:{width:200},disabled:!!Object.keys(u).length,onChange:e=>{d(e.target.value)},onKeyDown:e=>{13===e.keyCode&&i.current.doFinish()}})),l().createElement(es,{style:{marginTop:6},onChange:e=>{Object.keys(e).length&&d(""),m(e)}}),o&&l().createElement(Xo,{column:t,style:{marginTop:6}}),l().createElement(Zo,{ref:i,value:p}))};function ns(){return ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ns.apply(null,arguments)}const rs=e=>{const{$size:t}=l().useContext(Ha),{filterValue:n={}}=l().useContext(jo),{t:r}=U(),a=l().useRef(null),[i,o]=l().useState(n),s=e=>({value:i[e],size:t,disabled:Object.keys(i).some((e=>xr(e))),onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o((n=>Object.assign({},n,{[e]:t})))},onKeyDown:e=>{13===e.keyCode&&a.current.doFinish()}});return l().createElement(l().Fragment,null,l().createElement("div",{className:"filter-list"},l().createElement("ul",null,l().createElement("li",null,l().createElement("span",{className:"label"},"> "),l().createElement(R.InputNumber,ns({},s(">"),{placeholder:r("qm.table.highSearch.gtText"),style:{width:150}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"< "),l().createElement(R.InputNumber,ns({},s("<"),{placeholder:r("qm.table.highSearch.ltText"),style:{width:150}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"= "),l().createElement(R.InputNumber,ns({},s("=="),{placeholder:r("qm.table.highSearch.eqText"),style:{width:150}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"!="),l().createElement(R.InputNumber,ns({},s("!="),{placeholder:r("qm.table.highSearch.neqText"),style:{width:150}}))))),l().createElement(es,{style:{paddingLeft:20},onChange:e=>o(e)}),l().createElement(Zo,{ref:a,value:i}))};function as(){return as=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},as.apply(null,arguments)}const is=e=>{const{$size:t}=l().useContext(Ha),{filterValue:n={}}=l().useContext(jo),{t:r}=U(),[a,i]=l().useState(n),o=e=>({value:ir(a[e],ja),format:ja,size:t,disabled:Object.keys(a).some((e=>xr(e))),onChange:t=>{i((n=>Object.assign({},n,{[e]:lr(t,ja)})))}});return l().createElement(l().Fragment,null,l().createElement("div",{className:"filter-list"},l().createElement("ul",null,l().createElement("li",null,l().createElement("span",{className:"label"},"> "),l().createElement(F,as({},o(">"),{placeholder:r("qm.table.highSearch.gtText"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"< "),l().createElement(F,as({},o("<"),{placeholder:r("qm.table.highSearch.ltText"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"= "),l().createElement(F,as({},o("=="),{placeholder:r("qm.table.highSearch.eqText"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"!="),l().createElement(F,as({},o("!="),{placeholder:r("qm.table.highSearch.neqText"),style:{width:"150px"}}))))),l().createElement(es,{style:{paddingLeft:20},onChange:e=>i(e)}),l().createElement(Zo,{value:a}))},ls=e=>{const{column:t}=e,n=l().useRef(null),r="in";return l().createElement(l().Fragment,null,l().createElement(Xo,{column:t,isEnum:!0,onChange:(e,t)=>{n.current.doFinish(t?null:{[r]:e},!1)}}),l().createElement(Zo,{ref:n,style:{display:"none"}}))},os=(e,t,n)=>{let r;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[n]===t)))r=i[n];else{const e=os(i.children,t,n);e&&(r=e)}}return r},ss=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&ss(e.children,t),t(e)||e.children&&e.children.length))),cs=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...cs(e.children,t)),t(e)&&n.push(e)})),n},ds=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=ds(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},us=(e,t,n,r)=>e.map((e=>e[n]===t?{...e,children:r}:e.children?{...e,children:us(e.children,t,n,r)}:e)),ms=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ms(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},ps=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][n]===t)return[t];if(Array.isArray(e[r].children)){const a=ps(e[r].children,t,n);if(a)return[e[r][n],a].flat()}}},hs=(e,t)=>{const n=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>n.push(...hs(e,t)))),n},fs=l().forwardRef(((e,t)=>{const{className:n,style:r,filterable:a=!0,multiple:i,draggable:o,dataSource:s,fetch:c,autoFocus:d,asyncLoad:u,checkStrictly:m,checkStrategy:p="SHOW_CHILD",placeholder:h,fieldsDefine:g,value:y,height:b,defaultSelectedKeys:v=[],defaultExpandedKeys:x=[],defaultExpandAll:E=!0,showSearchBar:w=!0,showCollapse:C=!0,onSelectChange:S,onCheckChange:N,onDragStart:T,onDragChange:I,onExpand:O}=e,{$size:k}=Y(e),{t:L}=U(),P=g?.valueKey||"value",A=g?.textKey||"text",F=l().useRef(null),_=l().useRef(null),q=xt(F),[D,H]=ri(b,{value:b}),[$,M]=l().useState(!1),K=Et((()=>{H(F.current.offsetHeight-re.current.offsetHeight-10)}),5);f((()=>{b||K()}),[q.height]);const[z,V]=l().useState([]),[j,W]=l().useState({}),[B,G]=l().useState([]),[Q,Z]=l().useState([]),[J,ee]=l().useState(""),[te,ne]=l().useState(E),re=l().useRef(null),ae=l().useRef([]),le=l().useRef([]);l().useEffect((()=>{Array.isArray(s)&&(oe(s),G(se(s)),W({}))}),[s]),l().useEffect((()=>{ue(),d&&_.current?.focus()}),[]),De((()=>{ue()}),[c?.params]),De((()=>{Z(de())}),[j]),l().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=ds(z,(t=>e===t[P]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],oe([...z]))},REMOVE_RECORD:e=>{const t=os(z,e,P);if(void 0===t&&z.find((t=>t[P]===e)))oe(z.filter((t=>t[P]!==e)));else{const n=ds(z,(e=>t===e[P]));if(!n)return;const r=n.children?.findIndex((t=>e===t[P]));r>=0&&(n.children.splice(r,1),oe([...z]))}},UPDATE_RECORD:(e,t)=>{const n=ds(z,(t=>e===t[P]));n&&((0,X.merge)(n,t),oe([...z]))}})));const oe=e=>{V(e),ae.current=e,le.current=ms(e,P)},se=e=>{if(i)return v;const t=cs(e,(e=>v.includes(e[A])));return 1===t.length?[t[0][P]]:[]},ce=e=>ps(z,e,P)?.slice(0,-1)||[],de=()=>{if(E)return le.current;const e=[];return B.forEach((t=>{if(i){if("SHOW_ALL"===p&&!le.current.includes(t)&&e.push(...ce(t)),"SHOW_CHILD"===p&&e.push(...ce(t)),"SHOW_PARENT"===p){const n=jr(z,t);if(n){const r=ce(t),a=hs(n,P);e.push(...r,...[t,...a].filter((e=>le.current.includes(e))))}}}else e.push(...ce(t))})),[...new Set([...x,...e])]},ue=async()=>{if(!c)return;const{api:e,params:t,dataKey:n,afterFetch:r,callback:a}=c;try{M(!0);const i=await e(t);if(200===i.code){let e=Array.isArray(i.data)?i.data:(0,X.get)(i.data,n)??[];e="function"==typeof r?await r(e):e,oe(e),G(se(e)),W({}),a?.(e)}}catch(e){}M(!1)},me=e=>`${e}|${ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,pe=Ee("search-tree"),he={[pe]:!0,[`${pe}--lg`]:"large"===k,[`${pe}--sm`]:"small"===k};return l().createElement("div",{ref:F,className:xe()(he,n),style:r},l().createElement("div",{ref:re,className:"topper",style:{display:w||C?"":"none"}},w&&l().createElement(R.Input,{ref:_,value:J,size:k,placeholder:h||L("qm.form.inputPlaceholder"),suffix:l().createElement(we.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{if(!a)return;const t=ss(ae.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==me(n).indexOf(e)}));ee(e),V(t),Z(E||e?ms(t,P):de())})(e.target.value)}),C&&l().createElement("a",{className:"trigger",onClick:()=>{ne(!te),Z(te?[]:le.current)}},te?l().createElement(we.UpOutlined,null):l().createElement(we.DownOutlined,null)," ",L(te?"qm.form.collect":"qm.form.spread"))),l().createElement(mt,{spinning:$},l().createElement(R.Tree,{fieldNames:{title:A,key:P,children:"children"},multiple:i,draggable:o,blockNode:o,checkable:i,selectable:!i,height:D,disabled:e.disabled,checkStrictly:m,selectedKeys:y??B,checkedKeys:y??B,expandedKeys:Q,treeData:z,loadData:u?async({key:e,children:t})=>{if(!c||t)return;const{api:n,params:r,dataKey:a,formatter:i=e=>e,afterFetch:l}=c;try{const t=await n(i({...r,[P]:e}));if(200===t.code){let n=Array.isArray(t.data)?t.data:(0,X.get)(t.data,a)??[];n="function"==typeof l?await l(n):n;const r=us(ae.current,e,P,n);oe(r)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!J)return!1;const t=e[A]||"";return-1!==me(t).indexOf(J)},onDragStart:T,onDragEnter:e=>{Z(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),a=e.dropPosition-Number(r[r.length-1]),i=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][P]===t)return n(e[r],r,e);e[r].children&&i(e[r].children,t,n)}},l=[...z];let o;if(i(l,n,((e,t,n)=>{n.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,n=[];i(l,t,((t,r,a)=>{n=a,e=r})),-1===a?n.splice(e,0,o):n.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));oe(l)},onDragEnd:e=>{I?.(e,z)},onExpand:(e,t)=>{ie(e)&&ne(!1),le.current.every((t=>e.includes(t)))&&ne(!0),Z(e),O?.(e,t)},onSelect:e=>{G(e);const t=cs(ae.current,(t=>e.includes((0,X.get)(t,P))));S?.(i?t:t[0])},onCheck:e=>{m&&(e=e.checked),G(e),m||("SHOW_CHILD"===p&&(e=e.filter((e=>!le.current.includes(e)))),"SHOW_PARENT"===p&&(e=e.filter(((e,t,n)=>!n.includes(os(z,e,P))))));const t=cs(ae.current,(t=>e.includes((0,X.get)(t,P))));N?.(i?t:t[0])}})))}));fs.displayName="QmSearchTree";const gs=fs,ys=e=>{const{column:t}=e,{$size:n}=l().useContext(Ha),{filterValue:r={}}=l().useContext(jo),a=l().useMemo((()=>t.filter.items||t.dictItems||[]),[]),i=l().useMemo((()=>{const e=[];return function t(n){n.forEach((n=>{Array.isArray(n.children)?t(n.children):e.push(n.value)}))}(a),e}),[a]),o="in",[s,c]=l().useState(r.in??i),[d,u]=l().useState({}),m=l().useMemo((()=>Object.keys(d).length?d:s.length===i.length?null:{[o]:s}),[s,d]);return l().createElement(l().Fragment,null,l().createElement("div",{className:"tree-panel",style:t.filter.style},l().createElement(gs,{multiple:!0,value:s,dataSource:a,disabled:!!Object.keys(d).length,size:n,style:{height:238},onCheckChange:e=>{c(e.map((e=>e.value)))}})),l().createElement(es,{style:{marginLeft:-10,marginRight:-10,padding:"6px 0 0 20px",borderTop:"1px solid #e8e8e8"},onChange:e=>{Object.keys(e).length&&c([]),u(e)}}),l().createElement(Zo,{value:m}))},bs=e=>{const{column:t,filters:n}=e,{$size:r,prefixCls:a,pagerFilter:i,setFilters:o,clearSuperFilters:s}=l().useContext(Ha),{t:c}=U(),[d,u]=l().useState(!1),m=l().useRef(""),p=l().useMemo((()=>{const{dataIndex:e,filter:n}=t;return`${e}|${n.type}`}),[t]),h=l().useMemo((()=>!!Object.keys(n[p]||{}).length||!!i[t.dataIndex]),[n,i]),f=(e,t)=>{s(),o(e),t&&u(!1)},g=l().useMemo((()=>({dataKey:p,inputCache:m,filterValue:n[p],onChange:f})),[n]);l().useEffect((()=>{"radio"===t.filter.type&&me("Table","表头筛选类型 `radio` 即将被弃用,请使用 `checkbox` 替代")}),[]);const y={text:e=>l().createElement(Jo,{column:e}),textarea:e=>l().createElement(ts,{column:e}),number:e=>l().createElement(rs,{column:e}),date:e=>l().createElement(is,{column:e}),radio:e=>y.checkbox(e),checkbox:e=>l().createElement(ls,{column:e}),tree:e=>l().createElement(ys,{column:e})},b={"head-filter__popper":!0,[`${a}--lg`]:"large"===r,[`${a}--sm`]:"small"===r},v=["cell--filter",{selected:d,actived:h}];return l().createElement(Ai(),{action:["click"],popupVisible:d,popup:(()=>{const e=y[t.filter.type];return e?l().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},l().createElement(jo.Provider,{value:g},e(t))):(me("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:xe()(b),popupStyle:{minWidth:150},onPopupVisibleChange:e=>u(e),builtinPlacements:Ua,destroyPopupOnHide:!0,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("div",{className:xe()(v),title:c("qm.table.filter.text"),onClick:e=>e.stopPropagation()},l().createElement("span",{className:"svgicon icon"},l().createElement(Wo,null))))},vs=e=>{const{column:t}=e,{tableRef:n,bordered:r}=l().useContext(Ha),{columns:a,resizable:i,columnsChange:o=ee}=n.current.props,s=l().useMemo((()=>Kn(t)),[t]),c={resizable:!0,"is--line":i&&!r};return l().createElement("div",{className:xe()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:r,scrollBarRef:i}=n.current,l=r.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=Xn(t,r.$table).left-i.current.scrollLeft+c;r.$table.classList.add("c--resize"),l.style.left=`${u}px`,l.style.display="block";const m=s.width||s.renderWidth;let p=m;return document.onmousemove=function(e){if("number"!=typeof m)return;const t=e.clientX-d,n=m+t;n<(s.minWidth||ai.defaultColumnWidth)||(p=Math.floor(n),l.style.left=`${t+u}px`)},document.onmouseup=function(){r.$table.classList.remove("c--resize"),l.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&($n(a,s.dataIndex).width=p,o([...a]))},!1}})},xs=e=>{const{selectionKeys:t}=e,{tableRef:n,getRowKey:r,fetchParams:a,setSelectionKeysEffect:i,setInvalidRowKeys:o,setSpinning:s,pagination:c,isFetch:d,isWebPagination:u,createWebPageData:m}=l().useContext(Ha),{t:p}=U(),{selectionRows:h,recordsMap:f}=n.current,{rowSelection:g}=n.current.props,{fetchAllRowKeys:y,selectAllOnCurrentPage:b,filterable:v,onSelectAll:x}=g,E=l().useRef([]),w=l().useMemo((()=>d&&!!y),[d,y]),C=l().useMemo((()=>!w&&!!b),[w,b]),S=l().useMemo((()=>(v??!0)&&!C),[v,C]),N=()=>{const{disabled:e}=g;return(e?h.filter((t=>!e(t))):h).map((e=>r(e,e.index)))},T=()=>u?Vn(m()):Array.from(f.values()),I=l().useMemo((()=>(()=>{const{disabled:e}=g;if(w)return E.current.length?E.current:(0,X.union)(Array.from(f.keys()),N());if(!C)return e?Array.from(f.keys()).filter((t=>!e(f.get(t)))):Array.from(f.keys());const t=e?T().filter((t=>!e(t))).map((e=>r(e,e.index))):T().map((e=>r(e,e.index)));return(0,X.union)(t,N())})()),[f,E,h,c]),O=t.filter((e=>!I.includes(e))),k=t.length-O.length,L=k>0&&k<I.length,P=!!k&&k===I.length;o(O);const A=async()=>{const e=y;let t=[];s(!0);try{const n=await e.api(a);if(200===n.code){t=Array.isArray(n.data)?n.data:(0,X.get)(n.data,e.dataKey)??[];const{disabled:a}=g;a&&(t=(0,X.xor)(t,T().filter((e=>a(e))).map((e=>r(e,e.index))))),E.current=t}}catch(e){}return s(!1),t},F=async e=>{let t=[];t=w?e?await A():[]:e?I.slice(0):[],t=[...new Set([...t,...O])],i(t),x?.(e,t)};return l().createElement("div",{className:"cell--selection"},l().createElement(R.Checkbox,{checked:P,indeterminate:L,disabled:!I.length,onChange:e=>F(e.target.checked)}),S&&l().createElement(R.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{F(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=w?(0,X.xor)(t,await A()):(0,X.xor)(t,I),e=[...new Set([...e,...O])],i(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{F(!1)}}];return l().createElement(R.Menu,{items:e})})()},l().createElement(we.DownOutlined,{className:"svgicon icon"})),C&&l().createElement(R.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},l().createElement(we.InfoCircleOutlined,{className:"info"})))},Es=e=>{const{style:t}=e,{tableRef:n,rowExpandedKeys:r,setRowExpandedKeys:a,createAllExpandedKeys:i,filters:o,pagerFilter:s,superFilters:c}=l().useContext(Ha),{expandable:d}=n.current.props,[u,m]=l().useState(d?.defaultExpandAllRows||!1);De((()=>{p(r)!==u&&m(!u)}),[r]),De((()=>{n.current.isTreeTable&&(ie(o)&&ie(s)&&ie(c)||re((()=>!p(r)&&a(i()))))}),[o,s,c]);const p=e=>i().every((t=>e.includes(t))),h=Ee("expand"),f={[`${h}--icon`]:!0,expanded:u,collapsed:!u};return l().createElement("span",{className:xe()(f),title:"",onClick:e=>{e.stopPropagation(),m(!u),a(u?[]:i())},style:t})},ws=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().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"})),Cs=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().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"})),Ss=e=>{const{tableColumns:t}=e,{tableRef:n,prefixCls:r,layout:a,flattenColumns:i,sorter:o,filters:s,superFilters:c,pagerFilter:d,selectionKeys:u,isFetch:m,treeExpandIndex:p,tableChange:h,setSorter:f,setElementStore:g,resetTableScroll:y,getStickyLeft:b,getStickyRight:v,createTableFullData:x}=l().useContext(Ha),{ellipsis:E,resizable:w,multipleSort:C,rowSelection:S,expandable:N}=n.current.props,[T,I]=ai.sortDirections,{t:O}=U(),k=l().useRef(null),L=l().useMemo((()=>!m),[m]),P=l().useMemo((()=>!N?.hideExpandAll),[N]),A=l().useMemo((()=>!(!S||(m?!S.selectAllOnCurrentPage&&!S.fetchAllRowKeys:S.hideSelectAll))),[m,S]),F=l().useMemo((()=>Object.fromEntries(Object.entries(o).filter((([e,t])=>null!==t)))),[o]);De((()=>{M(),h(),y()}),[o]),De((()=>{j(),K(!0),h(),y()}),[s,c]),De((()=>{B(),K(!0),h(),y()}),[d]),l().useEffect((()=>{!ie(o)&&re((()=>M())),!ie(s)&&re((()=>j()))}),[]),l().useLayoutEffect((()=>{_()}),[]);const _=()=>{g("$header",k.current)},q=e=>{const{dataIndex:t,type:r,sorter:a,title:i,description:s}=e;if(t===ai.selectionColumn&&"checkbox"===r){if("checkbox"===r)return l().createElement("div",{className:"cell"},A?l().createElement(xs,{selectionKeys:u}):O("qm.table.config.selectionText"));if("radio"===r)return l().createElement("div",{className:"cell"},i)}const c=[];return c.push(l().createElement("div",{key:0,className:"cell",title:cr(i)},n.current.isTreeTable&&t===p&&P?l().createElement(Es,null):null,t===ai.expandableColumn&&P?l().createElement(Es,null):i)),s&&c.push(l().createElement(R.Tooltip,{key:1,placement:"top",title:s},l().createElement(we.InfoCircleOutlined,{className:"tip"}))),a&&c.push(D(o[t])),c},D=e=>{const t=["svgicon cell--sorter__asc",{actived:e===T}],n=["svgicon cell--sorter__desc",{actived:e===I}];return l().createElement("div",{key:2,className:"cell--sorter",title:O("qm.table.sorter.text")},l().createElement("span",{className:xe()(t)},l().createElement(ws,null)),l().createElement("span",{className:xe()(n)},l().createElement(Cs,null)))},H=e=>l().createElement(bs,{column:e,filters:s}),$=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=o[r],t=e?e===I?null:I:T;C?(delete o[r],f(Object.assign({},o,{[r]:t}))):f(Object.assign({},{[r]:t}))}},M=()=>{L&&K()},K=e=>{const t=Object.keys(F).length>0;e?t&&V(F):V(t?F:{index:T})},z=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,V=e=>{const t=((e,t)=>e.sort(((e,n)=>{for(const r in t){const a=i.find((e=>e.dataIndex===r)),l=t[r],o=Jn(e,r),s=Jn(n,r),c="function"!=typeof a?.sorter?z(o,s):a.sorter(e,n);if(0!==c)return"ascend"===l?c:-c}return 0})).slice(0))(n.current.tableFullData,e);x(t)},j=()=>{L&&W()},W=()=>{const{tableOriginData:e,isOriginTree:t}=n.current,r=c.length?ur(c):ur(s);let a=An(e,L?r:"",t);a=wr(a,d,t),x(a)},B=()=>{W()},G=Bn(t),{tableBodyWidth:Y}=a;return l().createElement("div",{ref:k,className:`${r}--header-wrapper`},l().createElement("table",{className:`${r}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Y?`${Y}px`:""}},l().createElement("colgroup",null,i.map((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;return l().createElement("col",{key:t,style:{width:`${n||r}px`,minWidth:`${n||r}px`}})}))),l().createElement("thead",null,(e=>e.map(((e,t)=>l().createElement("tr",{key:t,className:"header--row"},e.map(((t,r)=>((e,t,r)=>{const{dataIndex:a,colSpan:i,rowSpan:s,fixed:c,align:d,theadAlign:u,theadClassName:m="",sorter:p,filter:h,required:f,headRender:g}=e;if(0===i)return null;const y=u||d,x=["header--column",{"col--ellipsis":e.ellipsis??E,"col--center":"center"===y,"col--right":"right"===y,"column--required":!!f,"column-has-sorter":p,"column-has-filter":h,"column--sort":!!o[a],"cell-fix-left":"left"===c,"cell-fix-right":"right"===c,"cell-fix-left-last":"left"===c&&!r[t+(i??1)]?.fixed,"cell-fix-right-first":"right"===c&&!r[t-1]?.fixed,[m]:!!m}],C={left:"left"===c?`${b(a)}px`:"",right:"right"===c?`${v(a,"thead")}px`:""},S=w&&![ai.expandableColumn,ai.selectionColumn].includes(a);return l().createElement("th",{key:a,className:xe()(x),colSpan:i,rowSpan:s,style:{...C},onClick:t=>$(t,e)},l().createElement("div",{className:"cell--wrapper"},g?l().createElement("div",{className:"cell--text cell"},g(e,n.current.tableFullData)):l().createElement(l().Fragment,null,l().createElement("div",{className:"cell--text"},q(e)),h?H(e):null)),S&&l().createElement(vs,{column:e}))})(t,r,e)))))))(G))))},Ns=l().createContext([]),Ts=(e,t,n,r,a,i,l,o,s,c)=>{const{clientX:d,clientY:u}=e,{top:m,height:p}=e.target.getBoundingClientRect(),h=((a?.x||0)-d-12)/r,f=s.filter((e=>o[e]?.children?.length));let g=Is(o,n.eventKey);if(u<m+p/2){const e=l.findIndex((e=>e===g.key)),t=l[e<=0?0:e-1];g=Is(o,t)}const y=g.key,b=g,v=g.key;let x=0,E=0;if(!f.includes(y))for(let e=0;e<h&&Os(g);e+=1)g=g.parent,E+=1;const w=t.data,C=g.node;let S=!0;return ks(g)&&0===g.level&&u<m+p/2&&i({dragNode:w,dropNode:C,dropPosition:-1})&&g.key===n.eventKey?x=-1:(b.children||[]).length&&f.includes(v)?i({dragNode:w,dropNode:C,dropPosition:0})?x=0:S=!1:0===E?h>-1.5?i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1:i({dragNode:w,dropNode:C,dropPosition:0})?x=c?1:0:i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1:i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1,{dropPosition:x,dropLevelOffset:E,dropTargetKey:g.key,dropTargetPos:g.pos,dragOverNodeKey:v,dropContainerKey:0===x?null:g.parent?.key||null,dropAllowed:S}},Is=(e,t)=>e[t],Rs=e=>e.split("-"),Os=e=>{if(e.parent){const t=Rs(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},ks=e=>{const t=Rs(e.pos);return 0===Number(t[t.length-1])},Ls=(e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const a=Is(r,e);return{eventKey:e,pos:a?a.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}},Ps=({openDragSort:e})=>{const{tableRef:t,getRowKey:n,rowExpandedKeys:r,setRowExpandedKeys:a,createTableData:i,dataChange:o}=l().useContext(Ha),{tableFullData:s,recordsMap:c,isTreeTable:d}=t.current,u=te,m=l().useRef(null),p=l().useRef(null),h=l().useRef(null),f=l().useRef(),[g,y]=l().useState({}),[b,v]=l().useState(null),[x,E]=l().useState([]),[w,C]=l().useState(0),[S,N]=l().useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),T=e=>{N((t=>Object.assign({},t,e)))};l().useLayoutEffect((()=>{e&&y((e=>{const t={},r=(e,a=null,i=0)=>{const l=[];return e.forEach(((e,o)=>{const s=n(e,e.index),c={index:o,key:s,level:i,node:e,parent:a,pos:(d=a?.pos||"0",u=o,`${d}-${u}`),nodes:[...a?.nodes||[],e]};var d,u;Array.isArray(e.children)&&(c.children=r(e.children,c,i+1)),t[s]=c,l.push(c)})),l};return r(e),t})(s))}),[s]),l().useEffect((()=>()=>{window.removeEventListener("dragend",O)}),[]);const I=()=>{T({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},R=()=>{null!==b&&(v(null),T({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),p.current=null,h.current=null},O=e=>{k(e,null,!0),window.removeEventListener("dragend",O)},k=(e,t,n)=>{T({dragOverNodeKey:null}),R(),m.current=null,window.removeEventListener("dragend",O)};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;m.current=t,p.current={x:e.clientX,y:e.clientY};const i=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(r,n);v(n),E(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(Is(t,e).children),n})(n,g)),C(2*ai.treeTable.textIndent),a(i),window.addEventListener("dragend",O)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(h.current!==n&&(h.current=n),!m.current)return void I();const{dropPosition:i,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:y,dropAllowed:v,dragOverNodeKey:E}=Ts(e,m.current,t,w,p.current,u,Array.from(c.keys()),g,r,!d);-1===x.indexOf(o)&&v?(f.current||(f.current={}),Object.keys(f.current).forEach((e=>{clearTimeout(f.current[e])})),m.current.eventKey!==n&&(e.persist(),f.current[n]=window.setTimeout((()=>{if(null===b)return;let e=[...r];const t=Is(g,n);t&&t.children?.length&&(e=((e,t)=>{const n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n})(r,n)),a(e)}),800)),m.current.eventKey!==o||0!==l?T({dragOverNodeKey:E,dropPosition:i,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:y,dropAllowed:v}):I()):I()},onNodeDragOver:(e,t)=>{if(!m.current)return;const{dropPosition:n,dropLevelOffset:a,dropTargetKey:i,dropContainerKey:l,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:h}=Ts(e,m.current,t,w,p.current,u,Array.from(c.keys()),g,r,!d);-1===x.indexOf(i)&&o&&(m.current.eventKey===i&&0===a?null===S.dropPosition&&null===S.dropLevelOffset&&null===S.dropTargetKey&&null===S.dropContainerKey&&null===S.dropTargetPos&&!1===S.dropAllowed&&null===S.dragOverNodeKey||I():n===S.dropPosition&&a===S.dropLevelOffset&&i===S.dropTargetKey&&l===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&h===S.dragOverNodeKey||T({dropPosition:n,dropLevelOffset:a,dropTargetKey:i,dropContainerKey:l,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:h}))},onNodeDragLeave:(e,t)=>{h.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(I(),h.current=null)},onNodeDragEnd:k,onNodeDrop:(e,t,r=!1)=>{const{dropPosition:a,dropTargetKey:l,dropTargetPos:c,dropAllowed:d,dragOverNodeKey:u}=S;if(!d)return;if(T({dragOverNodeKey:null}),R(),null===l)return;const p={...Ls(l,{dropPosition:a,dragOverNodeKey:u,keyEntities:g}),data:Is(g,l).node};-1!==x.indexOf(l)&&me("Table Draggable","无法拖放到 `dragNode` 的子节点");const h=Rs(c),f={event:e,node:p,dragNode:m.current,dragNodesKeys:[m.current.eventKey].concat(x),dropToGap:0!==a,dropPosition:a+Number(h[h.length-1])};r||(e=>{const t=e.node.eventKey,r=e.dragNode.eventKey,a=e.node.pos.split("-"),l=e.dropPosition-Number(a[a.length-1]),c=(e,t,r)=>{for(let a=0;a<e.length;a++){if(n(e[a],e[a].index)===t)return r(e[a],a,e);e[a].children&&c(e[a].children,t,r)}},d=[...s];let u;if(c(d,r,((e,t,n)=>{n.splice(t,1),u=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,a)=>{n=a,e=r})),-1===l?n.splice(e,0,u):n.splice(e+1,0,u)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(u)}));i(d),o()})(f),m.current=null},indent:w,dropOptions:S}};function As(){const[,e]=i.useReducer((e=>e+1),0);return e}const Fs=l().forwardRef(((e,t)=>{const{rowKey:n,rowIndex:r,row:a,className:i,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:m,onNodeDragOver:p,onNodeDragLeave:h,onNodeDragEnd:f,onNodeDrop:g}=e,y=l().useRef({eventKey:n,data:a,props:e}),b=l().useRef(!1),[v,x]=l().useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,T=C===n&&0===E,I=C===n&&-1===E,R=C===n&&1===E,O=a._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-w*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-w*s+O*s});break;case 0:Object.assign(k,{bottom:0,left:s+O*s})}const L={"body--row-draggable":!0,"body--row-dragging":v,"drop-target":S===n,"drop-container":N===n,"drag-over":T,"drag-over-gap-top":I,"drag-over-gap-bottom":R};return l().createElement("tr",{ref:t,"data-row-key":n,"data-row-index":r,className:xe()(i,L),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),b.current=t)},onDragStart:e=>{if(e.stopPropagation(),b.current)return e.preventDefault();x(!0),u(e,y.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),m(e,y.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),p(e,y.current)},onDragLeave:e=>{e.stopPropagation(),h(e,y.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,y.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,y.current)}},e.children,C===n&&null!==E&&null!==w&&l().createElement("td",{className:"drop-indicator",style:k}))}));Fs.displayName="DraggableTr";const _s=Fs,qs=e=>{const{selectionKeys:t,column:n,record:r,rowKey:a}=e,{tableRef:i}=l().useContext(Ha),{rowSelection:o}=i.current.props,s=l().useMemo((()=>n.type||""),[n.type]),c=e=>{const{isTreeTable:n,tableFullData:r}=i.current,a=o.checkStrictly??!0;if(!n||a)return!1;const l=hr(r,(t=>t._rowKey===e));return((e,t)=>{const n=new Set(t);let r=!1,a=!1;for(const t of e)if(n.has(t)?r=!0:a=!0,r&&a)break;return r&&a})(Wn(l?.children??[],(e=>e._rowKey)),t)};return"radio"===s?(()=>{const e=o.disabled,n=e?.(r),i=!n&&t[0]===a;return l().createElement(R.Radio,{checked:i,disabled:n})})():(()=>{const e=o.disabled,n=e?.(r),i=!!t.includes(a);return l().createElement(R.Checkbox,{checked:i,indeterminate:c(a),disabled:n})})()},Ds=e=>{const{record:t,rowKey:n,style:r}=e,{tableRef:a,rowExpandedKeys:i,setRowExpandedKeys:o}=l().useContext(Ha),{expandable:s={}}=a.current.props,[c]=l().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=l().useMemo((()=>i.includes(n)),[i,n]);De((()=>{s.onExpand?.(d,t)}),[d]);const u=Ee("expand"),m={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return l().createElement("span",{className:xe()(m),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==n)):[...i,n];o(t)},style:r})},Hs=l().createContext({});function $s(){return $s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$s.apply(null,arguments)}const Ms=l().forwardRef(((e,t)=>{const{$size:n,doFieldValidate:r}=l().useContext(Ha),{dataKey:a,doFieldUpdate:i,cellValueChange:o}=l().useContext(Hs),{column:s,row:c,rowKey:d,columnKey:u,options:m,isTextArea:p}=e,{t:h}=U(),f=As(),g=l().useRef(!1),{dataIndex:y}=s,{type:b,extra:v={},rules:x=[],onInput:E,onChange:w,onEnter:C,onBlur:S}=m,N=Jn(c,y),T=Object.assign({},{minRows:1,maxRows:4},v.autoSize),I=p?{rows:T.minRows,autoSize:T}:null,O=v.password?R.Input.Password:p?R.Input.TextArea:R.Input;return l().createElement(O,$s({ref:t,size:n,value:N,maxLength:v.maxLength,showCount:v.showCount},I,{autoComplete:v.password?"new-password":"off",placeholder:v.placeholder??h("qm.table.editable.inputPlaceholder"),allowClear:v.allowClear,readOnly:v.readOnly,disabled:v.disabled,suffix:v.suffix,onChange:e=>{const t=e.target.value??"";er(c,y,t),r(x,t,d,u,cr(s.title)),f(),E?.({[a]:t}),g.current=!0},onBlur:e=>{const t=e.target.value??"";g.current&&(g.current=!1,i(c,d,u),w?.({[a]:t},c),S?.({[a]:t},c),o())},onKeyUp:e=>{if(13===e.keyCode&&!e.shiftKey){const t=e.target.value??"";C?.({[a]:t},c)}},onKeyDown:e=>{p&&13===e.keyCode&&!e.shiftKey&&C&&e.preventDefault()}}))}));Ms.displayName="TextCell";const Ks=Ms,zs=l().forwardRef(((e,t)=>{const{size:n,defaultValue:r,value:a,min:i,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:m,stringMode:p,allowClear:h,readOnly:f,disabled:g,formatter:y=e=>e.toString(),parser:b=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)<i&&(t=i.toString()),m>=0&&""!==t&&(t=new(Ra())(t).toFixed(m)),t},E=void 0!==a,[w,C]=l().useState(r??""),S=y(E?a:w),N=b(S);return De((()=>{e.onChange?.(N)}),[w]),l().createElement(R.Input,{ref:t,size:n,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const n=b(t.target.value.replace(/\s+/g,""));let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===m&&n.includes(".")&&(r=!1),i>=0&&n.startsWith("-")&&(r=!1),r){if(!p&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):C(t)})(n)}},onFocus:v,onBlur:()=>{const t=x(N);e.onBlur?.(t,N)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(N),N)}})}));zs.displayName="InputNumber";const Vs=zs,js=l().forwardRef(((e,t)=>{const{$size:n,doFieldValidate:r}=l().useContext(Ha),{dataKey:a,doFieldUpdate:i,cellValueChange:o}=l().useContext(Hs),{column:s,row:c,rowKey:d,columnKey:u,options:m}=e,{t:p}=U(),h=As(),f=l().useRef(!1),{dataIndex:g,precision:y,formatType:b}=s,{type:v,extra:x={},rules:E=[],onInput:w,onChange:C,onEnter:S,onBlur:N}=m,T=Jn(c,g);let I,R;"finance"===b&&(I=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},R=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===b&&(I=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Ra())(e).times(100).toNumber()}`,R=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Ra())(e).times(.01).toString());const O=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"";return l().createElement(Vs,{ref:t,size:n,value:T,min:x.min,max:x.max,precision:y,stringMode:x.stringMode,prefix:x.prefix,suffix:x.suffix??("percent"===b?"%":void 0),placeholder:x.placeholder??p("qm.table.editable.inputPlaceholder"),maxLength:x.maxLength,allowClear:x.allowClear,readOnly:x.readOnly,disabled:x.disabled,formatter:I,parser:R,onChange:e=>{er(c,g,e),r(E,e,d,u,cr(s.title)),h(),w?.({[a]:e}),f.current=!0},onBlur:(e,t)=>{if(!f.current)return;f.current=!1;let n=x.stringMode?e:O(e);"percent"===b&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),er(c,g,n),i(c,d,u),C?.({[a]:n},c),N?.({[a]:n},c),o()},onEnter:(e,t)=>{let n=x.stringMode?e:O(e);"percent"===b&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),S?.({[a]:n},c)}})}));js.displayName="NumberCell";const Ws=js,Bs=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u,isMultiple:m}=e,{t:p}=U(),{dataIndex:h,dictItems:f=[]}=(As(),o),{type:g,extra:y={},rules:b=[],items:v,onChange:x,onEnter:E}=u,w=v||f,C=Jn(s,h);let S=C;return l().createElement(R.Select,{mode:m?"multiple":void 0,size:t,popupClassName:ai.popupClassName,value:C||void 0,placeholder:y.placeholder??p("qm.table.editable.selectPlaceholder"),allowClear:y.allowClear,listHeight:y.listHeight,maxTagCount:y.collapseTags?"responsive":void 0,maxTagTextLength:y.maxTagTextLength,disabled:y.disabled,style:{width:"100%"},showSearch:y.filterable??!0,filterOption:(e,t)=>{const n=t?.children?.toString()||"";return`${n}|${ra.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{er(s,h,e),n(b,e,c,d,cr(o.title)),a(s,c,d),x?.({[r]:e},s),i()},onSelect:e=>{S=e},onInputKeyDown:e=>{13===e.keyCode&&re((()=>E?.({[r]:S},s)))}},w.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},Us=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u,dateType:m}=e,{t:p}=U(),{dataIndex:h}=(As(),o),{type:f,extra:g={},rules:y=[],onChange:b}=u,v=Jn(s,h);return l().createElement(F,{size:t,popupClassName:ai.popupClassName,value:ir(v,Ar[m])??void 0,picker:Pr[m],format:g.format,showTime:"datetime"===m,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=g;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:g.placeholder,allowClear:g.allowClear,disabled:g.disabled,style:{width:"100%"},onChange:e=>{const t=lr(e,Ar[m]);er(s,h,t),n(y,t,c,d,cr(o.title)),a(s,c,d),b?.({[r]:t},s),i()}})},Gs=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{t:m}=U(),{dataIndex:p}=(As(),o),{type:h,extra:f={},rules:g=[],onChange:y}=u,b="HH:mm:ss",v=Jn(s,p);return l().createElement(H,{size:t,popupClassName:ai.popupClassName,value:ir(v,b)??void 0,format:f.format||b,placeholder:f.placeholder,allowClear:f.allowClear,disabled:f.disabled,style:{width:"100%"},onChange:e=>{const t=lr(e,b);er(s,p,t),n(g,t,c,d,cr(o.title)),a(s,c,d),y?.({[r]:t},s),i()}})},Ys=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{t:m}=U(),{dataIndex:p}=(As(),o),{type:h,extra:f={},rules:g=[],onChange:y}=u,{trueValue:b=za,falseValue:v=Va,disabled:x}=f,E=Jn(s,p);return l().createElement(R.Checkbox,{checked:E===b,disabled:x,onChange:e=>{const t=e.target.checked?b:v;er(s,p,t),n(g,t,c,d,cr(o.title)),a(s,c,d),y?.({[r]:t},s),i()}})},Xs=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{t:m}=U(),{dataIndex:p}=(As(),o),{type:h,extra:f={},rules:g=[],onChange:y}=u,{trueValue:b=za,falseValue:v=Va,disabled:x}=f,E=Jn(s,p);return l().createElement(R.Switch,{checked:E===b,disabled:x,onChange:e=>{const t=e?b:v;er(s,p,t),n(g,t,c,d,cr(o.title)),a(s,c,d),y?.({[r]:t},s),i()}})},Qs=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],render:g,onChange:y}=u;if(!g)return me("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const b=Jn(s,m),v=e=>{er(s,m,e),n(f,e,c,d,cr(o.title)),a(s,c,d),y?.({[r]:e},s),i()},x=g(s,o,v);return l().isValidElement(x)?l().cloneElement(x,{value:b,disabled:h.disabled,readOnly:h.readOnly,popupClassName:ai.popupClassName,onChange:v}):null},Zs=e=>{const{multiple:t,tree:n={},defaultSelectedKeys:r,className:a,style:i,onClose:o}=e,{$size:s}=Y(e),{t:c}=U(),[d,u]=l().useState(),[m]=l().useState(n.fetch?.params),p=Ee("tree-helper"),h={[`${p}--wrapper`]:!0},f=n.fetch?{...oe(n.fetch,["params","valueKey","textKey"]),params:m}:void 0;return l().createElement("div",{className:xe()(h,a),style:i},l().createElement(gs,{multiple:t,fetch:f,fieldsDefine:{valueKey:n.fetch?.valueKey,textKey:n.fetch?.textKey},autoFocus:!0,asyncLoad:n.asyncLoad,checkStrictly:n.checkStrictly,checkStrategy:n.checkStrategy,defaultSelectedKeys:r,defaultExpandAll:n.defaultExpandAll,onSelectChange:e=>u(e),onCheckChange:e=>u(e)}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Da[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!d,onClick:()=>o(d)},c("qm.dialog.confirm"))))};Zs.displayName="TreeHelper";const Js=Zs,ec=l().forwardRef(((e,t)=>{const{$size:n,flattenColumns:r,doFieldValidate:a}=l().useContext(Ha),{dataKey:i,visible:o,setVisible:s,doFieldUpdate:c,cellValueChange:d}=l().useContext(Hs),{column:u,row:m,rowKey:p,columnKey:h,options:f}=e,{t:g}=U(),y=(As(),!!f.helper?.combinedDataIndex),{dataIndex:b,precision:v}=u,{type:x,extra:E={},rules:w=[],helper:C={},onChange:S,onEnter:N}=f,T=tr(m,y?C.combinedDataIndex:b),I=C.fieldAliasMap;I||me("Table","helper 需要配置 `fieldAliasMap` 选项");const O="function"==typeof I?I():I||{};Object.keys(O).includes(b)||me("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),y&&(C.combinedDataIndex.split("|").every((e=>Object.keys(O).includes(e)))||me("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),O[b].includes("|")&&me("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const k=e=>{const{beforeOpen:t}=C,n=(t??te)({[i]:T},m,u);n?.then?n.then((()=>{s(!0),e?.()})).catch((()=>{})):!1!==n&&(s(!0),e?.())},L=()=>{s(!1)},P=(e="",t)=>{if((0,X.isPlainObject)(t)&&Object.keys(t).length)for(const e in t){const n=t[e],i=r.find((t=>t.dataIndex===e));if(i){er(m,e,n,i.precision);const t=i.editRender?.(m,i);t&&Array.isArray(t.rules)&&a(t.rules,n,p,e,cr(i.title))}else er(m,e,n)}er(m,b,e,v),a(w,e,p,h,cr(u.title)),c(m,p,h),S?.({[i]:e},m),d()},A={visible:o,title:g("qm.searchHelper.text"),width:C.width??"40%",loading:!1,wrapClassName:ai.popupClassName,bodyStyle:{paddingBottom:`${Da[n]+20}px`},onClose:()=>{L()}},F={...C,defaultSelectedKeys:[T],size:n,onClose:e=>{e?(e=>{const t={};for(const n in O){const r=O[n];n!==b&&(t[n]=tr(e,r))}const n=O[b]?tr(e,O[b]):"";P(n,t);const{closed:r}=C;s(!1),r?.(e)})(e):L()}};return l().createElement(l().Fragment,null,l().createElement(R.Input.Search,{ref:t,value:T,allowClear:E.allowClear??!0,readOnly:E.readOnly,disabled:E.disabled,placeholder:E.placeholder??g("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!o&&k())},onDoubleClick:()=>{k()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?k():P(""))}}),l().createElement(yn,A,l().createElement(Js,F)))}));ec.displayName="TreeHelperCell";const tc=ec,nc=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,visible:a,setVisible:i,doFieldUpdate:o,cellValueChange:s}=l().useContext(Hs),{column:c,row:d,rowKey:u,columnKey:m,options:p}=e,{t:h}=U();As(),l().useLayoutEffect((()=>{p.items&&v(p.items.map((e=>({[y.current.valueKey]:e.value,[y.current.textKey]:e.text}))))}),[]);const[f,g]=l().useState(p.items||[]),y=l().useRef({}),b=l().useRef([]),v=e=>b.current=e,{dataIndex:x}=c,{type:E,extra:w={},items:C=[],rules:S=[],helper:N={},onInput:T,onChange:I,onEnter:O}=p,k=Jn(d,x),L=N.fieldAliasMap;L||me("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof L?L():L||{};Object.keys(P).includes("valueKey")&&Object.keys(P).includes("textKey")||me("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),y.current=P;const A=e=>{const{beforeOpen:t}=N,n=(t??te)({[r]:k},d,c);n?.then?n.then((()=>{i(!0),e?.()})).catch((()=>{})):!1!==n&&(i(!0),e?.())},F=()=>{i(!1)},_=e=>{er(d,x,e),n(S,e,u,m,cr(c.title)),o(d,u,m),I?.({[r]:e},d,b.current),s()},q={visible:a,title:h("qm.searchHelper.text"),width:N.width??"40%",loading:!1,wrapClassName:ai.popupClassName,bodyStyle:{paddingBottom:`${Da[t]+20}px`},onClose:()=>{F()}},D={...N,size:t,multiple:!0,initialValue:(0,X.merge)({},N.initialValue),defaultSelectedKeys:k,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=P;v(e);const r=b.current.map((e=>({text:e[t],value:e[n]})));g(r),_(r.map((e=>e.value)));const{closed:a}=N;i(!1),a?.(b.current)})(e):F()}};return l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{className:"ant-input-wrapper ant-input-group"},l().createElement(R.Select,{mode:"multiple",open:!1,value:k,placeholder:w.placeholder??h("qm.table.editable.selectPlaceholder"),allowClear:w.allowClear,maxTagCount:w.collapseTags?"responsive":void 0,maxTagTextLength:w.maxTagTextLength,disabled:w.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!a&&A()},onDoubleClick:()=>{w.disabled||A()},onChange:e=>{const{valueKey:t}=P;v(b.current.filter((n=>e.includes(n[t])))),_(e)}},f.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value},e.text)))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(R.Button,{className:"ant-input-search-button",disabled:w.disabled,icon:l().createElement(we.SearchOutlined,null),onClick:()=>{A()}})))),l().createElement(yn,q,l().createElement(Js,D)))},rc=l().forwardRef(((e,t)=>{const{$size:n,flattenColumns:r,doFieldValidate:a}=l().useContext(Ha),{dataKey:i,visible:o,setVisible:s,setMatching:c,doFieldUpdate:d,cellValueChange:u}=l().useContext(Hs),{column:m,row:p,rowKey:h,columnKey:f,options:g}=e,{t:y}=U(),b=(As(),!!g.helper?.combinedDataIndex),v=l().useRef(!1),x=l().useRef({}),[E,w]=l().useState(),{dataIndex:C,precision:S}=m,{type:N,extra:T={},rules:I=[],helper:O={},onInput:k,onChange:L,onEnter:P}=g,A=tr(p,b?O.combinedDataIndex:C),F=O.fieldAliasMap;F||me("Table","helper 需要配置 `fieldAliasMap` 选项");const _="function"==typeof F?F():F||{};Object.keys(_).includes(C)||me("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),b&&(O.combinedDataIndex.split("|").every((e=>Object.keys(_).includes(e)))||me("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),_[C].includes("|")&&me("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const q=e=>{const{filterAliasMap:t}=O,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],a={[C]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if((0,X.isPlainObject)(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](n):n;else a[e]=n})),a},D=e=>{const{autoQueryAssign:t=!0}=O;t&&(x.current=q(e)),s(!0)},H=(e,t)=>{const{beforeOpen:n}=O,r=(n??te)({[i]:A},p,m);r?.then?r.then((()=>{D(e),t?.()})).catch((()=>{})):!1!==r&&(D(e),t?.())},$=e=>{const t={};for(const n in _){const r=_[n];n!==C&&(t[n]=tr(e,r))}const n=_[C]?tr(e,_[C]):"";K(n,t);const{closed:r}=O;s(!1),r?.(e)},M=()=>{const{onlySelect:e=!0}=O;v.current&&K(e?"":A),s(!1)},K=(e="",t)=>{if((0,X.isPlainObject)(t)&&Object.keys(t).length)for(const e in t){const n=t[e],i=r.find((t=>t.dataIndex===e));if(i){er(p,e,n,i.precision);const t=i.editRender?.(p,i);t&&Array.isArray(t.rules)&&a(t.rules,n,h,e,cr(i.title))}else er(p,e,n)}b&&!e&&((e,t)=>{if(!t.includes("|"))return er(e,t,"",void 0);const n="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&er(e,t,n[r]?.trim())}))})(p,O.combinedDataIndex),er(p,C,e,S),a(I,e,h,f,cr(m.title)),d(p,h,f),L?.({[i]:e},p),u(),x.current={},v.current=!1,w(void 0)},z={visible:o,title:y("qm.searchHelper.text"),width:O.width??"60%",loading:!1,wrapClassName:ai.popupClassName,bodyStyle:{paddingBottom:`${Da[n]+20}px`},onClose:()=>{M()}},V={...O,size:n,initialValue:Object.assign({},x.current,O.initialValue),onClose:e=>{e?$(e):M()}};return l().createElement(l().Fragment,null,l().createElement(R.Input.Search,{ref:t,value:E??A,placeholder:T.placeholder??y("qm.table.editable.selectPlaceholder"),allowClear:T.allowClear,readOnly:T.readOnly,disabled:T.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:r}=O;if(v.current&&!o)return t&&n&&r?.fetch?.api?(e=>{const{table:t,initialValue:n={}}=O,{beforeFetch:r=te}=t.fetch;return new Promise((async(a,i)=>{const l=(0,X.merge)({},t.fetch.params,{...n,...q(e)},{currentPage:1,pageSize:500});if(!r(l))return i();c(!0);try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,X.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{re((()=>c(!1)))}}))})(t).then((e=>((e=[],t)=>{const n=e.filter((e=>tr(e,_[C]).toString().includes(t)));if(1===n.length)return $(n[0]);H(t)})(e,t))).catch((()=>K(""))):void K(t)},onChange:e=>{const{value:t}=e.target;k?.({[i]:t}),v.current=!0,w(t)},onKeyDown:e=>{if(13===e.keyCode){const t=e.target.value??"";!o&&H(t)}},onDoubleClick:e=>{const{value:t}=e.target;H(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&H(e)}}),l().createElement(yn,z,l().createElement(kc,V)))}));rc.displayName="SearchHelperCell";const ac=rc,ic=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,visible:a,setVisible:i,doFieldUpdate:o,cellValueChange:s}=l().useContext(Hs),{column:c,row:d,rowKey:u,columnKey:m,options:p}=e,{t:h}=U(),[f,g]=(As(),l().useState(p.items||[])),y=l().useRef({}),b=l().useRef([]),v=e=>b.current=e;l().useLayoutEffect((()=>{p.items&&v(p.items.map((e=>({[y.current.valueKey]:e.value,[y.current.textKey]:e.text}))))}),[]);const{dataIndex:x}=c,{type:E,items:w=[],extra:C={},rules:S=[],helper:N={},onInput:T,onChange:I,onEnter:O}=p,k=Jn(d,x),L=N.fieldAliasMap;L||me("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof L?L():L||{};Object.keys(P).includes("valueKey")&&Object.keys(P).includes("textKey")||me("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),y.current=P;const A=e=>{const{beforeOpen:t}=N,n=(t??te)({[r]:k},d,c);n?.then?n.then((()=>{i(!0),e?.()})).catch((()=>{})):!1!==n&&(i(!0),e?.())},F=()=>{i(!1)},_=e=>{er(d,x,e),n(S,e,u,m,cr(c.title)),o(d,u,m),I?.({[r]:e},d,b.current),s()},q={visible:a,title:h("qm.searchHelper.text"),width:N.width??"60%",loading:!1,wrapClassName:ai.popupClassName,bodyStyle:{paddingBottom:`${Da[t]+20}px`},onClose:()=>{F()}},D={...N,size:t,multiple:!0,initialValue:(0,X.merge)({},N.initialValue),defaultSelectedKeys:k,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=P;v((0,X.uniqBy)([...b.current.filter((e=>t.includes(e[r]))),...e],r));const a=b.current.map((e=>({text:e[n],value:e[r]}))),l=(0,X.uniqBy)([...a,...w],"value").filter((e=>t.includes(e.value)));g(l),_(l.map((e=>e.value)));const{closed:o}=N;i(!1),o?.(b.current)})(e,t):F()}};return l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{className:"ant-input-wrapper ant-input-group"},l().createElement(R.Select,{mode:"multiple",open:!1,value:k,placeholder:C.placeholder??h("qm.table.editable.selectPlaceholder"),allowClear:C.allowClear,maxTagCount:C.collapseTags?"responsive":void 0,maxTagTextLength:C.maxTagTextLength,disabled:C.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!a&&A()},onDoubleClick:()=>{C.disabled||A()},onChange:e=>{const{valueKey:t}=P;v(b.current.filter((n=>e.includes(n[t])))),_(e)}},f.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value},e.text)))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(R.Button,{className:"ant-input-search-button",disabled:C.disabled,icon:l().createElement(we.SearchOutlined,null),onClick:()=>{A()}})))),l().createElement(yn,q,l().createElement(kc,D)))},lc=l().forwardRef(((e,t)=>{const{column:n,record:r,rowKey:a,columnKey:i}=e,{tableRef:o,updateTableFlatData:s,dataChange:c}=l().useContext(Ha),d=l().useContext(Ns),{store:u,fieldAuth:m}=o.current,p=n.editRender?.(r,n)||{},h=l().useRef(null),f=l().useRef(null),g=l().useRef(null),y=l().useRef(null),[b,v]=l().useState(!1),[x,E]=l().useState(!1),w=`${a}|${i}`,C=2===d.length?`${d[0]}|${d[1]}`:"",S=(p.editable||br(d,[a,i],!0))&&!p.disabled&&!m[i]?.disabled,N=![...u.state.required,...u.state.validate].some((({x:e,y:t})=>e===a&&t===i)),T=u.state.required.find((({x:e,y:t})=>e===a&&t===i))?.text||"",I=u.state.validate.find((({x:e,y:t})=>e===a&&t===i))?.text||"",R=u.state.edited.some((({x:e,y:t})=>e===a&&t===i)),O=S||!N||b||x;l().useEffect((()=>{O&&C===w&&k()}),[d]);const k=()=>{const{type:e}=p;switch(e){case"text":h.current?.focus();break;case"number":f.current?.select();break;case"search-helper":g.current?.focus();break;case"tree-helper":y.current?.focus()}},L=()=>{const{type:e}=p;switch(e){case"text":h.current?.blur();break;case"number":f.current?.blur();break;case"search-helper":g.current?.blur();break;case"tree-helper":y.current?.blur()}},P=G((()=>{s(),c()})),A=(e,t,n)=>{const{cornerSign:r=!0}=p.extra||{};u.addToUpdated(e),r&&u.addToEdited({x:t,y:n})};l().useImperativeHandle(t,(()=>({focus:k,blur:L,isEditable:()=>!p.disabled,isOpening:()=>b})));const F=l().useMemo((()=>({dataKey:w,visible:b,matching:x,setVisible:v,setMatching:E,doFieldUpdate:A,cellValueChange:P})),[b,x]),_={text:()=>l().createElement(Ks,{ref:h,column:n,row:r,rowKey:a,columnKey:i,options:p}),textarea:()=>l().createElement(Ks,{ref:h,column:n,row:r,rowKey:a,columnKey:i,options:p,isTextArea:!0}),number:()=>l().createElement(Ws,{ref:f,column:n,row:r,rowKey:a,columnKey:i,options:p}),select:()=>l().createElement(Bs,{column:n,row:r,rowKey:a,columnKey:i,options:p}),"select-multiple":()=>l().createElement(Bs,{column:n,row:r,rowKey:a,columnKey:i,options:p,isMultiple:!0}),date:()=>l().createElement(Us,{column:n,row:r,rowKey:a,columnKey:i,options:p,dateType:"exactdate"}),datetime:()=>l().createElement(Us,{column:n,row:r,rowKey:a,columnKey:i,options:p,dateType:"datetime"}),month:()=>l().createElement(Us,{column:n,row:r,rowKey:a,columnKey:i,options:p,dateType:"month"}),year:()=>l().createElement(Us,{column:n,row:r,rowKey:a,columnKey:i,options:p,dateType:"year"}),time:()=>l().createElement(Gs,{column:n,row:r,rowKey:a,columnKey:i,options:p}),checkbox:()=>l().createElement(Ys,{column:n,row:r,rowKey:a,columnKey:i,options:p}),switch:()=>l().createElement(Xs,{column:n,row:r,rowKey:a,columnKey:i,options:p}),"search-helper":()=>l().createElement(ac,{ref:g,column:n,row:r,rowKey:a,columnKey:i,options:p}),"search-helper-multiple":()=>l().createElement(ic,{column:n,row:r,rowKey:a,columnKey:i,options:p}),"tree-helper":()=>l().createElement(tc,{ref:y,column:n,row:r,rowKey:a,columnKey:i,options:p}),"tree-helper-multiple":()=>l().createElement(nc,{column:n,row:r,rowKey:a,columnKey:i,options:p}),custom:()=>l().createElement(Qs,{column:n,row:r,rowKey:a,columnKey:i,options:p})};return l().createElement(l().Fragment,null,O?(()=>{const{type:e}=p,t=_[e];if(!t)return me("Table","单元格编辑的类型 `type` 配置不正确"),null;const n=["cell--edit",{"is-error":!N}];return l().createElement("div",{className:xe()(n)},l().createElement(Hs.Provider,{value:F},t()),!N&&l().createElement("div",{className:"cell-error"},T||I))})():(()=>{const{disabled:t,extra:n={}}=p,{disabledColor:r,disabledBgColor:a}=n,i=["cell--show",{"is-cell-bg":t&&a}];return l().createElement(l().Fragment,null,l().createElement("span",{className:xe()(i),style:{color:t?r:""}},e.children),t&&a&&l().createElement("i",{className:"cell--bg",style:{background:a}}))})(),R&&l().createElement("i",{className:"cell--sign"}))}));lc.displayName="CellEdit";const oc=lc,sc=require("copy-to-clipboard");var cc=r.n(sc);const dc=e=>{const{text:t,options:n,showMessage:r=!0,onCopy:a}=e,{t:i}=U();return wt(e.children,{onClick:o=>{const s=l().Children.only(e.children),c=cc()(t,n);a?.(t,c),c&&r&&R.message.success(i("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};dc.displayName="QmCopyToClipboard";const uc=dc,mc=l().forwardRef(((e,t)=>{const{column:n,row:r,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c,onUnmount:d}=e,{tableRef:u,selectionKeys:m,treeExpandIndex:p,updateMark:h}=l().useContext(Ha),{dataIndex:f,canCopy:g,render:y,editRender:b,shouldCellUpdate:v}=n,{t:x}=U(),{renderText:E,getTitleFromCellNode:w}=hi(),C=l().useRef(null),S=Jn(r,f),[N,T]=function(e,c){const d=i.useRef({});return"value"in d.current&&!((e,t)=>{if(v){const[,n]=e,[,a]=t;return v(a,n,r)}return!br(e,t,!0)})(d.current.condition,c)||(d.current.value=(()=>{const e=y?y(S,r,n,a,o):E(S,n,r);return[e,b?l().createElement(oc,{ref:t,column:n,record:r,rowKey:s,columnKey:f},e):null]})(),d.current.condition=c),d.current.value}(0,[h,r,S,y,b]);l().useEffect((()=>()=>d?.()),[]),l().useEffect((()=>{if([ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(f))return;const e=C.current.parentNode;c?e.title=w(N):e.removeAttribute("title")}),[c,N]);const I=e=>Array.isArray(e.children);return l().createElement("div",{ref:C,className:"cell"},(()=>{if(f===ai.expandableColumn)return l().createElement(Ds,{record:r,rowKey:s});if(f===ai.selectionColumn)return l().createElement(qs,{selectionKeys:m,column:n,record:r,rowKey:s});if(T)return T;if(u.current.isTreeTable&&f===p)return l().createElement(l().Fragment,null,(e=r._level)?l().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*ai.treeTable.textIndent+"px"}}):null,l().createElement(Ds,{key:"expand",record:r,rowKey:s,style:I(r)?{}:{visibility:"hidden"}}),N);var e;if(g){const e=w(N);return l().createElement("div",{className:"cell--copy"},l().createElement("span",{className:"text"},N),e&&l().createElement(uc,{text:e},l().createElement(we.CopyOutlined,{className:"icon",title:x("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return N})())}));mc.displayName="Cell";const pc=mc,hc={open:!1,offsetX:0,offsetY:0},fc=l().forwardRef(((e,t)=>{const{rowVirtualize:n}=e,{tableRef:r,getRowKey:a,prefixCls:i,tableFlatData:o,flattenColumns:s,tableRowHeight:c,mergedTdCells:d,setMergedCells:u}=l().useContext(Ha),{areaSelection:m={}}=r.current.props,{elementStore:p,scrollYLoad:h}=r.current,{t:f}=U(),g=l().useRef(document.onselectstart),y=l().useRef(null),b=l().useRef(null),v=l().useRef(null),x=e=>{v.current=e},[E,w]=l().useState(null),[C,S]=l().useState(null),[N,T]=l().useState(null),I=e=>{if(!e)return T(null);let t=!1;for(const n in e)if(N?.[n]!==e[n]){t=!0;break}t&&T(Object.assign({},N,e))};uo({ref:y,handler:()=>V()}),l().useEffect((()=>{const e=Ut()(p.$tableBody,"mousedown",D),t=Ut()(p.$tableBody,"contextmenu",_),n=Ut()(document,"keydown",q);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const R=()=>{w(null),I(null),x(null),S(null)};l().useImperativeHandle(t,(()=>({blur:R})));const O=e=>{let t=e;for(;t;){if(!p.$tableBody.contains(t))return null;if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},k=e=>({rowIndex:parseInt(e.parentNode.getAttribute("data-row-index"),10),colIndex:parseInt(e.getAttribute("data-col-index"),10),rowspan:Number(e.getAttribute("rowspan")||1),colspan:Number(e.getAttribute("colspan")||1),l:e.offsetLeft,t:e.offsetTop,w:e.offsetWidth,h:e.offsetHeight}),L=e=>({colStart:e.colIndex,colEnd:e.colIndex+e.colspan,rowStart:e.rowIndex,rowEnd:e.rowIndex+e.rowspan}),P=e=>{let[t,n,r,a]=[1/0,-1/0,1/0,-1/0];for(const i of e)t=Math.min(t,i.rowStart),n=Math.max(n,i.rowEnd),r=Math.min(r,i.colStart),a=Math.max(a,i.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:a}},A=Et((e=>{let t=P([L(e),v.current]);d.forEach((e=>{const n=o.findIndex((t=>a(t,t.index)===e.rowKey)),r=s.findIndex((t=>t.dataIndex===e.dataIndex)),i={rowStart:n,rowEnd:n+e.rowSpan,colStart:r,colEnd:r+e.colSpan};var l,c;c=i,(l=t).rowEnd<=c.rowStart||l.rowStart>=c.rowEnd||l.colEnd<=c.colStart||l.colStart>=c.colEnd||(t=P([t,i]))})),I(t)}),5),F=e=>{u(e),m.onCellMerge?.(e),re((()=>R()))},_=G((e=>{m.cellMerge&&E&&K(e.clientX,e.clientY)?(e.preventDefault(),z(e)):C?.open&&V()})),q=G((e=>{27===e.keyCode&&R()})),D=G((e=>{e.stopPropagation();const t=O(e.target);if(1!==e.buttons||!t)return;V();const n=k(t);w(n);const r=L(n);x(r),I(r),document.addEventListener("mousemove",H),document.addEventListener("mouseup",$),g.current=document.onselectstart,document.onselectstart=()=>!1})),H=G((e=>{const t=O(e.target);t&&A(k(t))})),$=G((()=>{m.onSelectChange?.((()=>{const e=[];if(!E||!N)return e;for(let t=N.rowStart;t<N.rowEnd;t++)for(let n=N.colStart;n<N.colEnd;n++)e.push({rowKey:a(o[t],o[t].index),dataIndex:s[n].dataIndex,cellValue:Jn(o[t],s[n].dataIndex)});return e})()),document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",$),M()})),M=()=>{document.onselectstart!==g.current&&(document.onselectstart=g.current)},K=(e,t)=>{const{top:n,left:r}=p.$tableBody.parentNode.getBoundingClientRect(),[a,i]=[e-r,t-n],{el:l,et:o,ew:s,eh:c}=X();return!(a<l||a>l+s||i<o||i>o+c)},z=e=>{const{top:t,left:n,height:r}=b.current.getBoundingClientRect();S({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},V=()=>{S((e=>({...e,open:!1})))},j=e=>({rowIndex:o.findIndex((t=>a(t,t.index)===e.rowKey)),colIndex:s.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),W=()=>{if(!E||!N||(t=N,(e=E).rowIndex===t.rowStart&&e.colIndex===t.colStart&&e.rowspan===t.rowEnd-t.rowStart&&e.colspan===t.colEnd-t.colStart))return R();var e,t;const n={rowKey:a(o[N.rowStart],o[N.rowStart].index),dataIndex:s[N.colStart].dataIndex,rowSpan:N.rowEnd-N.rowStart,colSpan:N.colEnd-N.colStart};F([...d.filter((e=>!((e,t)=>{const n=j(e),r=j(t),[a,i,l,o]=[n.rowIndex,n.colIndex,n.rowIndex+n.rowSpan-1,n.colIndex+n.colSpan-1],[s,c,d,u]=[r.rowIndex,r.colIndex,r.rowIndex+r.rowSpan-1,r.colIndex+r.colSpan-1];return a<=s&&i<=c&&l>=d&&o>=u||s<=a&&c<=i&&d>=l&&u>=o})(e,n))),n])},B=()=>{const e=a(o[N.rowStart],o[N.rowStart].index),t=s[N.colStart].dataIndex;F(d.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},Y=e=>{if(h)return n.measurementsCache.slice(0,e).map((e=>e.size)).reduce(((e,t)=>e+t),0);if(e>=o.length)return p.$tableBody.parentNode.offsetHeight;const t=a(o[e],o[e].index),r=p.$tableBody.querySelector(`tbody > tr[data-row-key="${t}"]`);return r?r.offsetTop:c*e},X=()=>{const{w:e,h:t,l:n,t:r}=E,a=s.slice(0,N.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=Y(N.rowStart);return{sl:n,st:r,sw:e,sh:t,el:a,et:i,ew:s.slice(0,N.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-a,eh:Y(N.rowEnd)-i}};return l().createElement("div",{className:`${i}--area-select`},(()=>{if(!E||!N)return null;const{sl:e,st:t,sw:n,sh:r,el:a,et:i,ew:o,eh:s}=X(),{open:c,offsetX:d,offsetY:u}=C||hc,m=l().createElement("ul",{ref:y,className:"ant-dropdown-menu"},l().createElement("li",{className:"ant-dropdown-menu-item",onClick:W},f("qm.table.areaSelect.mergeCell")),l().createElement("li",{className:"ant-dropdown-menu-item",onClick:B},f("qm.table.areaSelect.cancelMerge")));return l().createElement(l().Fragment,null,l().createElement("div",{className:"active-area",style:{left:e,top:t,width:n,height:r}}),l().createElement(Ai(),{popupVisible:c,popup:m,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:ai.popupClassName,builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},l().createElement("div",{ref:b,className:"checked-area",style:{left:a,top:i,width:o,height:s}})))})())}));fc.displayName="AreaSelect";const gc=fc,yc=l().forwardRef(((e,t)=>{const{tableRef:n,getRowKey:r,prefixCls:a,tableFlatData:i,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,tableRowHeight:m,sorter:p,layout:h,showFooter:f,selectionKeys:g,rowExpandedKeys:y,highlightKey:b,activedCell:v,isPingLeft:x,isPingRight:E,isTableEmpty:w,isGroupSubtotal:C,setElementStore:S,setSelectionKeysEffect:N,setHighlightKey:T,setActivedCell:I,getStickyLeft:R,getStickyRight:O,setPingLeft:k,setPingRight:L,setFullScreen:P,scrollBottomDebouncer:A}=l().useContext(Ha),{height:F,minHeight:_,maxHeight:q,rowSelection:D,rowHighlight:H,expandable:$,stripe:M,summation:K,rowHeight:z,rowStyle:V,cellStyle:j,spanMethod:W,tableConfig:B,areaSelection:U,ellipsis:Y,showHeader:Q,rowDraggable:Z,onRowClick:J,onRowDblclick:ne,onRowContextmenu:re,onRowEnter:ae}=n.current.props,ie=l().useRef(null),le=l().useRef(new Map),oe=l().useRef(null),se=l().useRef({prevST:0,prevSL:0}),{onNodeDragStart:ce,onNodeDragEnter:de,onNodeDragOver:ue,onNodeDragLeave:me,onNodeDragEnd:pe,onNodeDrop:he,indent:fe,dropOptions:ge}=Ps({openDragSort:Z}),{rowVirtualizer:ye,columnVirtualizer:be,virtualRows:ve,virtualColumns:Ee,resetItemXSize:we,getYIndexes:Ce,virtualTranslateY:Se,virtualTranslateX:Ne,calcVirtualYSize:Te,calcVirtualXSize:Ie,scrollToYIndex:Re}=((e,t)=>{const{tableRef:n,tableRowHeight:r}=l().useContext(Ha),{props:a,scrollBarRef:i}=n.current,o=a.tableConfig?.overscan||1,s=l().useMemo((()=>i.current?.scrollElement||null),[i.current]),c=l().useMemo((()=>{const e=[],n=[];return t.forEach(((t,r)=>{"left"===t.fixed&&e.push(r),"right"===t.fixed&&n.push(r)})),[e,n]}),[t]),d=lo({count:e.length,getScrollElement:()=>s,estimateSize:()=>r,indexAttribute:"data-row-index",overscan:o,enabled:n.current.scrollYLoad}),u=d.getVirtualItems(),m=lo({horizontal:!0,count:t.length,getScrollElement:()=>s,estimateSize:e=>t[e].width||t[e].renderWidth||0,indexAttribute:"data-col-index",overscan:o,enabled:n.current.scrollXLoad,rangeExtractor:e=>[...new Set([...c[0],...Xl(e),...c[1]])]}),p=m.getVirtualItems();return{rowVirtualizer:d,columnVirtualizer:m,virtualRows:u,virtualColumns:p,resetItemXSize:e=>{e.forEach(((e,t)=>{m.resizeItem(t,e.width||e.renderWidth||ai.defaultColumnWidth)}))},getYIndexes:()=>d.getVirtualIndexes()||[],getXIndexes:()=>m.getVirtualIndexes()||[],virtualTranslateY:()=>u[0]?.start||0,virtualTranslateX:()=>{const e=c[0].length;return e?p[e]?.index===e?p[0]?.start||0:(p[e]?.start||0)-p.slice(0,e).reduce(((e,t)=>e+t.size),0):p[0]?.start||0},calcVirtualYSize:()=>d.getTotalSize()||"",calcVirtualXSize:()=>m.getTotalSize()||"",scrollToYIndex:e=>{d.scrollToIndex(e)},scrollToXIndex:e=>{m.scrollToIndex(e)}}})(i,o),Oe=Ce(),ke=e=>{if(e&&!Y)return ye.measureElement(e)},Le=l().useMemo((()=>u.length&&n.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:a,colSpan:i})=>{const l=e+a-1,o=[];for(let t=e;t<=l;t++)r.has(t)&&o.push(t);if(0===o.length)return;const s=o.length;o.forEach(((e,r)=>{0===r&&n.push({row:e,col:t,rowSpan:s,colSpan:i});for(let a=t;a<t+i;a++)0===r&&a===t||n.push({row:e,col:a,rowSpan:0,colSpan:0})}))})),n})(u,Oe):u),[u,Oe.join(",")]),[Pe,Ae]=l().useState([]),Fe=As();uo({ref:ie,omitClassNames:[`.${ai.popupClassName}`],handler:()=>{Qe([]),oe.current?.blur()}}),l().useImperativeHandle(t,(()=>({setClickedValues:Qe,createFocus:We,forceUpdate:Fe,resetItemXSize:we,scrollToYIndex:Re}))),De((()=>{Pe.length&&n.current.tableManager.focus(n.current.uid)}),[Pe]),l().useLayoutEffect((()=>{je();const e=Ut()(document,"keydown",He);return()=>e.remove()}),[]);const _e=l().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:a}=h,i={};return w&&Object.assign(i,{minHeight:"100px"}),_&&Object.assign(i,{minHeight:Qn(_)-e-n+"px"}),q&&Object.assign(i,{maxHeight:Qn(q)-e-n+"px"}),F||r||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[F,q,_,w,h]),qe=G((e=>{const{elementStore:t}=n.current,{prevST:r,prevSL:a}=se.current,{scrollTop:i,scrollLeft:l}=e;if(l!==a){Q&&(t.$header.scrollLeft=l),f&&(t.$footer.scrollLeft=l);const e=l>0,n=Math.ceil(l+h.tableWidth)<h.tableBodyWidth;x!==e&&k(e),E!==n&&L(n)}se.current={prevST:i,prevSL:l}})),He=G((e=>{if(n.current.uid!==n.current.tableManager.getFocusInstance()?.id)return;const{keyCode:t}=e;if(27===t&&(Qe([]),T(""),I({}),P(!1)),Pe.length&&(Ue(document.activeElement,ie.current)||"INPUT"!==document.activeElement?.tagName)){if(13===t&&("radio"===D?.type||H)){const t=g[0]??b??null,n=i.find((e=>r(e,e.index)===t))??null;n&&ae?.(n,e)}Ye(Pe[0],Pe[1])||(38!==t&&40!==t||(Me(e),$e(e)),(9===t||e.shiftKey&&9===t)&&(Me(e),Ke(e)))}})),$e=Xt((e=>{if(!Pe.length)return;const t=i.length;let n=i.findIndex((e=>r(e,e.index)===Pe[0]));const a=38===e.keyCode?(--n+t)%t:++n%t,l=i[a],o=r(l,l.index),s=Ge(o,Pe[1]);"radio"!==D?.type||D.disabled?.(l)||s||N([o]),!H||H.disabled?.(l)||s||T(o),ze(38===e.keyCode?"top":"bottom",a),Be(...Pe),Qe([o,Pe[1]])}),100),Ke=Xt((e=>{if(!Pe.length)return;if(!s.length)return Qe([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Pe[1]));const r=e.shiftKey&&9===e.keyCode?(--n+t)%t:++n%t;Be(...Pe),Ve(e.shiftKey&&9===e.keyCode?"left":"right",r),Qe([Pe[0],s[r].dataIndex])}),100),ze=(e,t)=>{const{scrollBarRef:r,scrollYLoad:a}=n.current;if(a)return ye.scrollToIndex(t);const l=i.length,o=t,s=ie.current.querySelectorAll("tbody > tr"),c=i.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<r.current.scrollTop?r.current.SET_SCROLL_TOP(c):t===l-1&&r.current.SET_SCROLL_TOP(c-(h.viewportHeight-d)):c+d>r.current.scrollTop+h.viewportHeight?r.current.SET_SCROLL_TOP(c-(h.viewportHeight-d)):0===t&&r.current.SET_SCROLL_TOP(c)},Ve=(e,t)=>{const{scrollBarRef:r}=n.current,a=s.length,i=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),l=o.slice(0,i).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[i].width||o[i].renderWidth,m=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),p=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?l<r.current.scrollLeft+m?r.current.SET_SCROLL_LEFT(l-m):t===a-1&&r.current.SET_SCROLL_LEFT(l-(h.tableWidth-u)+p):l+u>r.current.scrollLeft+(h.tableWidth-p)?r.current.SET_SCROLL_LEFT(l-(h.tableWidth-u)+p):0===t&&r.current.SET_SCROLL_LEFT(l-m)},je=()=>{S("$tableBody",ie.current)},We=(e,t)=>{le.current.get(`${e}-${t}`)?.focus()},Be=(e,t)=>{le.current.get(`${e}-${t}`)?.blur()},Ge=(e,t)=>le.current.get(`${e}-${t}`)?.isEditable()??!1,Ye=(e,t)=>le.current.get(`${e}-${t}`)?.isOpening()??!1,Xe=e=>{const t=K.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Qe=e=>{(0,X.isEqual)(e,Pe)||Ae(e)},Ze=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Je=(e,t,r)=>{const{disabled:a}=D||{},{tableFullData:i,recordsMap:l}=n.current,o=hr(i,(t=>t._rowKey===e));let s=[],c=Wn(o?.children||[],(e=>e._rowKey));return a&&(c=c.filter((e=>!l.has(e)||!a(l.get(e))))),s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),(fr(i,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=hr(i,(t=>t._rowKey===e)),n=t?.children?.every((e=>s.includes(e._rowKey)));s=n?[...s,e]:s.filter((t=>t!==e))})),s},et=(e,t,a,i,o)=>{const{dataIndex:s,fixed:u,align:h,className:f=""}=e,{rowSpan:y,colSpan:b}=tt(a,e,i,t);if(!y||!b)return null;const x=e.ellipsis??Y,E=["body--column",{"col--ellipsis":x,"col--center":"center"===h,"col--right":"right"===h,"col-active":v.rowKey===o&&v.dataIndex===s,"column--sort":!!p[s],"cell-fix-left":"left"===u,"cell-fix-right":"right"===u,"cell-fix-left-last":"left"===u&&c[c.length-b]?.dataIndex===s,"cell-fix-right-first":"right"===u&&d[0]?.dataIndex===s,[f]:!!f}],w={left:"left"===u?`${R(s)}px`:"",right:"right"===u?`${O(s)}px`:""},S=V?"function"==typeof V?V(a,i):V:null,I=j?"function"==typeof j?j(a,e,i,t):j:null,k=C?(e=>{const{backgroundColor:t,color:n}=K.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:n}})(a._group):null,L=Object.assign({},w,{height:z?m:""},k,S,I);return l().createElement("td",{key:s,"data-col-index":t,rowSpan:y>1?y:void 0,colSpan:b>1?b:void 0,className:xe()(E),style:L,onClick:t=>((e,t,a)=>{const{dataIndex:i}=a;if([ai.expandableColumn,ai.operationColumn].includes(i))return;const l=r(t,t.index);Qe([l,i]);const o=Ge(l,i),{type:s,selectByClickRow:c=!0,disabled:d=ee}=D||{};!s||d(t)||o||(c||i===ai.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:a=!0,onSelect:i}=D||{};if("radio"===r&&N([e]),"checkbox"===r){const r=!g.includes(e),l=n.current.isTreeTable&&!a?Je(e,g,r):Ze(e,g,r);N(l),i?.(r,t,l)}})(l,t),[ai.selectionColumn].includes(i)||(!H||H.disabled?.(t)||o||T(l),J?.(t,a,e))})(t,a,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(r)||ne?.(t,n,e)})(t,a,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(r)||re?.(t,n,e)})(t,a,e)},l().createElement(pc,{ref:e=>{e&&le.current.set(`${o}-${s}`,e)},row:a,column:e,rowIndex:i,columnIndex:t,rowKey:o,showTitle:x,onUnmount:()=>le.current.delete(`${o}-${s}`)}))},tt=(e,t,n,r)=>{let a=1,l=1;const o=W;if("function"==typeof o){const s=o({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(s)?(a=s[0],l=s[1]):(0,X.isPlainObject)(s)&&(a=s.rowSpan,l=s.colSpan);const c=Oe[0]??0;if(e===i[c]&&0===a)for(let e=c;e<i.length;e++){const n=o({row:i[e],column:t,rowIndex:e,columnIndex:r,tableData:i});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;a++}}if(Le.length>0){const e=Le.find((e=>e.row===n&&e.col===r));e&&(a=e.rowSpan,l=e.colSpan)}return{rowSpan:a,colSpan:l}};return l().createElement(At,{ref:n.current.scrollBarRef,wrapClassName:`${a}--body-wrapper`,wrapStyle:_e,innerStyle:{height:Te(),width:Ie()},showTopScrollbar:B?.doubleXScrollbar,onScroll:qe,onReachedEnd:(e,t)=>{"bottom"===e&&A({type:"scroll",target:t,preventDefault:ee,stopPropagation:ee})}},l().createElement(Ns.Provider,{value:Pe},l().createElement("table",{ref:ie,style:{width:0,marginTop:Se(),marginLeft:Ne()},className:xe()(`${a}--body`,{"virtual-container":n.current.scrollYLoad||n.current.scrollXLoad}),tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=n.current;return l().createElement("colgroup",null,(e?Ee:o).map((t=>{const{dataIndex:n,width:r,renderWidth:a}=e?o[t.index]:t;return l().createElement("col",{key:n,style:{width:`${r||a}px`,minWidth:`${r||a}px`}})})))})(),l().createElement("tbody",null,(e=>{const{scrollYLoad:t,scrollXLoad:a}=n.current,s=[];return(t?e:i).forEach(((e,c)=>{const d=t?i[e.index]:e,u=t?e.index:c,m=r(d,d.index);if(s.push(((e,t,r)=>{const{scrollXLoad:a}=n.current,{disabled:i}=D||{},s=["body--row",{"body--row-striped":M&&t%2!=0,"body--row-selected":g.includes(r)&&!i?.(e),"body--row-current":b===r,...C?Xe(e._group):null}],c=(a?Ee:o).map(((n,i)=>et(a?o[n.index]:n,a?n.index:i,e,t,r)));return Z?l().createElement(_s,{key:r,ref:ke,className:xe()(s),rowKey:r,rowIndex:t,row:e,indent:fe,filter:".cell--edit input",dropOption:ge,onNodeDragStart:ce,onNodeDragEnter:de,onNodeDragOver:ue,onNodeDragLeave:me,onNodeDragEnd:pe,onNodeDrop:he},c):l().createElement("tr",{key:r,ref:ke,"data-row-key":r,"data-row-index":t,className:xe()(s)},c)})(d,u,m)),$?.expandedRowRender){const{expandedRowClassName:e,rowExpandable:t=te}=$;y.includes(m)&&t(d)&&s.push(l().createElement("tr",{key:`expand_${m}`,className:"body--row-expanded"},l().createElement("td",{colSpan:(a?Ee:o).length,className:"body--column",style:{paddingLeft:D?2*ai.selectionColumnWidth:ai.selectionColumnWidth}},l().createElement("div",{className:xe()("cell",e)},$.expandedRowRender(d,u)))))}})),s})(ve)))),!!U&&l().createElement(gc,{ref:oe,rowVirtualize:ye}))}));yc.displayName="TableBody";const bc=yc,vc=()=>{const{tableRef:e,prefixCls:t,sorter:n,layout:r,flattenColumns:a,leftFixedColumns:i,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=l().useContext(Ha),{footRender:m}=e.current.props,{t:p}=U(),h=l().useRef(null);l().useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",h.current)},{tableBodyWidth:g}=r;return l().createElement("div",{ref:h,className:`${t}--footer-wrapper`},m?m(a,e.current.tableFullData):l().createElement("table",{className:`${t}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:g?`${g}px`:""}},l().createElement("colgroup",null,a.map((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;return l().createElement("col",{key:t,style:{width:`${n||r}px`,minWidth:`${n||r}px`}})}))),l().createElement("tfoot",null,s.map(((t,r)=>l().createElement("tr",{key:r,className:"footer--row"},a.map(((r,a)=>((t,r,a)=>{const{dataIndex:s,fixed:c,align:m,summation:h}=t,f=["footer--column","col--ellipsis",{"col--center":"center"===m,"col--right":"right"===m,"column--sort":!!n[s],"cell-fix-left":"left"===c,"cell-fix-right":"right"===c,"cell-fix-left-last":"left"===c&&i[i.length-1]?.dataIndex===s,"cell-fix-right-first":"right"===c&&o[0]?.dataIndex===s}],g={left:"left"===c?`${d(s)}px`:"",right:"right"===c?`${u(s)}px`:""},y=h?.render?h.render(e.current.tableFullData):Jn(r,`${s}_text`),b=0===a&&""===y?p("qm.table.config.summaryText"):y;return l().createElement("td",{key:s,title:b,className:xe()(f),style:{...g}},l().createElement("div",{className:"cell"},b))})(r,t,a)))))))))};var xc=function(e){return e.small="small",e.middle="default",e.large="default",e}(xc||{});const Ec=e=>{const{current:t,pageSize:n,total:r,onChange:a}=e,{global:i}=l().useContext(o),{tableRef:s,prefixCls:c,$size:d,setElementStore:u}=l().useContext(Ha),{uniqueKey:m,paginationConfig:p,infoBarConfig:h}=s.current.props,f=l().useRef(null),g=l().useMemo((()=>m?`tablePager_${m}`:""),[m]);l().useLayoutEffect((()=>{y(),E()}),[]);const y=()=>{u("$pager",f.current)},b=p?.showSizeChanger??ai.pagination.showSizeChanger,v=p?.showQuickJumper??ai.pagination.showQuickJumper,x=p?.pageSizeOptions||i?.table?.pagination?.pageSizeOptions||ai.pagination.pageSizeOptions,E=async()=>{if(!g)return;const e=await w(g);e&&e!==n&&(a(t,e),localStorage.setItem(g,e.toString()))},w=async e=>{const t=i?.getComponentConfigApi;if(t&&!localStorage.getItem(g))try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},C={[`${c}-pager`]:!0};return l().createElement("div",{ref:f,className:xe()(C)},l().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&l().createElement(ci,{total:r})),l().createElement(R.Pagination,{size:xc[d],showSizeChanger:b,showQuickJumper:v,pageSizeOptions:x,current:t,pageSize:n,total:r,onChange:(e,t)=>{a(e,t)},onShowSizeChange:(e,t)=>{g&&((async(e,t)=>{const n=i?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(g,t),localStorage.setItem(g,`${t}`))}}))},wc=()=>{const{prefixCls:e,layout:t}=l().useContext(Ha),n=l().useMemo((()=>{const{headerHeight:e,viewportHeight:n}=t;return{top:`${e}px`,height:`${n}px`}}),[t]);return l().createElement("div",{className:`${e}--empty`,style:n},l().createElement(dt,null))},Cc=()=>{const{prefixCls:e,setElementStore:t}=l().useContext(Ha),n=l().useRef(null);l().useLayoutEffect((()=>{r()}),[]);const r=()=>{t("$resizableBar",n.current)};return l().createElement("div",{ref:n,className:`${e}--resizable-bar`})};function Sc(){return Sc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sc.apply(null,arguments)}const Nc=l().forwardRef(((e,t)=>{const n=h(Ma,e),{rowKey:r,columns:a,loading:i,resizable:s,customClass:c,areaSelection:d,tablePrint:u,exportExcel:m,infoBarConfig:p,topSpaceAlign:f,showTableInfo:g,showFullScreen:y,showRefresh:b,showToolBox:v,showHeader:x,className:E,style:w}=n,{$size:C}=Y(n),S=l().useRef(null),N=l().useRef(null),T=l().useRef(null),I=l().useRef(null),R=l().useRef(null),O=Ee("table"),k=G(((e,t)=>{const n="function"==typeof r?r(e,t):e?.[r];return void 0===n?(me("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:L,tableFullData:P,setElementStore:A,setOriginColumns:F,setTableFullData:_,setTableOriginData:q,setTableDataMaps:D,setInvalidRowKeys:H,setFieldAuth:$,setColumnsDefined:M,setScrollXLoad:K,setScrollYLoad:z,setResizeState:V,setHandleState:j,setSummaries:W,setSelectionRows:B,setUnMounted:U,clearElementStore:Z}=((e,{getRowKey:t})=>{const n=l().useRef({props:e,uid:Qa(),tableManager:Ja,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!e.dynamicThead,scrollBarRef:l().createRef(),store:new ti({getRowKey:t}),resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},isTreeTable:!1,isOriginTree:!1,scrollXLoad:!1,scrollYLoad:!1,selectionRows:[],recordsMap:new Map,unMounted:!1,isIE:!Q&&/MSIE|Trident/.test(navigator.userAgent)});var r;r=e,n.current.props=r;const a=(e,n,r="",i=0)=>{e.forEach((e=>{const l=t(e,e.index),o=r?`${r}.${e.index+1}`:`${e.index+1}`;e.indexPath=o,e._level=i,e._rowKey=l,e._parentRowKey=i?n:null,Array.isArray(e.children)&&a(e.children,l,o,i+1),e.children&&e.children.length||(e._isLeaf=1)}))};return{tableRef:n,...n.current,setElementStore:(e,t)=>{n.current.elementStore[e]=t},setOriginColumns:e=>{n.current.originColumns=e},setTableFullData:e=>{n.current.tableFullData=e;const t=e.some((e=>Array.isArray(e.children)));n.current.isTreeTable=t,t&&a(e,"")},setTableOriginData:e=>{n.current.tableOriginData=e,n.current.isOriginTree=e.some((e=>Array.isArray(e.children)))},setTableDataMaps:e=>{const r=Vn(e);n.current.recordsMap=new Map(r.map(((e,n)=>[t(e,e.index),r[n]])))},setInvalidRowKeys:e=>{n.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{n.current.fieldAuth[e]=t},setColumnsDefined:e=>{n.current.columnsDefined=e},setResizeState:e=>{n.current.resizeState=e},setHandleState:e=>{n.current.handleState=e},setSummaries:e=>{n.current.summaries=e},setScrollXLoad:e=>{n.current.scrollXLoad=e},setScrollYLoad:e=>{n.current.scrollYLoad=e},setSelectionRows:e=>{n.current.selectionRows=e},setUnMounted:e=>{n.current.unMounted=e},clearElementStore:()=>{for(const e in n.current.elementStore)n.current.elementStore[e]=null}}})(n,{getRowKey:k}),{tableFlatData:J,setTableFlatData:ee,filters:te,setFilters:ae,sorter:ie,setSorter:le,superFilters:oe,setSuperFilters:se,pagerFilter:ce,setPagerFilter:de,pagination:ue,setPagination:pe,selectionKeys:he,setSelectionKeys:fe,rowExpandedKeys:ge,setRowExpandedKeys:ye,highlightKey:be,setHighlightKey:ve,updateMark:we,forceUpdate:Ce,activedCell:Se,setActivedCell:Ne,mergedTdCells:Te,setMergedCells:Ie,layout:Re,setLayout:Oe,permission:ke,setPermission:Le,spinning:Pe,setSpinning:Ae,isPingLeft:Fe,setPingLeft:_e,isPingRight:qe,setPingRight:He,isFullScreen:$e,setFullScreen:Me,updateTableFlatData:Ke}=(e=>{const{uniqueKey:t,initialSorter:n={},initialFilter:r={},paginationConfig:a,rowSelection:i,expandable:s,rowHighlight:c,mergedCells:d}=e,{global:u}=l().useContext(o),m={current:a?.current??ai.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??a?.pageSize??u?.table?.pagination?.pageSize??ai.pagination.pageSize,total:0},p=i?.selectedRowKeys??i?.defaultSelectedRowKeys??[],h=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[f,g]=l().useState([]),[y,b]=l().useReducer(((e,t)=>(0,X.isEqual)(e,t)?e:t),r),[v,x]=l().useReducer(((e,t)=>(0,X.isEqual)(e,t)?e:t),n),[E,w]=l().useReducer(((e,t)=>(0,X.isEqual)(e,t)?e:t),[]),[C,S]=l().useReducer(((e,t)=>(0,X.isEqual)(e,t)?e:t),{}),[N,T]=l().useState(m),[I,R]=l().useReducer(((e,t)=>(0,X.isEqual)(e,t)?e:t),p),[O,k]=l().useReducer(((e,t)=>(0,X.isEqual)(e,t)?e:t),h),[L,P]=l().useState(c?.currentRowKey??""),[A,F]=l().useReducer((e=>e+1),0),[_,q]=l().useReducer(((e,t)=>(0,X.isEqual)(e,t)?e:t),{}),[D,H]=ri([],{value:d}),[$,M]=l().useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[K,z]=l().useState({export:!0,import:!0,print:!0}),[V,j]=l().useState(!1),[W,B]=l().useState(!1),[U,G]=l().useState(!1),[Y,Q]=l().useState(!1);return{tableFlatData:f,setTableFlatData:g,filters:y,setFilters:b,sorter:v,setSorter:x,superFilters:E,setSuperFilters:w,pagerFilter:C,setPagerFilter:S,pagination:N,setPagination:T,selectionKeys:I,setSelectionKeys:R,rowExpandedKeys:O,setRowExpandedKeys:k,highlightKey:L,setHighlightKey:P,updateMark:A,forceUpdate:F,activedCell:_,setActivedCell:q,mergedTdCells:D,setMergedCells:H,layout:$,permission:K,setPermission:z,setLayout:M,spinning:V,setSpinning:j,isPingLeft:W,setPingLeft:B,isPingRight:U,setPingRight:G,isFullScreen:Y,setFullScreen:Q,updateTableFlatData:()=>g([...f])}})(n),{isFetch:ze,isWebPagination:Ve,isScrollPagination:je,showPagination:We,tableColumns:Be,flattenColumns:Ue,editableColumns:Ge,summationColumns:Ye,leftFixedColumns:Xe,rightFixedColumns:Qe,tableRowHeight:Ze,derivedMergeCells:Je,treeExpandIndex:et,showSummary:tt,showFooter:nt,isHeadGroup:rt,bordered:at,isHeadSorter:it,isHeadFilter:lt,isServiceSummation:ot,isSelectCollection:st,isTableImport:ct,isTableClipboard:dt,isSuperSearch:ut,isFastSearch:pt,isPivotGrid:ht,isGroupSummary:ft,isGroupSubtotal:gt,isTableEmpty:yt,summationRows:bt,fetchParams:vt}=li(n,{getRowKey:k,tableRef:L,$size:C,tableFullData:P,tableFlatData:J,updateMark:we,sorter:ie,filters:te,superFilters:oe,selectionKeys:he,pagination:ue,mergedTdCells:Te}),{createElementStore:xt,tableStyles:Et,getSpan:wt,getStickyLeft:Ct,getStickyRight:St,scrollXToColumn:Nt,scrollYToRecord:Tt,calcTableHeight:It,resetTableScroll:Rt,createTableFocus:Ot,doLayout:kt}=((e,t)=>{const{height:n,minHeight:r,maxHeight:a,ellipsis:i,showHeader:o,spanMethod:s,rowSelection:c}=e,{getRowKey:d,tableRef:u,topElementRef:m,tableElementRef:p,tableBodyRef:h,$size:f,tableColumns:g,flattenColumns:y,leftFixedColumns:b,derivedMergeCells:v,tableFlatData:x,selectionKeys:E,highlightKey:w,layout:C,tableRowHeight:S,showFooter:N,showPagination:T,isFullScreen:I,setLayout:R,setElementStore:O}=t,k=l().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=C,i={};return r&&Object.assign(i,{minHeight:`${Qn(r)}px`}),a&&Object.assign(i,{maxHeight:`${Qn(a)}px`}),I?{...i,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...i,height:"auto"!==n?`${Qn(n)}px`:`${t}px`}:i}),[n,a,r,I,C]),L=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r}=u.current;if(void 0!==t&&t>=0)if(t<x.length)if(r)h.current.scrollToYIndex(t);else{const e=P(d(x[t],x[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*S);else if(r){const t=x.findIndex((t=>e===d(t,t.index)));t>=0&&h.current.scrollToYIndex(t)}else{const t=P(e);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}},P=e=>u.current.elementStore.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);return{createElementStore:()=>{O("$toper",m.current),O("$table",p.current)},tableStyles:k,getSpan:(e,t,n,r,a)=>{let i=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:a});Array.isArray(o)?(i=o[0],l=o[1]):(0,X.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan)}if(v.length>0){const e=v.find((e=>e.row===n&&e.col===r));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{if(y.findIndex((t=>t.dataIndex===e))<0){const t=$n(g,e);e=t?Mn(t).dataIndex:""}let t=0;for(let n=0;n<y.length;n++){const r=y[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{if(y.findIndex((t=>t.dataIndex===e))<0){const t=$n(g,e);e=t?Kn(t).dataIndex:""}const n="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let n=[];return e.forEach((e=>{e.colSpan>0&&n.length>0&&(t.push(n),n=[]),n.push(e)})),n.length>0&&t.push(n),t.map((e=>{const[t,n]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...n,...t.reverse()]})).flat()})(y):y;let r=0;for(let t=n.length-1;t>=0;t--){const a=n[t];if(a.dataIndex===e)break;r+=a.width||a.renderWidth||0}return r},scrollXToColumn:(e,t)=>{const n=void 0===t?y.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const{scrollBarRef:r}=u.current,a=b.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=y.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-a)},scrollYToRecord:L,calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=u.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(T?Da["small"!==f?"middle":f]+Ka:0)-Ka;R((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{L("",0)},createTableFocus:()=>{w&&h.current.setClickedValues([w,""]),"radio"===c?.type&&E.length&&h.current.setClickedValues([E[0],""])},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=u.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=ai,a=[];let i=0;if(y.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,a.push(e))})),a.length>0){const e=y.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===a.length)a[0].renderWidth=(a[0].minWidth||r)+t;else{const e=t/a.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;a.forEach(((t,a)=>{if(0===a)return;const i=Math.floor((t.minWidth||r)*e);n+=i,t.renderWidth=(t.minWidth||r)+i})),a[0].renderWidth=(a[0].minWidth||r)+t-n}}else a.forEach((e=>{e.renderWidth=e.minWidth||r}));R((t=>({...t,tableBodyWidth:Math.max(e,n)})))}else i=y.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),R((e=>({...e,tableBodyWidth:i})));R((e=>({...e,tableWidth:n}))),t&&h.current.resetItemXSize(y)})(),re((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=u.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,a=o?e.$header.offsetHeight:C.headerHeight,i=N?e.$footer.offsetHeight:C.footerHeight,l=r-a-i,s=e.$tableBody.offsetHeight;let c=0;if(I){const t=e.$toper?e.$toper.offsetHeight+Ka:0,r=e.$pager?e.$pager.offsetHeight+Ka:0;c=n.winHeight-t-r-20}R((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:l,tableBodyHeight:s,tableFullHeight:c})))})()))}}})(n,{getRowKey:k,tableRef:L,topElementRef:S,tableElementRef:N,tableBodyRef:T,$size:C,tableColumns:Be,flattenColumns:Ue,leftFixedColumns:Xe,derivedMergeCells:Je,tableFlatData:J,selectionKeys:he,highlightKey:be,tableRowHeight:Ze,layout:Re,showFooter:nt,showPagination:We,isFullScreen:$e,setLayout:Oe,setElementStore:A}),{initialTable:Lt,checkDataIndex:Pt,createTableFullData:At,createWebPageData:Ft,getTableData:_t,createTableData:qt,createGroupData:Dt,createAllExpandedKeys:Ht,setSelectionKeysEffect:$t,doFieldValidate:Mt,getTableLog:Kt,dataChange:zt,tableChange:Vt,toLastPage:jt,toFirstPage:Wt,getPageCount:Bt,pagerChangeHandle:Ut,scrollBottomDebouncer:Gt,clearTableSorter:Yt,clearTableFilter:Xt,clearSuperFilters:Qt,clearPagerFilter:Zt,clearRowSelection:Jt,clearRowHighlight:en,clearTableLog:tn,destroy:nn}=oi(n,{getRowKey:k,tableRef:L,tableElementRef:N,$size:C,tableColumns:Be,flattenColumns:Ue,tableFullData:P,pagination:ue,layout:Re,filters:te,sorter:ie,superFilters:oe,pagerFilter:ce,fetchParams:vt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:be,summationColumns:Ye,isFetch:ze,isWebPagination:Ve,isScrollPagination:je,isServiceSummation:ot,isGroupSubtotal:gt,doLayout:kt,setTableFlatData:ee,setTableFullData:_,setTableOriginData:q,setTableDataMaps:D,setPagination:pe,setPingRight:He,setPingLeft:_e,setSpinning:Ae,setSorter:le,setFilters:ae,setSuperFilters:se,setPagerFilter:de,setSelectionKeys:fe,setRowExpandedKeys:ye,setHighlightKey:ve,setSelectionRows:B,setScrollXLoad:K,setScrollYLoad:z,setFieldAuth:$,setResizeState:V,setSummaries:W,setPermission:Le,resetTableScroll:Rt,createTableFocus:Ot,clearElementStore:Z});((e,t)=>{const{columns:n,summation:r,rowSelection:a,expandable:i,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,summationRows:f,showSummary:g,isWebPagination:y,isScrollPagination:b,checkDataIndex:v,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:C,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:T,setRowExpandedKeys:I,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:L,initialTable:P,destroy:A}=t,F=l().useRef(f);De((()=>{if(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),Gn(m)||e?.(m,s.current.selectionRows),Yn(m)}),[m]),De((()=>{if(!i)return;const{onChange:e}=i;Gn(p)||e?.(p,p.map((e=>s.current.recordsMap.get(e)))),Yn(p)}),[p]),De((()=>{o&&(c.current.setClickedValues(h?[h,""]:[]),o.onChange?.(h,s.current.recordsMap.get(h)??null))}),[h]),De((()=>{(0,X.isEqual)(f,F.current)||(F.current=f,g&&r&&r.onChange?.(f))}),[f]),De((()=>{const e=a.selectedRowKeys||[];(0,X.isEqual)(e,m)||N(Un(e))}),[a?.selectedRowKeys]),De((()=>{const e=i.expandedRowKeys||[];(0,X.isEqual)(e,p)||I(Un(e))}),[i?.expandedRowKeys]),De((()=>{const{currentRowKey:e}=o;e!==h&&R(e??"")}),[o?.currentRowKey]),De((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(y&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&C({insert:null,remove:!1})}),[u.total]),De((()=>{L()}),[d]),De((()=>{(s.current.scrollYLoad||b)&&(e.height||e.maxHeight||me("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,b]),si({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(O(Object.assign({},e,{winHeight:n})),L())},delay:16}),l().useEffect((()=>(T(qn(n)),P(),v(),re((()=>L())),()=>{A(),k(!0)})),[])})(n,{tableRef:L,tableBodyRef:T,$size:C,pagination:ue,selectionKeys:he,rowExpandedKeys:ge,highlightKey:be,showSummary:tt,summationRows:bt,isWebPagination:Ve,isScrollPagination:je,checkDataIndex:Pt,toLastPage:jt,toFirstPage:Wt,getPageCount:Bt,setHandleState:j,scrollYToRecord:Tt,setOriginColumns:F,setSelectionKeysEffect:$t,setRowExpandedKeys:ye,setHighlightKey:ve,setResizeState:V,setUnMounted:U,calcTableHeight:It,initialTable:Lt,destroy:nn});const rn=l().useMemo((()=>({getRowKey:k,tableRef:L,tableBodyRef:T,prefixCls:O,$size:C,tableFlatData:J,flattenColumns:Ue,editableColumns:Ge,leftFixedColumns:Xe,rightFixedColumns:Qe,treeExpandIndex:et,sorter:ie,filters:te,superFilters:oe,pagerFilter:ce,layout:Re,bordered:at,showFooter:nt,showSummary:tt,summationRows:bt,tableRowHeight:Ze,pagination:ue,fetchParams:vt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:be,activedCell:Se,mergedTdCells:Te,derivedMergeCells:Je,updateMark:we,isFetch:ze,isPingLeft:Fe,isPingRight:qe,isHeadSorter:it,isHeadFilter:lt,isFullScreen:$e,isTableEmpty:yt,isHeadGroup:rt,isGroupSubtotal:gt,isWebPagination:Ve,dataChange:zt,tableChange:Vt,getTableData:_t,setElementStore:A,createTableFullData:At,createWebPageData:Ft,createGroupData:Dt,createAllExpandedKeys:Ht,updateTableFlatData:Ke,setSorter:le,setFilters:ae,setSuperFilters:se,setPagerFilter:de,setHighlightKey:ve,setRowExpandedKeys:ye,setSelectionRows:B,setSelectionKeysEffect:$t,setInvalidRowKeys:H,setActivedCell:Ne,setMergedCells:Ie,getSpan:wt,getStickyLeft:Ct,getStickyRight:St,scrollXToColumn:Nt,scrollYToRecord:Tt,setPagination:pe,setPingLeft:_e,setPingRight:He,setSpinning:Ae,setFullScreen:Me,doFieldValidate:Mt,createTableData:qt,scrollBottomDebouncer:Gt,resetTableScroll:Rt,clearTableSorter:Yt,clearTableFilter:Xt,clearSuperFilters:Qt,clearPagerFilter:Zt,clearRowSelection:Jt,clearRowHighlight:en})),[C,J,Ue,ie,te,oe,ce,Re,at,nt,tt,bt,Ze,ue,vt,he,ge,be,Se,Je,we,ze,Fe,qe,it,lt,$e,yt,rt,gt,Ve]);((e,t)=>{const{getRowKey:n,tableRef:r,toolBoxRef:a,tableBodyRef:i,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,isFetch:f,dataChange:g,getTableData:y,createTableData:b,calcTableHeight:v,scrollXToColumn:x,scrollYToRecord:E,doFieldValidate:w,setHandleState:C,setColumnsDefined:S,setSelectionKeysEffect:N,setRowExpandedKeys:T,setHighlightKey:I,setSelectionRows:R,setOriginColumns:O,forceUpdate:k,getTableLog:L,clearRowSelection:P,clearRowHighlight:A,clearTableSorter:F,clearTableFilter:_,clearSuperFilters:q,clearPagerFilter:D,clearTableLog:H}=t,{columns:$,columnsChange:M}=r.current.props,K=(e,t,r,a=0)=>e.filter((e=>{const i=n(e,e.index);e.children&&(e.children=K(e.children,t,r,a+1));const l=t.includes(i);return l&&r(e,i,a),!l}));l().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{v()},DO_REFRESH:async e=>{f&&(await ne(0),await y(),e?.())},GET_LOG:()=>L(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(P(),A(),F(),_(),q(),D(),H(),b([]))},CLEAR_LOG:()=>{H(),k()},CREATE_FOCUS:(e,t)=>{i.current.createFocus(e,t)},FORCE_UPDATE:()=>{k()},DO_EXPORT:()=>{a.current.exportHandle()},SCROLL_TO_RECORD:e=>{E(e)},SCROLL_TO_COLUMN:e=>{x(e)},SET_SELECTION:(e,t)=>{N(t?Un([...e]):e)},SET_EXPANDABLE:(e,t)=>{T(t?Un([...e]):e)},SET_HIGHLIGHT:e=>{I(e)},SET_SELECTION_ROWS:e=>{R(e)},SET_TABLE_DATA:e=>{b(e)},DEFINE_INITIAL_COLUMNS:e=>{O(qn(e)),S(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=$n($,e);if(!r)return me("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,X.isPlainObject)(t))return me("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return me("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,X.set)(r,e,t[e]);n&&(M?M([...$]):me("Table","需要设置 `columnsChange` 参数"),k())},INSERT_RECORDS:(e,t)=>{const{store:a,tableFullData:i,tableOriginData:l}=r.current,o=(Array.isArray(e)?e:[e]).filter((e=>(0,X.isPlainObject)(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(n)||er(e,n,Jn(e,n))})),a.addToInserted(e)}));const c="before"===t?.mode,d=void 0===t?.parentRowKey,u=[...i];if(d)c?u.unshift(...o):u.push(...o),c?l.unshift(...o):l.push(...o);else{const e=hr(u,(e=>t.parentRowKey===n(e,e.index)));if(e){const r=hr(l,(e=>t.parentRowKey===n(e,e.index))),a=vr(e,r);Array.isArray(e.children)?(c?e.children.unshift(...o):e.children.push(...o),!a&&r&&(c?r.children.unshift(...o):r.children.push(...o))):(e.children=o,!a&&r&&(r.children=o))}}d&&C(Object.assign({},r.current.handleState,{insert:c?"before":"after"})),b(l,(()=>u)),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:a,tableOriginData:i}=r.current,l=(Array.isArray(e)?e:[e]).map((e=>(0,X.isPlainObject)(e)?n(e,e.index):e));if(!l.length)return;let o=!1;const s=K([...a],l,((e,r,a)=>{if(t.addToRemoved(e),c.forEach((n=>{const{dataIndex:a,editRender:i}=n,l=i?.(e,n);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),a<=0){const e=i.findIndex((e=>n(e,e.index)===r));i.splice(e,1)}else if(!vr(e,hr(i,(e=>n(e,e.index)===r)))){const t=hr(i,(t=>n(t,t.index)===e._parentRowKey));t&&(t.children=t.children.filter((e=>n(e,e.index)!==r)))}o=!0}));o&&(C(Object.assign({},r.current.handleState,{remove:!0})),N(m.filter((e=>!l.includes(e)))),l.includes(h)&&A(),T(p.filter((e=>!l.includes(e)))),b(i,(()=>s)),g())},VALIDATE_FIELDS:(e,t)=>{Array.from(r.current.recordsMap.values()).forEach((r=>{c.forEach((a=>{const{dataIndex:i,title:l,editRender:o}=a,s=o?.(r,a);if(!s)return;const c=n(r,r.index);if(e&&!e.includes(c))return;if(t&&!t.includes(i))return;const{rules:d=[],disabled:u}=s;u||w(d,Jn(r,i),c,i,cr(l))}))}));const{required:a,validate:i}=L(),l=[...a,...i];return l.length&&E(l[0].rowKey),k(),{required:a,validate:i}}})))})(t,{getRowKey:k,tableRef:L,toolBoxRef:I,tableBodyRef:T,columnFilterRef:R,flattenColumns:Ue,editableColumns:Ge,pagination:ue,fetchParams:vt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:be,isFetch:ze,dataChange:zt,getTableData:_t,createTableData:qt,calcTableHeight:It,scrollXToColumn:Nt,scrollYToRecord:Tt,doFieldValidate:Mt,setHandleState:j,setColumnsDefined:M,setSelectionKeysEffect:$t,setRowExpandedKeys:ye,setHighlightKey:ve,setSelectionRows:B,setOriginColumns:F,forceUpdate:Ce,getTableLog:Kt,clearRowSelection:Jt,clearRowHighlight:en,clearTableSorter:Yt,clearTableFilter:Xt,clearSuperFilters:Qt,clearPagerFilter:Zt,clearTableLog:tn}),l().useLayoutEffect((()=>{xt(),L.current.tableManager.register(L.current.uid,t??{current:null})}),[]);const an={[`${O}--wrapper`]:!0,[`${O}--lg`]:"large"===C,[`${O}--sm`]:"small"===C,[`${O}--maximize`]:$e,[c]:!!c},ln={[O]:!0,"is--border":at,"is--fixed":Xe.length||Qe.length,"is--sortable":it,"is--filterable":lt,"is--head-group":rt,"is--area-select":!!d,"is--ping-left":Fe,"is--ping-right":qe};return l().createElement(Ha.Provider,{value:rn},l().createElement("div",{className:xe()(an,E),style:w},g&&l().createElement("div",{ref:S,className:`${O}-top`},l().createElement("div",{className:`${O}-top__space`},"bottom"!==p?.position&&l().createElement(ci,{total:ue.total}),l().createElement("div",{className:`${O}-top__space-slot`,style:{justifyContent:Ga[f]}},n.children)),l().createElement("div",{className:`${O}-top__actions`},l().createElement(Mo,{ref:I,showFullScreen:y,showReload:b&&ze,showPrint:ke.print&&!!u,showImport:ke.import&&ct,showExport:ke.export&&!!m,showClipboard:dt,showCollection:st,showFastSearch:pt,showSuperSearch:ut,showPivotGrid:ht,showGroupSummary:ft,showToolBox:v,tableColumns:Be}),l().createElement(Vo,{ref:R,columns:a}))),l().createElement(mt,{spinning:i??Pe},l().createElement("div",{ref:N,className:xe()(ln),style:Et},l().createElement("div",{className:`${O}--main-wrapper`},x&&l().createElement(Ss,{tableColumns:Be}),l().createElement(bc,{ref:T}),nt&&l().createElement(vc,null)),at&&l().createElement("div",{className:`${O}--border-line`}),yt&&l().createElement(wc,null),s&&l().createElement(Cc,null))),We&&l().createElement(Ec,Sc({},ue,{onChange:(e,t)=>Ut({current:e,pageSize:t})}))))}));Nc.displayName="QmTable";const Tc=Nc,Ic=Tc;function Rc(){return Rc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rc.apply(null,arguments)}const Oc=e=>{const{uniqueKey:t,multiple:n,initialValue:r,selectionRows:a,defaultSelectedKeys:i=[],filters:o=[],table:s={},className:c,style:d,onClose:u}=e,{$size:m}=Y(e),{t:p}=U(),h=l().useRef(null),g=l().useRef(null),y=l().useRef(null),b=xt(h),[v,x]=l().useState(s),[E,w]=l().useState(),[C,S]=l().useState(i),[N,T]=l().useState(!1),[I,R]=l().useState(300),[O,k]=l().useState(o),[L,P]=l().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[A,F]=l().useState((0,X.merge)({},s.fetch?.params,r)),[_,q]=l().useState([]),D=()=>{const e=h.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Da[m]-30)},H=Et(D,5);f((()=>{H()}),[b.width]),De((()=>{(0,X.isEqual)(o,O)||k(o)}),[o]),l().useEffect((()=>{$()}),[A]),l().useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{r&&g.current?.SET_FIELDS_VALUE(r)}),[]);const $=async()=>{const{webPagination:e,fetch:t}=v;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=te}=t;if(i(A)){T(!0);try{const e=await r(A);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,X.get)(e.data,a)??[];n||(S([]),await ne(0)),q(t)}}catch(e){}T(!1)}},M=e=>{n||(w(e),u(e))},K=e=>{F(Object.assign({},A,e))},z=Ee("search-helper"),V={[`${z}--wrapper`]:!0},j=v.webPagination?{dataSource:_,loading:N,webPagination:!0}:{fetch:{...v.fetch,params:A}};return l().createElement("div",{ref:h,className:xe()(V,c),style:d},l().createElement("div",{className:"form-wrap"},O.length?l().createElement(Nm,{ref:g,items:O,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>D(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await g.current.GET_FORM_DATA();e||K(t)}}):null),l().createElement("div",null,l().createElement(Ic,Rc({ref:y,uniqueKey:t,height:I,columns:L,rowKey:v.rowKey||"pageIndex"},j,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{S(e),w(n?t:t[0])}},topSpaceAlign:"left",paginationConfig:v.paginationConfig,columnsChange:e=>P(e),onRowDblclick:M,onRowEnter:M}),v.topBarExtra)),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Da[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!E,onClick:()=>u(E,n?C:void 0)},p("qm.dialog.confirm"))))};Oc.displayName="QmSearchHelper";const kc=Oc;function Lc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:Pc}=R.Input;class Ac extends i.Component{constructor(e){super(e),Lc(this,"context",void 0),Lc(this,"deriveParams",void 0),Lc(this,"valueKey",void 0),Lc(this,"_is_change",!1),Lc(this,"_record",void 0),Lc(this,"_prevValue",null),Lc(this,"state",{visible:!1,loading:!1}),Lc(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),Lc(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),Lc(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Lc(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||me("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||me("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&me("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Lc(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Lc(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Lc(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=e=>e,dataKey:r,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(e&&!ie(d)){this.setState({loading:!0});try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,X.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Kr(t,this.alias,s),c&&zr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Mr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})}})),Lc(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),Lc(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:n}=this.searchHelper,r=""!==e?e:void 0,a=("function"==typeof n?n():n)||[],i={[t]:r};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,X.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i})),Lc(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=te,formatter:a=e=>e}=t.fetch;return new Promise((async(i,l)=>{const o=(0,X.merge)({},this.searchHelper.table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!r(o))return l();this.setState({loading:!0});try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,X.get)(e.data,t.fetch.dataKey)??[]):l()}catch(e){l(e)}finally{re((()=>this.setState({loading:!1})))}}))})),Lc(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const a=Mr(e,this.alias[r]);void 0!==a&&(t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a),r===n&&t.setViewValue(n,a))}for(const n in this.extras){const r=Mr(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}})),Lc(this,"resetSearchHelperValue",(async(e=[],t)=>{const{fieldName:n}=this.props.option,r=e.filter((e=>Mr(e,this.alias[n])?.toString().toLowerCase().includes(t.toLowerCase())));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(t)})),Lc(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,a=(r??te)(n.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),Lc(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){if(r===n)continue;const a=Mr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Mr(e,this.extras[n])});const r=Mr(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Lc(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)})),Lc(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const n in this.alias)n!==t&&(e.SET_FIELDS_VALUE({[n]:void 0}),n===this.valueKey&&(this._prevValue=null));for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),Lc(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),Lc(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e)})),Lc(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Lc(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||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(){this.echoSearchHelper()}render(){const{$$form:e}=this.context,{visible:t,loading:n}=this.state,{value:r}=this.props,{type:a,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:y,maxLength:b}=o,v={visible:t,title:p("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?l().createElement(ia,{value:r,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Pc,{ref:e=>this[`${a}_Ref`]=e,value:r,title:r,loading:n,placeholder:d,style:c,prefix:g,suffix:y,maxLength:b,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:n}=e.target,{onlySelect:r=!0,table:a}=this.searchHelper;this.triggerBlur(n),this._is_change&&!t&&(n?r?a?.fetch?.api&&this.getSearchHelperTableData(n).then((e=>this.resetSearchHelperValue(e,n))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(n):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:n}=e.target;!t&&this.openSearchHelper(n)}},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):re((()=>this.clearSearchHelperValue())))}}),l().createElement(yn,v,l().createElement(kc,x)))}}Lc(Ac,"contextType",xn);class Fc extends i.Component{constructor(e,{$$form:t}){super(e),Lc(this,"context",void 0),Lc(this,"promiseRef",void 0),Lc(this,"searchRef",void 0),Lc(this,"state",{searchHelper:{}}),Lc(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Lc(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[]}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ac,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(i,t)}}))),m&&l().createElement(R.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(R.Col,{flex:ce(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Lc(Fc,"contextType",xn);const _c=Fc;function qc(){return qc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qc.apply(null,arguments)}function Dc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hc=e=>{class t extends i.Component{constructor(...e){super(...e),Dc(this,"startClick",void 0),Dc(this,"event1",null),Dc(this,"event2",null),Dc(this,"$el",null),Dc(this,"omitClassNames",[]),Dc(this,"state",{clickOutside:!1}),Dc(this,"mousedownHandler",(e=>{this.startClick=e})),Dc(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Dc(this,"documentHandler",((e,t)=>{const n=e.target,r=t?.target,a=!n||!r,i=this.$el?.contains(n)||this.$el?.contains(r),l=this.$el===n,o=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=o.some((e=>e?.contains(n)))||o.includes(r);let c;c=!(a||i||l||s),this.setState({clickOutside:c})})),Dc(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Dc(this,"setOmitClassNames",((e=[])=>{this.omitClassNames=e}))}componentDidMount(){this.event1=Ut()(document,"mousedown",this.mousedownHandler),this.event2=Ut()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:n}=this.state;return l().createElement(e,qc({ref:t},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Dc(t,"displayName",`OutsideClick(${e.displayName||e.name})`),l().forwardRef(((e,n)=>l().createElement(t,qc({},e,{forwardedRef:n}))))};var $c,Mc;function Kc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let zc=Hc((Mc=class extends i.Component{constructor(e){super(e),Kc(this,"context",void 0),Kc(this,"searchRef",l().createRef()),Kc(this,"_records",[]),Kc(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Kc(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),Kc(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||me("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||me("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Kc(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Kc(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Kc(this,"setItemList",(e=>{this.setState({itemList:e})})),Kc(this,"setRecords",(e=>{this._records=e})),Kc(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Kc(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),Kc(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??te)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),Kc(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords((0,X.uniqBy)([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Kc(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),t?.(e),n(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:r=[],clickOutside:a}=this.props;(0,X.isEqual)(n,r)||(0,X.isEqual)(r,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:n,params:r={},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(n){if(ie(c))return this.setRecords([]);this.setState({loading:!0});try{const o=await n(a({...r,keys:c}));if(200===o.code){let n=Array.isArray(o.data)?o.data:(0,X.get)(o.data,i)??[];n.forEach((n=>{s?.valueKey&&s.valueKey!==t&&(n[t]=n[s.valueKey]),s?.textKey&&s.textKey!==e&&(n[e]=n[s.textKey])})),n=n.filter((e=>c.includes(e[t])));const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),this.setViewValue(c),l?.(n)}}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:t,visible2:n,loading:r,itemList:a}=this.state,{value:i}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:y,maxTagTextLength:b}=s,v={visible:t,title:p("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,X.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),w=l().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>l().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):l().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,S=Ee("form-multiple-search-helper"),{size:N}=e.context,T={[S]:!0,[`${S}--lg`]:"large"===N,[`${S}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${S}`]);const I=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(ia,{value:I,bordered:m}):l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},l().createElement(Ai(),{popupVisible:!g&&n,popup:w,popupClassName:xe()(T),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Lr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement(R.Select,{mode:"multiple",maxTagCount:y?"responsive":void 0,maxTagTextLength:b,open:!1,value:i,placeholder:u,loading:r,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(R.Button,{className:"ant-input-search-button",disabled:g,icon:l().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),l().createElement(yn,v,l().createElement(kc,x)))}},Kc(Mc,"contextType",xn),$c=Mc))||$c;class Vc extends i.Component{constructor(e,{$$form:t}){super(e),Kc(this,"context",void 0),Kc(this,"promiseRef",void 0),Kc(this,"state",{searchHelper:{}}),Kc(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Kc(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(zc,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(i,n)}}))),m&&l().createElement(R.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(R.Col,{flex:ce(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Kc(Vc,"contextType",xn);const jc=Vc;function Wc(){return Wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wc.apply(null,arguments)}const Bc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Bc(e.children)),e.children&&t.push(e.value)})),t},Uc=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Uc(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Gc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Gc(e.children,t),t(e)||e.children&&e.children.length))),Yc=e=>{const{uniqueKey:t,multiple:n,initialValue:r,selectionRows:a,defaultSelectedKeys:i=[],filters:o=[],table:s={},tree:c={},className:d,style:u,onClose:m}=e,{$size:p}=Y(e),{t:h}=U(),g=l().useRef(null),y=l().useRef(null),b=l().useRef(null),v=xt(g),[x,E]=l().useState(s),[w,C]=l().useState(),[S,N]=l().useState(i),[T,I]=l().useState(!1),[O,k]=l().useState(300),[L,P]=l().useState(300),[A,F]=l().useState(o),[_,q]=l().useState([{title:h("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[D,H]=l().useState((0,X.merge)({},s.fetch?.params,r)),[$,M]=l().useState([]),K=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");k(e.offsetHeight-n.offsetHeight-10),P(e.offsetHeight-t.offsetHeight-2*Da[p]-30)},z=Et(K,5);f((()=>{z()}),[v.width]),De((()=>{(0,X.isEqual)(o,A)||F(o)}),[o]),l().useEffect((()=>{V()}),[D]),l().useEffect((()=>{a&&b.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{r&&y.current?.SET_FIELDS_VALUE(r),ie()}),[]);const V=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=te}=t;if(i(D)){I(!0);try{const e=await r(D);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,X.get)(e.data,a)??[];n||(N([]),await ne(0)),M(t)}}catch(e){}I(!1)}},j=e=>{n||(C(e),m(e))},W=e=>{H(Object.assign({},D,e))},[B,G]=l().useState([]),[Q,Z]=l().useState([]),[J,ee]=l().useState(""),re=l().useRef(B),ae=l().useRef([]);De((()=>{Z(Bc(B))}),[B]);const ie=async()=>{if(!c.fetch)return;const{api:e,params:t,dataKey:n,valueKey:r="value",textKey:a="text"}=c.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,X.get)(i.data,n)??[],t=Vr(e,r,a);G(t),re.current=t,ae.current=e}}catch(e){}},le=e=>`${e}|${ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe=Ee("tree-table-helper"),se={[`${oe}--wrapper`]:!0},ce=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:{...x.fetch,params:D}};return l().createElement("div",{ref:g,className:xe()(se,d),style:u},l().createElement(nt,{defaultValue:200,style:{height:"100%"}},l().createElement(nt.Pane,{min:100,style:{overflowY:"auto"}},l().createElement(R.Input,{className:"input-wrap",value:J,style:{marginBottom:8},placeholder:h("qm.form.inputPlaceholder"),suffix:l().createElement(we.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{const t=Gc(re.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==le(n).indexOf(e)}));ee(e),G(t)})(e.target.value)}),l().createElement(R.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:O,defaultExpandAll:!0,expandedKeys:Q,treeData:B,filterTreeNode:e=>{if(!J)return!1;const t=e.text||"";return-1!==le(t).indexOf(J)},onExpand:e=>{Z(e)},onSelect:e=>{const{valueKey:t="value"}=c.fetch;(e=>{if(!c.tableParamsMap)return me("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof c.tableParamsMap?c.tableParamsMap():c.tableParamsMap,n={};for(const r in t)n[r]=(0,X.get)(e,t[r]);W(n)})(Uc(ae.current,(n=>(0,X.get)(n,t)===e[0]))||{})}})),l().createElement(nt.Pane,{className:"split-pane"},l().createElement("div",{className:"form-wrap"},A.length?l().createElement(Nm,{ref:y,items:A,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>F(e),onCollapse:()=>K(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||W(t)}}):null),l().createElement("div",null,l().createElement(Ic,Wc({ref:b,uniqueKey:t,height:L,columns:_,rowKey:x.rowKey||"pageIndex"},ce,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),C(n?t:t[0])}},topSpaceAlign:"left",paginationConfig:x.paginationConfig,columnsChange:e=>q(e),onRowDblclick:j,onRowEnter:j}),x.topBarExtra)))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Da[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>m(null),style:{marginRight:8}},h("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!w,onClick:()=>m(w,n?S:void 0)},h("qm.dialog.confirm"))))};Yc.displayName="TreeTableHelper";const Xc=Yc;function Qc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:Zc}=R.Input;class Jc extends i.Component{constructor(e){super(e),Qc(this,"context",void 0),Qc(this,"valueKey",void 0),Qc(this,"_record",void 0),Qc(this,"_prevValue",null),Qc(this,"state",{visible:!1,loading:!1}),Qc(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),Qc(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),Qc(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Qc(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||me("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||me("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&me("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Qc(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Qc(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Qc(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=e=>e,dataKey:r,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(e&&!ie(d)){this.setState({loading:!0});try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,X.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Kr(t,this.alias,s),c&&zr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Mr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})}})),Qc(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const a=Mr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a),r===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Mr(e,this.extras[n])})})),Qc(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??te)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),Qc(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){if(r===n)continue;const a=Mr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Mr(e,this.extras[n])});const r=Mr(e,this.alias[n]);this.triggerChange(r);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Qc(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const n in this.alias)n!==t&&(e.SET_FIELDS_VALUE({[n]:void 0}),n===this.valueKey&&(this._prevValue=null));for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),Qc(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this._record)})),Qc(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(){this.echoSearchHelper()}render(){const{$$form:e}=this.context,{visible:t,loading:n}=this.state,{value:r=""}=this.props,{type:a,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:y,maxLength:b}=o,v={visible:t,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,X.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?l().createElement(ia,{value:r,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Zc,{ref:e=>this[`${a}_Ref`]=e,value:r,title:r,loading:n,placeholder:d,style:c,prefix:g,suffix:y,maxLength:b,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),l().createElement(yn,v,l().createElement(Xc,x)))}}Qc(Jc,"contextType",xn);class ed extends i.Component{constructor(e,{$$form:t}){super(e),Qc(this,"context",void 0),Qc(this,"promiseRef",void 0),Qc(this,"state",{searchHelper:{}}),Qc(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Qc(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Jc,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(i,t)}}))),m&&l().createElement(R.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(R.Col,{flex:ce(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Qc(ed,"contextType",xn);const td=ed;var nd,rd;function ad(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let id=Hc((rd=class extends i.Component{constructor(e){super(e),ad(this,"context",void 0),ad(this,"searchRef",l().createRef()),ad(this,"_records",[]),ad(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),ad(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),ad(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||me("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||me("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),ad(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ad(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ad(this,"setItemList",(e=>{this.setState({itemList:e})})),ad(this,"setRecords",(e=>{this._records=e})),ad(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),ad(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),ad(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??te)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),ad(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords((0,X.uniqBy)([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ad(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),t?.(e),n(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:r=[],clickOutside:a}=this.props;(0,X.isEqual)(n,r)||(0,X.isEqual)(r,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:n,params:r={},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(n){if(ie(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await n(a({...r,keys:s}));if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,X.get)(l.data,i)??[];n.forEach((n=>{o?.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),o?.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t])));const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),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:t,visible2:n,loading:r,itemList:a}=this.state,{value:i}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:y,maxTagTextLength:b}=s,v={visible:t,title:p("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,X.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),w=l().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>l().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):l().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,S=Ee("form-multiple-tree-table-helper"),{size:N}=e.context,T={[S]:!0,[`${S}--lg`]:"large"===N,[`${S}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${S}`]);const I=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(ia,{value:I,bordered:m}):l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},l().createElement(Ai(),{popupVisible:!g&&n,popup:w,popupClassName:xe()(T),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Lr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement(R.Select,{mode:"multiple",maxTagCount:y?"responsive":void 0,maxTagTextLength:b,open:!1,value:i,placeholder:u,loading:r,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(R.Button,{className:"ant-input-search-button",disabled:g,icon:l().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),l().createElement(yn,v,l().createElement(Xc,x)))}},ad(rd,"contextType",xn),nd=rd))||nd;class ld extends i.Component{constructor(e,{$$form:t}){super(e),ad(this,"context",void 0),ad(this,"promiseRef",void 0),ad(this,"state",{searchHelper:{}}),ad(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),ad(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(id,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(i,n)}}))),m&&l().createElement(R.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(R.Col,{flex:ce(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ad(ld,"contextType",xn);const od=ld;function sd(){return sd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sd.apply(null,arguments)}const cd="_startSign",dd="_endSign",ud=e=>{const{uniqueKey:t,initialValue:n,filters:r=[],table:a={},onClose:i}=e,{$size:o}=Y(e),{t:s}=U(),c=l().useRef(null),d=l().useRef(null),u=l().useRef(null),m=xt(c),[p,h]=l().useState(a),[g,y]=l().useState(!1),[b,v]=l().useState([]),[x,E]=l().useState(300),[w,C]=l().useState(r),[S,N]=l().useState([{title:s("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},{title:s("qm.form.rangeSearchHelper")[0],dataIndex:cd,width:80,align:"right",render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)},...a.columns||[],{title:s("qm.form.rangeSearchHelper")[1],dataIndex:dd,fixed:"right",width:80,render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)}]),[T,I]=l().useState((0,X.merge)({},a.fetch?.params,n)),[O,k]=l().useState([]),L=l().useMemo((()=>b.map((e=>e?.pageIndex))),[b]),P=l().useMemo((()=>2===L.length&&L.every((e=>void 0!==e))),[L]),A=()=>{const e=c.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*Da[o]-30)},F=Et(A,5);f((()=>{F()}),[m.width]),De((()=>{(0,X.isEqual)(r,w)||C(r)}),[r]),l().useEffect((()=>{_()}),[T]);const _=async()=>{const{webPagination:e,fetch:t}=p;if(!e||!t?.api)return;const{api:n,dataKey:r,beforeFetch:a=te}=t;if(a(T)){y(!0);try{const e=await n(T);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,X.get)(e.data,r)??[];k(t)}}catch(e){}y(!1)}},q=(e,t)=>{delete e[t]},D=()=>{b.forEach((e=>{e&&(q(e,cd),q(e,dd))})),v([])},H=e=>{D(),I(Object.assign({},T,e))},$=Ee("range-helper"),M=p.webPagination?{dataSource:O,loading:g,webPagination:!0}:{fetch:{...p.fetch,params:T}};return l().createElement("div",{ref:c,className:`${$}--wrapper`},l().createElement("div",{className:"form-wrap"},w.length?l().createElement(Nm,{ref:d,items:w,initialValues:n,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>A(),onFinish:e=>H(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||H(t)}}):null),l().createElement("div",null,l().createElement(Ic,sd({ref:u,height:x,columns:S,rowKey:p.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=L[0]&&e.pageIndex<=L[1]?{backgroundColor:"#f5f5f5"}:{}},M,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[cd,dd].includes(n)&&(n===cd&&(e[n]?(q(e,n),v([void 0,b[1]])):e.pageIndex>L[1]?R.message.warning(s("qm.searchHelper.rangeStartTip")):(b[0]&&q(b[0],n),e[n]="[",v([e,b[1]]))),n===dd&&(e[n]?(q(e,n),v([b[0],void 0])):e.pageIndex<L[0]?R.message.warning(s("qm.searchHelper.rangeEndTip")):(b[1]&&q(b[1],n),e[n]="]",v([b[0],e]))),u.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===L[0]&&(e[cd]="["),e.pageIndex===L[1]&&(e[dd]="]")}))}}),l().createElement(fe,{type:"primary",icon:l().createElement(we.ClearOutlined,null),title:s("qm.table.alert.clear"),onClick:()=>D()}))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Da[o]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>i(null),style:{marginRight:8}},s("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!P,onClick:()=>i(b.map((e=>(e=>{const t={};for(const n in e)[cd,dd].includes(n)||(t[n]=e[n]);return t})(e))))},s("qm.dialog.confirm"))))};ud.displayName="RangeTableHelper";const md=ud;function pd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const hd=new Array(2).fill("");class fd extends i.Component{constructor(e){super(e),pd(this,"context",void 0),pd(this,"_is_change",!1),pd(this,"_ceho_data",void 0),pd(this,"_records",[]),pd(this,"_is_clear",!1),pd(this,"state",{visible:!1,loading:!1,itemList:[],textValue:hd}),pd(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),pd(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||me("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||me("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),pd(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),pd(this,"setItemList",(e=>{this.setState({itemList:e})})),pd(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),pd(this,"setTextValue",(e=>{this.setState({textValue:e})})),pd(this,"setRecords",(e=>{this._records=e})),pd(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),pd(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,t?.(e),n(e,this.createViewText(),this._records)})),pd(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(hd),this.triggerChange([])})),pd(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:n}=this.alias,r=e.map((e=>({value:e[t],text:e[n]})));this.setRecords(e),this.setItemList(r),this.setTextValue(r.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),pd(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??te)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),pd(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,n=ie(e)?void 0:e;return{[t]:n}})),pd(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=te,formatter:a=e=>e}=t.fetch;return new Promise((async(i,l)=>{const o=(0,X.merge)({},this.searchHelper.table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!r(o))return l();this.setState({loading:!0});const e=await t.fetch.api(o);if(re((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,X.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}l()}))})),pd(this,"resetSearchHelperValue",(async(e=[])=>{const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{const r=e[n]?.toString().toLowerCase();return t.some((e=>r?.includes(e.toLowerCase())))}));if(2===r.length)return this.closeSearchHelper(r);this.openSearchHelper()})),pd(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:n=[]}=this.props;(0,X.isEqual)(t,n)||(0,X.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:a}=this.props.option;if(!(0,X.isEqual)(r[a],this._ceho_data)&&(this._ceho_data=r[a],this.setItemList(r[a]),n.length)){const e=hd.map(((e,t)=>r[a].find((e=>e.value===n[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:n,params:r={},formatter:a=e=>e,dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(n){if(ie(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await n(a({...r,keys:s}));if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,X.get)(l.data,i)??[];n.forEach((n=>{o?.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),o?.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t]))).slice(0,2);const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),this.setTextValue(r.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:t=[]}=this.props,{visible:n,loading:r,textValue:a}=this.state,{fieldName:i,options:o={},searchHelper:s={},placeholder:c=p("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,f=a.every((e=>$r(e)))?"":a.join(" - "),g={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},y={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,X.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?l().createElement(ia,{value:f,bordered:d}):l().createElement(l().Fragment,null,l().createElement(R.Input.Group,null,l().createElement(R.Input,{value:a[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,a[1]]))}}),l().createElement(R.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),l().createElement(R.Input.Search,{value:a[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:r,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.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([a[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),l().createElement(yn,g,l().createElement(md,y)))}}pd(fd,"contextType",xn);class gd extends i.Component{constructor(e,{$$form:t}){super(e),pd(this,"context",void 0),pd(this,"promiseRef",void 0),pd(this,"state",{searchHelper:{}}),pd(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),pd(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(fd,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{h(t,r),e.setViewValue(i,n)}}))),u&&l().createElement(R.Col,null,e.renderFormItemButton(i,u)),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...d}))))}}pd(gd,"contextType",xn);const yd=gd;function bd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const vd=e=>{const{$$form:t}=l().useContext(xn),{value:n,items:r,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,p=ie(m)?r:m,h=e=>p.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?l().createElement(ia,{value:h(n),bordered:c}):l().createElement(R.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{a?.(e),i(e,h(e))})(e)}},p.map((e=>l().createElement(R.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class xd extends i.Component{constructor(...e){super(...e),bd(this,"context",void 0),bd(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,X.isEqual)(t,n)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,X.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(p)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(vd,{option:this.props.option,items:t,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&l().createElement(R.Col,{flex:ce(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}bd(xd,"contextType",xn);const Ed=xd;function wd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cd=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{options:i={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=t.isFormDisabled}=e.option,{allowHalf:u,count:m=5,tooltips:p}=i;return l().createElement(R.Rate,{value:n,count:m,style:o,allowHalf:u,allowClear:s,tooltips:p,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;r?.(e),a(e,(t=e,p?p[Math.ceil(t)-1]:t.toString()))})(e)}})};class Sd extends i.Component{constructor(...e){super(...e),wd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Cd,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}wd(Sd,"contextType",xn);const Nd=Sd;function Td(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Id=e=>{const{$$form:t}=l().useContext(xn),{value:n,items:r,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=t.isFormDisabled}=e.option,{itemList:m=[]}=o,p=ie(m)?r:m,h=e=>p.find((t=>t.value===e))?.text??"";return t.isOnlyShow?l().createElement(ia,{value:h(n),bordered:c}):l().createElement(R.Radio.Group,{value:n,style:{width:"100%",...s},disabled:u||t.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e,h(e))})(t)}},p.map((e=>l().createElement(R.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Rd extends i.Component{constructor(...e){super(...e),Td(this,"context",void 0),Td(this,"state",{itemList:[]}),Td(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,X.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,X.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(p)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Id,{option:this.props.option,items:t,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&l().createElement(R.Col,{flex:ce(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Td(Rd,"contextType",xn);const Od=Rd;function kd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ld=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=Rr,trueValue:p=Ir}=o,{t:h}=U();return l().createElement(l().Fragment,null,l().createElement(R.Switch,{checked:n===p,style:s,disabled:d||t.isOnlyShow,checkedChildren:l().createElement(we.CheckOutlined,null),unCheckedChildren:l().createElement(we.CloseOutlined,null),onChange:e=>{(e=>{r?.(e),a(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(e?p:m)}}),u?l().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},i):null)};class Pd extends i.Component{constructor(...e){super(...e),kd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option,{labelToSwitch:h}=o;return l().createElement(R.Form.Item,{label:h?" ":e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Ld,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}kd(Pd,"contextType",xn);const Ad=Pd;function Fd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const _d=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=U(),{options:o={},style:s={},placeholder:c=i("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:g}=e.option,{showCount:y,maxLength:b,autoSize:v}=o,x=Object.assign({},{minRows:1,maxRows:3},v);return l().createElement(R.Input.TextArea,{value:n,placeholder:c,style:s,maxLength:b,showCount:y,autoSize:x,bordered:d,allowClear:u,readOnly:m||t.isOnlyShow,disabled:p,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;n?.(t)})(n),f?.(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g?.(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{r?.(e),a(e)})(t)}})};class qd extends i.Component{constructor(...e){super(...e),Fd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(_d,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Fd(qd,"contextType",xn);const Dd=qd;function Hd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $d=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=U(),{fieldName:o,options:s={},style:d={},placeholder:u=i("qm.form.datePlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:y,disabledDate:b,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=s,w=l().createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),r?.(e),a(e,S(e))},S=e=>$r(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Hr(c()().subtract(e,"day"),Ar[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return t.isOnlyShow?l().createElement(ia,{value:S(n),bordered:m}):l().createElement(F,{ref:w,style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:Pr[g],format:y,bordered:m,showToday:!1,showTime:"datetime"===g&&{defaultValue:c()("00:00:00","HH:mm:ss")},allowClear:p,disabled:f,inputReadOnly:h,disabledDate:b??(e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[v,x])),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():l().createElement(l().Fragment,null,l().createElement(R.Tag,{color:"processing",onClick:()=>N(0)},i("qm.form.datePickers")[0]),l().createElement(R.Tag,{color:"processing",onClick:()=>N(1)},i("qm.form.datePickers")[1]),l().createElement(R.Tag,{color:"processing",onClick:()=>N(7)},i("qm.form.datePickers")[2]),l().createElement(R.Tag,{color:"processing",onClick:()=>N(30)},i("qm.form.datePickers")[3])):void 0,value:Dr(n,Ar[g]),onChange:(e,t)=>{C(Hr(e,Ar[g]))}})};class Md extends i.Component{constructor(...e){super(...e),Hd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement($d,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Hd(Md,"contextType",xn);const Kd=Md;function zd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Vd=e=>[c()().subtract(e,"day"),c()()],jd=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=U(),{fieldName:o,options:s={},style:d={},placeholder:u=i("qm.form.daterangePlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f=t.isFormDisabled}=e.option,{dateType:g="date",format:y,disableds:b=[!1,!1],allowEmpty:v,disabledDate:x,minDateTime:E,maxDateTime:w,shortCuts:C=!0}=s,S={[i("qm.form.dateRangePickers")[0]]:Vd(7),[i("qm.form.dateRangePickers")[1]]:Vd(30),[i("qm.form.dateRangePickers")[2]]:Vd(90),[i("qm.form.dateRangePickers")[3]]:Vd(180)},N=e=>$r(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?l().createElement(ia,{value:N(n),bordered:m}):l().createElement(F.RangePicker,{style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:Pr[g],format:y,bordered:m,showTime:"datetime"===g&&{defaultValue:[c()("00:00:00","HH:mm:ss"),c()("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:v,disabled:f?[!0,!0]:b,inputReadOnly:h,disabledDate:x??(e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[E,w])),ranges:C&&g.includes("date")?S:void 0,value:ie(n)?null:[Dr(n?.[0],Ar[g]),Dr(n?.[1],Ar[g])],onChange:(e,t)=>{(e=>{"date"===g&&(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=[]),r?.(e),a(e,N(e))})([Hr(e?.[0],Ar[g]),Hr(e?.[1],Ar[g])])}})};class Wd extends i.Component{constructor(...e){super(...e),zd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(jd,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}zd(Wd,"contextType",xn);const Bd=Wd;function Ud(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gd=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=U(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.timePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:y=1,secondStep:b=1}=s;return t.isOnlyShow?l().createElement(ia,{value:n,bordered:u}):l().createElement(H,{style:{width:"100%",...c},popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:y,secondStep:b,allowClear:m,disabled:h,inputReadOnly:p,format:Fr[f],value:Dr(n,Fr[f]),onChange:(e,t)=>{(e=>{const t=Hr(e,Fr[f]);r?.(t),a(t)})(e)}})};class Yd extends i.Component{constructor(...e){super(...e),Ud(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Gd,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ud(Yd,"contextType",xn);const Xd=Yd;function Qd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Zd=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=U(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h=t.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],allowEmpty:y,hourStep:b=1,minuteStep:v=1,secondStep:x=1}=s,E=e=>$r(e)?"":e.join(" - ");return t.isOnlyShow?l().createElement(ia,{value:E(n),bordered:u}):l().createElement(H.RangePicker,{style:{width:"100%",...c},popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:b,minuteStep:v,secondStep:x,allowClear:m,allowEmpty:y,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Fr[f],value:ie(n)?null:[Dr(n?.[0],Fr[f]),Dr(n?.[1],Fr[f])],onChange:(e,t)=>{(e=>{const t=[Hr(e?.[0],Fr[f]),Hr(e?.[1],Fr[f])];r?.(t),a(t,E(t))})(e)}})};class Jd extends i.Component{constructor(...e){super(...e),Qd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Zd,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Qd(Jd,"contextType",xn);const eu=Jd;function tu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class nu extends i.Component{constructor(e){super(e),tu(this,"context",void 0),tu(this,"searchRef",l().createRef()),tu(this,"valueKey",void 0),tu(this,"_clicking",!1),tu(this,"_record",void 0),tu(this,"_prevValue",null),tu(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),tu(this,"getSearchHelper",vn()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),tu(this,"paramsChangeHandler",(async(e,t)=>{await this.props.waiting(),(0,X.isEqual)(e,t)||this.getItemList()})),tu(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),tu(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(r||me("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(e)||me("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&me("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&me("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),tu(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),tu(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=e=>e,dataKey:r,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(e&&!ie(d))try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,X.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Kr(t,this.alias,s),c&&zr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Mr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}})),tu(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){const a=Mr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a),r===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Mr(e,this.extras[n])})})),tu(this,"fetchHandle",(0,X.debounce)(this.getItemList,200)),tu(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),tu(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this._record)})),tu(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),tu(this,"clickHandle",((e,t)=>{const{$$form:n}=this.context,{fieldName:r}=this.props.option;for(const t in this.alias){if(t===r)continue;const a=Mr(e,this.alias[t]);n.SET_FIELDS_VALUE({[t]:a}),t===this.valueKey&&(this._prevValue=e?a:null)}for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:Mr(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Mr(e,this.alias[r]);this.triggerChange(a),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,n=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;this.paramsChangeHandler(n,t),this.echoSearchHelper()}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:n,params:r={},formatter:a=e=>e,dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(n){this.setState({loading:!0});try{const l=await n(a({...r,[t]:e}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,X.get)(l.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:t,loading:n,itemList:r,inputText:a}=this.state,{value:i}=this.props,{fieldName:s,options:c={},style:d={},placeholder:u=p("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{listHeight:y=Or}=c,{hideHeader:b,onlySelect:v=!0}=this.searchHelper||c,x=this.searchHelper.columns||[],E=Ee("form-immediate"),w=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,C=l().createElement(R.Spin,{spinning:n},r.length?l().createElement("table",{cellSpacing:0,cellPadding:0,className:xe()("table")},!b&&l().createElement("thead",null,l().createElement("tr",null,x.filter((e=>!e.hidden)).map((e=>l().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),l().createElement("tbody",null,r.map(((e,t)=>l().createElement("tr",{key:t,className:this.state.activeIndex===t?"active":"",onMouseEnter:()=>{this.setState({activeIndex:t})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},x.filter((e=>!e.hidden)).map((t=>l().createElement("td",{key:t.dataIndex},(0,X.get)(e,t.dataIndex))))))))):l().createElement(dt,null));return l().createElement(o.Consumer,null,(n=>{const o={[E]:!0,[`${E}--lg`]:"large"===n?.size,[`${E}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(ia,{value:i,bordered:m}):l().createElement(Ai(),{action:g?[]:["click"],popupVisible:!g&&t,popup:C,popupClassName:xe()(o,`form-popper__${s}`),popupStyle:{minWidth:w,maxHeight:y},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Lr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(R.Input,{ref:this.searchRef,placeholder:u,allowClear:h,bordered:m,readOnly:f,disabled:g,style:{width:"100%",...d},value:a??i,title:i,onFocus:()=>{!r.length&&this.fetchHandle(i)},onBlur:e=>{v&&!this._clicking&&a!==i&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(r[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 n=40===e.keyCode?++t%r.length:(--t+r.length)%r.length;this.setState({activeIndex:n})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),v?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}})))}))}}tu(nu,"contextType",xn);class ru extends i.Component{constructor(e,{$$form:t}){super(e),tu(this,"context",void 0),tu(this,"promiseRef",void 0),tu(this,"state",{searchHelper:{}}),tu(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),tu(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(nu,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(i,t)}}))),m&&l().createElement(R.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(R.Col,{flex:ce(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}tu(ru,"contextType",xn);const au=ru;function iu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class lu extends i.Component{constructor(...e){super(...e),iu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,fieldName:r,className:a,style:i={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=ee}=o,m=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===r))??[],n=c??t.length-1;t.slice(n+1).forEach((t=>{const n=d.find((e=>e.fieldName===t.fieldName));if(!n)return;const r=n.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&m.push({...t,text:`${r}${a}`})}))}return l().createElement(R.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},l().createElement(Se,{id:r,label:n,className:a,extra:m.map((e=>e.text)).join(" | "),style:{...i},collapse:s[r],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[r]:t})}))),u(t)}}))}}iu(lu,"contextType",xn);const ou=lu;function su(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cu(){return cu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cu.apply(null,arguments)}const du=(e,t,n,r)=>e.map((e=>e[n]===t?{...e,children:r}:e.children?{...e,children:du(e.children,t,n,r)}:e)),uu=e=>{const{$$form:t}=l().useContext(xn),{value:n,items:r,multiple:a,loading:i,onChange:o,onValuesChange:s}=e,{t:c}=U(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,asyncLoad:g,readOnly:y,disabled:b}=e.option,{itemList:v,filterable:x=!0,listHeight:E=Or,checkStrictly:w,checkStrategy:C="SHOW_CHILD",collapseTags:S,echoRequest:N,defaultExpandAll:T=!g,defaultExpandedKeys:I,dropdownStyle:O,openPyt:k=!0}=u,[L,P]=l().useState(ie(v)?r:v),[A,F]=l().useState([]),[_,q]=l().useState(!1),[D,H]=l().useState(!1),$=l().useRef(null),M=l().useRef(null),K=l().useRef(L),z=l().useRef(D),V=l().useRef(null),j=e=>{H(e),z.current=e};uo({ref:M,handler:()=>j(!1)}),l().useEffect((()=>{n!==V.current&&(G(),V.current=n),M.current=$.current?.querySelector(".ant-select-selection-overflow-item-rest")||null}),[n]),De((()=>{const e=ie(v)?r:v;g?(0,X.isEqual)(e,K.current)||(P((t=>[...e,...t.filter((e=>!!e.style))])),K.current=e):P(e)}),[v,r]),De((()=>{P((e=>[...e,...A.filter((t=>!e.some((e=>e.value===t.value))))]))}),[A]);const W=e=>jr(L,e)?.text||e?.toString()||"",B=e=>(w&&Array.isArray(n)&&n.every((e=>(0,X.isPlainObject)(e)))&&(e=e.map((e=>e.value))),a?e?.map((e=>W(e))).join(",")||"":W(e)),G=async()=>{if(!N)return;if(!g)return me("Form","TREE_SELECT 的 echoRequest 选项必须组合 `asyncLoad` 一起使用");const{fetchApi:e,params:t,dataKey:r,callback:a,formatter:i=e=>e}=N||{},{textKey:l="text",valueKey:o="value"}=g;if(e&&!ie(n))try{const s=await e(i({...t,[o]:n}));if(200===s.code){const e=Array.isArray(s.data)?s.data:(0,X.get)(s.data,r)??[];if(e.length){const t=Vr(e,o,l);F(t.map((e=>({...e,style:{display:"none"}})))),a?.(e)}}}catch(e){}};return t.isOnlyShow?l().createElement(ia,{value:B(n),bordered:h}):l().createElement(Ai(),{popupVisible:!b&&D,popup:(()=>{if(!a)return null;const e=n?.map((e=>W(e)))||[];return l().createElement("ul",{className:"ant-dropdown-menu"},e.length?e.map(((e,t)=>l().createElement("li",{key:`${e}-${t}`,className:"ant-dropdown-menu-item"},e))):l().createElement("li",{className:"ant-dropdown-menu-item"},c("qm.table.config.emptyText")))})(),popupStyle:{minWidth:$.current?.offsetWidth},onPopupVisibleChange:e=>j(e),builtinPlacements:Lr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",{ref:$,style:{width:"100%"}},l().createElement(R.TreeSelect,cu({open:_,fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:a,treeCheckable:a,treeCheckStrictly:w,showCheckedStrategy:R.TreeSelect[C],popupClassName:`form-popper__${d}`,dropdownStyle:O,placeholder:p,listHeight:E,style:m,loading:i,bordered:h,allowClear:f,disabled:b,treeDefaultExpandAll:T,treeDefaultExpandedKeys:I,showSearch:x,maxTagCount:S?"responsive":void 0,loadData:g?async({key:e,children:t})=>{if(!g||t)return;const{fetchApi:n,params:r,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=e=>e}=g;if(n)try{const t=await n(s({...r,[l]:e}));if(200===t.code){const n=Array.isArray(t.data)?t.data:(0,X.get)(t.data,a)??[],r=du(L,e,l,Vr(n,l,i));P(r),o?.(n)}}catch(e){}}:void 0,treeData:L},a?{title:B(n)}:null,{filterTreeNode:(e,t)=>{const n=t?.text?.toString()||"",r=ra.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(k?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onMouseDown:e=>{e.target.classList.contains("ant-select-selection-overflow-item-rest")&&(j(!0),q(!1))},onDropdownVisibleChange:e=>{if(!e)return q(e);re((()=>{z.current||q(e)}))},onChange:e=>{(e=>{o?.(e),s(e,B(e),L)})(e),V.current=e}}))))};class mu extends i.Component{constructor(...e){super(...e),su(this,"context",void 0),su(this,"state",{itemList:[],loading:!1}),su(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,X.get)(e.data,r)??[],n=Vr(t,a,i);this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,X.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:n}=this.state,{type:r,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:xe()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(h)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(uu,{option:this.props.option,items:t,loading:n,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&l().createElement(R.Col,{flex:ce(m.labelWidth||Tr)},e.renderFormItemExtra({fieldName:o,...m}))))}}su(mu,"contextType",xn);const pu=mu;function hu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fu(){return fu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fu.apply(null,arguments)}const gu=e=>{const{$$form:t}=l().useContext(xn),{value:n,multiple:r,items:a}=e,{t:i}=U(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,asyncLoad:p,readOnly:h,disabled:f}=e.option,{itemList:g,changeOnSelect:y,checkStrictly:b,checkStrategy:v="SHOW_PARENT",filterable:x=!0,dropdownStyle:E,openPyt:w=!0}=s,[C,S]=l().useState(ie(g)?a:g),N=l().useRef(C);De((()=>{const e=ie(g)?a:g;p?(0,X.isEqual)(e,N.current)||(S(e),N.current=e):S(e)}),[g,a]);const T=e=>Wr(C,e??"").map((e=>e.text)).join("/"),I=e=>r?e?.map((e=>T(e))).join(",")||"":T(e);return t.isOnlyShow?l().createElement(ia,{value:I(n),bordered:u}):l().createElement(R.Cascader,fu({value:(e=>ie(e)?[]:r?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:C,multiple:r,maxTagCount:"responsive",changeOnSelect:y||b,showCheckedStrategy:R.Cascader[v],popupClassName:`form-popper__${o}`,dropdownStyle:E,placeholder:d,style:c,bordered:u,allowClear:m,disabled:f,showSearch:x&&!p&&{filter:(e,t)=>t.some((t=>{const n=t?.text?.toString()||"",r=ra.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?async e=>{const t=e[e.length-1];if(!p||t.children)return;const{fetchApi:n,params:r,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=e=>e}=p;if(n)try{const e=await n(s({...r,[l]:t.value}));if(200===e.code){const n=Array.isArray(e.data)?e.data:(0,X.get)(e.data,a)??[],r=du(C,t.value,l,Vr(n,l,i));S(r),o?.(n)}}catch(e){}}:void 0},r?{title:I(n)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;n?.(t),r(t,I(t),C)})(((e=[])=>r?e.map((e=>e.join(","))):e.join(","))(t))}}))};class yu extends i.Component{constructor(...e){super(...e),hu(this,"context",void 0),hu(this,"state",{itemList:[],loading:!1}),hu(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,X.get)(e.data,r)??[],n=Vr(t,a,i);this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,X.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:n}=this.state,{type:r,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:xe()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(h)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(gu,{option:this.props.option,multiple:t,items:n,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&l().createElement(R.Col,{flex:ce(m.labelWidth||Tr)},e.renderFormItemExtra({fieldName:o,...m}))))}}hu(yu,"contextType",xn);const bu=yu,vu=require("china-area-data");var xu=r.n(vu);function Eu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const wu=["110000","120000","310000","500000"],Cu=["810000","820000"],Su=[{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"}],Nu=[{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"}],Tu=e=>ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Iu=(e,t,n=1)=>{if(!(n>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...wu,...Cu].includes(e))):Object.keys(e[t])).map((r=>({l:Tu(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:Iu(e,r,n+1)})))},Ru=(e,t)=>t.map((t=>({l:Tu(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Ou extends i.Component{constructor(e){super(e),Eu(this,"context",void 0),Eu(this,"searchRef",l().createRef()),Eu(this,"scrollRef",l().createRef()),Eu(this,"zxsAndGa",void 0),Eu(this,"provinces",void 0),Eu(this,"allCities",void 0),Eu(this,"letterCities",void 0),Eu(this,"state",{visible:!1,select_type:"0",active_key:""}),Eu(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Eu(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(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}),Yt()(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:Ru(xu(),wu)},{l:"Z2",n:"港澳",c:"",p:"",children:Ru(xu(),Cu)}]}createProvince(){return(Iu(xu(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Nu.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...wu,...Cu].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return l().createElement(R.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}))}},l().createElement(R.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),l().createElement(R.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:t}=this.state;return("0"===t?Su:Nu).map((t=>l().createElement("li",{key:t.value,className:xe()({tag:!0,actived:t.value===e}),onClick:()=>this.scrollHandle(t.value.toString())},t.text)))}renderSelect(){const{value:e}=this.props;return l().createElement(R.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=>l().createElement(R.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:t}=this.state;return("0"===t?this.provinces:this.letterCities).map(((t,n)=>l().createElement("div",{key:n},l().createElement("dt",{ref:e=>this[`${t.l}Ref`]=e},t.n,":"),l().createElement("dd",null,t.children?.map((t=>l().createElement("li",{key:t.c,className:xe()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:n}=this.props,{fieldName:r,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=Ee("form-city-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(n),y=l().createElement("div",{className:"container",style:{...i}},l().createElement("div",{className:"city-drop"},l().createElement("div",{className:"city-drop-toper"},l().createElement("div",{className:"city-drop-toper__type"},this.renderType()),l().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),l().createElement("div",{className:"city-drop-letter"},this.renderLetter()),l().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},l().createElement("dl",null,this.renderCity(n)))));return l().createElement(o.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(ia,{value:g,bordered:c}):l().createElement(Ai(),{action:m?[]:["click"],popupVisible:!m&&t,popup:y,popupClassName:xe()(a,`form-popper__${r}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Lr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(R.Input,{ref:this.searchRef,placeholder:s,allowClear:d,bordered:c,readOnly:u,disabled:m,style:{width:"100%",...i},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Eu(Ou,"contextType",xn);class ku extends i.Component{constructor(...e){super(...e),Eu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Ou,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(a,n)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Eu(ku,"contextType",xn);const Lu=ku;function Pu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Au=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Au(e,n)})))};class Fu extends i.Component{constructor(e){super(e),Pu(this,"context",void 0),Pu(this,"searchRef",l().createRef()),Pu(this,"prevText",void 0),Pu(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Pu(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Au(xu(),"86")||[];this.state={results:t,visible:!1,values:[],tabs:[t.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.state.values.join(",")!==(n??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}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 n=this.state.tabs.slice(0,1);for(let r=0;r<t.length;r++){const a=jr(e,t[r]);if(a&&ie(a.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(a?.children)&&(n[r+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:n,formatter:r=e=>e,dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(n)try{const t=await n(r({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,X.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,t=this.state.tabs.map(((t,n)=>{const r=t.find((t=>t.value===e[n]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return l().createElement(on.TabPane,{key:n.toString(),tab:r},l().createElement("div",{className:"region-box"},t.map((t=>l().createElement("span",{key:t.value,className:xe()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[n]=t.value.toString(),e=e.slice(0,n+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},t.text)))))}));return t.length?l().createElement(on,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):l().createElement(dt,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:n}=this.props,{fieldName:r,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=Ee("form-region-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=l().createElement("div",{className:"container"},this.renderTabs());let y=this.prevText;if(!t){const e=this.createTextValue(n);(""===e||e.split("/").every((e=>""!==e)))&&(y=e,this.prevText=y)}return l().createElement(o.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(ia,{value:y,bordered:c}):l().createElement(Ai(),{action:m?[]:["click"],popupVisible:!m&&t,popup:g,popupClassName:xe()(a,`form-popper__${r}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Lr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(R.Input,{ref:this.searchRef,placeholder:s,allowClear:d,bordered:c,style:{width:"100%",...i},readOnly:u,disabled:m,value:y,title:y,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&re((()=>this.initial()))}})))}))}}Pu(Fu,"contextType",xn);class _u extends i.Component{constructor(...e){super(...e),Pu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Fu,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(a,n)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Pu(_u,"contextType",xn);const qu=_u,Du=zt;function Hu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $u=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{options:i={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:y,onPreview:b,onDownload:v,onRemove:x,onSortChange:E,onEditChange:w}=i,{action:C,headers:S,params:N,withCredentials:T=!1,dataKey:I="",downloadWithHeaders:O,fieldAliasMap:k,beforeUpload:L,button:P}=o,A="function"==typeof k?k():k||{},{t:F}=U();return l().createElement(Du,{name:"file",action:C,multiple:d,headers:S,data:N,withCredentials:T,downloadWithHeaders:O,beforeUpload:L,maxCount:u,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:y,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,button:P,showUploadList:{showDownloadIcon:!0,downloadIcon:l().createElement(we.DownloadOutlined,null)},fileList:n,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},n={};for(const r in A)n[r]=e[r]||t.data?.[A[r]]||"";return e.response&&200!==t.code&&R.message.error(t.message||F("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...n,url:e.url||(I?(0,X.get)(t.data,I):t.data)||"",status:e.status}}));r?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onPreview:b,onDownload:v,onRemove:x,onSortChange:E,onEditChange:w})};class Mu extends i.Component{constructor(...e){super(...e),Hu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement($u,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Hu(Mu,"contextType",xn);const Ku=Mu,zu=require("cropperjs");var Vu=r.n(zu);const ju=l().forwardRef(((e,t)=>{const n=h({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},e),{className:r,style:a,src:i,alt:o,imgStyle:s,...c}=n,d=l().useRef(null),u=l().useRef(null);l().useEffect((()=>{const e={};for(const t in c)void 0!==n[t]&&(e[t]=n[t]);return u.current=new(Vu())(d.current,e),()=>{v(),u.current=null}}),[]);const m=()=>u.current?.reset(),p=()=>u.current?.clear(),f=()=>u.current?.crop(),g=(e,t=!1)=>u.current?.replace(e,t),y=()=>u.current?.enable(),b=()=>u.current?.disable(),v=()=>u.current?.destroy(),x=(e,t)=>u.current?.move(e,t),E=(e,t=e)=>u.current?.moveTo(e,t),w=(e,t)=>u.current?.zoom(e),C=(e,t)=>u.current?.zoomTo(e,t),S=e=>u.current?.rotate(e),N=e=>u.current?.rotateTo(e),T=e=>u.current?.scaleX(e),I=e=>u.current?.scaleY(e),R=(e,t=e)=>u.current?.scale(e,t),O=(e=!1)=>u.current?.getData(e),k=e=>u.current?.setData(e),L=()=>u.current?.getContainerData(),P=()=>u.current?.getImageData(),A=()=>u.current?.getCanvasData(),F=e=>u.current?.setCanvasData(e),_=()=>u.current?.getCropBoxData(),q=e=>u.current?.setCropBoxData(e),D=(e={})=>u.current?.getCroppedCanvas(e),H=e=>u.current?.setAspectRatio(e),$=e=>u.current?.setDragMode(e);l().useImperativeHandle(t,(()=>({reset:m,clear:p,initCrop:f,replace:g,enable:y,disable:b,destroy:v,move:x,moveTo:E,relativeZoom:w,zoomTo:C,rotate:S,rotateTo:N,scaleX:T,scaleY:I,scale:R,getData:O,setData:k,getContainerData:L,getImageData:P,getCanvasData:A,setCanvasData:F,getCropBoxData:_,setCropBoxData:q,getCroppedCanvas:D,setAspectRatio:H,setDragMode:$})));const M=Ee("cropper"),K={[M]:!0};return l().createElement("div",{className:xe()(K,r),style:a},l().createElement("img",{ref:d,src:i,alt:o,style:{maxWidth:"100%",...s}}))}));ju.displayName="Cropper";const Wu=ju,Bu=e=>{const{fileTypes:t=[],fileSize:n,fixedSize:r,quality:a,beforeCrop:i,className:o}=e,{t:s}=U(),c=l().useRef(null),d=l().useRef(),u=l().useRef(),m=l().useRef(),p=l().useRef(),[h,f]=l().useState(""),g=e=>{c.current.relativeZoom(e)},y=e=>{c.current.rotate(e)},b=()=>{f("")},v=Ee("cropper-preview");return l().createElement(l().Fragment,null,(()=>{const t=Array.isArray(e.children)?e.children[0]:e.children;if(!t)return null;const{beforeUpload:n,...r}=t.props;return d.current=n,l().createElement(t.type,{...r,beforeUpload:(e,t)=>new Promise((async(n,r)=>{const a=()=>n(R.Upload.LIST_IGNORE);if(i&&!await i(e,t))return void a();u.current=e,m.current=n,p.current=a;const l=new FileReader;l.onload=()=>{f(l.result),l.onload=null},l.readAsDataURL(e)}))})})(),h&&l().createElement(R.Modal,{open:!0,wrapClassName:xe()(v,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{(async()=>{const{type:e,name:n,uid:r}=u.current;c.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===e?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async a=>{let i=new File([a],n,{type:e});if(Object.assign(i,{uid:r}),t.length&&!t.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return R.message.warning(s("qm.upload.tooltip",{type:t.join(",")})),p.current("file type is error");if("function"!=typeof d.current)return m.current(i);const l=d.current(i,[i]);if("boolean"==typeof l||l){if(!0===l)return m.current(i);if(!1===l)return p.current("not upload");if(l&&"function"==typeof l.then)try{const e=await l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),m.current(i)}catch(e){p.current(e)}}else me("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),e,a),await ne(100),b()})()},onCancel:b,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:r?`calc(380px * ${r[1]/r[0]})`:"auto"};return l().createElement("div",{className:"cropper-preview"},l().createElement("div",{className:"cropper-area"},l().createElement("div",{className:"img-cropper"},l().createElement(Wu,{ref:c,aspectRatio:r?r[0]/r[1]:r,src:h,dragMode:"move",preview:".preview"})),l().createElement("div",{className:"actions"},l().createElement(R.Space,{size:"small"},l().createElement(R.Button,{type:"primary",size:"middle",icon:l().createElement(we.ZoomInOutlined,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),l().createElement(R.Button,{type:"primary",size:"middle",icon:l().createElement(we.ZoomOutOutlined,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),l().createElement(R.Button,{type:"primary",size:"middle",icon:l().createElement(we.RotateRightOutlined,null),onClick:()=>y(90)},s("qm.uploadCropper.rotatePlus")),l().createElement(R.Button,{type:"primary",size:"middle",icon:l().createElement(we.RotateLeftOutlined,null),onClick:()=>y(-90)},s("qm.uploadCropper.rotateSubtract"))))),l().createElement("div",{className:"preview-area"},l().createElement("div",{className:"preview",style:e})))})()))};function Uu(){return Uu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uu.apply(null,arguments)}const Gu=e=>{const t=h({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:n=[],openCropper:r=!0,fixedSize:a,quality:i=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:m,className:p,popupClassName:f,beforeCrop:g,onSortChange:y,onChange:b}=t,{t:v}=U(),{$size:x}=Y(t),E=l().useRef(null),w=l().useRef(null),C=l().useRef(!1),[S,N]=l().useState(!1),[T,I]=l().useState(0),O=l().useMemo((()=>u||m),[u,m]),k=l().useMemo((()=>!c||n.length<c),[n,c]);l().useEffect((()=>(P(),document.addEventListener("paste",F),()=>{w.current?.destroy(),document.removeEventListener("paste",F)})),[]),De((()=>{k||(C.current=!1)}),[n]);const L=G((e=>{const{oldIndex:t,newIndex:r}=e;if(t!==r){const e=[...n],[a]=e.splice(t,1);e.splice(r,0,a),y?.(e),b?.({file:n[t],fileList:e})}})),P=()=>{d&&(w.current=_t().create(Be(E.current,Ee("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:L}))},A=(e,n)=>new Promise((async(r,a)=>{const{fileTypes:i=[],fileSize:l,beforeUpload:o}=t,s=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!l||e.size/1024/1024<l,d=s&&c;if(s||R.message.warning(v("qm.upload.tooltip",{type:i.join(",")})),c||R.message.warning(v("qm.upload.sizeLimit",{size:l})),!d)return R.Upload.LIST_IGNORE;if(o){const t=o(e,n);if(!0===t)return r(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{r(await t)}catch(e){a(e)}}else r(e)})),F=G((async e=>{const{action:r,data:a,headers:i}=t;if(C.current&&k&&r)for(const t of e.clipboardData.items)if("file"===t.kind&&t.type.startsWith("image/")){const e=t.getAsFile(),l=Date.now(),o=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${l}`});try{await A(o,[...n,o]);const e=new FormData;if(e.append("file",o),a)for(const t in a)e.append(t,a[t]);const t="string"==typeof r?r:await r(o),l=await fetch(t,{method:"POST",body:e,headers:i});if(!l.ok)throw new Error(v("qm.upload.uploadError"));const s=await l.json();b?.({file:o,fileList:[...n,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})),_=Ee("upload-img"),q={[_]:!0,[`${_}--lg`]:"large"===x,[`${_}--sm`]:"small"===x},D=l().createElement(R.Upload,Uu({className:xe()(q,p)},oe(t,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:A,disabled:O,onPreview:e=>{const t=n.findIndex((t=>t.url===e.url));t<0||(I(t),N(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,n,r)=>l().createElement("div",{className:xe()("upload-item",{handle:d})},e,!O&&l().createElement(we.CloseOutlined,{title:v("qm.upload.remove"),className:"icon",onClick:()=>r.remove()}))}),l().createElement("span",{className:"inner",ref:E},k&&!(m&&n.length)&&l().createElement(l().Fragment,null,l().createElement("p",{className:"ant-upload-drag-icon"},l().createElement(we.InboxOutlined,null)),l().createElement("p",{className:"ant-upload-text"},v("qm.uploadCropper.dragableText")),l().createElement("button",{className:xe()("ant-upload-button",{disabled:O}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{C.current=!0},onBlur:()=>{C.current=!1}},v("qm.uploadCropper.pasteText")))));return l().createElement(l().Fragment,null,r?l().createElement(Bu,{className:f,fixedSize:a,quality:i,fileTypes:o,fileSize:s,beforeCrop:g},D):D,l().createElement("div",{style:{display:"none"}},l().createElement(R.Image.PreviewGroup,{key:n.map((e=>e.uid||"")).join(","),preview:{visible:S,current:T,rootClassName:f,onVisibleChange:e=>N(e)}},n.map(((e,t)=>l().createElement(R.Image,{key:e.uid||t,src:e.url,alt:""}))))))};Gu.displayName="QmUploadImg";const Yu=Gu;function Xu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qu=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{options:i={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:y,onRemove:b,onSortChange:v}=i,{action:x,headers:E,params:w,withCredentials:C=!1,dataKey:S="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,O="function"==typeof T?T():T||{},{t:k}=U();return l().createElement(Yu,{name:"file",action:x,multiple:d,headers:E,data:w,withCredentials:C,popupClassName:N,beforeUpload:I,maxCount:u,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:y,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,fileList:n,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},n={};for(const r in O)n[r]=e[r]||t.data?.[O[r]]||"";return e.response&&200!==t.code&&R.message.error(t.message||k("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...n,url:e.url||(S?(0,X.get)(t.data,S):t.data)||"",status:e.status}}));r?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onRemove:b,onSortChange:v})};class Zu extends i.Component{constructor(...e){super(...e),Xu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Qu,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Xu(Zu,"contextType",xn);const Ju=Zu,em={onActivate:Cr.func,onAddUndo:Cr.func,onBeforeAddUndo:Cr.func,onBeforeExecCommand:Cr.func,onBeforeGetContent:Cr.func,onBeforeRenderUI:Cr.func,onBeforeSetContent:Cr.func,onBeforePaste:Cr.func,onBlur:Cr.func,onChange:Cr.func,onClearUndos:Cr.func,onClick:Cr.func,onContextMenu:Cr.func,onCommentChange:Cr.func,onCopy:Cr.func,onCut:Cr.func,onDblclick:Cr.func,onDeactivate:Cr.func,onDirty:Cr.func,onDrag:Cr.func,onDragDrop:Cr.func,onDragEnd:Cr.func,onDragGesture:Cr.func,onDragOver:Cr.func,onDrop:Cr.func,onExecCommand:Cr.func,onFocus:Cr.func,onFocusIn:Cr.func,onFocusOut:Cr.func,onGetContent:Cr.func,onHide:Cr.func,onInit:Cr.func,onKeyDown:Cr.func,onKeyPress:Cr.func,onKeyUp:Cr.func,onLoadContent:Cr.func,onMouseDown:Cr.func,onMouseEnter:Cr.func,onMouseLeave:Cr.func,onMouseMove:Cr.func,onMouseOut:Cr.func,onMouseOver:Cr.func,onMouseUp:Cr.func,onNodeChange:Cr.func,onObjectResizeStart:Cr.func,onObjectResized:Cr.func,onObjectSelected:Cr.func,onPaste:Cr.func,onPostProcess:Cr.func,onPostRender:Cr.func,onPreProcess:Cr.func,onProgressState:Cr.func,onRedo:Cr.func,onRemove:Cr.func,onReset:Cr.func,onSaveContent:Cr.func,onSelectionChange:Cr.func,onSetAttrib:Cr.func,onSetContent:Cr.func,onShow:Cr.func,onSubmit:Cr.func,onUndo:Cr.func,onVisualAid:Cr.func,onSkinLoadError:Cr.func,onThemeLoadError:Cr.func,onModelLoadError:Cr.func,onPluginLoadError:Cr.func,onIconsLoadError:Cr.func,onLanguageLoadError:Cr.func},tm={apiKey:Cr.string,id:Cr.string,inline:Cr.bool,init:Cr.object,initialValue:Cr.string,onEditorChange:Cr.func,value:Cr.string,tagName:Cr.string,cloudChannel:Cr.string,plugins:Cr.oneOfType([Cr.string,Cr.array]),toolbar:Cr.oneOfType([Cr.string,Cr.array]),disabled:Cr.bool,textareaName:Cr.string,tinymceScriptSrc:Cr.string,rollback:Cr.oneOfType([Cr.number,Cr.oneOf([!1])]),scriptLoading:Cr.shape({async:Cr.bool,defer:Cr.bool,delay:Cr.number}),...em},nm=e=>"function"==typeof e,rm=e=>e in em,am=e=>e.substr(2),im=(e,t,n,r,a)=>((t,n,r,a,i,l,o)=>{const s=Object.keys(i).filter(rm),c=Object.keys(l).filter(rm),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=am(e),n=o[t];r(t,n),delete o[t]})),u.forEach((r=>{const a=((t,n)=>r=>t(n)?.(r,e))(t,r),i=am(r);o[i]=a,n(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,n,r);let lm=0;const om=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return lm++,e+"_"+n+lm+String(t)},sm=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),cm=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),dm=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},um=()=>({listeners:[],scriptId:om("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),mm=(()=>{let e=um();return{load:(t,n,r,a,i,l)=>{const o=()=>((t,n,r,a,i)=>{const l=n.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=t,l.src=r,l.async=a,l.defer=i;const o=()=>{l.removeEventListener("load",o),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};l.addEventListener("load",o),n.head&&n.head.appendChild(l)})(e.scriptId,t,n,r,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=um()}}})(),pm=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function hm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class fm extends i.Component{constructor(e){super(e),hm(this,"editor",void 0),hm(this,"id",void 0),hm(this,"elementRef",void 0),hm(this,"inline",void 0),hm(this,"currentContent",void 0),hm(this,"boundHandlers",void 0),hm(this,"rollbackTimer",void 0),hm(this,"valueCursor",void 0),hm(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})),hm(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){}})),hm(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),hm(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))}})),hm(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),hm(this,"initialise",((e=0)=>{const t=this.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,n=e.parentNode;for(;null!=n;)t=n,n=t.parentNode;return t===e.ownerDocument}return e.isConnected})(t)){if(0===e)setTimeout((()=>this.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>this.initialise(e+1)),100)}return}const n=pm(this.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const r={...this.props.init,selector:void 0,target:t,readonly:this.props.disabled,inline:this.inline,plugins:(a=this.props.init?.plugins,i=this.props.plugins,cm(a).concat(cm(i))),toolbar:this.props.toolbar??this.props.init?.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!sm(t)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&nm(this.props.init.setup)&&this.props.init.setup(e)},init_instance_callback:e=>{const t=this.getInitialValue();this.currentContent=this.currentContent??e.getContent(),this.currentContent!==t&&(this.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=this.props.disabled??!1;dm(this.editor,n?"readonly":"design"),this.props.init&&nm(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}};var a,i;this.inline||(t.style.visibility=""),sm(t)&&(t.value=this.getInitialValue()),n.init(r)})),this.id=this.props.id||om("tiny-react"),this.elementRef=i.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 n=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const r of[t,n])if(r)try{e.selection.moveToBookmark(r),this.valueCursor=r;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;dm(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==pm(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&mm.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=pm(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:e="div"}=this.props;return i.createElement(e,{ref:this.elementRef,id:this.id})}renderIframe(){return i.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){im(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,n=t(e),r=t(this.props);!n&&r?(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)):n&&!r&&(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))}}}hm(fm,"propTypes",tm),hm(fm,"defaultProps",{cloudChannel:"6"});var gm=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(gm||{});const ym=e=>{const{className:t,style:n,tinymce:r={},upload:a={},thresholdSize:i=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:m}=e,{global:p}=l().useContext(o),{$size:h}=Y(e),{$locale:f,t:g}=U(),y={height:r.height||400,plugins:r.plugins||"preview importcss searchreplace autolink save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons",toolbar:r.toolbar||"undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl",menubar:r.menubar||"file edit view insert format tools table help",font_family_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",font_size_formats:"10px 12px 14px 16px 18px 20px 24px 36px 48px 56px 72px",language:gm[f],skin:"tinymce-5",...oe(r,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>{const{action:t,headers:n,dataKey:r,customHandler:l}=a;return l?l(e):new Promise((async(a,l)=>{const o=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(t&&c/1024/1024>i)try{const e=await fetch(t,{method:"POST",body:s,headers:n});if(!e.ok)throw l(""),new Error(g("qm.upload.uploadError"));const i=await e.json();200===i.code&&a(r?(0,X.get)(i.data,r):i.data)}catch(e){R.message.error(g("qm.uploadCropper.uploadError"))}else a(o)}))},setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;u?.({width:n,height:r},t)}))}},b=Ee("tinymce"),v={[b]:!0,[`${b}--lg`]:"large"===h,[`${b}--sm`]:"small"===h},x={init:y,value:d,disabled:c,tinymceScriptSrc:s||p?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{m?.(t.getContent(),t)}};return l().createElement("div",{className:xe()(v,t),style:n},l().createElement(fm,x))};ym.displayName="QmTinymce";const bm=ym;function vm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xm=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{options:i={},upload:o,style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{tinymce:u,thresholdSize:m,onResizeEditor:p}=i;return l().createElement(bm,{value:n,tinymce:u,upload:o,thresholdSize:m,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:p,onChange:e=>{(e=>{r?.(e),a(e)})(e)}})};class Em extends i.Component{constructor(...e){super(...e),vm(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=ee}=this.props.option;return l().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(R.Row,{wrap:!1,gutter:4},l().createElement(R.Col,{flex:"auto"},l().createElement(R.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(xm,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(R.Col,{flex:ce(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}vm(Em,"contextType",xn);const wm=Em;function Cm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Sm extends i.Component{constructor(e){super(e),Cm(this,"context",void 0),Cm(this,"provide",{$$form:this,echo_data:{}}),Cm(this,"_initialValues",void 0),Cm(this,"_initialOthers",void 0),Cm(this,"_initialExtras",void 0),Cm(this,"_fieldAuth",{}),Cm(this,"wrapperRef",l().createRef()),Cm(this,"formRef",l().createRef()),Cm(this,"originItems",[]),Cm(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Cm(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})})),Cm(this,"resizeListenerHandle",(0,X.debounce)(this.resizeObserveHandler,10)),Cm(this,"getFormItems",vn()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Cm(this,"getFlattenItems",vn()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,X.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),Cm(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Cm(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Cm(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Cm(this,"finishFailedHandle",(({values:e,errorFields:t})=>{this.props.onFinishFailed?.(t)})),Cm(this,"openValidateInfo",(e=>{const t=l().createElement("ul",null,e.map((e=>{const{label:t}=this.formItems.find((t=>t.fieldName===e.name[0]));return l().createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof t?`${t}: `:"")+e.errors.join(","),"]")})));R.notification.error({message:p("qm.form.validatePrompt"),description:t,duration:10})})),Cm(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Yt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){bt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){vt(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&&me("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(e=[]){return e.some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return Object.assign({},n)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,X.isPlainObject)(e.extra))).forEach((n=>{t[n.fieldName]=e[n.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,X.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:n,options:r}=e;return t=t??void 0,kr.includes(n)&&(t=t??[]),"CHECKBOX"!==n&&"SWITCH"!==n||(t=t??r?.falseValue??Rr),t}createFormValue(e){const t={};return this.flattenItems.forEach((n=>{t[n.fieldName]=this.getInitialValue(n,e[n.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)}createOriginItems(){this.originItems=this.props.items.map((e=>({fieldName:e.fieldName,hidden:e.hidden})))}getOriginItems(){return this.originItems}setViewValue(e,t=""){t!==this.getViewValue(e)&&this.setState((n=>({viewData:Object.assign({},n.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){e!==this.state.collapse&&this.setState({collapse:e},(()=>{re((()=>this.props.onCollapse?.(e)))}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:n}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!n||setTimeout((()=>this.CREATE_FOCUS(n)))}getFormItemLabel(e){if(Br(e))return Ur(e);if((0,X.isPlainObject)(e)){const{fieldName:t,label:n,options:r={}}=e;if(Br(n))return Ur(n);const{itemList:a=[]}=r,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,n=this.dividers.length;t<n;t++){const n=this.formItems.findIndex((e=>e===this.dividers[t]));let r=this.formItems.findIndex((e=>e===this.dividers[t+1]));r=r>-1?r:void 0,e.push(this.formItems.slice(n,r).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){if("DIVIDER"===e)return!0;const n=this.getBlockDerivedItems();for(let e=0,r=n.length;e<r;e++){const r=n[e],a=this.dividers.find((e=>e.fieldName===r[0].fieldName)),i=a?.collapse?.showLimit??r.length-1;for(let e=1;e<r.length;e++)if(r[e].fieldName===t&&e>i)return this.state.expand[r[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const n=e[t];if($r(n)&&(e[t]=""),Array.isArray(n)&&n.forEach(((n,r)=>{$r(n)&&(e[t][r]="")})),t.includes("|")&&Array.isArray(n)){const[r,a]=t.split("|");e[r]=n[0]??"",e[a]=n[1]??""}}if(this.isFilterType)for(const t in e)ie(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=oe(e,["fetch"]);if(e.fetch){const{api:n,params:r,dataKey:a}=e.fetch;try{const e=await n(r);200===e.code&&(t=(a?(0,X.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:n}=e,r=t.fieldList.find((e=>e.dataIndex===n));if(r){const t=this.originItems.find((e=>e.fieldName===n)),{visible:a=1,disabled:i,secretName:l}=r;a||(e.noAuth=!0,t.noAuth=!0),i&&(e.disabled=!0,t.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},t.options=Object.assign({},t.options,{secretType:l})),this.setFieldAuth(n,{visible:a,disabled:i,secretName:l})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return l().createElement(wa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return l().createElement(Ta,{option:e})}INPUT_NUMBER(e){return l().createElement(Pa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return l().createElement(qa,{option:e})}SEARCH_HELPER(e){return l().createElement(_c,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return l().createElement(jc,{option:e})}TREE_TABLE_HELPER(e){return l().createElement(td,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return l().createElement(od,{option:e})}RANGE_SEARCH_HELPER(e){return l().createElement(yd,{option:e})}CHECKBOX(e){return l().createElement(fa,{option:e})}MULTIPLE_CHECKBOX(e){return l().createElement(Ed,{option:e})}RATE(e){return l().createElement(Nd,{option:e})}RADIO(e){return l().createElement(Od,{option:e})}SWITCH(e){return l().createElement(Ad,{option:e})}TEXT_AREA(e){return l().createElement(Dd,{option:e})}DATE(e){return l().createElement(Kd,{option:e})}RANGE_DATE(e){return l().createElement(Bd,{option:e})}TIME(e){return l().createElement(Xd,{option:e})}RANGE_TIME(e){return l().createElement(eu,{option:e})}SELECT(e){return l().createElement(ua,{option:e})}MULTIPLE_SELECT(e){return l().createElement(ua,{option:e,multiple:!0})}IMMEDIATE(e){return l().createElement(au,{option:e})}DIVIDER(e){return l().createElement(ou,{option:e})}TREE_SELECT(e){return l().createElement(pu,{option:e})}MULTIPLE_TREE_SELECT(e){return l().createElement(pu,{option:e,multiple:!0})}CASCADER(e){return l().createElement(bu,{option:e})}MULTIPLE_CASCADER(e){return l().createElement(bu,{option:e,multiple:!0})}CITY_SELECT(e){return l().createElement(Lu,{option:e})}REGION_SELECT(e){return l().createElement(qu,{option:e})}UPLOAD_FILE(e){return l().createElement(Ku,{option:e})}UPLOAD_IMG(e){return l().createElement(Ju,{option:e})}TINYMCE(e){return l().createElement(wm,{option:e})}renderFormLabel(e){if(Br(e)||!(0,X.isPlainObject)(e))return e;const{type:t,fieldName:n,label:r,options:a={},onChange:i=ee}=e,{itemList:o=[]}=a;return"SELECT"===t?l().createElement(R.Form.Item,{name:n,noStyle:!0},l().createElement(ca,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>i(e,t)})):"CHECKBOX"===t?l().createElement(l().Fragment,null,l().createElement("span",{style:{paddingRight:5}},r),l().createElement(R.Form.Item,{name:n,noStyle:!0},l().createElement(pa,{option:e,onValuesChange:e=>i(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:n,style:r={},render:a}=e,{extra:i}=this.state;if(n)return l().createElement(R.Tooltip,{className:"extra-tooltip",title:i[t]},l().createElement(we.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===t));return l().createElement("div",{className:"extra-text",title:a?"":i[t],style:r},l().createElement("span",{className:"extra-overflow-cut"},a?a(o,this):i[t]))}renderFormItemButton(e,t){const n=this.formItems.find((t=>t.fieldName===e)),r="function"==typeof t?t(n):t;return this.isOnlyShow?null:r}renderFormItem(e){const{label:t,fieldName:n,invisible:r,tooltip:a,className:i,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return l().createElement(R.Form.Item,{label:this.renderFormLabel(t),name:n,rules:c,tooltip:a,hidden:r,className:xe()(i),style:{width:"100%",...d},labelCol:{flex:this.verticalLayout?"initial":ce(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(t)}},this.formRef.current?u(e,this):l().createElement(l().Fragment,null))}createFormItem(e){return(0,X.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(me("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:t,defaultRows:n,isFieldsDefine:r}=this.props,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<n;e++)a.push({})}));const i=24/e,o=[],s=a.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return o.push(r),r}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,d=[],u=a.map(((t,n)=>{let{selfCol:r=1}=t;const{type:a,fieldName:s}=t;r=r>=24||"DIVIDER"===a||"TINYMCE"===a?e:r;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(o[n]),l().createElement(R.Col,{key:s??n,className:s,span:r*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},a?this.createFormItem(se(t)):null)}));return r&&"default"===t&&u.push(l().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(e=0){const{flexCols:t,collapse:n}=this.state,{searchButtonCols:r,isSearchBtn:a,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const o=24/t,s=r||1,c=t-e%t-s;return a?l().createElement(R.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},l().createElement(R.Space,{style:{marginBottom:12}},l().createElement(fe,{type:"primary",size:this.$size,icon:l().createElement(we.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),l().createElement(fe,{size:this.$size,icon:l().createElement(we.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),i?this.createFieldsDefine():null,this.showFilterCollapse&&l().createElement("a",{onClick:()=>this.setExpandHandle(!n)},n?l().createElement(we.UpOutlined,null):l().createElement(we.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const r=24/e;return n&&"default"===t?l().createElement(R.Row,{gutter:0},l().createElement(R.Col,{key:"-",span:r},l().createElement(R.Form.Item,null,l().createElement(R.Space,{style:{marginBottom:12}},l().createElement(fe,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),l().createElement(fe,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:n}=this.props;return l().createElement(ba,{uniqueKey:e,items:t,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[n,r]=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:[]})));n||a.length?t((n||[]).concat(a)):e(r)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),n=Object.keys(this._initialOthers),r=t.filter((e=>!n.includes(e))),a={};return r.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){me("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:a}=this.props,i=r.find((t=>t.fieldName===e));if(!i)return me("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,X.isPlainObject)(t))return me("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return me("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||(0,X.set)(i,n,t[n]));n&&(a?a([...r]):me("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:n,disabled:r,labelWidth:a,labelAlign:i,labelWrap:o,customClass:s}=this.props,c=Ee("form"),d={required:"${label}"+p("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return l().createElement("div",{ref:this.wrapperRef,className:xe()(u,e),style:t},l().createElement(R.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:i,labelWrap:o,colon:!1,disabled:r,labelCol:{flex:this.verticalLayout?"initial":ce(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},l().createElement(xn.Provider,{value:this.provide},l().createElement(R.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Cm(Sm,"contextType",o),Cm(Sm,"propTypes",_r),Cm(Sm,"defaultProps",qr);const Nm=Sm,Tm=e=>null!=e;function Im(e,t,n,r){const[a,i]=l().useState(void 0);l().useLayoutEffect((()=>{const t="function"==typeof e?e():e;i(t||null)}));const[o,s]=l().useState(null),c=()=>{if(a){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:a,bottom:i,left:l}=e.getBoundingClientRect();return r>=0&&l>=0&&a<=t&&i<=n})(a)&&t&&a.scrollIntoView(r);const{left:e,top:n,width:i,height:l}=a.getBoundingClientRect(),o={left:e,top:n,width:i,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};return l().useLayoutEffect((()=>{c()}),[a,t]),si({handler:c}),[l().useMemo((()=>{if(!o)return o;const e=n?.offset||6,t=n?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,n]),a]}function Rm(){return Rm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rm.apply(null,arguments)}const Om={fill:"transparent",pointerEvents:"auto"},km=e=>{const{prefixCls:t,rootClassName:n,pos:r,showMask:a,style:i={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${Qa()}`,m="object"==typeof c?c?.placeholder:c;return l().createElement($l(),{open:s,autoLock:!0},l().createElement("div",{className:xe()(`${t}-mask`,n),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...i}},a?l().createElement("svg",{style:{width:"100%",height:"100%"}},l().createElement("defs",null,l().createElement("mask",{id:u},l().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),r&&l().createElement("rect",{x:r.left,y:r.top,rx:r.radius,width:r.width,height:r.height,fill:"black",className:m?`${t}-placeholder-animated`:""}))),l().createElement("rect",Rm({},r?null:Om,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),r&&l().createElement(l().Fragment,null,l().createElement("rect",Rm({},Om,{x:"0",y:"0",width:"100%",height:`${r.top}px`})),l().createElement("rect",Rm({},Om,{x:"0",y:"0",width:r.left,height:"100%"})),l().createElement("rect",Rm({},Om,{x:"0",y:r.top+r.height,width:"100%",height:`calc(100vh - ${r.top+r.height}px)`})),l().createElement("rect",Rm({},Om,{x:r.left+r.width,y:"0",width:`calc(100vw - ${r.left+r.width}px)`,height:"100%"})))):null))},Lm=e=>{const{prefixCls:t,zIndex:n,open:r,onPause:a,onPlay:i}=e,[o,s]=ri(void 0,{value:r,postState:e=>e??!0}),c=l().useRef(null),d=l().useRef(!1),u=G((e=>{m(e),e.shiftKey&&32===e.keyCode&&p()}));l().useEffect((()=>{const e=Ut()(document,"keyup",u);return()=>e.remove()}),[]);const m=e=>{e.stopPropagation(),e.preventDefault()},p=()=>{d.current?d.current=!1:(s(!o),o?a?.():i?.())};return l().createElement("div",{ref:c,className:`${t}-control`,style:{zIndex:n+1},onMouseDown:e=>{m(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,l=e.clientX-We(t).x,o=e.clientY-We(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>a-n-1&&(s=a-n-1),c<0&&(c=0),c>i-r-1&&(c=i-r-1),ze(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>p()},o?l().createElement(we.PauseOutlined,null):l().createElement(we.CaretRightOutlined,null))},Pm=e=>{const{prefixCls:t,current:n,total:r=0,cover:a,title:i,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:m,onNext:p,onFinish:h,className:f,indicatorsRender:g}=e,{t:y}=U(),b="primary"!==c?"primary":"default",v=G((e=>{C(e),40===e.keyCode&&(n<r-1?p?.():h?.()),38===e.keyCode&&n>0&&m?.()}));l().useEffect((()=>{const e=Ut()(document,"keyup",v);return()=>e.remove()}),[]);const x=Tm(a)?l().createElement("div",{className:`${t}-cover`},a):null,E=Tm(o)?l().createElement("div",{className:`${t}-description`},o):null;let w;w=g?g(n,r):[...Array.from({length:r}).keys()].map(((e,r)=>l().createElement("span",{key:e,className:xe()(r===n&&`${t}-indicator-active`,`${t}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return l().createElement("div",{className:xe()(`${t}-content`,f)},l().createElement("div",{className:`${t}-inner`},l().createElement(we.CloseOutlined,{className:`${t}-close`,onClick:u}),s.content&&l().createElement(R.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},l().createElement(we.QuestionCircleOutlined,{className:xe()(`${t}-close`,"help-icon")})),x,l().createElement("div",{className:`${t}-header`},l().createElement("div",{className:`${t}-title`},i)),E,l().createElement("div",{className:`${t}-footer`},r>1&&l().createElement("div",{className:`${t}-indicators`},w),l().createElement(be,{className:`${t}-buttons`},0!==n?l().createElement(fe,{className:`${t}-prev-btn`,size:"small",onMouseDown:C,onClick:m},y("qm.tour.prevStep")):null,n===r-1?l().createElement(fe,{className:`${t}-finish-btn`,type:b,size:"small",onClick:h},y("qm.tour.finish")):l().createElement(fe,{className:`${t}-next-btn`,type:b,size:"small",onMouseDown:C,onClick:p},y("qm.tour.nextStep"))))))},Am=e=>{const{current:t,renderPanel:n}=e;return l().createElement(l().Fragment,null,"function"==typeof n?n(e,t):l().createElement(Pm,e))};function Fm(){return Fm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fm.apply(null,arguments)}const _m={left:"50%",top:"50%",width:1,height:1},qm=l().forwardRef(((e,t)=>{const{steps:n=[],defaultCurrent:r,current:a,onChange:i,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:m=!0,control:p=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:y,zIndex:b,renderPanel:v,indicatorsRender:x,gap:E,animated:w=!0,scrollIntoViewOptions:C=!0,...S}=e,N=l().useRef(),[T,I]=ri(0,{value:a,defaultValue:r}),[R,O]=ri(void 0,{value:c,postState:e=>!(T<0||T>=n.length)&&(e??!1)}),[k,L]=ri(1051,{value:b,defaultValue:b}),[P,A]=l().useState(),F=l().useRef(R);l().useLayoutEffect((()=>{R&&!F.current&&I(0),F.current=R,A(R)}),[R]),l().useImperativeHandle(t,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:_,type:q,placement:D,trigger:H,delay:$,style:M,arrow:K,className:z,mask:V,scrollIntoViewOptions:j,zIndex:W,action:B}=n[T]||{},U=W||k,G=q||d,Y=R&&(V??u),X=j??C,[Q,Z]=Im(_,!!c,E,X),J=((e,t,n)=>n??t??(null===e?"center":"bottom"))(Z,g,D),ee=!!Z&&(void 0===K?m:K),te="object"==typeof ee&&ee.pointAtCenter;l().useLayoutEffect((()=>{N.current?.forceAlign()}),[te,T]),De((()=>{R&&(ie(),B?.(Z,T))}),[R,Z]);const re=e=>{I(e),i?.(e)},ae=()=>{O(!1),o?.(T)},ie=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||"none"===Ke(r=n,"display")||"hidden"===Ke(r,"visibility")||"0"===Ke(r,"opacity")||e.push(n);for(const e of Array.from(n.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const le=async()=>{if(!H||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[a,i]=[e+n/2,t+r/2],l=new MouseEvent(H,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),o=document.elementFromPoint(a,i);o&&(o.dispatchEvent(l),await ne($??320))},oe="boolean"==typeof Y?Y:!!Y,se="boolean"==typeof Y?void 0:Y,ce=Object.assign({},f,M),de=Ee("tour"),ue=[{[`${de}-primary`]:"primary"===G},h,z],me=Tl({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(km,{zIndex:U,prefixCls:de,pos:Q,showMask:oe,style:se?.style,fill:se?.color,open:P,animated:w,rootClassName:h}),l().createElement($l(),{open:P,autoLock:!0},l().createElement(Rl(),Fm({ref:N},S,{zIndex:U,builtinPlacements:me,popupStyle:ce,popupPlacement:J,popupVisible:P,popupClassName:xe()(ue),prefixCls:de,popup:()=>l().createElement(Am,Fm({key:"content",arrow:ee,prefixCls:de,total:n.length,helper:y,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await le(),re(T-1)},onNext:async()=>{await le(),re(T+1)},onClose:ae,current:T,onFinish:()=>{ae(),s?.()}},Object.assign({},n[T],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),l().createElement("div",{className:xe()(h,`${de}-target-placeholder`),style:{...Q||_m,position:"fixed",pointerEvents:"none"}}))),p&&l().createElement($l(),{open:R},l().createElement(Lm,{zIndex:U,prefixCls:de,onPause:()=>A(!1),onPlay:()=>A(!0)})))}));qm.displayName="QmTour";const Dm=qm,Hm={previewWidth:1100,defaultDistance:.45,logoHeight:60},$m=(0,i.createContext)(void 0);var Mm=null;function Km(){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),n=e.match(/MSIE\D?\d+/i),r=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!n&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){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 zm(e,t){var n;try{var r=navigator.userAgent,a=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(Km()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void R.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&r.match(/x64/i),e||t?n=a?e:t:Mm?n=Mm:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),Mm=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n;return n.VERSION<"6.2.2.6"&&Km(),n}catch(e){R.message.error("getLodop 出错:"+e)}}Km();const Vm=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:n}=window.screen;if(t&&n)e[0]=t,e[1]=n;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)},jm=l().forwardRef(((e,t)=>{const{templateRender:n,directPrint:r}=e,{global:a}=l().useContext(o),{$$preview:i}=l().useContext($m),{state:s,isWindowsPrinter:c,pageSize:d}=i,u=l().useRef(null),m=l().useRef({}),p=l().useRef([]),h=l().useRef([]),f=l().useRef([]),[g,y]=l().useState(!0);l().useImperativeHandle(t,(()=>({createPreviewDom:k,createExportHtml:P,createPrintHtml:L,SHOW_PREVIEW:A,DIRECT_PRINT:F}))),De((()=>{O()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),l().useEffect((()=>{m.current.templateEl=u.current.querySelector(".origin-template").children[0],m.current.previewEl=u.current.querySelector(".workspace")}),[]);const b=l().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*Hm.defaultDistance+10*Hm.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[s,c,d]),v=l().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*Hm.defaultDistance+10*Hm.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),x=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Vm(b-10*(e.left-Hm.defaultDistance)-10*(e.right-Hm.defaultDistance))}),[s,b]),E=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Vm(v-10*(e.top-Hm.defaultDistance)-10*(e.bottom-Hm.defaultDistance))}),[s,v]),w=s.form.scale,C=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:Vm(10*e.left),right:Vm(10*e.right),top:Vm(10*e.top),bottom:Vm(10*e.bottom)}}),[s]),S=l().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:n,top:r,bottom:a}=C,i=x+t+n,l=Hm.previewWidth-i<=0?0:(Hm.previewWidth-i)/2,o=Math.abs((1-w)*i/2);let c=0;return w>1&&(c=o>l?-1*l:-1*o),w<1&&(c=i-2*o>Hm.previewWidth?0:l>0?o:(Hm.previewWidth-(i-2*o))/2),{width:`${x}px`,height:"stylus"===e?"auto":E+"px",paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${w})`,opacity:g?0:1}}),[s,g,C,w,E,x]),N=(p.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=a?.print?.leftLogo??"",t=a?.print?.rightLogo??"";return[`<tr style="height: ${Hm.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("")}),T=()=>{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},I=()=>{let e=document.createElement("tr");var t,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=T().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=m.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},R=()=>{const e=m.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const a=e[r].clientHeight;e[r].style.height=a+"px",n.push(a),t.push(e[r].outerHTML)}h.current=n,p.current=t},O=()=>{if(!p.current.length)return;const{form:{setting:e,printerType:t}}=s;if(r)return f.current.push([T(),N(),...p.current]);const n=e.fixedLogo?E-Hm.logoHeight:E;let a=[];if(f.current=[],"stylus"===t)f.current.push([T(),...e.fixedLogo?[N()]:[],...p.current]);else{let t=0;for(let r=0,i=h.current.length;r<i;r++){const l=p.current[r],o=h.current[r];e.fixedLogo||0!==r||(t+=Hm.logoHeight),t+=o,t<=n?a.push(l):(f.current.push([T(),...e.fixedLogo?[N()]:[],...a]),a=[],t=0,r-=1),r===i-1&&a.length&&f.current.push([T(),...e.fixedLogo?[N()]:[],...a])}}e.fixedLogo||f.current[0]?.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');i.setState({currentPage:1,totalPage:f.current.length}),k()},k=()=>{const{currentPage:e}=s;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${m.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",m.current.previewEl.innerHTML=t,m.current.previewEl.parentNode.scrollTop=0},L=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${m.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},P=()=>{const e=[];for(let t=0;t<p.current.length;t++)e[t]=p.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+T()+e.join("")+"</table>"},A=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return _();m.current.previewEl.innerHTML||(I(),await ne(0),R(),O(),y(!1))},F=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return _();I(),await ne(0),R(),O(),y(!1),i.doPrint(L()),await ne(0),i.doClose()},_=()=>{me("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},q=Ee("print-container"),D={[q]:!0,"no-visible":r};return l().createElement("div",{ref:u,className:xe()(D)},l().createElement(mt,{wrapperClassName:"spin",spinning:g,tip:"Loading..."},l().createElement("div",{className:"preview"},l().createElement("div",{className:"origin-template",style:{width:`${x}px`,marginLeft:`-${Math.floor(x/2)}px`}},n?.()),l().createElement("div",{className:"workspace",style:S}))))}));jm.displayName="Container";const Wm=jm;function Bm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Um extends i.Component{constructor(...e){super(...e),Bm(this,"context",void 0),Bm(this,"formRef",l().createRef()),Bm(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:Hm.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:Hm.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:Hm.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:Hm.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),Bm(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})})),Bm(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")}))),Bm(this,"state",{formList:this.createFormList()}),Bm(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())})),Bm(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return l().createElement(l().Fragment,null,l().createElement(Nm,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),l().createElement(fe,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}Bm(Um,"contextType",o);const Gm=Um;function Ym(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Xm extends i.Component{constructor(...e){super(...e),Ym(this,"context",void 0),Ym(this,"provide",{$$preview:this}),Ym(this,"containRef",l().createRef()),Ym(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Hm.defaultDistance,right:Hm.defaultDistance,top:Hm.defaultDistance,bottom:Hm.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Ym(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Ym(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Ym(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 Wi().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Ym(this,"doClose",(()=>{this.props.onClose?.()})),Ym(this,"getPrintConfig",(async e=>{const t=this.context.global,n=t?.getComponentConfigApi;if(n)try{const t=await n({key:e});if(200===t.code)return t.data}catch(e){}})),Ym(this,"savePrintConfig",(async(e,t)=>{const n=this.context.global,r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})),Ym(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 ')),Ym(this,"doPrint",(e=>{const t=zm();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Hm,{left:d,right:u,top:m,bottom:h}=a.distance;t.PRINT_INIT(n??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),a.doubleSide&&("auto"===a.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===l&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():R.message.error(p("qm.print.printError"))},t.PRINT()})),Ym(this,"doExport",(e=>{const t=zm();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(n??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&this.doClose():R.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(`${c()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:p("qm.print.laserPrinter"),value:"laser"},{text:p("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=zm(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const n=e.GET_PRINTER_COUNT();for(let r=0;r<n;r++)t.push({text:e.GET_PRINTER_NAME(r),value:r})}catch(e){me("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 Wi().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,X.isPlainObject)(e)&&await Wi().setItem(this.printerKey,e)),(0,X.isPlainObject)(e)&&Object.keys(e).length&&(0,X.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:t}=this.props,{visible:n,form:r,currentPage:a,totalPage:i,printPage:o}=this.state,s=Ee("print-preview"),c={visible:n,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?l().createElement(l().Fragment,null,l().createElement("div",{className:xe()(d)},l().createElement("div",{className:"outer"},l().createElement("div",{className:"header"},l().createElement("span",null,p("qm.print.printer"),":",l().createElement(R.Select,{value:r.printerName,onChange:e=>{this.setState((t=>(0,X.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",null,p("qm.print.type"),":",l().createElement(R.Select,{value:r.printerType,onChange:e=>{this.setState((t=>(0,X.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>l().createElement(R.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",null,p("qm.print.copies"),":",l().createElement(R.InputNumber,{value:r.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,X.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),l().createElement("span",null,p("qm.print.printPage.0"),l().createElement(R.InputNumber,{value:o,min:1,max:i,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),p("qm.print.printPage.1")),l().createElement("span",null,l().createElement(R.Pagination,{size:"small",current:a,pageSize:1,total:i,onChange:this.pageChangeHandle})),l().createElement("span",null,l().createElement(fe,{type:"text",icon:l().createElement(we.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),l().createElement("span",null,l().createElement(fe,{type:"text",icon:l().createElement(we.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),l().createElement("span",null,l().createElement(fe,{icon:l().createElement(we.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),l().createElement("div",{className:"main"},l().createElement($m.Provider,{value:this.provide},l().createElement(Wm,{ref:this.containRef,templateRender:t,directPrint:!1}))),l().createElement("div",{className:"footer"},l().createElement("span",null,p("qm.print.scale"),":",l().createElement(R.Slider,{value:r.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,X.merge)({},t,{form:{scale:e}})))}}),l().createElement("em",{className:"scale-text"},`${Math.floor(100*r.scale)}%`)),l().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),l().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:a,totalPage:i}))))),l().createElement(yn,c,l().createElement(Gm,{setting:r.setting,onChange:e=>{this.setState((t=>(0,X.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):l().createElement($m.Provider,{value:this.provide},l().createElement(Wm,{ref:this.containRef,templateRender:t,directPrint:!0}))}}Ym(Xm,"contextType",o);const Qm=Xm;function Zm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Jm extends i.Component{constructor(...e){super(...e),Zm(this,"context",void 0),Zm(this,"previewRef",l().createRef()),Zm(this,"state",{visible:!1,loading:!1}),Zm(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})})),Zm(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:n,defaultConfig:r,preview:a,closeAfterPrint:i}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${Hm.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:n,defaultConfig:r,preview:a,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return a?l().createElement(yn,o,l().createElement(Qm,s)):e?l().createElement(Qm,s):null})),Zm(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ne(0),this.setState({visible:!0}),await ne(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:t,icon:n,type:r,disabled:a,shape:i}=this.props,o={size:t||this.context.size||"",type:r,shape:i,icon:n,loading:e,disabled:a,click:this.clickHandle};return l().createElement(l().Fragment,null,this.props.children&&l().createElement(fe,o,this.props.children),this.createRender())}}Zm(Jm,"propTypes",{size:(e,t,n)=>{if(!Nr(e[t]||""))return ue("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Sr().elementType}),Zm(Jm,"defaultProps",{preview:!0,type:"primary",icon:l().createElement(we.PrinterOutlined,null)}),Zm(Jm,"contextType",o);const ep=Jm;function tp(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function np(e){const t=tp(e);return t?t.frameElement:null}function rp(e){const t=lp(e);return ap([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function ap(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function ip(e,t){const n=np(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let a=n,i=!1;for(;a;){const e=rp(a);if(r.push(e),a=np(a),i)break;a&&tp(a)===t&&(i=!0)}return ap(r)}return e.getBoundingClientRect()}function lp(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function op(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sp=Object.assign;class cp{constructor(e,t){op(this,"node",void 0),op(this,"border",void 0),op(this,"padding",void 0),op(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=pp.border,this.padding.style.borderColor=pp.padding,this.content.style.backgroundColor=pp.background,sp(this.node.style,{borderColor:pp.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){mp(t,"margin",this.node),mp(t,"border",this.border),mp(t,"padding",this.padding),sp(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),sp(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class dp{constructor(e,t){op(this,"tip",void 0),op(this,"nameSpan",void 0),op(this,"dimSpan",void 0),this.tip=e.createElement("div"),sp(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),sp(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),sp(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,n){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(n)+"px"}updatePosition(e,t){const n=this.tip.getBoundingClientRect(),r=function(e,t,n){const r=Math.max(n.height,20),a=Math.max(n.width,60);let i;i=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-r<=t.top+t.height?e.top-r-5<t.top+5?t.top+5:e.top-r-5:t.top+t.height-r-5;let l=e.left+5;return e.left<t.left&&(l=t.left+5),e.left+a>t.left+t.width&&(l=t.left+t.width-a-5),i+="px",l+="px",{style:{top:i,left:l}}}(e,t,{width:n.width,height:n.height});sp(this.tip.style,r.style)}}class up{constructor(){op(this,"window",void 0),op(this,"tipBoundsWindow",void 0),op(this,"container",void 0),op(this,"tip",void 0),op(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const n=e.document;this.container=n.createElement("div"),this.container.style.zIndex="10000000",this.tip=new dp(n,this.container),this.rects=[],n.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const n=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>n.length;){const e=this.rects.pop();e?.remove()}if(0===n.length)return;for(;this.rects.length<n.length;)this.rects.push(new cp(this.window.document,this.container));const r={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};n.forEach(((e,t)=>{const n=ip(e,this.window),a=lp(e);r.top=Math.min(r.top,n.top-a.marginTop),r.right=Math.max(r.right,n.left+n.width+a.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+a.marginBottom),r.left=Math.min(r.left,n.left-a.marginLeft),this.rects[t].update(n,a)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const a=ip(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:r.top,left:r.left,height:r.bottom-r.top,width:r.right-r.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function mp(e,t,n){sp(n.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const pp={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let hp=null,fp=null;function gp(){null!=window.document&&(hp=null,null!==fp&&(fp.remove(),fp=null))}function yp(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class bp{constructor(e){yp(this,"_isRunning",void 0),yp(this,"_selectIgnore",void 0),yp(this,"_lastHoveredNode",null),yp(this,"excludeSelectors",void 0),yp(this,"onSelect",void 0),yp(this,"iframesListeningTo",new Set),yp(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),yp(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),yp(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),yp(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Ue(t,window.document.querySelector(e)))))return this._selectIgnore=!0,gp();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var n;n=[t],null!=window.document?(null!==hp&&clearTimeout(hp),null!=n&&(null===fp&&(fp=new up),fp.inspect(n,null))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}})),yp(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),yp(this,"selectFiberForNode",(0,X.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let n=e;const r=[];for(;n!==t&&null!==n;){let e=n.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,r=Array.from(n.classList).reverse();e<r.length;e++)t.test(r[e])&&n.classList.remove(r[e]);if(n.id&&/^rc-\w+/.test(n.id)&&n.removeAttribute("id"),n.id)e+=`#${n.id}`;else{const t=Array.from(n.parentElement.children).filter((e=>e.tagName===n.tagName)),r=n.className.trim();if(t.filter((e=>e.className.includes(r))).length<=1){if(r){const t=r.split(/\s+/);let n="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(n+=`.${t[e]}`);e+=n}}else n.getAttribute("name")?e+=`[name=${n.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(n)+1})`}n.nodeType!==Node.TEXT_NODE&&r.unshift(e),n=n.parentElement}return r.join(" > ")}(e))}),200,{leading:!1})),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){gp(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function vp(e){return document.querySelector(e)}const xp=e=>{const{action:t,onConfirm:n,onCancel:r,onFinish:a}=e,{t:i}=U();return l().createElement(l().Fragment,null,l().createElement("div",{style:{height:100}},i("qm.table.config.emptyText")),l().createElement(be,{style:{width:"100%",justifyContent:"flex-end"}},l().createElement(fe,{size:"small",onClick:()=>r?.()},i("qm.guideTracker.closeButton")),l().createElement(fe,{size:"small",onClick:()=>n?.()},i("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),l().createElement(fe,{size:"small",onClick:()=>a?.()},i("qm.guideTracker.finishButton"))))},Ep={left:"50%",top:"50%",width:1,height:1},wp=l().forwardRef(((e,t)=>{const{open:n,current:r,defaultCurrent:a,steps:i=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:m,zIndex:p,helper:h={},selectFilter:f=e=>e,onSelect:g,onChange:y,onClose:b,onFinish:v}=e,{t:x}=U(),E=l().useRef(),w=l().useRef(i.length),[C,S]=ri(0,{value:r,defaultValue:a}),[N,T]=ri(void 0,{value:n,postState:e=>e??!1}),[I,O]=ri(1051,{value:p,defaultValue:p}),[k,L]=l().useState({}),[P,A]=l().useState(!1),[F,_]=l().useState(N),[q,D]=l().useState(!1),[H,$]=Im(k.node,!!n),[M,K]=l().useState(22),z=l().useRef(!1),V=l().useMemo((()=>C>=i.length?"add":"edit"),[C,i]),j=l().useMemo((()=>`${C+1} / ${i.length}`),[C,i]);l().useLayoutEffect((()=>{E.current=new bp({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:or(),node:e,path:t}),S(w.current),A(!0),B(),g?.(t,e)}})}),[]),l().useEffect((()=>(N?W():B(),N?setTimeout((()=>_(!0)),16):_(!1),()=>{B()})),[N]),l().useEffect((()=>{w.current=i.length}),[i]);const W=()=>{E.current.startHandle()},B=()=>{E.current.stopHandle()},G=e=>{e.stopPropagation(),e.preventDefault()};l().useImperativeHandle(t,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),GET_CURRENT_STEP:()=>({current:C,selector:k.path})})));const Y=Ee("guide-tracker"),Q=[{[`${Y}-primary`]:!0}],Z=Tl({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement($l(),{open:N&&P,autoLock:!0},l().createElement(Rl(),{zIndex:I,builtinPlacements:Z,popupPlacement:o,popupVisible:N&&P,popupClassName:xe()(Q,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{A(!1),W()};return l().createElement("div",{className:`${Y}-content`},l().createElement("div",{className:`${Y}-inner`},l().createElement(we.CloseOutlined,{className:`${Y}-close`,onClick:()=>{b?.(C),e()}}),l().createElement(R.Dropdown,{open:q,trigger:["click"],dropdownRender:()=>i.length?l().createElement("div",{className:"ant-dropdown-menu step-list"},l().createElement(ga.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.id)),n=i.map((e=>e.id));if((0,X.isEqual)(t,n))return;const r=t.findIndex((e=>e===k.id)),a=-1!==r?r:C;S(a),y?.(yr(e),a)}},i.map(((e,t)=>l().createElement("li",{key:t,className:xe()("item",{actived:e.id===k.id})},l().createElement(we.HolderOutlined,{className:"handle",title:x("qm.form.draggable")}),l().createElement("span",{className:"box"},l().createElement("span",{className:"title",title:e.title,onClick:()=>{t!==C&&(L({id:e.id,node:vp(e.selector),path:e.selector}),S(t),K(22===M?M+1:M-1),y?.(i,t))}},e.title),l().createElement(R.Popconfirm,{title:x("qm.button.confirmTitle"),zIndex:I+1,onConfirm:()=>{const n=i.filter((t=>t.id!==e.id)),r=t===C;let a=t<=C?C-1:C;if(a=a<0?0:a,a=a>n.length?n.length:a,r&&n[a]){const{id:e,selector:t}=n[a];L({id:e,node:vp(t),path:t})}S(a),y?.(n,a)}},l().createElement(we.CloseOutlined,{className:"close-icon"})))))))):l().createElement(l().Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:I},onOpenChange:e=>D(e)},l().createElement(we.MenuOutlined,{className:xe()(`${Y}-close`,"menu-icon"),style:{width:M}})),h.content&&l().createElement(R.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:I},content:h.content,title:h.title},l().createElement(we.QuestionCircleOutlined,{className:xe()(`${Y}-close`,"help-icon")})),l().createElement("div",{className:"panel-label"},l().createElement("span",{className:"title"},x("qm.guideTracker.label")),l().createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),j)),m?m({id:k.id,selector:k.path,actionStatus:V,DO_CLOSE:e},C):l().createElement(xp,{action:V,onConfirm:()=>{y?.("add"===V?[...i,{id:k.id,selector:k.path,title:"Guide Title"}]:[...i],C),e()},onCancel:()=>{b?.(C),e()},onFinish:()=>{e(),b?.(C),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},l().createElement("div",{className:xe()(`${Y}-target-placeholder`),style:{...H||Ep,position:"fixed",zIndex:I-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:G,onClick:G}))),s&&l().createElement($l(),{open:F},l().createElement(Lm,{zIndex:I,prefixCls:Y,onPause:()=>{z.current=P,A(!1),B()},onPlay:()=>{z.current?A(!0):W()}})))}));wp.displayName="QmGuideTracker";const Cp=wp,Sp=e=>{const{content:t,image:n,width:r,height:a,font:o={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:m=1,antiTamper:p=!0,grayscale:h,className:f,style:g}=e,y=l().useRef(null),b=l().useRef(new Map),v=o.fontSize??16,x=o.fontWeight??"normal",E=o.fontStyle??"normal",w=o.fontFamily??"sans-serif",C=o.color??"rgba(0, 0, 0, 0.15)",S=o.textAlign??"center",N=Array.isArray(t)?t:[t],T=s[0],I=s[1],R=T/2,O=I/2,k=c[0]??R,L=c[1]??O,P=l().useMemo((()=>{const e=k-R,t=L-O;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:u}}),[R,O,k,L,u]),A=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const i=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[l,o]=(e=>{let t=120,i=64;if(!n&&e.measureText){e.font=`${v}px ${w}`;const n=N.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...n)),i=v*N.length+3*(N.length-1)}return[r??t,a??i]})(t),s=l*i,c=o*i,u=(T+l)*i,p=(I+o)*i,f=T/2*i,g=I/2*i,R=u/2,O=p/2,k=2*(T+l);e.width=2*u,e.height=2*p,t.globalAlpha=m,t.save(),t.translate(R,O),t.rotate(Math.PI/180*d),t.translate(-R,-O);const L=()=>{t.restore(),t.drawImage(e,0,0,u,p,u,p,u,p),h&&(e=>{const t=e.getContext("2d");if(!t)return;const n=t.getImageData(0,0,e.width,e.height),{data:r}=n;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}t.putImageData(n,0,0)})(e),((e,t)=>{if(y.current){const n=b.current.get(y.current);n&&(y.current.contains(n)&&y.current.removeChild(n),b.current.delete(y.current));const r=document.createElement("div");r.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${n=e,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var n})).join(";"))({...P,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),y.current?.append(r),b.current.set(y.current,r)}})(e.toDataURL(),k)},A=()=>{const e=Number(v)*i;t.font=`${E} normal ${x} ${e}px/${o}px ${w}`,t.fillStyle=C,t.textAlign=S,t.textBaseline="top",t.translate(s/2,0),N.forEach(((n,r)=>{t.fillText(n??"",f,g+r*(e+3*i))})),L()};if(n){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),L()},e.onerror=()=>{A()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=n}else A()},F=e=>Array.from(b.current.values()).includes(e);l().useEffect((()=>{A()}),[t,n,r,a,o,s,c,d,u,m,p,h]),function(e,t,n={}){const r=window&&"MutationObserver"in window,a=i.useRef(),l=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};i.useLayoutEffect((()=>(l(),r&&e.current&&(a.current=new MutationObserver(t),a.current.observe(e.current,n)),()=>l())),[e])}(y,(e=>{if(p)for(const t of e){const e=Array.from(t.removedNodes).some((e=>F(e))),n="attributes"===t.type&&F(t.target);if(e||n){A();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const _=Ee("watermark");return l().createElement("div",{ref:y,className:xe()(_,f),style:{position:"relative",...g}},e.children)},Np=new Map,Tp=new WeakMap;let Ip=0;function Rp(e,t,n={},r=undefined){if(void 0===window.IntersectionObserver&&void 0!==r){const a=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:a,intersectionRect:a,rootBounds:a}),()=>{}}const{id:a,observer:i,elements:l}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(Tp.has(n)||(Ip+=1,Tp.set(n,Ip.toString())),Tp.get(n)):"0"):e[t]}`;var n})).toString()}(e);let n=Np.get(t);if(!n){const r=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const n=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=n),r.get(t.target)?.forEach((e=>{e(n,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:r},Np.set(t,n)}return n}(n),o=l.get(e)||[];return l.has(e)||l.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(l.delete(e),i.unobserve(e)),0===l.size&&(i.disconnect(),Np.delete(a))}}const Op=e=>{const{forceRender:t,height:n,placeholder:r=null,unmountIfInvisible:a,className:i,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:t,threshold:n,triggerOnce:r,fallbackInView:a,trackVisibility:i,skip:o,delay:s,onChange:c}={})=>{const[d,u]=l().useState(null),[m,p]=l().useState({inView:!1,entry:void 0}),h=l().useRef(c);l().useEffect((()=>{if(o||!d)return;let l;return l=Rp(d,((e,t)=>{p({inView:e,entry:t}),h.current?.(e,t),t.isIntersecting&&r&&l&&(l(),l=void 0)}),{root:e,rootMargin:t,threshold:n,trackVisibility:i,delay:s},a),()=>{l&&l()}}),[Array.isArray(n)?n.toString():n,d,e,t,r,o,i,a,s]);const f=m.entry?.target,g=l().useRef();d||!f||r||o||g.current===f||(g.current=f,p({inView:!1,entry:void 0}));const y=[u,m.inView,m.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!a}));l().useEffect((()=>{n||me("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=Ee("lazy-load"),m={[u]:!0};return l().createElement("div",{ref:s,className:xe()(m,i),style:o},t||c?e.children:l().createElement("div",{className:"placeholder",style:{height:n}},r))},kp=require("html2canvas");var Lp=r.n(kp);function Pp(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ap{constructor(e,t,n,r){if(Pp(this,"x",void 0),Pp(this,"y",void 0),Pp(this,"pressure",void 0),Pp(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class Fp{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Fp(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,a=e.y-t.y,i=t.x-n.x,l=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+a*a),m=Math.sqrt(i*i+l*l),p=m/(u+m),h=c+(o-c)*p,f=d+(s-d)*p,g=t.x-h,y=t.y-f;return{c1:new Ap(o+g,s+y),c2:new Ap(c+g,d+y)}}constructor(e,t,n,r,a,i){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=a,this.endWidth=i}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const a=r/10,i=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),l=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=i-e,a=l-t;n+=Math.sqrt(r*r+a*a)}e=i,t=l}return n}point(e,t,n,r,a){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+a*e*e*e}}function _p(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class qp{constructor(e,t){_p(this,"canvas",void 0),_p(this,"ctx",void 0),_p(this,"textInput",void 0),_p(this,"width",320),_p(this,"height",200),_p(this,"ratio",Math.max(window.devicePixelRatio||1,1)),_p(this,"penColor","rgba(0,0,0,1)"),_p(this,"backgroundColor","rgba(0,0,0,0)"),_p(this,"canAddHistory",!1),_p(this,"mode",void 0),_p(this,"openSmooth",!0),_p(this,"dotSize",0),_p(this,"throttle",16),_p(this,"minDistance",5),_p(this,"velocityFilterWeight",.7),_p(this,"compositeOperation","source-over"),_p(this,"minWidth",.5),_p(this,"maxWidth",2.5),_p(this,"fontSize",16),_p(this,"eraserSize",20),_p(this,"lineHeight",1.25),_p(this,"degreeOfBlur",5),_p(this,"textInputPos",{x:0,y:0}),_p(this,"onStart",(()=>{})),_p(this,"onEnd",(()=>{})),_p(this,"_drawingStroke",!1),_p(this,"_lastPoints",[]),_p(this,"_data",[]),_p(this,"_historyList",[]),_p(this,"_lastVelocity",0),_p(this,"_lastWidth",0),_p(this,"_strokeMoveUpdate",void 0),_p(this,"setCanvasSize",(()=>{this.canvas.style.height=`${this.height}px`,this.canvas.style.width=`${this.width}px`,this.canvas.height=this.height*this.ratio,this.canvas.width=this.width*this.ratio,1!==this.ratio&&this.ctx.scale(this.ratio,this.ratio)})),_p(this,"setTextInput",(()=>{this.openSmooth||(this.textInput.setAttribute("class","signature__text-input"),this.textInput.setAttribute("contentEditable","true"),this.textInput.setAttribute("spellCheck","false"),this.canvas.parentNode.appendChild(this.textInput))})),_p(this,"isTouchEvent",(e=>"touches"in e)),_p(this,"addListener",(()=>{this.removeListener(),this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",("ontouchstart"in window||navigator.maxTouchPoints)&&(this.canvas.addEventListener("touchstart",this.onDrawStart,{passive:!1}),this.canvas.addEventListener("touchmove",this.onDrawMove,{passive:!1}),document.addEventListener("touchcancel",this.onDrawEnd,{passive:!1}),document.addEventListener("touchend",this.onDrawEnd,{passive:!1})),this.canvas.addEventListener("mousedown",this.onDrawStart),this.canvas.addEventListener("mousemove",this.onDrawMove),document.addEventListener("mouseup",this.onDrawEnd),this.textInput.addEventListener("blur",this.onInputBlur)})),_p(this,"removeListener",(()=>{this.canvas.style.touchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("touchstart",this.onDrawStart),this.canvas.removeEventListener("touchmove",this.onDrawMove),document.removeEventListener("touchend",this.onDrawEnd),document.removeEventListener("touchcancel",this.onDrawEnd),this.canvas.removeEventListener("mousedown",this.onDrawStart),this.canvas.removeEventListener("mousemove",this.onDrawMove),document.removeEventListener("mouseup",this.onDrawEnd),this.textInput.removeEventListener("blur",this.onInputBlur)})),_p(this,"_isLeftButtonPressed",((e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),_p(this,"_pointerEventToSignatureEvent",(e=>({event:e,type:e.type,x:this.isTouchEvent(e)?e.touches[0]?.clientX:e.clientX,y:this.isTouchEvent(e)?e.touches[0]?.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}))),_p(this,"_getPointGroupOptions",(e=>({penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}))),_p(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),n={...t,points:[]};this._data.push(n),this._reset(t),this._strokeUpdate(e,!1)})),_p(this,"_strokeUpdate",((e,t=!0)=>{if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);const n=this._createPoint(e.x,e.y,e.pressure),r=this._data[this._data.length-1],a=r.points,i=a.length>0&&a[a.length-1],l=!!i&&n.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(r);if(!i||!i||!l){const e=this._addPoint(n,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(n,o)),a.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}})),_p(this,"_strokeEnd",((e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)})),_p(this,"_reset",(e=>{this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this.ctx.fillStyle=e.penColor,this.ctx.globalCompositeOperation=e.compositeOperation})),_p(this,"_drawDot",((e,t)=>{const n=this.ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()})),_p(this,"_drawCurve",((e,t)=>{const n=this.ctx,r=e.endWidth-e.startWidth,a=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<a;n+=1){const i=n/a,l=i*i,o=l*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*l*e.control2.x,u+=o*e.endPoint.x;let m=d*e.startPoint.y;m+=3*c*i*e.control1.y,m+=3*s*l*e.control2.y,m+=o*e.endPoint.y;const p=Math.min(e.startWidth+o*r,t.maxWidth);this._drawCurveSegment(u,m,p)}n.closePath(),n.fill()})),_p(this,"_drawCurveSegment",((e,t,n)=>{const r=this.ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1)})),_p(this,"_createPoint",((e,t,n)=>{const r=this.canvas.getBoundingClientRect();return new Ap(e-r.left,t-r.top,n,(new Date).getTime())})),_p(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),_p(this,"_addPoint",((e,t)=>{const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=Fp.fromPoints(n,e);return n.shift(),r}return null})),_p(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),_p(this,"_calculateCurveWidths",((e,t,n)=>{const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(r,n),i={end:a,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=a,i})),_p(this,"onDrawStart",(e=>{e.preventDefault(),this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&(this._strokeBegin(this._pointerEventToSignatureEvent(e)),this.ctx.strokeStyle=this.penColor,this.ctx.lineWidth=this.maxWidth,"line"===this.mode&&this.createPencil(e),"eraser"===this.mode&&this.createEraser(e),"text"===this.mode&&this.createTextInput(e),this.onStart?.(e))})),_p(this,"onDrawMove",(e=>{e.preventDefault(),"text"!==this.mode&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?window.requestAnimationFrame?window.requestAnimationFrame((()=>this.drawHandler(e))):this.drawHandler(e):this._strokeEnd(this._pointerEventToSignatureEvent(e)))})),_p(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),_p(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),_p(this,"drawHandler",(e=>{switch(this.mode){case"line":this.drawLine(e);break;case"square":this.drawSquare(e);break;case"round":this.drawRound(e);break;case"arrow":this.drawArrow(e);break;case"mosaic":this.drawMosaic(e);break;case"text":this.drawText(e);break;case"eraser":this.drawEraser(e)}this.canAddHistory=!0})),_p(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,a-n),this.ctx.stroke(),this.ctx.restore()})),_p(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(r,t),l=Math.min(a,n),o=.5*(Math.max(r,t)-i),s=.5*(Math.max(a,n)-l),c=i+o,d=l+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()})),_p(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(n-a,t-r)/Math.PI,l=(i+25)*Math.PI/180,o=(i-25)*Math.PI/180,s=15*Math.cos(l),c=15*Math.sin(l),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,a),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,a);const m=r+s,p=a+c;this.ctx.lineTo(m,p);const h=r+d,f=a+u;this.ctx.lineTo(h,f),this.ctx.lineTo(r,a),this.ctx.fill(),this.ctx.restore()})),_p(this,"getAxisColor",((e,t,n)=>{const r=e.width,a=e.data,i=[];return i[0]=a[4*(n*r+t)],i[1]=a[4*(n*r+t)+1],i[2]=a[4*(n*r+t)+2],i[3]=a[4*(n*r+t)+3],i})),_p(this,"setAxisColor",((e,t,n,r)=>{const a=e.width,i=e.data;i[4*(n*a+t)]=r[0],i[4*(n*a+t)+1]=r[1],i[4*(n*a+t)+2]=r[2],i[4*(n*a+t)+3]=r[3]})),_p(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),r=this.ctx.getImageData(t*this.ratio,n*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),a=r.width,i=r.height,l=a/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<l;t++){const n=this.getAxisColor(r,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let a=0;a<this.degreeOfBlur;a++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(r,t*this.degreeOfBlur+i,e*this.degreeOfBlur+a,n)}this.ctx.putImageData(r,t*this.ratio,n*this.ratio)})),_p(this,"drawText",(e=>{const{x:t,y:n}=this.textInputPos;if(0===t&&0===n)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const r=this.fontSize*this.lineHeight,a=this.width-t,i=e.target.innerText,l=[];let o="";for(let e=0;e<i.length;e++){const t=o+i[e];this.ctx.measureText(t).width>a&&o.length>0?(l.push(o),o=i[e]):o=t}l.push(o),l.forEach(((e,a)=>{this.ctx.fillText(e,t+1,n+a*r+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),_p(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)})),_p(this,"drawPencil",(e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.restore()})),_p(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)})),_p(this,"drawEraser",(e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),_p(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),_p(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=n?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())})),_p(this,"setInputStyle",(()=>{if(!this._lastPoints.length)return;const{x:e,y:t}=this._lastPoints[0];this.textInput.style.left=e+"px",this.textInput.style.lineHeight=this.lineHeight.toString(),this.textInput.style.fontSize=this.fontSize+"px",this.textInput.style.color=this.penColor,this.textInput.style.top=t-Math.floor((this.textInput.offsetHeight-2)/2)+"px",this.textInputPos={x:e,y:t}})),_p(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),_p(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),_p(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),_p(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),_p(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),_p(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),_p(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),_p(this,"setDrawMode",(e=>{this.mode=e})),_p(this,"setLineWidth",(e=>{this.maxWidth=e})),_p(this,"setPenColor",(e=>{this.penColor=e})),_p(this,"setFontSize",(e=>{this.fontSize=e})),_p(this,"isEmpty",(()=>{const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this.canvas.width,e.height=this.canvas.height,1!==this.ratio&&t.scale(this.ratio,this.ratio),this.backgroundColor&&(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)),e.toDataURL()===this.canvas.toDataURL()})),_p(this,"toDataURL",((e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const n=document.createElement("canvas");return n.width=this.width,n.height=this.height,n.getContext("2d").drawImage(this.canvas,0,0,n.width,n.height),n.toDataURL(e,t)})),_p(this,"getPNG",(()=>this.toDataURL())),_p(this,"getJPG",((e=.8)=>this.toDataURL("image/jpeg",e))),this.initial(e,t)}initial(e,t={}){e&&(this.canvas=e,this.ctx=e.getContext("2d"),this.textInput=document.createElement("div"),this.width=t.width||e.clientWidth||this.width,this.height=t.height||e.clientHeight||this.height,this.penColor=t.penColor||this.penColor,this.fontSize=t.fontSize||this.fontSize,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this.backgroundColor=this.openSmooth&&t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,a,i=0,l=null;const o=()=>{i=Date.now(),l=null,n=e.apply(r,a),l||(r=null,a=[])};return function(...s){const c=Date.now(),d=t-(c-i);return r=this,a=s,d<=0||d>t?(l&&(clearTimeout(l),l=null),i=c,n=e.apply(r,a),l||(r=null,a=[])):l||(l=window.setTimeout(o,d)),n}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}_p(qp,"dataURLToBlob",(e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),a=r.length,i=new Uint8Array(a);for(let e=0;e<a;++e)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})})),_p(qp,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),_p(qp,"canvasToBlob",(e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}))));const Dp=qp,Hp=l().forwardRef(((e,t)=>{const{open:n,width:r,height:a,imageName:i,penColor:o,penMode:s,minWidth:d,maxWidth:u,backgroundColor:m,className:p,style:h,onOk:f,onCancel:g}=e,{t:y}=U(),b=l().useRef(),v=l().useRef(null),x=l().useRef(null),E=l().useRef(null),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=ri(void 0,{value:n,postState:e=>e??!1}),I=l().useMemo((()=>!!e.children),[e.children]),[O,k]=l().useState(s||(I?"square":"line")),[L,P]=l().useState(w[0]),[A,F]=l().useState(I?S[0]:S[4]),[_,q]=l().useState(C[1]),[D,H]=l().useState("bottomLeft"),[$,M]=l().useState(!1),[K,z]=l().useState(!1);l().useEffect((()=>{const e={width:r??x.current?.offsetWidth,height:a??x.current?.offsetHeight,maxWidth:L,mode:O,penColor:A,fontSize:_,backgroundColor:m,openSmooth:!I};return e.openSmooth&&Object.assign(e,{penColor:o,minWidth:d,maxWidth:u}),b.current=new Dp(v.current,e),()=>b.current.destroy()}),[]);const V=e=>{const[t,n]=[r??x.current?.offsetWidth,a??x.current?.offsetHeight],{width:i,height:l}=b.current;let o=!1;t&&t!==i&&(b.current.width=t,o=!0),n&&n!==l&&(b.current.height=n,o=!0),(o||e)&&b.current.update()};De((()=>{I&&N&&V()}),[N,I]),De((()=>{b.current.setDrawMode(O)}),[O]),De((()=>{b.current.setLineWidth(L)}),[L]),De((()=>{b.current.setPenColor(A)}),[A]),De((()=>{b.current.setFontSize(_)}),[_]);const j=async()=>{const e=I?x.current.parentNode:v.current;if(e)try{const t=await Lp()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Dp.canvasToDataURL(t)}catch(e){me("Signature","生成合成图片失败!")}},W=()=>{b.current.clear(),g?.()};l().useImperativeHandle(t,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),CLEAR:()=>b.current.clear(),UNDO:()=>b.current.undo(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:V,GET_DATE_URL:j})));const B=e=>{e&&H((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},G=e=>l().createElement("div",{className:xe()("ant-dropdown-menu","content")},"text"!==e?l().createElement("div",{className:"lineWidth"},w.map((e=>l().createElement("span",{key:e,className:xe()("dot",`s${e}`,{active:e===L}),onClick:()=>P(e)})))):l().createElement("div",{className:"fontSize"},l().createElement(R.Select,{size:"small",value:_,options:C.map((e=>({value:e,label:e.toString()}))),onChange:e=>q(e)})),l().createElement("span",{className:"divider"}),l().createElement("div",{className:"penColor"},S.map((e=>l().createElement("span",{key:e,className:xe()("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>F(e)},l().createElement(we.CheckOutlined,{className:"icon"})))))),Y=Ee("signature"),X={[Y]:!0,"is-annotation":I},Q=r?{...h,width:r}:h;return l().createElement("div",{className:xe()(X,p),style:Q},I&&l().createElement(l().Fragment,null,l().createElement("div",{ref:x,className:"content"},e.children),K&&l().createElement(mt,{spinning:!0,className:"spinning"})),l().createElement("div",{className:xe()("signature",{show:N})},l().createElement("canvas",{ref:v,className:O}),I&&l().createElement("div",{ref:E,className:"signature__tool-bar"},l().createElement("div",{className:"wrapper"},l().createElement("div",{className:xe()("actions",{hidden:$})},l().createElement(R.Dropdown,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("square")},l().createElement(we.BorderOutlined,null))),l().createElement(R.Dropdown,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("round")},l().createElement(po,null))),l().createElement(R.Dropdown,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("arrow")},l().createElement(fo,null))),l().createElement(R.Dropdown,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("line")},l().createElement(we.EditOutlined,null))),l().createElement(R.Dropdown,{dropdownRender:()=>G("text"),overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("text")},l().createElement(ho,null))),l().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{z(!0);const e=await j();if(e){const t=i?i.slice(0,i.lastIndexOf(".")>0?i.lastIndexOf("."):void 0):c()().format(Ba);qt(Dp.dataURLToBlob(e),`${t}.png`)}z(!1)})(),W()}},l().createElement(we.DownloadOutlined,null)),l().createElement("button",{className:"btn",onClick:()=>k("eraser")},l().createElement(go,null)),l().createElement("button",{className:"btn",onClick:()=>b.current.undo()},l().createElement(yo,null)),l().createElement("button",{className:"btn",onClick:()=>b.current.clear()},l().createElement(we.ClearOutlined,null)),l().createElement("span",{className:"divider"}),l().createElement("button",{className:"btn",onClick:()=>g?.()},l().createElement(we.CloseOutlined,null)),l().createElement("button",{className:"btn",onClick:async()=>{z(!0),await ne(10);const e=await j();z(!1),W(),f?.(e)}},l().createElement(we.CheckOutlined,null))),l().createElement("button",{className:"btn btn-fold",title:y($?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!$)},$?l().createElement(we.LeftOutlined,null):l().createElement(we.RightOutlined,null))))))}));Hp.displayName="QmSignature";const $p=Hp,Mp="1.12.10";return 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={442:t=>{t.exports=e}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};r.r(a),r.d(a,{Affix:()=>K.Affix,Alert:()=>K.Alert,Anchor:()=>K.Anchor,AutoComplete:()=>K.AutoComplete,Avatar:()=>K.Avatar,BackTop:()=>K.BackTop,Badge:()=>K.Badge,Breadcrumb:()=>K.Breadcrumb,Button:()=>K.Button,Calendar:()=>W,Card:()=>K.Card,Carousel:()=>K.Carousel,Cascader:()=>K.Cascader,Checkbox:()=>K.Checkbox,Col:()=>K.Col,Collapse:()=>K.Collapse,Comment:()=>K.Comment,ConfigProvider:()=>K.ConfigProvider,DatePicker:()=>U,DcpAnchor:()=>tn,DcpButton:()=>he,DcpCollapse:()=>Fe,DcpColorPicker:()=>Pl,DcpConfigProvider:()=>ie,DcpCopyToClipboard:()=>uc,DcpCountup:()=>lt,DcpCropper:()=>Wu,DcpDivider:()=>Ce,DcpDownload:()=>Wt,DcpDrawer:()=>dn,DcpEmpty:()=>ct,DcpForm:()=>Nm,DcpGuideTracker:()=>Cp,DcpLazyLoad:()=>Op,DcpModal:()=>yn,DcpPivotGrid:()=>Oo,DcpPrint:()=>ep,DcpRangeTableHelper:()=>md,DcpScrollbar:()=>At,DcpSearchHelper:()=>kc,DcpSearchTree:()=>gs,DcpSignature:()=>$p,DcpSpace:()=>ye,DcpSpin:()=>ut,DcpSplit:()=>tt,DcpTable:()=>Ic,DcpTabs:()=>on,DcpTinymce:()=>bm,DcpTour:()=>Dm,DcpTransition:()=>It,DcpTreeHelper:()=>Js,DcpTreeTableHelper:()=>Xc,DcpUploadFile:()=>Du,DcpUploadImg:()=>Yu,DcpVirtualList:()=>Yo,DcpWatermark:()=>Sp,Descriptions:()=>K.Descriptions,Divider:()=>K.Divider,Drawer:()=>K.Drawer,Dropdown:()=>K.Dropdown,Empty:()=>K.Empty,Form:()=>K.Form,Grid:()=>K.Grid,Image:()=>K.Image,Input:()=>K.Input,InputNumber:()=>K.InputNumber,Layout:()=>K.Layout,List:()=>K.List,Mentions:()=>K.Mentions,Menu:()=>K.Menu,Modal:()=>K.Modal,PageHeader:()=>K.PageHeader,Pagination:()=>K.Pagination,Popconfirm:()=>K.Popconfirm,Popover:()=>K.Popover,Progress:()=>K.Progress,QmAnchor:()=>tn,QmButton:()=>he,QmCollapse:()=>Fe,QmColorPicker:()=>Pl,QmConfigProvider:()=>ie,QmCopyToClipboard:()=>uc,QmCountup:()=>lt,QmCropper:()=>Wu,QmDivider:()=>Ce,QmDownload:()=>Wt,QmDrawer:()=>dn,QmEmpty:()=>ct,QmForm:()=>Nm,QmGuideTracker:()=>Cp,QmLazyLoad:()=>Op,QmModal:()=>yn,QmPivotGrid:()=>Oo,QmPrint:()=>ep,QmRangeTableHelper:()=>md,QmScrollbar:()=>At,QmSearchHelper:()=>kc,QmSearchTree:()=>gs,QmSignature:()=>$p,QmSpace:()=>ye,QmSpin:()=>ut,QmSplit:()=>tt,QmTable:()=>Ic,QmTabs:()=>on,QmTinymce:()=>bm,QmTour:()=>Dm,QmTransition:()=>It,QmTreeHelper:()=>Js,QmTreeTableHelper:()=>Xc,QmUploadFile:()=>Du,QmUploadImg:()=>Yu,QmVirtualList:()=>Yo,QmWatermark:()=>Sp,Radio:()=>K.Radio,Rate:()=>K.Rate,Result:()=>K.Result,Row:()=>K.Row,Segmented:()=>K.Segmented,Select:()=>K.Select,Skeleton:()=>K.Skeleton,Slider:()=>K.Slider,Space:()=>K.Space,Spin:()=>K.Spin,Statistic:()=>K.Statistic,Steps:()=>K.Steps,Switch:()=>K.Switch,Table:()=>K.Table,Tabs:()=>K.Tabs,Tag:()=>K.Tag,TimePicker:()=>Q,Timeline:()=>K.Timeline,Tooltip:()=>K.Tooltip,Transfer:()=>K.Transfer,Tree:()=>K.Tree,TreeSelect:()=>K.TreeSelect,Typography:()=>K.Typography,Upload:()=>K.Upload,message:()=>K.message,notification:()=>K.notification,pinyin:()=>ra,version:()=>Mp});var i=r(442),l=r.n(i);const o=(0,i.createContext)({}),s=require("dayjs");var c=r.n(s);const d={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?",shortcutKey:"快捷键"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传",remove:"删除文件",batchDownload:"批量下载"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"过滤{text}",searchAreaText:"过滤{text},用逗号隔开",text:"筛选",selectAll:"全选",invert:"反选",onlyItem:"仅此项",keywordSearch:"关键词搜索"},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 数据"},areaSelect:{mergeCell:"合并单元格",cancelMerge:"取消合并"},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:"不包含",nullText:"空值",notNullText:"非空值",startsWithText:"开头是",endsWithText:"结尾是",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",matchCase:"大小写匹配",matchFullchar:"全字符匹配",queryLabel:"查找内容",queryPrev:"查找上一个",queryNext:"查找下一个",queryAll:"查找全部",findTotal:"查找到 {total} 个单元格",cellText:"单元格",valText:"值"},pivotGrid:{text:"多维表",settingTitle:"多维表看板"}},pivotGrid:{saved:{text:"配置",add:"添加配置项",title:"已保存的配置信息"},export:{text:"导出",group:"导出分组",list:"导出列表"},count:{statistic:"统计",records:"记录数",unique:"唯一值",empty:"空值",notEmpty:"非空值",sum:"合计值",max:"最大值",min:"最小值",avg:"平均值"},field:{text:"字段管理",title:"字段自定义设置"},fillColor:{text:"填色",add:"添加条件",title:"设置填色条件",cell:"单元格",row:"整行",col:"整列"},filter:{text:"筛选",title:"设置筛选条件",matchAll:"满足所有条件",matchAny:"满足任一条件"},group:{text:"分组",title:"设置分组条件",foldAll:"折叠所有",unfoldAll:"展开所有",empty:"(内容为空)",ascend:"选项顺序",descend:"选项倒序"},lineHeight:{text:"行高",size:["常规","中等","高"]},search:{text:"查找",title:"设置查找条件"},sorter:{text:"排序",title:"设置排序条件",ascend:"字段升序",descend:"字段降序"},viewMode:{table:"表格视图",gantt:"甘特视图",card:"看板视图"}}}};require("dayjs/locale/zh-cn");let u=d;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const p=(...e)=>{const[t,n]=e;let r;const a=t.split(".");let i=u;for(let e=0,t=a.length;e<t;e++){if(r=i[a[e]],e===t-1)return m(r,n);if(!r)return"";i=r}return""},h=require("lodash-es"),f="undefined"==typeof window,g=e=>l().isValidElement(e),y=e=>g(e)&&e.type===l().Fragment,b=()=>{},v=()=>!0,x=async e=>new Promise((t=>setTimeout(t,e))),E=e=>{Promise.resolve().then(e)},w=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),C=e=>!!(!e&&0!==e||(0,h.isArray)(e)&&!e.length||(0,h.isPlainObject)(e)&&!Object.keys(e).length),S=(e,t)=>t.split(".").reduce(((e,t)=>e?.[t]),e),N=(e,t)=>{const n={...e};for(const e of t)delete n[e];return n},T=(e,t=new WeakMap)=>{if((0,h.isPlainObject)(e)||(0,h.isArray)(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const a=n?void 0:Object.keys(e);return function(n){let i=-1;const l=n.length;for(;++i<l;)o=n[i],s=i,a&&(s=o),r[s]=T(e[s],t);var o,s}(a||e),r}return e},I=e=>(0,h.isNumber)(e)?`${e}px`:e.toString(),R=(e,t)=>({...e,...Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})}),O=require("dayjs/plugin/localeData");var k=r.n(O);const L=require("dayjs/plugin/advancedFormat");var P=r.n(L);const A=require("dayjs/plugin/customParseFormat");var F=r.n(A);const _=require("dayjs/plugin/quarterOfYear");var q=r.n(_);const D=require("dayjs/plugin/weekOfYear");var H=r.n(D);const $=require("dayjs/plugin/weekday");var M=r.n($);c().extend(k()),c().extend(P()),c().extend(F()),c().extend(q()),c().extend(H()),c().extend(M());const K=require("antd"),z=require("rc-picker/es/generate/dayjs");var V=r.n(z);const j=require("antd/es/calendar/generateCalendar"),W=r.n(j)()(V()),B=require("antd/es/date-picker/generatePicker"),U=r.n(B)()(V());function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},G.apply(null,arguments)}const Y=i.forwardRef(((e,t)=>i.createElement(U,G({},e,{picker:"time",mode:void 0,ref:t}))));Y.displayName="TimePicker";const X=i.forwardRef(((e,t)=>i.createElement(U.RangePicker,G({},e,{picker:"time",mode:void 0,ref:t}))));X.displayName="RangePicker",Y.RangePicker=X;const Q=Y,Z={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?",shortcutKey:"Shortcut Key"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload",remove:"Delete files",batchDownload:"Batch download"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Filter {text}",searchAreaText:"Filter {text}, separated by commas",text:"Filter",selectAll:"Select all",invert:"Invert",onlyItem:"Only item",keywordSearch:"Keyword Search"},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"},areaSelect:{mergeCell:"Cell Merge",cancelMerge:"Cancel 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",nullText:"null value",notNullText:"not null value",startsWithText:"beginning is",endsWithText:"ending is",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?",matchCase:"Case matching",matchFullchar:"Full character matching",queryLabel:"Find content",queryPrev:"Find previous",queryNext:"Find next",queryAll:"Find all",findTotal:"Found {total} cells",cellText:"Cell",valText:"Value"},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}},pivotGrid:{saved:{text:"Config",add:"Add configuration",title:"Saved configuration list"},export:{text:"Export",group:"Export group",list:"Export list"},count:{statistic:"Statistics",records:"count",unique:"unique",empty:"empty",notEmpty:"not empty",sum:"sum value",max:"max value",min:"min value",avg:"avg value"},field:{text:"Field manage",title:"Field customization settings"},fillColor:{text:"Fill color",add:"Add condition",title:"Set fill color conditions",cell:"Cell",row:"Row",col:"Col"},filter:{text:"Filter",title:"Set filter conditions",matchAll:"Meet all conditions",matchAny:"Meet any conditions"},group:{text:"Group",title:"Set group conditions",foldAll:"Fold all",unfoldAll:"unfold all",empty:"(Empty content)",ascend:"Order ascend",descend:"Order descend"},lineHeight:{text:"Line height",size:["Common size","Middle size","Large size"]},search:{text:"Search",title:"Set search conditions"},sorter:{text:"Sorter",title:"Set sorter conditions",ascend:"Field ascend",descend:"Field descend"},viewMode:{table:"Table view",gantt:"Gantt view",card:"Card view"}}}},J=require("antd/es/locale/zh_CN");var ee=r.n(J);const te=require("antd/es/locale/en_GB");var ne=r.n(te);const re={[Z.name]:{qm:Z,antd:ne()},[d.name]:{qm:d,antd:ee()}},ae=e=>{const t="zh-cn",n=R({locale:t,size:"middle"},e),{locale:r,size:a,global:i}=n,s=l().useMemo((()=>Object.assign({},re,i?.langPackage)),[i]),d=l().useMemo((()=>i?N(i,["langPackage"]):i),[i]),m=(e,n)=>{const r=e.split("-")[0],a=s[e]?e:s[r]?r:t;return s[a][n]};l().useMemo((()=>{return e=m(r,"qm"),u=e||u,void(u.name&&c().locale(u.name));var e}),[r]);const p=l().useMemo((()=>({locale:r,size:a,global:d})),[r,a]);return l().createElement(o.Provider,{value:p},l().createElement(K.ConfigProvider,{locale:m(r,"antd"),componentSize:a,autoInsertSpaceInButton:d?.autoInsertSpaceInButton},n.children))};ae.displayName="QmConfigProvider";const ie=ae;function le(){const{locale:e}=i.useContext(o);return{t:p,$locale:e}}function oe(e){const t=i.useRef();return t.current=e,i.useCallback(((...e)=>t.current?.(...e)),[])}function se(e){const{size:t}=i.useContext(o);return{$size:i.useMemo((()=>e.size??t??""),[e.size,t])}}class ce extends Error{constructor(e){super(e),this.name="QmDesignError"}}function de(e,t){throw new ce(`[${e}] ${t}`)}function ue(e,t){console.warn(new ce(`[${e}] ${t}`))}function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},me.apply(null,arguments)}const pe=e=>{const{loading:t,shortcutKey:n,authConfig:r,click:a,confirm:i}=e,{t:o}=le(),{$size:s}=se(e);l().useEffect((()=>(n&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=l().useState(!1),u=oe((e=>{const t=n.split("+").map((e=>e.trim().toLowerCase())),r=t.includes("alt"),a=t.includes("ctrl"),i=t.includes("shift"),l=t[t.length-1];r&&!e.altKey||a&&!e.ctrlKey||i&&!e.shiftKey||e.key.toLowerCase()!==l||(e.preventDefault(),p.disabled||p.onClick?.(e))})),m=(0,h.isFunction)(a)?{onClick:async t=>{d(!0);try{await(e.click?.(t))}catch(e){ue("Button","`click`方法执行出错")}d(!1)}}:null,p={...N(e,["shortcutKey","authConfig","click","confirm"]),size:s,loading:c||t||!1,...m};if(r){const{visible:e=1,disabled:t}=r||{};if(!e)return null;t&&(p.disabled=!0)}const f=l().createElement(K.Button,p,e.children);return i?l().createElement(K.Popconfirm,{title:i.title||o("qm.button.confirmTitle"),disabled:p.disabled,onConfirm:e=>{i.onConfirm?.(),p.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},l().createElement(K.Button,me({},p,{onClick:b}),e.children)):!n||p.disabled?f:l().createElement(K.Tooltip,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${n}`},f)};pe.displayName="QmButton";const he=pe;var fe=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(fe||{});const ge=e=>{const{$size:t}=se(e),n=(0,h.isNumber)(e.size)?e.size:fe[t||"default"],r={...N(e,["size"]),size:n};return l().createElement(K.Space,r,e.children)};ge.displayName="QmSpace";const ye=ge,be=require("classnames");var ve=r.n(be);const xe=e=>`qm-${e}`,Ee=require("@ant-design/icons"),we=e=>{const{label:t,extra:n,collapse:r,bordered:a=!0,disabled:i,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=se(e),{t:m}=le(),p=xe("divider"),h={[p]:!0,[`${p}-borderless`]:!a,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return l().createElement("div",{id:o,className:ve()(h,s),style:c},l().createElement("span",{className:`${p}__title`},t),l().createElement("div",{className:`${p}__extra`},n),void 0!==r&&l().createElement(K.Button,{type:"link",className:`${p}__collapse`,disabled:i,onClick:()=>{d?.(!r)}},m(r?"qm.divider.collect":"qm.divider.spread"),r?l().createElement(Ee.UpOutlined,null):l().createElement(Ee.DownOutlined,null)))};we.displayName="QmDivider";const Ce=we,Se=()=>({height:0,opacity:0}),Ne=e=>({height:e.scrollHeight,opacity:1}),Te=e=>({height:e?e.offsetHeight:0}),Ie=(e,t)=>!0===t?.deadline||"height"===t.propertyName,Re=require("rc-motion");var Oe=r.n(Re);const ke=l().forwardRef(((e,t)=>{const{forceRender:n,className:r,style:a,boxStyle:i,isActive:o}=e,[s,c]=l().useState(o||n);if(l().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const d=xe("collapse");return l().createElement("div",{ref:t,className:ve()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},r),style:a},l().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));ke.displayName="PanelContent";const Le=ke;function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pe.apply(null,arguments)}const Ae=e=>{const{defaultActive:t,label:n,extra:r,className:a,style:i,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[p,h]=l().useState(!!t),f=xe("collapse"),g=ve()({[`${f}`]:!0,[`${f}-active`]:p,[`${f}-disabled`]:c},a);return l().createElement("div",{className:g,style:i},l().createElement(Ce,{label:n,extra:r,collapse:p,bordered:s,disabled:c,onCollapseChange:e=>{h(e),m?.(e)}}),l().createElement(Oe(),Pe({visible:p},((e=xe("motion-collapse"))=>({motionName:e,onAppearStart:Se,onEnterStart:Se,onAppearActive:Ne,onEnterActive:Ne,onLeaveStart:Te,onLeaveActive:Se,onAppearEnd:Ie,onEnterEnd:Ie,onLeaveEnd:Ie,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:t,style:n},r)=>l().createElement(Le,{ref:r,prefixCls:f,className:t,style:n,boxStyle:o,isActive:p,forceRender:d},e.children))))};Ae.displayName="QmCollapse";const Fe=Ae,_e=l().createContext(void 0);function qe(e,t){((t,n)=>{const r=i.useRef(!0);i.useEffect((()=>(t=>{if(!t)return e()})(r.current)),n),i.useEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})(0,t)}const De=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},He=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},$e=e=>e.preventDefault(),Me=(e,t)=>{if(f||!e||!t)return null;"float"===(t=w(t))&&(t="cssFloat");try{const n=e.style[t];if(n)return n;const r=window.getComputedStyle(e);return r?r[t]:""}catch(n){return e.style[t]}},Ke=(e,t,n)=>{!f&&e&&t&&((0,h.isPlainObject)(t)?Object.keys(t).forEach((n=>{Ke(e,n,t[n])})):(t=w(t),e.style[t]=n))},ze=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Ve=(e,t)=>Math.abs(ze(e)-ze(t)),je=e=>{let t=0,n=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:n}},We=(e,t)=>{let n=e;for(;n;){if(n.classList?.contains(t))return n;n=n.parentNode}return null},Be=(e,t)=>{if(f||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Ue=e=>Math.pow(e,3),Ge=e=>e<.5?Ue(2*e)/2:1-Ue(2*(1-e))/2,Ye=e=>{const{minValues:t,onDragChange:n,onDragging:r}=e,{splitRef:a,direction:i}=l().useContext(_e),{t:o}=le(),s=l().useRef(f?null:document.onselectstart),c=l().useMemo((()=>"horizontal"===i),[i]),d=l().useMemo((()=>c?"X":"Y"),[c]),u=l().useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const n=e[`page${d}`]-u.current[`start${d}`],a=[t[0],u.current[`containerSize${d}`]-t[1]];let i=u.current[`firstElementSize${d}`]+n;i=Math.max(a[0],i),i=Math.min(a[1],i),r(i)},h=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),n(!1),He(document,"mousemove",p),He(document,"mouseup",h),g()},g=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},y=xe("split"),b={[`${y}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return l().createElement("div",{className:ve()(b),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,r=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:r.offsetWidth,firstElementSizeY:r.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),De(document,"mousemove",p),De(document,"mouseup",h),n(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Ye.displayName="ResizeBar";const Xe=Ye,Qe=l().forwardRef(((e,t)=>{const{offset:n,className:r,style:a}=e,{direction:i,dragging:o}=l().useContext(_e),s="vertical"===i?"height":"width",c=xe("split-pane"),d={[c]:!0,isLocked:o,horizontal:"horizontal"===i,vertical:"vertical"===i,[r]:!!r},u=void 0!==n?{[s]:I(n)}:{flex:1,[s]:0};return l().createElement("div",{ref:t,className:ve()(d),style:{...u,...a}},e.children)}));Qe.displayName="SplitPane";const Ze=Qe;function Je(){return Je=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Je.apply(null,arguments)}const et=e=>{const{direction:t="horizontal",defaultValue:n="50%",uniqueKey:r,className:a,style:i,onDragStart:s,onDrag:c=b,onDragEnd:d}=e,{global:u}=l().useContext(o),m=l().useRef(null),p=l().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),v=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},x=l().useMemo((()=>r?`split_${r}`:""),[r]),[E,w]=l().useState(!1),[C,S]=l().useState(h(n));qe((()=>{E?s?.(f(C)):(d?.(f(C)),localStorage.setItem(x,C),I(x,C))}),[E]),l().useEffect((()=>{N()}),[]);const N=()=>{if(!x)return;const e=localStorage.getItem(x);e?S(h(e)):T(x).then((e=>{localStorage.setItem(x,h(e||n)),N()})).catch((()=>{}))},T=async e=>{const t=u?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},I=async(e,t)=>{const n=u?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},R=l().useMemo((()=>({splitRef:m,direction:t,dragging:E})),[t,E]),O=[];l().Children.map(e.children,(e=>{g(e)&&!y(e)&&"SplitPane"===e.type?.displayName&&O.push(e)}));const[k,L]=O,P=l().useMemo((()=>[v(k),v(L)]),[k,L]),A=xe("split"),F={[A]:!0,vertical:"vertical"===t};return l().createElement(_e.Provider,{value:R},l().createElement("div",{ref:m,className:ve()(F,a),style:i},l().createElement(Ze,Je({},k.props,{ref:p,offset:C})),l().createElement(Xe,{minValues:P,onDragChange:e=>w(e),onDragging:e=>{S(`${e}px`),c(e)}}),l().createElement(Ze,L.props)))};et.displayName="QmSplit",et.Pane=Ze;const tt=et,nt=require("react-countup");var rt=r.n(nt);function at(){return at=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},at.apply(null,arguments)}const it=e=>{const{className:t,style:n}=e,{$size:r}=se(e),a=xe("countup"),i={[a]:!0,[`${a}--lg`]:"large"===r,[`${a}--sm`]:"small"===r};return l().createElement(rt(),at({},e,{className:ve()(i,t),style:n}),e.children)};it.displayName="QmCountup";const lt=it;function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ot.apply(null,arguments)}const st=e=>{const{className:t}=e,{$size:n}=se(e),r=xe("empty"),a={...e,image:K.Empty.PRESENTED_IMAGE_SIMPLE},i={[r]:!0,[`${r}--lg`]:"large"===n,[`${r}--sm`]:"small"===n};return l().createElement(K.Empty,ot({},a,{className:ve()(i,t)}))};st.displayName="QmEmpty";const ct=st,dt=e=>{const t=R({tip:"Loading..."},e),{fullHeight:n,className:r,style:a}=t,i=xe("spin"),o={[i]:!0,[`${i}-fullHeight`]:!!n},s={wrapperClassName:ve()(o,r),...N(t,["fullHeight"]),style:{...a,maxHeight:"none"}};return l().createElement(K.Spin,s,t.children)};dt.displayName="QmSpin";const ut=dt,mt=l().createContext(void 0),pt=require("resize-observer-polyfill");var ht=r.n(pt);const ft=new Map,gt=new(ht())((function(e){e.forEach((e=>{const{target:t}=e;ft.get(t)?.forEach((e=>e(t)))}))}));function yt(e,t){ft.has(e)||(ft.set(e,new Set),gt.observe(e)),ft.get(e).add(t)}function bt(e,t){ft.has(e)&&(ft.get(e).delete(t),ft.get(e).size||(gt.unobserve(e),ft.delete(e)))}function vt(e){const[t,n]=i.useState({width:0,height:0});return i.useLayoutEffect((()=>{const t=e.current,r=e=>{n({width:e.offsetWidth,height:e.offsetHeight})};return t&&yt(t,r),()=>{t&&bt(t,r)}}),[e]),t}function xt(e,t){((t,n)=>{const r=i.useRef(!0);i.useLayoutEffect((()=>(t=>{if(!t)return e()})(r.current)),n),i.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})(0,t)}function Et(e,t){const n=i.useRef(null);return i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]),i.useCallback(((...r)=>{n.current&&clearTimeout(n.current),n.current=setTimeout((()=>e.apply(this,r)),t)}),[e,t])}const wt=(e,...t)=>l().isValidElement(e)?l().cloneElement(e,...t):null,Ct=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],St=e=>({_s:e,status:Ct[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Nt=e=>e?6:5,Tt=(e,t,n,r,a)=>{clearTimeout(r.current);const i=St(e);t(i),n.current=i,a?.({current:i})},It=e=>{const{name:t,in:n,timeout:r,preEnter:a=!0,preExit:o}=e,[s,c]=((e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:a,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,m]=(0,i.useState)((()=>St(o?2:Nt(s)))),p=(0,i.useRef)(u),f=(0,i.useRef)(),[g,y]=(e=>(0,h.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(l),b=(0,i.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return Nt(t)}})(p.current._s,c);e&&Tt(e,m,p,f,d)}),[d,c]),v=(0,i.useCallback)((e=>{const i=e=>{switch(Tt(e,m,p,f,d),e){case 1:g>=0&&(f.current=setTimeout(b,g));break;case 4:y>=0&&(f.current=setTimeout(b,y));break;case 0:case 3:f.current=setTimeout((()=>i(e+1)),0)}},l=p.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&i(t?r?0:1:2):l&&i(n?a?3:4:Nt(c))}),[b,d,t,n,r,a,g,y,c]);return(0,i.useEffect)((()=>()=>clearTimeout(f.current)),[]),[u,v,b]})({timeout:r,preEnter:a,preExit:o,initialEntered:n});return xt((()=>{c()}),[n]),l().createElement(l().Fragment,null,l().Children.map(e.children,(e=>l().isValidElement(e)?wt(e,{className:ve()(e.props.className,t,s.status)}):e)))},Rt=6,Ot={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"}},kt=e=>{const{thumb:t,always:n,className:r,barSize:a=Rt,direction:i="vertical",onDrag:o=b}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=l().useContext(mt),u=Ot[i],m=l().useRef(null),p=l().useRef(null),h=l().useRef({}),g=l().useRef(!1),y=l().useRef(!1),v=l().useRef(f?null:document.onselectstart),[x,E]=l().useState(!1);l().useEffect((()=>{const e=c.current;return De(e,"mousemove",N),De(e,"mouseleave",T),()=>{S(),He(document,"mouseup",C),He(e,"mousemove",N),He(e,"mouseleave",T)}}),[]);const w=e=>{if(!m.current||!p.current)return;if(!g.current)return;const t=h.current[u.axis];if(!t)return;const n=100*(-1*(m.current.getBoundingClientRect()[u.direction]-e[u.client])-(p.current[u.offset]-t))/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},C=()=>{g.current=!1,h.current={[u.axis]:0},He(document,"mousemove",w),He(document,"mouseup",C),S(),y.current&&E(!1),o(!1)},S=()=>{document.onselectstart!==v.current&&(document.onselectstart=v.current)},N=oe((()=>{y.current=!1,E(!!t.size)})),T=oe((()=>{y.current=!0,E(g.current)})),I=xe("scrollbar"),R={[`${I}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},O={[u.reverse]:a},k={[u.size]:t.size,transform:`translate${u.axis}(${t.offset}%)`};return l().createElement(It,{name:"fade",in:n||s||x,timeout:300},l().createElement("div",{ref:m,className:ve()(R,r),style:O,onMouseDown:e=>{const t=e.target;if(!t)return;const n=100*(Math.abs(t.getBoundingClientRect()[u.direction]-e[u.client])-p.current[u.offset]/2)/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100}},l().createElement("div",{ref:p,className:`${I}__thumb`,style:k,onMouseDown:e=>{e.stopPropagation(),De(document,"mousemove",w),De(document,"mouseup",C),g.current=!0,v.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])})}})))},Lt=20,Pt=l().forwardRef(((e,t)=>{const{wrapClassName:n,wrapStyle:r,innerStyle:a,barWidth:i,always:o,native:s,showTopScrollbar:c,minSize:d=Lt,onScroll:u,onReachedEnd:m}=e,p=l().useRef(null),f=l().useRef(null),g=l().useRef(null),y=l().useRef({prevTop:0,prevLeft:0}),[b,v]=l().useState({size:0,offset:0,ratio:1}),[x,E]=l().useState({size:0,offset:0,ratio:1}),[w,C]=l().useState(!1),S=vt(p),N=vt(g);xt((()=>{!s&&T()}),[N.width,N.height,S.width,S.height]);const T=Et((()=>{if(!f.current)return;const e=f.current.offsetHeight-4,t=f.current.offsetWidth-4,n=e**2/f.current.scrollHeight,r=t**2/f.current.scrollWidth,a=Math.max(n,d),i=Math.max(r,d),l=n/(e-n)/(a/(e-a)),o=r/(t-r)/(i/(t-i)),s=a+4<e?a:0,c=i+4<t?i:0,u=100*f.current.scrollTop/e*l,m=100*f.current.scrollLeft/t*o;v(Object.assign({},b,{size:c,ratio:o,offset:m})),E(Object.assign({},x,{size:s,ratio:l,offset:u}))}),5),I=e=>{C(e)},R=(e,t)=>{(0,h.isNumber)(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollTop=r+(t-r)*Ge(l),a(i)):e.scrollTop=t};a(i)})(f.current,e):f.current.scrollTop=e:ue("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},O=(e,t)=>{(0,h.isNumber)(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollLeft=r+(t-r)*Ge(l),a(i)):e.scrollLeft=t};a(i)})(f.current,e):f.current.scrollLeft=e:ue("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};l().useImperativeHandle(t,(()=>({container:p.current,scrollElement:f.current,scrollTop:f.current?.scrollTop||0,scrollLeft:f.current?.scrollLeft||0,SET_SCROLL_TOP:R,SET_SCROLL_LEFT:O})));const k=l().useMemo((()=>({dragging:w,scrollbarElement:p,wrapElement:f})),[w]),L=xe("scrollbar"),P={[`${L}__wrap`]:!0,[`${L}__wrap--hidden`]:!s};return l().createElement("div",{ref:p,className:ve()(L,e.className),style:e.style},l().createElement("div",{ref:f,className:ve()(P,n),style:r,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(({scrollTop:e,scrollLeft:t})=>{if(!f.current)return;const n=f.current.offsetHeight-4,r=f.current.offsetWidth-4,a=100*e/n*x.ratio,i=100*t/r*b.ratio;v(Object.assign({},b,{offset:i})),E(Object.assign({},x,{offset:a}))})({scrollTop:t,scrollLeft:n}),u?.({scrollTop:t,scrollLeft:n});const{prevTop:r,prevLeft:a}=y.current,i={bottom:t+f.current.clientHeight>=f.current.scrollHeight,top:t<=0&&0!==r,right:n+f.current.clientWidth>=f.current.scrollWidth&&a!==n,left:n<=0&&0!==a};let l;var o;r!==t&&(l=t>r?"bottom":"top"),a!==n&&(l=n>a?"right":"left"),l&&i[l]&&m?.(l,{scrollTop:t,scrollLeft:n}),o={prevTop:t,prevLeft:n},y.current=o}},l().createElement("div",{ref:g,className:`${L}__view`,style:a},e.children)),!s&&l().createElement(mt.Provider,{value:k},c&&l().createElement(kt,{className:"top",direction:"horizontal",thumb:b,barSize:i,always:o,onDrag:I}),l().createElement(kt,{direction:"horizontal",thumb:b,barSize:i,always:o,onDrag:I}),l().createElement(kt,{direction:"vertical",thumb:x,barSize:i,always:o,onDrag:I})))}));Pt.displayName="QmScrollbar";const At=Pt,Ft=require("sortablejs");var _t=r.n(Ft);const qt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const n=window.URL.createObjectURL(e);let r=document.createElement("a");r.href=n,r.download=decodeURI(t),r.click(),r=null}};function Dt(){return Dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dt.apply(null,arguments)}const Ht=async(e,{fileName:t,headers:n,params:r})=>{const a=r?new URLSearchParams(r).toString():"",i=a?e.includes("?")?"&":"?":"",l=await fetch(e+`${i+a}`,{method:"GET",headers:n});if(!l.ok)throw new Error(p("qm.download.error"));const o=await l.blob(),s=l.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));qt(o,c)},$t=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},Mt=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Kt=e=>{const t=R({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:n=[],fileDirection:r="vertical",batchDownload:a,draggable:i,editable:o,disabled:s,readOnly:c,button:d={},className:u,onPreview:m,onSortChange:p,onEditChange:h,onDownload:f,onChange:g}=t,{t:y}=le(),{$size:b}=se(t),v=l().useRef(null),x=l().useRef(null),[E,w]=l().useState({}),C=l().useMemo((()=>s||c),[s,c]);l().useEffect((()=>(I(),()=>x.current?.destroy())),[]);const S=(e,t)=>{w((n=>Object.assign({},n,{[e]:t??!n[e]})))},T=oe((e=>{const{oldIndex:t,newIndex:r}=e;if(t!==r){const e=[...n],[a]=e.splice(t,1);e.splice(r,0,a),p?.(e),g?.({file:n[t],fileList:e})}})),I=()=>{i&&(x.current=_t().create(We(v.current,xe("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:T}))},O=async e=>{if(f)return void await f(e);const{downloadWithHeaders:n,headers:r}=t;try{e.url&&await Ht(e.url,{fileName:e.name,...n?{headers:r}:null})}catch(e){K.message.error(y("qm.download.error"))}},k=xe("upload-file"),L={[k]:!0,[`${k}--lg`]:"large"===b,[`${k}--sm`]:"small"===b,[`${k}--horizontal`]:"horizontal"===r};return l().createElement(K.Upload,Dt({className:ve()(L,u)},N(t,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,n)=>new Promise((async(r,a)=>{const{fileTypes:i=[],fileSize:l,maxCount:o,fileList:s=[],beforeUpload:c}=t,d=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!l||e.size/1024/1024<l,m=!(o>1)||s.length<o,p=d&&u&&m;if(d||K.message.warning(y("qm.upload.tooltip",{type:i.join(",")})),u||K.message.warning(y("qm.upload.sizeLimit",{size:l})),m||K.message.warning(y("qm.upload.countLimit",{count:o})),!p)return K.Upload.LIST_IGNORE;if(c){const t=c(e,n);if(!0===t)return r(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{r(await t)}catch(e){a(e)}}else r(e)})),disabled:C,onChange:g,onPreview:async e=>{if("function"==typeof m)return m(e,(t=>O(t||e)));s||await O(e)},onDownload:async e=>{await O(e)},itemRender:(e,r,a,c)=>((e,r)=>{const{iconRender:a}=t,{uid:c,name:d,url:u,status:m="done"}=e,p="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return l().createElement("div",{className:ve()("ant-upload-list-item",`ant-upload-list-item-${m}`,"ant-upload-list-item-list-type-text",{handle:i})},l().createElement("div",{className:"ant-upload-list-item-info"},l().createElement("span",{className:"ant-upload-span"},l().createElement("div",{className:"ant-upload-text-icon"},a?a(e):l().createElement(Ee.LinkOutlined,null)),l().createElement("div",{className:"ant-upload-list-item-name"},E[c]?l().createElement(K.Input,{size:"small",autoFocus:!0,defaultValue:$t(d),onBlur:t=>{const{value:r}=t.target;if(r!==$t(d)){const t=Object.assign({},e,{name:`${r}.${Mt(d)}`}),a=n.map((e=>e.uid!==c?e:t));h?.(t,a),g?.({file:t,fileList:a})}S(c,!1)}}):l().createElement("a",{rel:"noreferrer",target:"_blank",title:d,href:u,onClick:e=>{e.preventDefault(),o?C||S(c,!0):r.preview()}},d)),l().createElement("span",{className:"ant-upload-list-item-card-actions"},o&&!C&&l().createElement("button",{type:"button",className:p,onClick:()=>S(c)},E[c]?l().createElement(Ee.CheckOutlined,null):l().createElement(Ee.EditOutlined,null)),o&&l().createElement("button",{type:"button",className:ve()(p,"preview"),onClick:()=>r.preview()},l().createElement(Ee.EyeOutlined,null)),l().createElement("button",{type:"button",className:ve()(p,"download"),disabled:s,onClick:()=>r.download()},l().createElement(Ee.DownloadOutlined,null)),l().createElement("button",{type:"button",className:ve()(p,"delete"),disabled:C,onClick:()=>r.remove()},l().createElement(Ee.DeleteOutlined,null))))))})(r,c)}),l().createElement("span",{className:"inner",ref:v},t.children||c&&n.length?t.children:l().createElement(K.Button,{type:d.type??"default",icon:d.icon??l().createElement(Ee.UploadOutlined,null),disabled:C},d.text||y("qm.upload.text")),a&&!!n.length&&l().createElement(K.Button,{disabled:s,style:{marginLeft:8},onClick:async e=>{if(e.stopPropagation(),"function"==typeof a)await a(n);else for(const e of n)await O(e)}},y("qm.upload.batchDownload"))))};Kt.displayName="QmUploadFile";const zt=Kt;function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(null,arguments)}const jt=e=>{const t=R({icon:l().createElement(Ee.DownloadOutlined,null),withCredentials:!1},e),{$size:n}=se(t),{t:r}=le(),[a,i]=l().useState(!1),o=N(t,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return l().createElement(K.Button,Vt({},o,{size:n,loading:a,onClick:async()=>{i(!0);try{const{action:e,fileName:n,headers:a,params:i,beforeDownload:l=v,onSuccess:o}=t,s=(0,h.isString)(e)?e:await(async()=>{const e=t.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""})();if(!s)return ue("Download","参数 `action` 有误!");if(!l(s))return;await Ht(s,{fileName:n,headers:a,params:i}),await x(100),o?.(),K.message.success(r("qm.download.success"))}catch(e){t.onError?.(e),K.message.error(r("qm.download.error"))}i(!1)}}),t.children||r("qm.download.text"))};jt.displayName="QmDownload";const Wt=jt,Bt=require("add-dom-event-listener");var Ut=r.n(Bt);const Gt=require("scroll-into-view-if-needed");var Yt=r.n(Gt);function Xt(e,t){const n=i.useRef(null),r=i.useRef(0);return i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]),i.useCallback(((...n)=>{const a=Date.now();(!r.current||a-r.current>t)&&(e.apply(this,n),r.current=a)}),[e,t])}const Qt=e=>{const{activeKey:t,labels:n,onTabClick:r}=e;return l().createElement(l().Fragment,null,n.map(((e,n)=>{const a={item:!0,actived:n===t};return l().createElement("div",{key:n,className:ve()(a),onClick:e=>r(n,e)},l().createElement("span",null,e))})))},Zt=e=>{const{label:t,showDivider:n,className:r,style:a}=e,i=xe("anchor-item"),o={[i]:!0};return l().createElement("div",{className:ve()(o,r),style:a},n&&l().createElement(Ce,{label:t,style:{marginBottom:10}}),e.children)};Zt.displayName="AnchorItem";const Jt=Zt,en=l().forwardRef(((e,t)=>{const{labelList:n=[],defaultActiveIndex:r,labelWidth:a,tabPosition:i="left",onTabClick:o,className:s,style:c}=e,{$size:d}=se(e),u=l().useRef(null),m=l().useRef(),p=l().useRef("ready"),h=l().useRef(0),[f,b]=l().useState(r||0),v=l().useMemo((()=>!!n?.length),[n]);l().useEffect((()=>{x();const e=Ut()(u.current,"scroll",w);return()=>{e.remove()}}),[]);const x=()=>{f>0&&(u.current.scrollTop=Ve(E(f),u.current))},E=e=>v?document.getElementById(n[e].id):u.current.children[e],w=Xt((e=>{if("ready"!==p.current)return;const t=(e=>{const t=Math.abs(e),r=(v?n.map((e=>document.getElementById(e.id))):Array.from(u.current?.children||[])).map((e=>Ve(e,u.current)));let a=-1;for(let e=0;e<r.length;e++){const n=r[e],i=r[e+1]||1e4;t>=n-1&&t<i&&(a=e)}return a})(e.target.scrollTop);-1!==t&&b(t)}),60),C=e=>{const t=E(e);t&&(b(e),p.current="stop",m.current&&clearTimeout(m.current),Yt()(t,{block:"start",behavior:"smooth",boundary:u.current}),m.current=setTimeout((()=>p.current="ready"),500))};l().useImperativeHandle(t,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>h.current?h.current:e,C(e)}})));const S=xe("anchor"),N={[S]:!0,[`${S}-left`]:"left"===i,[`${S}-top`]:"top"===i,[`${S}--lg`]:"large"===d,[`${S}--sm`]:"small"===d},T=[];l().Children.map(e.children,(e=>{g(e)&&!y(e)&&"AnchorItem"===e.type?.displayName&&T.push(e)}));const R=v?n.map((e=>e.label)):T.map((e=>e.props.label)),O=v?n.map((e=>e.id)):T.map(((e,t)=>e.props["data-id"]||t.toString()));return h.current=R.length,l().createElement("div",{className:ve()(N,s),style:c},l().createElement("div",{className:ve()("anchor-nav"),style:{width:a?I(a):""}},l().createElement(Qt,{activeKey:f,labels:R,onTabClick:(e,t)=>{C(e),o?.({label:R[e],id:O[e]},t)}})),l().createElement("div",{ref:u,className:ve()("anchor-container")},v?e.children:T))}));en.displayName="QmAnchor",en.Item=Jt;const tn=en,nn=e=>l().createElement(K.Tabs.TabPane,e,e.children);nn.displayName="TabPane";const rn=nn;function an(){return an=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},an.apply(null,arguments)}const ln=e=>{const t=R({tabPosition:"top"},e),{items:n,tabPosition:r,tabBarGutter:a,className:i,authConfig:o}=t,{$size:s}=se(t),c=xe("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u={...N(t,["items","authConfig"]),size:s,tabBarGutter:a??(["top","bottom"].includes(r)?30:0)},m=[];l().Children.map(t.children,(e=>{g(e)&&!y(e)&&"TabPane"===e.type?.displayName&&m.push(e)}));const p=n?[...n]:m.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<p.length;t++){const n=p[t],r=e.find((e=>e.dataIndex===n.key)),{visible:a=1,disabled:i}=r||{};a?i&&(n.disabled=!0):(p.splice(t,1),t--)}}return l().createElement(K.Tabs,an({},u,{items:p,className:ve()(d,i)}))};ln.displayName="QmTabs",ln.TabPane=rn;const on=ln;function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sn.apply(null,arguments)}const cn=l().forwardRef(((e,t)=>{const n=R({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:r,open:a,className:i,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:p,onClosed:f,onFullChange:g}=n,{global:y}=l().useContext(o),{$size:b}=se(n),v=l().useRef(null),x=l().useRef(null),E=l().useRef(!1),[w,C]=l().useState(!1),[S,T]=l().useState(!1),[O,k]=l().useState(!1);qe((()=>{(a??r)&&(!m&&E.current||(0,h.isUndefined)(s)&&T(!0))}),[a??r]),qe((()=>{x.current&&Ke(x.current,w?{width:"100%"}:{width:I(n.width||"72%")})}),[w]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>k(!0),STOP_LOADING:()=>k(!1)})));const L=xe("drawer"),P={[L]:!0,"no-header":!c,[`${L}--lg`]:"large"===b,[`${L}--sm`]:"small"===b};return l().createElement(K.Drawer,sn({},N(n,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??r,maskClosable:u??y?.maskClosable??!1,className:ve()(P,i),title:l().createElement(l().Fragment,null,l().createElement("span",{ref:v,className:"text"},c&&n.title),d&&l().createElement("button",{type:"button",className:"full-screen",onClick:()=>{x.current=We(v.current,"ant-drawer-content-wrapper"),C(!w),g?.(!w)}},l().createElement(w?Ee.FullscreenExitOutlined:Ee.FullscreenOutlined))),footer:null,afterOpenChange:e=>{e?(E.current=!0,(0,h.isUndefined)(s)&&setTimeout((()=>T(!1)),100)):(C(!1),f?.())},onClose:p}),n.children,(s||O||S)&&l().createElement(ut,{spinning:!0,className:ve()("spinning")}))}));cn.displayName="QmDrawer";const dn=cn,un=require("react-draggable");var mn=r.n(un);function pn(){return pn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pn.apply(null,arguments)}const hn="10vh";var fn=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(fn||{});const gn=l().forwardRef(((e,t)=>{const n=R({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:hn}},e),{visible:r,open:a,width:i,height:s,className:c,loading:d,draggable:u,showHeader:m,showFullScreen:p,maskClosable:f,destroyOnClose:g,bodyStyle:y,onFullChange:b,onClose:v,onClosed:x}=n,{global:E}=l().useContext(o),{$size:w}=se(n),C=l().createRef(),S=l().useRef(!1),T=l().useMemo((()=>`calc(100vh - ${hn} - ${hn} - ${fn[m?w:"none"]}px)`),[w,m]),[O,k]=l().useState(!1),[L,P]=l().useState(!1),[A,F]=l().useState(!1),[_,q]=l().useState(!0),[D,H]=l().useState({left:0,top:0,bottom:0,right:0}),[$,M]=l().useState();qe((()=>{if(a??r){if(!g&&S.current||(0,h.isUndefined)(d)&&P(!0),!g&&S.current)return;setTimeout((()=>{S.current=!0,(0,h.isUndefined)(d)&&P(!1)}),400)}}),[a??r]),qe((()=>{M(O?{x:0,y:0}:void 0)}),[O]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>F(!0),STOP_LOADING:()=>F(!1)})));const z=xe("modal"),V={height:s?I(s):T,maxHeight:"auto"===s?T:"",overflow:"auto"},j={[z]:!0,"no-header":!m,[`${z}--lg`]:"large"===w,[`${z}--sm`]:"small"===w};return l().createElement(K.Modal,pn({},N(n,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:a??r,maskClosable:f??E?.maskClosable??!1,className:ve()(j,c),title:l().createElement("div",{onMouseOver:()=>{_&&q(!1)},onMouseOut:()=>{q(!0)}},l().createElement("span",{className:"text"},m&&n.title),p&&l().createElement("button",{type:"button",className:"full-screen",onClick:e=>{const t=We(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");O?(Ke(t,{width:I(i||"60%"),height:"auto",top:hn}),Ke(n,{height:s?I(s):T,maxHeight:"auto"===s?T:""})):(Ke(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Ke(n,{height:`calc(100vh - ${fn[m?w:"none"]}px)`,maxHeight:""})),k(!O),b?.(!O)}},l().createElement(O?Ee.FullscreenExitOutlined:Ee.FullscreenOutlined))),footer:null,bodyStyle:Object.assign({},V,y),onCancel:v,afterClose:()=>{x?.(),k(!1)},modalRender:e=>l().createElement(mn(),{nodeRef:C,bounds:D,position:$,disabled:!u||_||O,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,a=C.current.getBoundingClientRect();a&&H({left:-a.left+t.x,right:n-(a.right-t.x)-1,top:-a.top+t.y,bottom:r-(a.bottom-t.y)-1})})(0,t)},l().createElement("div",{ref:C},e))}),n.children,(d||A||L)&&l().createElement(ut,{spinning:!0,className:ve()("spinning")}))}));gn.displayName="QmModal";const yn=gn,bn=require("memoize-one");var vn=r.n(bn);const xn=(0,i.createContext)(void 0),En={string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e,t){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 n=0,r=(e=Array.isArray(e)?e:[e]).length;n<r;n++)t+="number"==typeof e[n]?e[n]:"'"+e[n]+"'",n<r-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,n){return e.split(t).join(n)},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 "," || "),this.find_replace(e," <> "," != ")}},wn=["==","<",">","<=",">=","!=","like","nlike","likes","in","nin","^=","=$","nil","nnil"],Cn=function(e,t){let n="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?n+=" "+e[t]+" ":n+=e[t];const r=n.split(" ").filter((e=>""!==e));for(let e=0;e<r.length;e++)wn.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),wn.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return r.join(" ")},Sn=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Nn=["string","number","boolean","symbol"],Tn=e=>Nn.includes(typeof e),In=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Rn=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(new RegExp(dr,"g")," ").replace(Sn,"\\$1"),"i"),On=(e,t,n)=>{e=e??"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Rn(n));break;case"nlike":r=null===e.toString().match(Rn(n));break;case"likes":r=n.split(/,|,/).some((t=>On(e,"like",t)));break;case"in":Tn(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Tn(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"^=":r=e.toString().startsWith(n);break;case"=$":r=e.toString().endsWith(n);break;case"nil":r=""===e||null==e;break;case"nnil":r=!On(e,"nil",null);break;case"!=":case"<>":r=(In(e)?e.slice(0,10):e)!=n;break;case"<":r=(In(e)?e.slice(0,10):e)<n;break;case"<=":r=(In(e)?e.slice(0,10):e)<=n;break;case">":r=(In(e)?e.slice(0,10):e)>n;break;case">=":r=(In(e)?e.slice(0,10):e)>=n;break;default:r=(In(e)?e.slice(0,10):e)==n}return r};window.__query__=(...e)=>On(e[0],e[1],e[2]);const kn=En.stringify,Ln=En.array_format,Pn=function(e){let t=0;const n=e.length;for(let r=0;r<n;r++){const n=e.charAt(r);"("===n&&t++,")"===n&&t--}return 0===t},An=(e,t,n)=>{if(!t)return e;let r=[];t=En.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Cn(t,"record")};`);r=gr(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Cn(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)n(e,t)&&r.push(e[t])}}catch(t){ue("Table","组件 `initialFilter` 参数有误!"),r=e}return r},Fn=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Fn(e.children)):t.push(e)})),t},_n=e=>e.filter((e=>(e.children&&(e.children=_n(e.children)),!e.hidden&&!e.noAuth))),qn=e=>e.map((e=>{const t={dataIndex:e.dataIndex};return Array.isArray(e.children)&&(t.children=qn(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),t})),Dn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Dn(e.children))})),t},Hn=(e,t)=>e.map((e=>(e.children&&(e.children=Hn(e.children,t)),t?.(e),e))),$n=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=$n(n.children,t);if(e)return e}}return null},Mn=e=>{const t=e.children;return t?t[0].children?Mn(t[0]):t[0]:e},Kn=e=>{const t=e.children;return t?t[t.length-1].children?Kn(t[t.length-1]):t[t.length-1]:e},zn=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Vn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Vn(e.children))})),t},jn=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...jn(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},Wn=(e,t)=>{const n=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&n.push(...Wn(e[r].children,t)),n.push(t(e[r]));return n},Bn=e=>{let t=1;const n=(e,r)=>{if(r&&(e.level=r.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((r=>{e.fixed?r.fixed=e.fixed:delete r.fixed,n(r,e),t+=r.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return Dn(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Un=e=>Object.assign(e,{__prevent__:!0}),Gn=e=>e.__prevent__,Yn=e=>{delete e.__prevent__},Xn=(e,t,n={left:0,top:0})=>{if(e){const r=e.parentNode;if(n.top+=e.offsetTop,n.left+=e.offsetLeft,r&&r!==document.documentElement&&r!==document.body&&(n.top-=r.scrollTop,n.left-=r.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Xn(e.offsetParent,t,n)}return n},Qn=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Zn=(e,t)=>(0,h.transform)(e,((e,n,r)=>{(0,h.isEqual)(n,t[r])||(e[r]=(0,h.isPlainObject)(n)&&(0,h.isPlainObject)(t[r])?Zn(n,t[r]):n)})),Jn=(e,t)=>(0,h.get)(e,t)??"",er=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),(0,h.set)(e,t,n??"")},tr=(e,t)=>{if(!t.includes("|"))return Jn(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(Jn(e,t))})),n.every((e=>!e))?"":n.join(" | ")},nr=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),rr=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],a="";for(;r.length>3;)a=`,${r.slice(-3)}${a}`,r=r.slice(0,r.length-3);return r&&(a=r+a),`${n}${a}${t[1]?`.${t[1]}`:""}`},ar=(e,t)=>{const n=e.toString();if(!nr(n)||0===t)return e;const r=Number.parseFloat(n).toString(),a=r.indexOf(".");if(-1===a)return r+"."+"0".repeat(t);const i=Math.max(0,t-(r.length-a-1));return r+"0".repeat(i)},ir=(e,t)=>e?c()(e,t):null,lr=(e,t)=>e?c()(e).format(t):"",or=(e="")=>{let t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},sr=e=>{const t=[];return function e(n){null!=n&&"boolean"!=typeof n&&("string"!=typeof n&&"number"!=typeof n?Array.isArray(n)?n.forEach(e):l().isValidElement(n)&&e(n.props.children):t.push(n))}(e),t},cr=e=>sr(e).join(""),dr="",ur=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=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)?Ln(i.condition):kn(i.condition,dr);n+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,r=i.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[a,i]=r.includes("|")?r.split("|"):[r,""],l=e[r];for(const e in l)n+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?Ln(l[e]):kn(l[e],dr)} and `}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},mr=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(Jn(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},pr=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].dataIndex===t)return[e[n]];if(Array.isArray(e[n].children)){const r=pr(e[n].children,t);if(r)return[e[n],r].flat()}}},hr=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=hr(n.children,t);if(e)return e}if(t(n))return n}return null},fr=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n]._rowKey===t)return[t];if(Array.isArray(e[n].children)){const r=fr(e[n].children,t);if(r)return[e[n]._rowKey,r].flat()}}},gr=(e,t)=>e.reduce(((e,n)=>{const r={...n};return Array.isArray(n.children)&&(r.children=gr(n.children,t)),(t(r)||r.children&&r.children.length>0)&&e.push(r),e}),[]),yr=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),br=(e,t,n=!1)=>{const r=new Set;return function e(t,a,i=1){if(r.has(t))return!1;if(t===a)return!0;if(n&&i>1)return!1;r.add(t);const l=i+1;if(Array.isArray(t)){if(!Array.isArray(a)||t.length!==a.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],a[n],l))return!1;return!0}if(t&&a&&"object"==typeof t&&"object"==typeof a){const n=Object.keys(t);return n.length===Object.keys(a).length&&n.every((n=>e(t[n],a[n],l)))}return!1}(e,t)},vr=(e,t)=>e===t,xr=e=>["nil","nnil"].includes(e);function Er(e,t){for(const n in t){const r=t[n],a=Jn(e,n);if(r&&!r.includes(a))return!1}return!0}const wr=(e,t,n)=>Object.keys(t).length&&e.length?n?gr(e,(e=>Er(e,t))):e.filter((e=>Er(e,t))):e,Cr=require("prop-types");var Sr=r.n(Cr);const Nr=e=>["","small","middle","large"].includes(e),Tr=80,Ir="1",Rr="0",Or=400,kr=["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"],Lr={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 Pr=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}({}),Ar=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}({}),Fr=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const _r={items:Sr().arrayOf(Sr().shape({type:Sr().string.isRequired,fieldName:Sr().string.isRequired})),initialValues:Sr().object,initialExtras:Sr().object,layout:Sr().oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!Nr(e[t]||""))return de("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Sr().number,className:Sr().string,style:Sr().object,compactMode:Sr().bool,labelWidth:Sr().oneOfType([Sr().number,Sr().string]),labelAlign:Sr().oneOf(["left","right"]),labelWrap:Sr().bool,formType:Sr().oneOf(["default","search","onlyShow"]),disabled:Sr().bool,uniqueKey:Sr().string,defaultRows:Sr().number,defaultExpand:Sr().bool,searchButtonCols:Sr().number,scrollToFirstError:Sr().bool,authConfig:Sr().object,isAutoFocus:Sr().bool,isCollapse:Sr().bool,isFieldsDefine:Sr().bool,isSearchBtn:Sr().bool,isSubmitBtn:Sr().bool,fieldsChange:Sr().func,onValuesChange:Sr().func,onFieldsChange:Sr().func,onFinish:Sr().func,onFinishFailed:Sr().func,onReset:Sr().func,onCollapse:Sr().func},qr={layout:"horizontal",labelWidth:Tr,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:b,onFieldsChange:b,onFinish:b,onFinishFailed:b,onReset:b,onCollapse:b},Dr=(e,t)=>{if(!e)return null;if(t===Ar.week){const t=e.match(/^(\d{4})-(\d+)/);return t?c()().year(Number(t[1])).week(Number(t[2])):null}if(t===Ar.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?c()().year(Number(t[1])).quarter(Number(t[2])):null}return c()(e,t)},Hr=(e,t)=>e?c()(e).format(t):"",$r=e=>""===e||null==e,Mr=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const n=t.split("|");let r="";for(let t=0,a=n.length;t<a;t++)r+=(e[n[t].trim()]??"")+(t===a-1?"":" | ");return r},Kr=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const a=t[r].split("|"),i=n[r].split("|");a.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},zr=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const a=t[r].split("|"),i=n[r].split("|");a.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},Vr=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),(0,h.isUndefined)(e.isLeaf)||(r.isLeaf=!!e.isLeaf),(0,h.isUndefined)(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=Vr(e.children,t,n)),r})),jr=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=jr(n.children,t);if(e)return e}}return null},Wr=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...Wr(e.children,t,n+1))})),r},Br=e=>g(e)||"string"==typeof e,Ur=e=>sr(e).join(""),Gr=(e,t,n,r)=>{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={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:n(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={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:n(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:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Yr={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"}};let Xr,Qr=null;function Zr(e){return e||null===Qr?("object"==typeof Intl&&Intl.Collator?(Xr=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Qr=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Qr=!1,Qr):Qr}function Jr(e){const t=Yr.UNIHANS,n=Yr.PINYINS,r=Yr.EXCEPTIONS,a={source:e};if(e in r)return a.type=2,a.target=r[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=1,a.target=e,a;if(i=Xr.compare(e,"阿"),i<0)return a.type=3,a.target=e,a;if(0===i)a.type=2,l=0;else{if(i=Xr.compare(e,"鿿"),i>0)return a.type=3,a.target=e,a;0===i&&(a.type=2,l=t.length-1)}if(a.type=2,l<0){let n=0,r=t.length-1;for(;n<=r;){l=~~((n+r)/2);const a=t[l];if(i=Xr.compare(e,a),0===i)break;i>0?n=l+1:r=l-1}}return i<0&&l--,a.target=n[l],a.target||(a.type=3,a.target=a.source),a}function ea(e){return"string"==typeof e&&Zr()?e.split("").map((e=>Jr(e))):e}const ta={isSupported:Zr,parse:ea,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Yr)})))},genToken:Jr,convertToPinyin:(e,t,n)=>ea(e).map((e=>t&&2===e.type?e.target.toLowerCase():e.target)).join(n||"")},na={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()&&na.shouldPatch(ta.genToken)&&ta.patchDict(na);const ra=ta,aa=e=>{const{value:t,bordered:n}=e;return l().createElement(K.Input,{value:t,title:t,bordered:n,readOnly:!0})};aa.displayName="FormItemView";const ia=aa;function la(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oa(){return oa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},oa.apply(null,arguments)}const{Option:sa}=K.Select,ca=e=>{const{$$form:t}=l().useContext(xn),{value:n,items:r,multiple:a,loading:i,onChange:o,onValuesChange:s}=e,{t:c}=le(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,readOnly:g,disabled:y,onClear:b}=e.option,{itemList:v=[],filterable:x=!0,listHeight:E=Or,collapseTags:w,maxTagTextLength:S,dropdownStyle:N,openPyt:T=!0}=u,I=C(v)?r:v,R=e=>I.find((t=>t.value===e))?.text||e?.toString()||"",O=e=>a?e?.map((e=>R(e))).join(",")||"":R(e);return t.isOnlyShow?l().createElement(ia,{value:O(n),bordered:h}):l().createElement(K.Select,oa({value:n,mode:a?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:N,placeholder:p,style:m,loading:i,bordered:h,allowClear:f,disabled:y,showSearch:x,listHeight:E,maxTagCount:w?"responsive":void 0,maxTagTextLength:S},a?{title:O(n)}:null,{filterOption:(e,t)=>{const n=t?.children?.toString()||"",r=ra.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(T?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,O(e),I)})(e)},onClear:b}),I.map((e=>l().createElement(sa,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class da extends i.Component{constructor(...e){super(...e),la(this,"context",void 0),la(this,"state",{itemList:[],loading:!1}),la(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,h.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,h.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:n}=this.state,{type:r,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,buttonAfter:p,validateTrigger:h,rules:f=[],onChange:g=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(a),className:ve()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":I(d)},required:e.getFormItemRequired(f)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(ca,{option:this.props.option,items:t,loading:n,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),p&&l().createElement(K.Col,null,e.renderFormItemButton(o,p)),m&&l().createElement(K.Col,{flex:I(m.labelWidth||Tr)},e.renderFormItemExtra({fieldName:o,...m}))))}}la(da,"contextType",xn);const ua=da;function ma(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pa=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=Rr,trueValue:p=Ir}=o,{t:h}=le();return l().createElement(K.Checkbox,{checked:n===p,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{r?.(e),a(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(t?p:m)}},u?i:null)};class ha extends i.Component{constructor(...e){super(...e),ma(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option,{labelToCheckbox:h}=o;return l().createElement(K.Form.Item,{label:h?" ":e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(pa,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}ma(ha,"contextType",xn);const fa=ha,ga=require("react-sortablejs"),ya=e=>{const{uniqueKey:t,items:n,fieldsChange:r}=e,{global:a}=l().useContext(o),{$$form:i}=l().useContext(xn),{$size:s}=se(e),{t:c}=le(),d=l().useRef(null),[u,m]=l().useState(!1),p=l().useMemo((()=>t?`form_${t}`:""),[t]);l().useLayoutEffect((()=>{g()}),[]);const f=e=>{if(!p)return;const t=e.map((e=>{const t={};return(0,h.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),n=JSON.parse(localStorage.getItem(p));(0,h.isEqual)(t,n)||(localStorage.setItem(p,JSON.stringify(t)),(async(e,t)=>{const n=a?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(p,t))},g=()=>{const e=(()=>{if(!p)return;const e=JSON.parse(localStorage.getItem(p));return e||(async e=>{const t=a?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(p).then((e=>{e?(localStorage.setItem(p,JSON.stringify(e)),g()):a?.getComponentConfigApi&&f(n)})).catch((()=>{})),e?(0,h.xor)(e.map((e=>e.fieldName)),n.map((e=>e.fieldName))).length>0?n.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?((0,h.isUndefined)(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>({...n.find((t=>t.fieldName===e.fieldName)),...e}))):void 0})();e&&y(e)},y=e=>{r?.([...e])},b=xe("form-fields-filter"),v={[b]:!0,[`${b}--lg`]:"large"===s,[`${b}--sm`]:"small"===s};return l().createElement(K.Dropdown,{open:u,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","fields-list")},l().createElement("div",{className:"reset"},l().createElement(he,{type:"text",size:"small",onClick:()=>(e=>{const t=e.filter((e=>n.find((t=>t.fieldName===e.fieldName)))).map((e=>{const t=n.find((t=>t.fieldName===e.fieldName));return Object.assign({},t,{hidden:e.hidden})}));y(t),f(t)})(i.getOriginItems())},c("qm.table.columnFilter.reset"))),l().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));if((0,h.isEqual)(t,r))return;i.setExpandHandle(!0);const a=yr(e);y(a),f(a)}},n.map((e=>l().createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},l().createElement(K.Checkbox,{disabled:e.rules?.findIndex((e=>e.required))>-1,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,y(n),f(n)}}),l().createElement(Ee.HolderOutlined,{className:"handle",title:c("qm.form.draggable")}),l().createElement("span",{className:"title"},i.getFormItemLabel(e.label))))))),overlayClassName:ve()(v),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>d.current,onOpenChange:e=>{m(e)}},l().createElement("a",{ref:d,style:{padding:"5px 0"}},l().createElement(Ee.UnorderedListOutlined,null)))};ya.displayName="FieldsFilter";const ba=ya;function va(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xa=l().forwardRef(((e,t)=>{const{$$form:n}=l().useContext(xn),{value:r,onChange:a,onValuesChange:i}=e,{t:o}=le(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:f,onFocus:g,onBlur:y,onEnter:b,onClear:v}=e.option,{prefix:x,suffix:E,password:w,maxLength:C,pattern:S,toUpper:N,toTrim:T,autoFocus:I,autoComplete:R,secretType:O}=s,k=O&&(p||f),L=l().useRef(),P=l().useRef(!1);l().useEffect((()=>{const e=()=>v?.(),t=L.current?.input.parentNode.querySelector("span[class*='clear-icon']");return m&&t&&t.addEventListener("click",e),()=>{t?.removeEventListener("click",e)}}),[]);const A=e=>{a?.(e),i(e)},F=w?K.Input.Password:K.Input,_=k?((e="",t)=>(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))(r,O):r;return n.isOnlyShow?l().createElement(ia,{value:(e=>e&&w?new Array(e.length).fill("*").join(""):e)(_),bordered:u}):l().createElement(F,{ref:e=>{L.current=e,"function"==typeof t&&t(e)},value:_,autoComplete:w?"new-password":R,autoFocus:I,placeholder:d,style:c,title:w?"":_,prefix:x,suffix:E,maxLength:C,bordered:u,allowClear:m,readOnly:p,disabled:f,onFocus:e=>{g?.(e.target.value,e)},onBlur:t=>{let n=t.target.value??"";if(T){const e=n.trim();n!==e&&(n=e,A(n))}(t=>{const{onBlur:n}=e;n?.(t)})(n),y?.(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;b?.(t,e),n.isFilterType&&(n.SUBMIT_FORM(),L.current?.blur())}},onCompositionStart:()=>{P.current=!0},onCompositionEnd:()=>{P.current=!1},onChange:e=>{let t=e.target.value;(0,h.isRegExp)(S)&&(t=S.test(t)?t:r??""),N&&!P.current&&(t=t.toUpperCase()),A(t)}})}));xa.displayName="VInput";class Ea extends i.Component{constructor(...e){super(...e),va(this,"context",void 0),va(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(p)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(xa,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),u&&l().createElement(K.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}va(Ea,"contextType",xn);const wa=Ea;function Ca(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sa=e=>{const{$$form:t}=l().useContext(xn),{value:n=[],onChange:r,onValuesChange:a}=e,{t:i}=le(),{options:o={},placeholder:s=i("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{prefix:p,suffix:h,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;r?.(t),a(t,y(t))},y=e=>e.join(" - ");return t.isOnlyShow?l().createElement(ia,{value:y(n),bordered:c}):l().createElement(K.Input.Group,null,l().createElement(K.Input,{value:n[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:p,suffix:h,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([t,n[1]])}}),l().createElement(K.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),l().createElement(K.Input,{value:n[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:p,suffix:h,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class Na extends i.Component{constructor(...e){super(...e),Ca(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(s),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(o)},required:e.getFormItemRequired(u)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Sa,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(a,n)}}))),c&&l().createElement(K.Col,{flex:I(c.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...c}))))}}Ca(Na,"contextType",xn);const Ta=Na,Ia=require("big.js");var Ra=r.n(Ia);function Oa(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ka=l().forwardRef(((e,t)=>{const{$$form:n}=l().useContext(xn),{value:r,onChange:a,onValuesChange:i}=e,{t:o}=le(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:m,disabled:p,onFocus:f,onBlur:g,onEnter:y}=e.option,{step:b=1,min:v,max:x,precision:w,autoFocus:C,stringMode:S,textAlign:N="left",controls:T=!0,formatter:I,parser:R}=s,O=l().useRef(),k=l().useRef(r),L=e=>{const t=$r(e)?"":(0,h.isNumber)(e)?e.toFixed(w):new(Ra())(e).toFixed(w);return"function"==typeof I?I(t):t},P={[N]:!0,controls:T};return n.isOnlyShow?l().createElement(ia,{value:L(r),bordered:u}):l().createElement(K.InputNumber,{ref:e=>{O.current=e,"function"==typeof t&&t(e)},value:r,className:ve()(P),placeholder:d,style:{width:"100%",...c},step:b,min:v,max:x,controls:T,precision:w,autoFocus:C,stringMode:S,formatter:I,parser:R,bordered:u,readOnly:m,disabled:p,onFocus:e=>{f?.(e.target.value,e)},onBlur:t=>{E((()=>{(t=>{const{onBlur:n}=e;n?.(t)})(k.current),g?.(k.current,t)}))},onKeyUp:e=>{13===e.keyCode&&(y?.(r,e),n.isFilterType&&(n.SUBMIT_FORM(),O.current?.blur()))},onChange:e=>{const t=e??"";!S&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{k.current=e,a?.(e),i(e,L(e))})(t)}})}));ka.displayName="VInputNumber";class La extends i.Component{constructor(...e){super(...e),Oa(this,"context",void 0),Oa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(p)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(ka,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&l().createElement(K.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Oa(La,"contextType",xn);const Pa=La;function Aa(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fa=e=>{const{$$form:t}=l().useContext(xn),{value:n=[],onChange:r,onValuesChange:a}=e,{t:i}=le(),{options:o={},placeholder:s=i("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{step:p=1,min:h=0,max:f,textAlign:g="left",controls:y=!0,precision:b,formatter:v,parser:x}=o,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),w(e)},w=e=>{const t=e.every((e=>null===e))?[]:[...e];r?.(t),a(t,C(t))},C=e=>$r(e)?"":e.map((e=>$r(e)?"":Number(e).toFixed(b))),S={[g]:!0,controls:y};return t.isOnlyShow?l().createElement(ia,{value:C(n),bordered:c}):l().createElement(K.Input.Group,null,l().createElement(K.InputNumber,{value:n[0],className:ve()("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:p,min:h,max:f,controls:y,precision:b,formatter:v,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([e,n[1]])},onBlur:()=>{E(n)}}),l().createElement(K.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),l().createElement(K.InputNumber,{value:n[1],className:ve()("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:p,min:h,max:f,controls:y,precision:b,formatter:v,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([n[0],e])},onBlur:()=>{E(n)}}))};class _a extends i.Component{constructor(...e){super(...e),Aa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(s),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(o)},required:e.getFormItemRequired(u)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Fa,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(a,n)}}))),c&&l().createElement(K.Col,{flex:I(c.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...c}))))}}Aa(_a,"contextType",xn);const qa=_a;let Da=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});const Ha=(0,i.createContext)(void 0),$a={dataIndex:Sr().string.isRequired,title:Sr().string.isRequired,description:Sr().string,colSpan:Sr().number,width:Sr().number,minWidth:Sr().number,fixed:Sr().oneOf(["left","right"]),align:Sr().oneOf(["left","center","right"]),theadAlign:Sr().oneOf(["left","center","right"]),printFixed:Sr().bool,hidden:Sr().bool,noAuth:Sr().bool,noFixed:Sr().bool,ellipsis:Sr().bool,className:Sr().string,theadClassName:Sr().string,children:Sr().array,sorter:Sr().oneOfType([Sr().bool,Sr().func]),filter:Sr().shape({type:Sr().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Sr().arrayOf(Sr().shape({text:Sr().string,value:Sr().oneOfType([Sr().string,Sr().number])})),style:Sr().object,openFilterList:Sr().bool}),precision:Sr().number,displayPrecision:Sr().number,formatType:Sr().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Sr().bool,canCopy:Sr().bool,editRender:Sr().func,dictItems:Sr().arrayOf(Sr().shape({text:Sr().string,value:Sr().oneOfType([Sr().string,Sr().number])})),summation:Sr().shape({sumBySelection:Sr().bool,displayWhenNotSelect:Sr().bool,dataKey:Sr().string,unit:Sr().string,render:Sr().func}),groupSummary:Sr().shape({dataKey:Sr().string,unit:Sr().string,render:Sr().func}),shouldCellUpdate:Sr().func,headRender:Sr().func,render:Sr().func,outputRender:Sr().func},Ma=(Sr().arrayOf(Sr().shape($a)).isRequired,Sr().func,Sr().array,Sr().oneOfType([Sr().string,Sr().func]).isRequired,Sr().number,Sr().bool,Sr().bool,Sr().shape({api:Sr().func.isRequired,params:Sr().object.isRequired,formatter:Sr().func,beforeFetch:Sr().func,afterFetch:Sr().func,stopToFirst:Sr().bool,dataKey:Sr().string,callback:Sr().func}),Sr().bool,Sr().bool,Sr().string,Sr().string,Sr().object,Sr().bool,Sr().bool,Sr().bool,Sr().oneOfType([Sr().object,Sr().func]),Sr().oneOfType([Sr().object,Sr().func]),Sr().array,Sr().func,Sr().bool,Sr().object,Sr().object,Sr().shape({type:Sr().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Sr().array,selectedRowKeys:Sr().array,hideSelectAll:Sr().bool,checkStrictly:Sr().bool,filterable:Sr().bool,selectByClickRow:Sr().bool,selectFirstRowOnChange:Sr().bool,clearableAfterFetched:Sr().bool,selectAllOnCurrentPage:Sr().bool,fetchSelectedRows:Sr().shape({api:Sr().func.isRequired,params:Sr().object,dataKey:Sr().string}),fetchAllRowKeys:Sr().shape({api:Sr().func.isRequired,params:Sr().object,dataKey:Sr().string}),disabled:Sr().func,onChange:Sr().func,onSelect:Sr().func,onSelectAll:Sr().func}),Sr().shape({currentRowKey:Sr().oneOfType([Sr().number,Sr().string]),disabled:Sr().func,onChange:Sr().func}),Sr().shape({virtual:Sr().bool,overscan:Sr().number,doubleXScrollbar:Sr().bool}),Sr().shape({expandIconColumn:Sr().string}),Sr().shape({defaultExpandAllRows:Sr().bool,defaultExpandedRowKeys:Sr().array,expandedRowKeys:Sr().array,hideExpandAll:Sr().bool,rowExpandable:Sr().func,expandedRowClassName:Sr().string,expandedRowRender:Sr().func,onExpand:Sr().func,onChange:Sr().func}),Sr().shape({cellMerge:Sr().bool,onCellMerge:Sr().func,onSelectChange:Sr().func}),Sr().shape({groupItems:Sr().arrayOf(Sr().shape({dataIndex:Sr().string.isRequired,titleIndex:Sr().string,color:Sr().string,backgroundColor:Sr().string})),fetch:Sr().shape({api:Sr().func.isRequired,params:Sr().object,dataKey:Sr().string}),onChange:Sr().func}),Sr().func,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().shape({current:Sr().number,pageSize:Sr().number,pageSizeOptions:Sr().array,showSizeChanger:Sr().bool,showQuickJumper:Sr().bool}),Sr().shape({fileName:Sr().string,fetch:Sr().shape({api:Sr().func.isRequired,params:Sr().object}),beforeExport:Sr().func,cellStyle:Sr().bool,hideIcon:Sr().bool}),Sr().shape({showLogo:Sr().bool}),Sr().shape({fetch:Sr().shape({api:Sr().func.isRequired,params:Sr().object,dataKey:Sr().string}),fieldList:Sr().arrayOf(Sr().object)}),Sr().shape({position:Sr().oneOf(["top","bottom"]),hideAlert:Sr().bool,hideClearButton:Sr().bool}),Sr().oneOf(["left","right"]),Sr().func,Sr().func,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().bool,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,Sr().func,{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}),Ka=10,za="1",Va="0",ja="YYYY-MM-DD",Wa="YYYY-MM-DD HH:mm:ss",Ba="YYYYMMDDHHmmss",Ua={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 Ga=function(e){return e.left="flex-start",e.right="flex-end",e}({});const Ya={...i}.useId;let Xa=0;const Qa=Ya?function(e){const t=Ya();return e||t}:function(e){const[t]=i.useState(`qm_unique_${Xa}`);return i.useEffect((()=>{Xa+=1}),[]),e||t};let Za=[];const Ja={_getInstance:function(e){return Za.find((t=>t.id===e))??null},getFocusInstance:function(){return Za[0]??null},focus:function(e){const t=this._getInstance(e);t&&0!==Za.findIndex((e=>e===t))&&(this.deregister(e),Za=[t,...Za])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),Za=[{id:e,vm:t},...Za])},deregister:function(e){e&&(Za=Za.filter((t=>t.id!==e)))}};function ei(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ti=class{constructor(e){ei(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),ei(this,"getRowKey",void 0),ei(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),ei(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)})),ei(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),ei(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)})),ei(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),ei(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)})),ei(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),ei(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),ei(this,"addToUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e||this.getRowKey(t,t.index)===this.getRowKey(e,e.index)));-1===t?this.state.updated.push(e):this.state.updated.splice(t,1,e)})),ei(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),ei(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),ei(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),ei(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),this.getRowKey=e.getRowKey}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}};function ni(e){return void 0!==e}function ri(e,t){const{defaultValue:n,value:r,onChange:a,postState:l}=t||{},[o,s]=i.useState((()=>ni(r)?r:ni(n)?"function"==typeof n?n():n:"function"==typeof e?e():e)),c=ni(r)?r:o,d=l?l(c):c,u=oe(a),[m,p]=i.useState([c]);return xt((()=>{const e=m[0];o!==e&&u(o,e)}),[m]),xt((()=>{ni(r)||s(r)}),[r]),[d,oe((e=>{s(e),p([c])}))]}const ai={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",virtualScrollX:50,virtualScrollY:100,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored",popupClassName:"table-editable__popper"},ii=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=ii(t.children)),t})),li=(e,t)=>{const{fetch:n,columns:r,border:a,rowHeight:i,rowSelection:o,summation:s,expandable:c,treeConfig:d,webPagination:u,scrollPagination:m,showSuperSearch:p,showFastSearch:h,showGroupSummary:f,showTableImport:g,showClipboard:y,showSelectCollection:b,showPivotGrid:v,footRender:x}=e,{tableRef:E,getRowKey:w,$size:C,tableFullData:S,tableFlatData:N,updateMark:T,selectionKeys:I,sorter:R,filters:O,superFilters:k,pagination:L,mergedTdCells:P}=t,{selectionRows:A,summaries:F}=E.current,{expandIconColumn:_=""}=d||{},{t:q}=le(),D=(e,t,n,r,a)=>{const i=`${t},${n}`;e.has(i)||e.set(i,{row:t,col:n,rowSpan:r,colSpan:a})},H=l().useMemo((()=>!!n?.api),[n?.api]),$=l().useMemo((()=>!H&&!!u),[H,u]),M=l().useMemo((()=>H&&!!m),[H,m]),K=l().useMemo((()=>(H||$)&&!M),[H,$,M]),z=l().useMemo((()=>(e=>{const t=(e=>{const t=[],n=[],r=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?n.push(i):r.push(i)}return[...t,...r,...n]})(ii(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:ai.selectionColumn,title:"radio"===t?q("qm.table.config.selectionText"):"",width:ai.selectionColumnWidth,fixed:"left",type:t}})(o),r=(a=c,a?.expandedRowRender?{dataIndex:ai.expandableColumn,title:"",width:ai.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return n&&t.unshift(n),r&&t.unshift(r),_n(t)})(r)),[r]),V=l().useMemo((()=>Fn(z)),[z]),j=l().useMemo((()=>V.filter((e=>"function"==typeof e.editRender))),[V]),W=l().useMemo((()=>V.filter((e=>!!e.summation))),[V]),B=l().useMemo((()=>V.filter((e=>"left"===e.fixed))),[V]),U=l().useMemo((()=>V.filter((e=>"right"===e.fixed))),[V]),G=l().useMemo((()=>i||ai.rowHeightMaps[C]),[i,C]),Y=l().useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=N.findIndex((t=>w(t,t.index)===e.rowKey)),r=V.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){D(t,n,r,e.rowSpan,e.colSpan);for(let a=0;a<e.rowSpan;a++)for(let i=0;i<e.colSpan;i++)0===a&&0===i||D(t,n+a,r+i,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(P)),[P,V,S]),X=l().useMemo((()=>{const e=V.filter((e=>![ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(e.dataIndex)));return _&&e.some((e=>e.dataIndex===_))?_:e[0]?.dataIndex??""}),[V,_]),Q=l().useMemo((()=>W.length>0),[W]),Z=l().useMemo((()=>!!x||Q),[x,Q]),J=l().useMemo((()=>Bn(z).length>1),[z]),ee=l().useMemo((()=>a||J),[a,J]),te=l().useMemo((()=>V.some((e=>e.sorter))),[V]),ne=l().useMemo((()=>V.some((e=>e.filter))),[V]),re=l().useMemo((()=>W.some((e=>!!e.summation.dataKey))),[W]),ae=l().useMemo((()=>!H&&!!g),[H,g]),ie=l().useMemo((()=>!!y&&j.length>0),[y,j]),oe=l().useMemo((()=>!!b&&"checkbox"===o?.type),[b,o]),se=l().useMemo((()=>!!p&&ne),[p,ne]),ce=l().useMemo((()=>!H&&!!h),[H,h]),de=l().useMemo((()=>!H&&!!v),[H,v]),ue=l().useMemo((()=>!!f&&V.some((e=>!!e.groupSummary))),[V]),me=l().useMemo((()=>!!s?.groupItems?.length),[s]),pe=l().useMemo((()=>!N.length),[N]),he=l().useMemo((()=>(()=>{const e={};return W.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=!A.length&&!!o;let d=(!l||c?E.current.tableFullData:A).reduce(((e,t)=>{if(t?.[ai.summaryIgnore])return e;const r=Jn(t,n);return nr(r)?e.plus(r):e}),new(Ra())(0));!Object.keys(F).includes(n)||l&&!c||(d=new(Ra())(Jn(F,n))),er(e,n,d.toNumber());let u=r>=0?d.toFixed(r):d.toString();a>=0&&""!==u&&(u=ar(u,a)),u=rr(u),er(e,`${n}_text`,s?`${u} ${s}`:u)})),[e]})()),[N,T,I,F]),fe=l().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(W)),[W]),ge=l().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(R),t=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,a]=ai.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{n.push({type:["radio","tree"].includes(a)?"checkbox":a,bracketLeft:"",fieldName:r,expression:e,value:xr(e)?null:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{const t=ai.showFilterType?e.fieldType:"";n.push({type:["radio","tree"].includes(t)?"checkbox":t,bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:xr(e.expression)?null:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(O,k);return{...e?{[ai.sorterFieldName]:e}:null,...t.length?{[ai.filterFieldName]:t}:null,...fe?{[ai.groupSummary.summaryFieldName]:fe,usedJH:1}:null,...n?.params??null,[ai.currentPageName]:L.current,[ai.pageSizeName]:L.pageSize}}),[n?.params,L.current,L.pageSize,R,O,k,fe]);return{isFetch:H,isWebPagination:$,isScrollPagination:M,showPagination:K,tableColumns:z,flattenColumns:V,editableColumns:j,summationColumns:W,leftFixedColumns:B,rightFixedColumns:U,tableRowHeight:G,derivedMergeCells:Y,treeExpandIndex:X,showSummary:Q,showFooter:Z,isHeadGroup:J,bordered:ee,isHeadSorter:te,isHeadFilter:ne,isServiceSummation:re,isSelectCollection:oe,isTableImport:ae,isTableClipboard:ie,isSuperSearch:se,isFastSearch:ce,isPivotGrid:de,isGroupSummary:ue,isGroupSubtotal:me,isTableEmpty:pe,summationRows:he,fetchParams:ge}},oi=(e,t)=>{const{rowKey:n,height:r,dataSource:a,summation:i,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:m,authConfig:p,ignorePageIndex:f,columnsChange:g,onChange:y,onDataChange:b,onDataLoad:x,onScrollEnd:E,onFetchError:w}=e,{getRowKey:S,tableRef:T,tableElementRef:I,$size:R,tableColumns:O,flattenColumns:k,tableFullData:L,pagination:P,layout:A,filters:F,sorter:_,superFilters:q,pagerFilter:D,fetchParams:H,selectionKeys:$,rowExpandedKeys:M,highlightKey:K,summationColumns:z,isFetch:V,isWebPagination:j,isScrollPagination:W,isServiceSummation:B,isGroupSubtotal:U,doLayout:G,setTableFullData:Y,setTableOriginData:X,setTableFlatData:Q,setTableDataMaps:Z,setPagination:J,setPingRight:ee,setPingLeft:te,setSpinning:ne,setSorter:re,setFilters:ae,setSuperFilters:ie,setPagerFilter:se,setSelectionKeys:ce,setRowExpandedKeys:de,setHighlightKey:me,setSelectionRows:pe,setScrollXLoad:he,setScrollYLoad:fe,setFieldAuth:ge,setResizeState:ye,setSummaries:be,setPermission:ve,resetTableScroll:xe,createTableFocus:Ee,clearElementStore:we}=t,{t:Ce}=le(),{store:Se}=T.current,Ne=l().useRef({...H}),Te=l().useRef(!1),Ie=e=>Te.current=e,Re=vt(I);xt((()=>{De(),G()}),[O]),xt((()=>{Oe()}),[Re.width,Re.height,R,r,A.tableAutoHeight]),qe((()=>{lt(),ot(),st(),ct(),V||(j&&Ae(),Je(a)),s&&re(s),c&&ae(c)}),[a,o?.params]),qe((()=>{const e=Fe(H,Ne.current);var t;e||V&&d?.clearableAfterFetched&&dt(),!e&&H[ai.currentPageName]>1&&!o?.stopToFirst?Ae():V&&Ge(),t=H,Ne.current=t}),[H]),qe((()=>{j&&(at(),Xe()),W||xe(),je()}),[P.current,P.pageSize]),qe((()=>{V||ke(L.length),T.current.isTreeTable&&!V&&tt(),G()}),[L]),qe((()=>{T.current.isTreeTable&&at()}),[M]);const Oe=()=>{const{scrollBarRef:e,resizeState:t}=T.current,{width:n,height:r}=Re;G(),A.tableBodyWidth>n&&ee(!0),e.current.scrollLeft>0&&te(!0),ye(Object.assign({},t,{width:n,height:r}))},ke=e=>{e!==P.total&&J((t=>Object.assign({},t,{total:e})))},Le=({current:e,pageSize:t})=>{J((n=>Object.assign({},n,{current:e,pageSize:t})))},Pe=()=>{const{pageSize:e,total:t}=P;return Math.ceil(t/e)||1},Ae=()=>{Le(Object.assign({},P,{current:1}))},Fe=(e,t)=>{const n=Object.keys(Zn(e,t));return 1===n.length&&(n.includes(ai.currentPageName)||n.includes(ai.pageSizeName))},_e=Et((e=>{Qe(),E?.(e)})),De=()=>{he(k.length>ai.virtualScrollX)},He=(e=[])=>{let t=e.length>ai.virtualScrollY;T.current.isTreeTable&&(t=!0),m?.virtual&&(t=!0),fe(t)},$e=e=>U?Me(Ke(e)):e,Me=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Me(e.children)),delete e.children,t.push(e)})),t},Ke=(e,t=0)=>{const r=i.groupItems?.[t];return r?mr(e,[r.dataIndex]).map((e=>{const a={children:Ke(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&er(a,n.toString(),or()),r.titleIndex&&er(a,r.titleIndex,Jn(e[0],r.titleIndex)),er(a,r.dataIndex,Jn(e[0],r.dataIndex)),z.forEach((e=>{const{dataIndex:t}=e,n=a.children?.reduce(((e,n)=>{if(n[ai.summaryIgnore])return e;const r=Number(Jn(n,t));return Number.isNaN(r)?e:e+r}),0);er(a,t,n)})),a})):(e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e)},ze=e=>{ce(e),pe((e=>{const{selectionRows:t,recordsMap:n}=T.current,r=new Map;t.forEach((e=>r.set(S(e,e.index),e)));const a=[];for(let t=0,i=e.length;t<i;t++){const i=r.get(e[t])||n.get(e[t]);i&&a.push(i)}return a})(e))},Ve=()=>{const{isTreeTable:e,tableFullData:t,recordsMap:n}=T.current;return e?jn(t,(e=>e._rowKey)):Array.from(n.keys())},je=Et((()=>{y?.(P,Be(F),We(_),q,{currentDataSource:rt()})})),We=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},Be=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,a]=n.split("|");t[ai.showFilterType?`${r}|${a}`:r]=e[n]}return t},Ue=oe((async()=>{if(!o)return;const{formatter:e=e=>e,beforeFetch:t=v,afterFetch:n,callback:r}=o;if(!t(H))return;const a=!!i?.fetch?.api;ne(!0);try{const[t,l]=a?await Promise.all([o.api(e(H)),i.fetch.api(e(H))]):[await o.api(e(H))];if(T.current.unMounted)return;if(a?200===t.code&&200===l.code:200===t.code){const e=o.dataKey??ai.dataKey;let a=(0,h.get)(t.data,e)??[];a="function"==typeof n?await n(a):a;const i=(0,h.get)(t.data,e.replace(/[^.]+$/,ai.totalKey))||a.length||0,s=Math.max(Math.ceil(i/P.pageSize),1);if(H[ai.currentPageName]>s)return Le({...P,current:s});Je(Te.current?T.current.tableFullData.concat(a):a),ke(i),Ye(l?.data||t.data),r?.(t.data,t)}}catch(e){w?.(e)}var l;l=o,Object.prototype.hasOwnProperty.call(l,"stopToFirst")&&(o.stopToFirst=!1),ne(!1),Ie(!1)})),Ge=Et(Ue),Ye=e=>{if(!B)return;const t=i?.fetch?.dataKey??ai.summationKey,n=(t?(0,h.get)(e,t):e)??{},r={};z.filter((e=>!!e.summation.dataKey)).forEach((e=>{er(r,e.dataIndex,Number(Jn(n,e.summation.dataKey)))})),be(r)},Xe=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=rt();if(e.length){const t=S(e[0],e[0].index);ze([t])}else ze([])}},Qe=()=>{if(!W)return;const e=Pe();Te.current||P.current>=e||(Ie(!0),Le({...P,current:P.current+1}))},Ze=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Ze(e.children)),e.index=t,f||(e.pageIndex=(e=>{const{current:t,pageSize:n}=P;return!V||W?e:(t-1)*n+e})(t)),e))),Je=e=>{const t=et(e,(e=>wr(e,D,T.current.isOriginTree)));ze((e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:$;let a=[];return T.current.isTreeTable&&!n&&r.forEach((e=>{a.push(...((e,t)=>{const{disabled:n}=d||{},{tableFullData:r,recordsMap:a}=T.current,i=hr(r,(t=>t._rowKey===e));let l=[];if(!i)return l;let o=Wn(i?.children||[],(e=>e._rowKey));return n&&(o=o.filter((e=>!a.has(e)||!n(a.get(e))))),l=[...new Set([...t,...o])],(fr(r,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=hr(r,(t=>t._rowKey===e)),n=t?.children?.every((e=>l.includes(e._rowKey)));l=n?[...l,e]:l.filter((t=>t!==e))})),l})(e,r))})),a="radio"===t?r.slice(0,1):[...new Set([...r,...a])],a})()),de((e=>{const{isTreeTable:t,tableFullData:n,recordsMap:r}=T.current,{defaultExpandAllRows:a,rowExpandable:i,expandedRowRender:l}=u||{};let o=Array.isArray(e)?e:[...M];if(a)o=Ve();else if(t){l&&ue("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...$];K&&e.unshift(K),e.forEach((e=>{const t=fr(n,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=[...new Set(o)]}return i&&o.filter((e=>{const t=r.get(e);return!!t&&i(t)})),o})()),Xe(),x?.(t)},et=(e,t)=>{const n=Ze(e);return X(n),it(t?.(n)||n),n},tt=()=>{const{updated:e}=Se.state;e.length&&function t(n){n.forEach((n=>{n.children&&t(n.children);const r=e.find((e=>e._rowKey===S(n,n.index)));r&&Object.assign(n,N(r,["children"]))}))}(T.current.tableOriginData)},nt=()=>{const{current:e,pageSize:t}=P;return T.current.tableFullData.slice((e-1)*t,e*t)},rt=()=>j?nt():T.current.tableFullData,at=()=>{const{recordsMap:e,isTreeTable:t}=T.current;let n=j?Vn(nt()):Array.from(e.values());n=t?(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=S(e,e.index);if(!e._parentRowKey)return n.push(e),t.set(r,!0);M.includes(e._parentRowKey)&&t.get(e._parentRowKey)&&(n.push(e),t.set(r,!0))})),t.clear(),n})(n):$e(n),He(n),Q(n)},it=e=>{Y(e),Z(e),at()},lt=()=>{re({})},ot=()=>{ae({})},st=()=>{ie([])},ct=()=>{se({})},dt=()=>{ze([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=N(p,["fetch"]);if(p.fetch){const{api:e,params:n,dataKey:r}=p.fetch;try{const a=await e(n);200===a.code&&(t=(r?(0,h.get)(a.data,r):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:n=1,isPrint:r=1}=t;ve((t=>Object.assign({},t,{export:!!e,import:!!n,print:!!r})))}if(Array.isArray(t.fieldList)){const n=Hn(e.columns,(e=>{const{dataIndex:n}=e,r=t.fieldList.find((e=>e.dataIndex===n));if(r){const{visible:t=1,disabled:a,secretName:i}=r,l=$n(T.current.originColumns,n);ge(n,{visible:t,disabled:a,secretName:i}),t||(e.noAuth=!0,l.noAuth=!0),i&&(e.formatType=`secret-${i}`,l.formatType=`secret-${i}`)}}));g?.(n)}})(),Ee(),De(),He(),V?Ue():Je(a)},checkDataIndex:()=>{const e=k.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&ue("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:it,createWebPageData:nt,getTableData:Ue,createTableData:et,createGroupData:$e,createAllExpandedKeys:Ve,setSelectionKeysEffect:ze,doFieldValidate:(e,t,n,r,a)=>{if(!Array.isArray(e))return ue("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Se.removeFromRequired({x:n,y:r}),Se.removeFromValidate({x:n,y:r}),e.forEach((e=>{e.required&&C(t)&&Se.addToRequired({x:n,y:r,text:e.message||a+Ce("qm.form.requiredTips")}),"function"!=typeof e.validator||e.validator?.(t)||Se.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:a}=Se.state,i=(0,h.intersection)(n,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:n.filter((e=>!i.includes(e))),updated:r.filter((e=>![...(0,h.intersection)(r,n),...(0,h.intersection)(r,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{b?.(T.current.tableFullData)},tableChange:je,toLastPage:()=>{const e=Pe();P.current!==e&&Le(Object.assign({},P,{current:e}))},toFirstPage:Ae,getPageCount:Pe,pagerChangeHandle:Le,scrollBottomDebouncer:_e,clearTableSorter:lt,clearTableFilter:ot,clearSuperFilters:st,clearPagerFilter:ct,clearRowSelection:dt,clearRowHighlight:()=>{me("")},clearTableLog:()=>{Se.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=T.current;we(),Se.destroy(),e.deregister(t)}}};function si({handler:e,delay:t=0}){const n=Xt(e,t),r=oe(t>0?n:e);i.useEffect((()=>(window.addEventListener("resize",r),()=>window.removeEventListener("resize",r))),[r])}const ci=e=>{const{total:t}=e,{tableRef:n,prefixCls:r,selectionKeys:a,isHeadSorter:i,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearPagerFilter:u,clearRowSelection:m,clearRowHighlight:p,setActivedCell:h}=l().useContext(Ha),{infoBarConfig:f,rowSelection:g,rowHighlight:y}=n.current.props,{isTreeTable:b,recordsMap:v,invalidRowKeys:x}=n.current,{hideAlert:w,hideClearButton:C}=f||{},{t:S}=le(),[N,T]=l().useState(a.length-x.length);l().useEffect((()=>{E((()=>T(a.length-x.length)))}),[a,x]);const I=l().useMemo((()=>!w),[w]),R=l().useMemo((()=>!C&&!!(i||o||g||y)),[C,i,o,g,y]),O={[`${r}__alert`]:!0};return I?l().createElement("div",{className:ve()(O)},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.InfoCircleFilled,null)),l().createElement("span",null,S("qm.table.alert.total",{total:b?v.size:t}),g?`,${S("qm.table.alert.selected",{total:Math.max(N,0)})}`:""),R&&l().createElement("em",{onClick:()=>{c(),d(),u(),m(),p(),E((()=>s())),h({})}},S("qm.table.alert.clear"))):null},di=l().forwardRef(((e,t)=>{const{isFullScreen:n,open:r=!0}=e,{prefixCls:a,setFullScreen:i}=l().useContext(Ha),{t:o}=le(),s=()=>{i(!n)};return l().useImperativeHandle(t,(()=>({clickHandle:s}))),r?l().createElement("span",{className:`${a}-full-screen`,title:o(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},n?l().createElement(Ee.FullscreenExitOutlined,null):l().createElement(Ee.FullscreenOutlined,null))):null}));di.displayName="FullScreen";const ui=di,mi=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,getTableData:a}=l().useContext(Ha),{t:i}=le(),o=()=>{a()};return l().useImperativeHandle(t,(()=>({clickHandle:o}))),n?l().createElement("span",{className:`${r}-reload`,title:i("qm.table.refresh.text"),onClick:()=>o()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.ReloadOutlined,null))):null}));mi.displayName="Reload";const pi=mi,hi=()=>{const e={dateFormat:e=>{const t=e?c()(e).format(ja):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?c()(e).format(Wa):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?c()(e).format(Wa.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>nr(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>rr(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")},t=(t,n,r)=>{const{dictItems:a,precision:i,displayPrecision:l,formatType:o,editRender:s}=n,c=a||s?.(r,n)?.items||[];let d=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(d=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),i>=0&&""!==d&&(d=nr(d)?new(Ra())(d).toFixed(i):d),l>=0&&""!==d&&(d=ar(d,l)),o){const t=e[`${w(o)}Format`];t?d=t(d):ue("Table","字段的格式化类型 `formatType` 配置不正确")}return d},n=e=>sr(e).join("");return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,a,i)=>{const l=Jn(e,r.dataIndex),o=r.render?r.render(l,e,r,a,i):t(l,r,e);return n(o)}}},fi=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{global:a}=l().useContext(o),{tableRef:i,prefixCls:s,flattenColumns:c,summationRows:d,showSummary:u,createGroupData:m,getSpan:p}=l().useContext(Ha),{tablePrint:f,showHeader:y}=i.current.props,{t:b}=le(),{getTitleFromCellValue:v}=hi(),x=a?.print?.leftLogo??"",E=a?.print?.rightLogo??"",w=!(!x&&!E),C=l().useMemo((()=>T(zn(n,[ai.expandableColumn,ai.selectionColumn,ai.operationColumn]))),[n]),S=l().useMemo((()=>T(zn(c,[ai.expandableColumn,ai.selectionColumn,ai.operationColumn]))),[c]),N=l().useMemo((()=>T(n.filter((e=>e.printFixed)))),[n]),I=e=>{const t=Object.assign({},pr(C,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?I(t):t},R=(e,t)=>(0,h.map)((0,h.groupBy)((0,h.flatten)(e),t),(0,h.spread)(((...e)=>(0,h.mergeWith)(...e,((e,n)=>{if(Array.isArray(e))return R(e.concat(n),t)}))))),O=()=>{const e=(e=>{const t=[];let n=[],r=0,a=0;for(;a<e.length;){const i=e[a],l=c.find((e=>e.dataIndex===i.dataIndex));i.width=l.width||l.renderWidth||ai.defaultColumnWidth,r+=i.width||i.renderWidth,r<=ai.printWidth?(n.push(i),a===e.length-1&&t.push(n),a++):a>0?(e.splice(0,a),N.length&&e.unshift(...N),t.push(n),n=[],r=0,a=0):(i.width=ai.printWidth,n.push(i),t.push(n),a++)}return t})([...S]),t=(e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(I(e))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const n=e.filter((e=>e.dataIndex===t));return n.length<=1?n[0]:R(n,"dataIndex")[0]})))(n),t.push(Bn(n))})),t})(e);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("");const{isTreeTable:r,tableFullData:a}=i.current;for(let i=0;i<e.length;i++)n+=k(t[i],e[i],r?a:m(a)),n+='<div class="page-break"></div>';return n+"</body></html>"},k=(e,t,n)=>{const{showLogo:r=!0}=f;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,y&&(a+=["<thead>",r&&w?`<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">',x?`<img src="${x}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',E?`<img src="${E}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${cr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(a+=`<tbody>${Vn(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:a,colSpan:i}=p(e,t,e.index,r,n);if(!a||!i)return null;const{dataIndex:l,outputRender:o}=t;return`<td rowspan="${a}" colspan="${i}">${0===r&&e._level?`<span style="padding-left:${e._level*ai.treeTable.textIndent}px"></span>`:""}${o?o(Jn(e,l),e,t,e.index,r):v(e,t,e.index,r)}</td>`})).join("")}</tr>`)).join("")}</tbody>`),u&&d.length&&(a+=["<tfoot>",d.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(n):Jn(e,`${a}_text`);return`<td>${0===r&&""===l?b("qm.table.config.summaryText"):g(l)?sr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},L=()=>{((e,t)=>{const{filename:n,type:r,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!a)return Promise.resolve({type:r,content:t,blob:e});qt(e,i)}})(0,O())?.then((({content:e,blob:t})=>{let n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),i.current.isIE?(n.contentDocument.write(e),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(t))}))};return l().useImperativeHandle(t,(()=>({clickHandle:L}))),r?l().createElement("span",{className:`${s}-print`,title:b("qm.table.print.text"),onClick:()=>L()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.PrinterOutlined,null))):null}));fi.displayName="TablePrint";const gi=fi,yi=require("exceljs");var bi=r.n(yi);const vi="606060",xi="thin",Ei="d4d4d4",wi=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Ci=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Si=()=>({top:{style:xi,color:{argb:Ei}},left:{style:xi,color:{argb:Ei}},bottom:{style:xi,color:{argb:Ei}},right:{style:xi,color:{argb:Ei}}}),Ni=e=>{const{children:t}=e;return t&&t.length?Ni(t[0]):e},Ti=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},Ii=()=>{const{tableRef:e,tableRowHeight:t,getSpan:n,showSummary:r,isHeadGroup:a}=l().useContext(Ha),{spanMethod:i,showHeader:o}=e.current.props,{t:s}=le(),c=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(e,l,c,d)=>{const{columns:u,footSummation:m}=e,p=Fn(u),h=Bn(u),f=[],y=[],b=[],v=[];let x=0;const E={};p.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;E[t]=cr(e.title),b.push({key:t,width:(n||r||ai.defaultColumnWidth)/8})})),o&&(a?h.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:a}=e,i=Ni(e),l=p.findIndex((({dataIndex:e})=>e===i.dataIndex));n[i.dataIndex]=cr(e.title),0!==r&&(r>1||a>1)&&v.push({s:{r:t,c:l},e:{r:t+a-1,c:l+r-1}})})),f.push(n)})):(p.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&v.push({s:{r:x,c:t},e:{r:x+r-1,c:t+n-1}})})),f.push(E)),x+=f.length);const w=Vn(l).map(((e,t)=>{const r={};return p.forEach(((a,o)=>{if("function"==typeof i){const{rowSpan:r,colSpan:i}=n(e,a,t,o,l);(i>1||r>1)&&v.push({s:{r:t+x,c:o},e:{r:t+x+r-1,c:o+i-1}})}const s=["percent","finance"].includes(a.formatType);r[a.dataIndex]=s?Jn(e,a.dataIndex):d(e,t,a,o)})),r._level=e._level,r}));x+=w.length,r&&m&&c(p,l).forEach(((e,t)=>{const n={};p.forEach(((t,r)=>{const{dataIndex:a,summation:i}=t,o=i?.render?i.render(l):Jn(e,a);n[a]=0===r&&""===o?s("qm.table.config.summaryText"):g(o)?sr(o).join(""):o})),y.push(n)}));const{sheetName:C,useStyle:S}=e,N=new(bi().Workbook),T=N.addWorksheet(C);T.columns=b,o&&T.addRows(f).forEach((e=>{S&&wi(e,t),e.eachCell((e=>{const t=T.getColumn(e.col),n=$n(u,t.key),{align:r,theadAlign:a}=n;Ci(e,a||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:vi}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Si()})}))})),T.addRows(w).forEach(((e,n)=>{const{_level:r}=w[n];S&&wi(e,t),e.eachCell((e=>{const t=T.getColumn(e.col),n=$n(u,t.key),{align:a}=n;Ci(e,a),Object.assign(e,Ti(n)),S&&Object.assign(e,{font:{color:{argb:vi}},border:Si()}),1===Number(e.col)&&r&&(e.alignment={...e.alignment,indent:r})}))})),r&&m&&T.addRows(y).forEach((e=>{S&&wi(e,t),e.eachCell((e=>{const t=T.getColumn(e.col),n=$n(u,t.key),{align:r}=n;Ci(e,r),Object.assign(e,Ti(n)),S&&Object.assign(e,{font:{color:{argb:vi}},border:Si()})}))})),v.forEach((({s:e,e:t})=>{T.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const I=await N.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const n=(e=>{const t=document.createElement("div");t.innerHTML=e.trim();const n=t.querySelector("table");if(!n)throw new Error("Invalid table HTML input.");return n})(t),r="\ufeff"+(e=>Array.from(e.rows).map((e=>Array.from(e.cells).map((e=>((e,t)=>{const n=e.replace(/"/g,'""');return"string"===t?`"=""${n}"""`:"number"===t?n:n.includes(",")||n.includes("\r")||n.includes("\n")?`"${n}"`:n})(e.textContent?.trim()??"",e.getAttribute("data-type")))).join(","))).join("\r\n"))(n);return new Blob([r],{type:"text/csv;charset=utf-8"})},importXLSX:(e,t)=>{const{columns:n,file:r}=e,a=Fn(n),i=new FileReader;i.onerror=()=>{K.message.error(s("qm.table.import.error"))},i.onload=e=>{const n=a.map((e=>cr(e.title))),r=new(bi().Workbook),i=e.target;i?r.xlsx.load(i.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],o=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,l);if(o){const r=e.slice(i+1).map((e=>{const t={};e.forEach(((e,n)=>{let r=e;Array.isArray(r?.richText)&&(r=r.richText.map((e=>e.text)).join("")),(0,h.isPlainObject)(r)&&"text"in r&&(r=r.text),(0,h.isDate)(r)&&(r=lr(r,Wa)),r?.formula&&(r=r.result??r.value),t[l[n]]=r}));const r={};return n.forEach(((e,n)=>{const{dataIndex:i,dictItems:l}=a[n];Array.isArray(l)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>c(l,e))).filter((e=>""!==e)):t[e]=c(l,t[e])),er(r,i,t[e])})),r}));t?.(r)}else K.message.error(s("qm.table.import.error"))}else K.message.error(s("qm.table.import.error"))})):K.message.error(s("qm.table.import.error"))},i.readAsArrayBuffer(r)}}},Ri=e=>{const{fileType:t,onChange:n}=e,{prefixCls:r}=l().useContext(Ha),{t:a}=le();let i,o;const s=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}};return l().createElement(he,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return i||(i=document.createElement("form"),o=document.createElement("input"),i.className=`${r}--file-form`,o.name="file",o.type="file",i.appendChild(o),document.body.appendChild(i)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=l=>{const{files:c}=l.target,d=c[0];let u="";if(!r)for(let e=0;e<c.length;e++){const{type:n}=s(c[e]);if(t.type!==n){u=n;break}}u?(K.message.warning(a("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(i),i=null,o=null},i.reset(),o.click()}))})({type:t});n?.(e.name,e)}catch(e){}})()},a("qm.upload.text"))},Oi=e=>{const{columns:t,onClose:n}=e,{tableRef:r,prefixCls:a,createTableData:i,dataChange:o}=l().useContext(Ha),{beforeTableImport:s}=r.current.props,{t:c}=le(),{importXLSX:d}=Ii(),u=l().useRef(null),[m,p]=l().useState(!1),[h,f]=l().useState(!0),g=e=>e.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(e.dataIndex))),y={posIndex:"条"},[b,v]=l().useState([{type:"INPUT",label:c("qm.table.export.fileName"),fieldName:"fileName",render:(e,t)=>{const{fileName:n}=t.GET_FIELDS_VALUE(["fileName"]);return l().createElement(l().Fragment,null,n?l().createElement("span",null,n):l().createElement(Ri,{fileType:t.state.formData.fileType,onChange:(e,n)=>{t.SET_FIELDS_VALUE({fileName:e,file:n}),n&&f(!1)}}))}},{type:"SELECT",label:c("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:c("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:c("qm.table.import.fillText"),value:"fill"},{text:c("qm.table.import.addText"),value:"add"},{text:c("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{b.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,"insert"===e&&u.current.SET_FIELDS_EXTRA(y),v([...b])}},{type:"INPUT_NUMBER",label:c("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:0,max:r.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]);return l().createElement("div",{className:`${a}-import__setting`},l().createElement(Nm,{ref:u,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:y,items:b,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(he,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(he,{type:"primary",loading:m,disabled:h,onClick:()=>(async()=>{const[e,a]=await u.current.GET_FORM_DATA();e||(p(!0),d({columns:g(t),file:a.file},(async e=>{const{tableFullData:t,store:l}=r.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=await s(e)}catch(e){}if("fill"===a.importType&&i(e),"add"===a.importType&&i([...t,...e]),"insert"===a.importType){const n=a.posIndex,r=t.slice(0,n).concat(e).concat(t.slice(n));i(r)}e.forEach((e=>{l.addToInserted(e)})),o(),K.message.success(c("qm.table.import.success",{total:e.length})),p(!1),n()})))})()},c("qm.table.import.text"))))},ki=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{prefixCls:a}=l().useContext(Ha),{t:i}=le(),[o,s]=l().useState(!1),c=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:c})));const d={[`${a}-import`]:!0},u={visible:o,title:i("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:ve()(d),title:i("qm.table.import.textNoSpace"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.ImportOutlined,null))),l().createElement(yn,u,l().createElement(Oi,{columns:n,onClose:()=>s(!1)})))}));ki.displayName="TableImport";const Li=ki,Pi=require("rc-trigger");var Ai=r.n(Pi);const Fi=e=>{const{columns:t,onChange:n}=e,{prefixCls:r,$size:a}=l().useContext(Ha),{t:i}=le(),o=l().useRef([]),[s,c]=l().useState(!1),[d,u]=l().useState(t);qe((()=>{p()}),[d]),l().useEffect((()=>{m()}),[t]);const m=()=>{const e=[];t.forEach(((n,r)=>{const a=n.colSpan;a>1&&t.slice(r+1,r+a).every((({colSpan:e})=>0===e))&&e.push(t.slice(r,r+a))})),o.current=e},p=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const a=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===a)return e.push(t);e.push(...o.current[a].map((({dataIndex:e},n)=>{const r=d.find((t=>t.dataIndex===e));return n>0&&void 0!==t.hidden&&(r.hidden=t.hidden),r})))})),n?.(e)},f={[`${r}__popper`]:!0,"column-filter__popper":!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a},g=[`${r}-column-filter`,{selected:s}];return l().createElement(Ai(),{action:["click"],popupVisible:s,popup:l().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"main"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:d,setList:e=>{const t=e.map((e=>e.dataIndex)),n=d.map((e=>e.dataIndex));(0,h.isEqual)(t,n)||u(yr(e))}},d.map((e=>(e=>{const{colSpan:t}=e;if(0===t)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const n=["svgicon","handle","main-handle"];return l().createElement("li",{key:e.dataIndex,className:"item"},l().createElement(K.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,u([...d])}}),l().createElement("i",{className:ve()(n),title:i("qm.table.columnFilter.draggable")},l().createElement(Ee.HolderOutlined,null)),l().createElement("span",{className:"text"},cr(e.title)))})(e)))))),popupClassName:ve()(f),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Ua,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:ve()(g),title:i("qm.table.columnFilter.text")},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.SettingOutlined,null)),l().createElement("span",null,i("qm.table.columnFilter.text"))))},_i=e=>{const{defaultValue:t,onClose:n,onOk:r}=e,{tableRef:a,prefixCls:i,selectionKeys:o,pagination:s,showSummary:d}=l().useContext(Ha),{rowSelection:u}=a.current.props,{t:m}=le(),p=l().useRef(null),[h,f]=l().useState(!1),g=l().useMemo((()=>Object.assign({},{fileName:`${c()().format(Ba)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:d?1:0,useStyle:0},t,{columns:T(t.columns||[])})),[]),[y,b]=l().useState([{type:"INPUT",label:m("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:m("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:m("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:m("qm.table.export.all"),value:"all"},{text:m("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==u?.type},{text:m("qm.table.export.custom"),value:"custom"}]},onChange:e=>{y.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...y])}},options:{min:1},disabled:!0},{type:"INPUT",label:m("qm.table.columnFilter.text"),fieldName:"columns",render:(e,t)=>l().createElement(Fi,{columns:t.state.formData.columns,onChange:e=>{t.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:m("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!d,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:m("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return l().createElement("div",{className:`${i}-export__setting`},l().createElement(Nm,{ref:p,initialValues:g,items:y,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(he,{onClick:()=>n(),style:{marginRight:8}},m("qm.table.export.closeButton")),l().createElement(he,{type:"primary",loading:h,onClick:()=>(async()=>{const[e,t]=await p.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);r(t),await x(1e3),f(!1),n()}})()},m("qm.table.export.text"))))},qi=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{global:a}=l().useContext(o),{tableRef:i,prefixCls:s,flattenColumns:d,pagination:u,fetchParams:m,isFetch:p,showSummary:f,getSpan:y}=l().useContext(Ha),{exportExcel:b,fetch:v,showHeader:x}=i.current.props,{t:E}=le(),{getTitleFromCellValue:w}=hi(),[C,S]=l().useState(!1),[N,T]=l().useState(!1),I=l().useMemo((()=>!!b?.fetch?.api),[b]),R=l().useMemo((()=>!u.total||N),[u.total,N]),O=l().useMemo((()=>zn(n,[ai.expandableColumn,ai.selectionColumn,ai.operationColumn])),[n]),k=l().useMemo((()=>zn(d,[ai.expandableColumn,ai.selectionColumn,ai.operationColumn])),[d]),L=(e,t="",n=0)=>e.map(((e,r)=>{const a={...e,index:r,pageIndex:r},i=t?`${t}.${a.index+1}`:`${a.index+1}`;return a.indexPath=i,a._level=n,Array.isArray(e.children)&&(a.children=L(e.children,i,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&er(a,t,Jn(a,t))})),a})),P=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,a=t.reduce(((e,t)=>{if(t?.[ai.summaryIgnore])return e;const n=Number(Jn(t,r));return Number.isNaN(n)?e:e+n}),0);er(n,r,a)})),[n]},A=(e,t,n,r)=>{const{dataIndex:a,precision:i,formatType:l,outputRender:o}=n;if(o)return o(Jn(e,a),e,n,t,r);let s=w(e,n,t,r);return i>=0&&!l&&""!==s&&(s=Number(s)),s},{exportXLSX:F,exportCSV:_}=Ii(),q=async e=>{const{api:t,formatter:n=e=>e,afterFetch:r,dataKey:a}=v;let i=[];try{T(!0);const l={[ai.currentPageName]:1,[ai.pageSizeName]:e??u.total},o=await t({...n({...m,...l}),...l});if(200===o.code){let e=Array.isArray(o.data)?o.data:(0,h.get)(o.data,a)??[];e="function"==typeof r?await r(e):e,i=L(e)}}catch(e){}return T(!1),i},D=e=>{const t=a?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},H=(e,t)=>{const n={text:"string",textarea:"string",number:"number",date:"date"};return t&&n[t]?n[t]:typeof e},$=b?.fileName??`${c()().format(Ba)}.xlsx`,M=$.slice($.lastIndexOf(".")+1).toLowerCase(),z=()=>{if(R)return K.message.warning(E("qm.table.export.warnText"));I?(async e=>{T(!0);try{const{api:t,params:n}=b.fetch,r=await t({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:a}=e.filter||{};return{title:t,dataIndex:n,type:a,hidden:r}})),...m,...n,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[ai.currentPageName]:void 0,[ai.pageSizeName]:void 0});r.data&&(qt(r.data,e),D(e))}catch(e){}T(!1)})($):S(!0)};l().useImperativeHandle(t,(()=>({clickHandle:z})));const V={[`${s}-export`]:!0},j={visible:C,title:E("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},W={fileName:$.slice(0,$.lastIndexOf(".")),fileType:M,columns:O,useStyle:b?.cellStyle?1:0};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:ve()(V),title:E("qm.table.export.textNoSpace"),onClick:()=>z()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.DownloadOutlined,null))),l().createElement(yn,j,l().createElement(_i,{defaultValue:W,onClose:()=>S(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:n,exportType:r,startIndex:a=1,endIndex:l}=e,{tableFullData:o,selectionRows:s}=i.current;let c=[];if(p?("all"===r&&(c=await q()),"custom"===r&&(c=await q(l),c=c.slice(a-1))):("all"===r&&(c=o.slice(0)),"custom"===r&&(c=o.slice(a-1,l||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof b?.beforeExport)try{c=b?.beforeExport(c)}catch(e){}if("xlsx"===n){const n=await F(e,c,P,A);qt(n,`${t}.xlsx`),D(`${t}.xlsx`)}if("csv"===n){const n=_(e,((e,t)=>{const{columns:n,footSummation:r}=e,a=Fn(n);let i='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${a.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,x&&(i+=["<thead>","<tr>",a.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${cr(e.title)}</th>`})).join(""),"</tr>","</thead>"].join("")),t.length&&(i+=`<tbody>${Vn(t).map((e=>`<tr>${a.map(((n,r)=>{const{rowSpan:a,colSpan:i}=y(e,n,e.index,r,t);if(!a||!i)return null;const l=A(e,e.index,n,r);return`<td rowspan="${a}" colspan="${i}" data-type="${H(l,n.filter?.type)}">${l}</td>`})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(i+=["<tfoot>",P(a,t).map((e=>`<tr>${a.map(((n,r)=>{const{dataIndex:a,summation:i}=n,l=i?.render?i.render(t):Jn(e,a);return`<td>${0===r&&""===l?E("qm.table.config.summaryText"):g(l)?sr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i})(e,c));qt(n,`${t}.csv`),D(`${t}.csv`)}})(Object.assign({},e,{columns:_n(e.columns)}))}})))}));qi.displayName="TableExport";const Di=qi,Hi=e=>{const{columns:t,onClose:n}=e,{tableRef:r,tableBodyRef:a,prefixCls:i,dataChange:o}=l().useContext(Ha),{beforeClipboard:s}=r.current.props,{t:c}=le(),d=l().useRef(null),[u,m]=l().useState([{type:"INPUT_NUMBER",label:c("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:c("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:t.map(((e,t)=>({value:t,text:cr(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:c("qm.table.clipboard.content"),fieldName:"content",placeholder:c("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[p,h]=l().useState(!1);return l().createElement("div",{className:`${i}-clipboard__setting`},l().createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),l().createElement(Nm,{ref:d,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:u,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(he,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(he,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,i]=await d.current.GET_FORM_DATA();if(e)return;const{tableFullData:l,store:u,fieldAuth:m}=r.current;h(!0);const p=i.content.trim().replace(/(\r|\n)$/,"");let f=p.replace(/"[^"]+"/g,"^");(p.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{f=f.replace(/\^/,e)}));let g=f.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{g=await s(g,g[0].map(((e,n)=>t[i.colIndex+n].dataIndex)))}catch(e){}g.forEach(((e,n)=>{e.forEach(((e,r)=>{const a=l[i.rowIndex-1+n],o=t[i.colIndex+r];if(a&&o){let t=!1;if(o.editRender){const e=o.editRender(a,o);t=!(e.disabled||e.extra?.disabled||m[o.dataIndex]?.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&(er(a,o.dataIndex,e),u.addToUpdated(a))}}))})),a.current.forceUpdate(),o(),K.message.success(c("qm.table.clipboard.success",{total:g.length})),h(!1),n()})()},c("qm.table.clipboard.text"))))},$i=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,flattenColumns:a}=l().useContext(Ha),{t:i}=le(),[o,s]=l().useState(!1),c=l().useMemo((()=>(e=>e.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(e.dataIndex))))(a)),[a]),d=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:d})));const u={[`${r}-clipboard`]:!0},m={visible:o,title:i("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:ve()(u),title:i("qm.table.clipboard.textNoSpace"),onClick:()=>d()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.CopyOutlined,null))),l().createElement(yn,m,l().createElement(Hi,{columns:c,onClose:()=>s(!1)})))}));$i.displayName="TableClipboard";const Mi=$i,Ki=e=>{const{columns:t,onClose:n}=e,{tableRef:r,$size:a,selectionKeys:i,setSelectionKeysEffect:o}=l().useContext(Ha),{rowKey:s,rowSelection:c}=r.current.props,{t:d}=le(),u=l().useRef(null),m=vt(u),p=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=p(e.children)),t})),[h,f]=l().useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(t.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(e.dataIndex))))]),[g]=l().useState((()=>{const{disabled:e}=c||{},t=r.current.selectionRows.map((e=>({...e,children:void 0})));return e?t.filter((t=>!e(t))):t})()),[y,b]=l().useState(300),v=Et((()=>{const e=u.current;b(e.offsetHeight-2*Da[a]-30)}),5);return xt((()=>{v()}),[m.width]),l().createElement("div",{ref:u,style:{height:"100%"}},l().createElement(Tc,{size:a,columns:h,dataSource:g,rowKey:s,height:y,rowSelection:{type:"checkbox",selectedRowKeys:i,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),l().createElement("div",{style:{height:10}}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(he,{onClick:()=>n()},d("qm.table.selectCollection.closeButton"))))},zi=l().forwardRef(((e,t)=>{const{columns:n,open:r=!0}=e,{tableRef:a,getRowKey:i,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=l().useContext(Ha),{rowSelection:p}=a.current.props,{t:f}=le(),[g,y]=l().useState(!1),b=l().useRef(!1);qe((()=>{!b.current&&v()}),[d]);const v=async()=>{const{fetchSelectedRows:e,disabled:t=e=>!1}=p;if(c&&e)try{const n=await e.api(Object.assign({},{selectedKeys:s},e.params));if(200===n.code){let r=Array.isArray(n.data)?n.data:(0,h.get)(n.data,e.dataKey)??[];r=r.filter((e=>!t(e))),u(r.map(((e,t)=>i(e,t)))),m(r),b.current=!0}}catch(e){}},x=()=>{y(!0)};l().useImperativeHandle(t,(()=>({clickHandle:x})));const E={visible:g,title:f("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>y(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${o}-select-collection`,title:f("qm.table.selectCollection.text"),onClick:()=>x()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.CheckSquareOutlined,null))),l().createElement(yn,E,l().createElement(Ki,{columns:n,onClose:()=>y(!1)})))}));zi.displayName="SelectCollection";const Vi=zi,ji=require("localforage");var Wi=r.n(ji);const Bi=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,getRowKey:a,prefixCls:i,$size:s,tableFlatData:c,flattenColumns:d,setActivedCell:u,scrollXToColumn:m,scrollYToRecord:p}=l().useContext(Ha),{uniqueKey:h}=r.current.props,{t:f}=le(),{getTitleFromCellValue:g}=hi(),y=l().useRef(""),[b,v]=l().useState(""),[x,E]=l().useState([]),[w,C]=l().useState(0),[S,N]=l().useState(!1),[T,I]=l().useState({case:0,fullchar:0}),R=l().useMemo((()=>`${x.length>0?w+1:w}/${x.length}`),[w,x]);qe((()=>{A(x[w])}),[w,x]);const O=e=>{I(Object.assign({},T,e))},k=(e,t,n)=>new Promise(((r,a)=>{K.Modal.confirm({title:f("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),L=oe((async e=>{if(!b)return y.current=b,P();const t=((e,t)=>{const n=new RegExp(T.fullchar?`^${t}$`:t,T.case?"":"i"),r=[];return e.forEach(((e,t)=>{d.forEach(((i,l)=>{const{dataIndex:o}=i;if([ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(o))return;const s=g(e,i,e.index,l);n.test(s)&&r.push({value:s,rowKey:a(e,e.index),dataIndex:o,rowIndex:t,colIndex:l})}))})),r})(c,b);if(!t.length)return K.Modal.warning({title:f("qm.button.confirmPrompt"),content:f("qm.table.fastSearch.notMatch")});if(E(t),"all"===e&&N(!0),b!==y.current)return y.current=b,C(0);if("next"===e){const e=w+1;e>t.length-1?await k(f("qm.table.fastSearch.toTheEnd"),(()=>C(0)),(()=>{})):C(e)}if("prev"===e){const e=w-1;e<0?await k(f("qm.table.fastSearch.toStart"),(()=>C(t.length-1)),(()=>{})):C(e)}})),P=()=>{C(0),E([]),u({})},A=e=>{e&&(p(e.rowKey),m(e.dataIndex),u(e))},F=l().useMemo((()=>h?`fastSearch_${h}`:""),[h]),[_,q]=l().useState([]),[D,H]=l().useState(""),[$,M]=l().useState("");qe((()=>{if($){const{input:e,config:t}=_.find((e=>e.value===$)).condition;v(e),I(t),setTimeout((()=>L()))}}),[$]),l().useEffect((()=>{z()}),[]);const z=async()=>{if(!F)return;let e=await Wi().getItem(F);e||(e=await V(F),Array.isArray(e)&&await Wi().setItem(F,e)),Array.isArray(e)&&e.length&&q(e)},V=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},j=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}};return l().createElement("div",{className:`${i}-fast-search__setting`},l().createElement("div",{className:"main"},l().createElement("div",{className:"container"},l().createElement("div",{className:"search-box"},l().createElement("span",{className:"label"},f("qm.table.fastSearch.queryLabel"),":"),l().createElement(K.Input,{value:b,placeholder:f("qm.table.fastSearch.queryCondition"),allowClear:!0,style:{flex:"auto",width:"auto"},onChange:e=>v(e.target.value)})),l().createElement("div",{className:"condition"},l().createElement(K.Checkbox,{checked:!!T.case,onChange:e=>O({case:e.target.checked})},f("qm.table.fastSearch.matchCase")),l().createElement(K.Checkbox,{checked:!!T.fullchar,onChange:e=>O({fullchar:e.target.checked})},f("qm.table.fastSearch.matchFullchar"))),l().createElement("div",{className:"all-list"},S&&l().createElement("table",{className:"rtable",tabIndex:-1,cellSpacing:"0",cellPadding:"0"},l().createElement("thead",null,l().createElement("tr",null,l().createElement("th",{style:{width:40,minWidth:40}},"#"),l().createElement("th",{style:{width:130,minWidth:130}},f("qm.table.fastSearch.cellText")),l().createElement("th",null,f("qm.table.fastSearch.valText")))),l().createElement("tbody",null,x.map(((e,t)=>l().createElement("tr",{key:t,className:ve()({active:w===t}),onClick:()=>C(t)},l().createElement("td",null,t+1),l().createElement("td",null,"Row:",e.rowIndex+1,", Col:",e.colIndex+1),l().createElement("td",null,e.value)))))))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(K.Input,{size:s,value:D,placeholder:f("qm.table.highSearch.configText"),disabled:!b,onChange:e=>{const{value:t}=e.target;H(t)}}),l().createElement(he,{type:"primary",disabled:!D||!b,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!F)return ue("Table","必须设置组件参数 `uniqueKey` 才能保存");if(!b)return;const e=or(),t=[..._,{text:D,value:e,condition:{input:b,config:T}}];q(t),H(""),await Wi().setItem(F,t),await j(F,t)})()},f("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${ai.rowHeightMaps[s]}px`}},l().createElement("span",null,f("qm.table.fastSearch.savedSetting"))),l().createElement("ul",null,_.map((e=>l().createElement("li",{key:e.value,className:ve()({selected:e.value===$}),title:e.text,onClick:()=>{return t=e.value,void M(t!==$?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:f("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=_.filter((t=>t.value!==e));q(t),await Wi().setItem(F,t),await j(F,t)})(e.value)}},l().createElement(Ee.CloseCircleOutlined,null))))),!_.length&&l().createElement("div",{style:{padding:Ka}},l().createElement(ct,null)))))),l().createElement("div",{className:"bottom-bar",style:{position:"absolute",left:0,bottom:0,right:0,height:`${Da[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",boxSizing:"border-box"}},l().createElement("div",null,f("qm.table.fastSearch.findTotal",{total:R})),l().createElement("div",null,l().createElement(he,{onClick:()=>L("all"),style:{marginRight:8}},f("qm.table.fastSearch.queryAll")),l().createElement(he,{type:"primary",onClick:()=>L("prev"),style:{marginRight:8}},f("qm.table.fastSearch.queryPrev")),l().createElement(he,{type:"primary",onClick:()=>L("next"),style:{marginRight:8}},f("qm.table.fastSearch.queryNext")),l().createElement(he,{onClick:()=>t()},f("qm.table.fastSearch.closeButton")))))},Ui=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,$size:a}=l().useContext(Ha),{t:i}=le(),[o,s]=l().useState(!1),c=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:c})));const d={visible:o,title:i("qm.table.fastSearch.settingTitle"),width:650,loading:!1,bodyStyle:{paddingBottom:`${Da[a]+20}px`},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${r}-super-search`,title:i("qm.table.fastSearch.text"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.MonitorOutlined,null))),l().createElement(yn,d,l().createElement(Bi,{onClose:()=>s(!1)})))}));Ui.displayName="FastSearch";const Gi=Ui,Yi={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:60,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"},Xi=e=>[Yi.selectionColumnDefine,...e].filter((e=>!e.hidden)),Qi=e=>e.some((e=>Array.isArray(e.children))),Zi=e=>void 0!==e._groupLevel,Ji=(e,t)=>t.split(Yi.separator).reduce(((e,t)=>e?.[t]),e),el=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(el)):0,tl=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const a=t?`${t}${Yi.separator}${r}`:r;if(n.push(a),Array.isArray(e[r]))return n;const i=tl(e[r],a);return n.concat(i)}),[]),nl={sum:e=>e.reduce(((e,t)=>isNaN(Number(t))?e:e+Number(t)),0),avg:e=>e.length?(e.reduce(((e,t)=>isNaN(Number(t))?e:e+Number(t)),0)/e.length).toFixed(2):"",max:e=>e.length?Math.max(...e):"",min:e=>e.length?Math.min(...e):"",count:e=>e.length,unique:e=>new Set(e).size,empty:e=>e.filter((e=>C(e))).length,notEmpty:e=>e.filter((e=>!C(e))).length},rl=l().createContext(void 0),al=e=>{const{prefixCls:t,pivotProps:n,size:r,getRowKey:a,flatColumns:i,tableData:o}=e,{initialGroup:s,initialCount:c,initialFilter:d,initialSorter:u}=n,m=e=>{const t=new Map;return Vn(e).forEach((e=>t.set(a(e,e.index),e))),t},p=l().useRef({props:n,originGridData:o,flatGroupData:[],isTree:Qi(o),keyRecordMap:m(o)}),[h,f]=l().useState({pivotRef:p,prefixCls:t,size:r,viewMode:"table",columns:i,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=i.map((e=>e.dataIndex));return e.forEach((e=>{n.includes(e.fieldName)&&["ascend","descend"].includes(e.order)&&t.push(e)})),t})(s):[],filterList:d?(e=>{const t=[],n=i.map((e=>e.dataIndex));for(const r in e){const[a,i]=r.split("|");if(n.includes(a)&&i){const n=e[r]||{};Object.keys(n).forEach((e=>{t.push({type:i,bracketLeft:"",fieldName:a,expression:e,value:xr(e)?null:n[e],bracketRight:"",logic:"and"})}))}}return t})(d):[],sorterList:u?(e=>{const t=[],n=i.map((e=>e.dataIndex));for(const r in e)n.includes(r)&&["ascend","descend"].includes(e[r])&&t.push({fieldName:r,order:e[r]});return t})(u):[],colorList:[],expandedKeys:[],searchResults:[],switchIndex:0,fillColorCells:new Map,countMethod:c?(e=>{const t=["count","unique","empty","notEmpty","sum","max","min","avg"],n=i.map((e=>e.dataIndex)),r={};for(const a in e)n.includes(a)&&t.includes(e[a])&&(r[a]=e[a]);return r})(c):{},summationData:{}}),g=e=>{f((t=>{const n={...t};let r=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};xt((()=>{v(o),y("originGridData",o),y("isTree",Qi(o)),y("keyRecordMap",m(o))}),[o]),xt((()=>{b(i)}),[i]),xt((()=>{g({size:r})}),[r]);const y=(e,t)=>{h.pivotRef.current[e]=t};y("props",n);const b=e=>{g({columns:e})},v=e=>{g({gridData:e})},x=e=>{g({groupGridData:e})},E=e=>{g({groupList:e})},w=e=>{g({filterList:e})},C=e=>{g({sorterList:e})},S=e=>{g({colorList:e})},N=e=>{g({expandedKeys:e})},T=e=>{g({searchResults:e})},I=e=>{g({switchIndex:e})},R=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),g({fillColorCells:t})},O=e=>{var t;g({countMethod:(t=Object.assign({},h.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},k=e=>{g({summationData:e})},L=l().useMemo((()=>({...h,setContext:g,getRowKey:a,setPivotGridRef:y,setColumns:b,setGridData:v,setGroupGridData:x,setGroupList:E,setFilterList:w,setSorterList:C,setColorList:S,setExpandedKeys:N,setSearchResults:T,setSwitchIndex:I,setFillColor:R,setCountMethod:O,setSummationData:k})),[h]);return l().createElement(rl.Provider,{value:L},e.children)},il=()=>l().useContext(rl),ll=()=>{const{prefixCls:e,pivotRef:t,groupList:n,columns:r,gridData:a,setGroupList:i,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=il(),{originGridData:d}=t.current,{onGroupChange:u,onDataChange:m}=t.current.props,{t:p}=le(),f=l().useRef([]),g=l().useRef([]),y=l().useMemo((()=>n.filter((e=>e.fieldName&&e.order))),[n]),b=l().useMemo((()=>r.map((e=>({label:cr(e.title),value:e.dataIndex,disabled:n.some((t=>t.fieldName===e.dataIndex))})))),[n,r]),v=l().useMemo((()=>{const e=y.map((e=>({[e.fieldName]:e.order})));return(0,h.isEqual)(e,f.current)?f.current:(f.current=e,e)}),[y]),x=[{label:p("qm.pivotGrid.group.ascend"),value:"ascend"},{label:p("qm.pivotGrid.group.descend"),value:"descend"}];l().useEffect((()=>{o(g.current)}),[v,d]),l().useLayoutEffect((()=>{const e=((e,t=[],n)=>{const r=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:a}]=t,i=Object.keys(t[0])[0],l=t.slice(1),o=Object.groupBy(e,(e=>n(e,i))),s=Object.keys(o).sort(((e,t)=>{const n=(r=e,i=t,Number.isNaN(r-i)?r.toString().localeCompare(i.toString()):r-i);var r,i;return"ascend"===a?n:-n})),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],l)})),c};return r(e,t)})(a,v,((e,t)=>{let n=Jn(e,t);return(0,h.isPlainObject)(n)&&(n=Object.values(n)),Array.isArray(n)&&(n=n.join(",")),C(n)?p("qm.pivotGrid.group.empty"):n}));var t;s(e),t=tl(e),g.current=t,c("flatGroupData",((e,t=[])=>{const n=[];return function e(r,a,i=""){if(Array.isArray(r))r.forEach(((e,t)=>{e._varIndex=t,i?e._parentRowKey=i:delete e._parentRowKey})),n.push(...Vn(r));else for(const l in r){const o=i?`${i}${Yi.separator}${l}`:l,s=Object.keys(t[a])[0];n.push({id:o,_fieldName:s,_groupLevel:a}),e(r[l],a+1,o)}}(e,0),n})(e,v))}),[v,a]),qe((()=>{u?.(y)}),[v]),qe((()=>{m?.(a)}),[a]);const E=()=>{i([...n,{fieldName:"",order:"ascend"}])},w=(e,t,r)=>{Object.assign(t,{[e]:r}),i([...n])};return l().createElement(K.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,p("qm.pivotGrid.group.title")),!!y.length&&l().createElement("div",null,l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},p("qm.pivotGrid.group.foldAll")),l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(g.current)},p("qm.pivotGrid.group.unfoldAll")))),l().createElement("div",{className:"list"},l().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));(0,h.isEqual)(t,r)||i(e)}},n.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(r=e,l().createElement(l().Fragment,null,l().createElement(Ee.HolderOutlined,{className:"icon handle"}),l().createElement(K.Select,{value:r.fieldName||void 0,placeholder:p("qm.table.editable.selectPlaceholder"),options:b,style:{width:160,margin:"0 10px"},onChange:e=>w("fieldName",r,e)}),l().createElement(K.Select,{value:r.order,options:x,placeholder:p("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:e=>w("order",r,e)}),l().createElement(Ee.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(n.filter((t=>t!==e)))})(r)}))));var r})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:E},l().createElement(Ee.PlusOutlined,{className:"icon"}),p("qm.pivotGrid.fillColor.add")))),className:ve()("action-btn",{active:!!y.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ee.FolderOpenOutlined,{className:"icon"}),p("qm.pivotGrid.group.text"),y.length?`(${y.length})`:null))},ol=()=>{const{prefixCls:e,pivotRef:t,columns:n,filterList:r,setFilterList:a,setGridData:i}=il(),{originGridData:o,isTree:s}=t.current,{onFilterChange:c}=t.current.props,{t:d}=le(),u=l().useRef([]),m=l().useMemo((()=>r.filter((e=>e.fieldName&&(xr(e.expression)||!C(e.value))))),[r]),p=l().useMemo((()=>n.map((e=>({label:cr(e.title),value:e.dataIndex})))),[n]),[f,g]=l().useState("and"),y=l().useMemo((()=>{const e=m.map((e=>`${e.fieldName},${e.expression},${e.value??""}`));return(0,h.isEqual)(e,u.current)?u.current:(u.current=e,e)}),[m]);qe((()=>{a(r.map((e=>({...e,logic:f}))))}),[f]),qe((()=>{v(),c?.(m)}),[y]),l().useEffect((()=>{m.length&&b()}),[]);const b=()=>{const e=ur(m.map((e=>({...N(e,["value"]),condition:e.value}))));i(e?An(o,e,s):o)},v=Et(b,200),x=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],E=()=>{a([...r,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:f}])},w=(e,t,i)=>{if(Object.assign(t,{[e]:i}),"fieldName"===e){const e=n.find((e=>e.dataIndex===i)).filter?.type||"text";Object.assign(t,{type:e,expression:S(e)[0].value,value:""})}"expression"===e&&xr(i)&&Object.assign(t,{value:""}),a([...r])},S=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:d("qm.table.highSearch.gtText")},{value:"<",label:d("qm.table.highSearch.ltText")},{value:">=",label:d("qm.table.highSearch.gteText")},{value:"<=",label:d("qm.table.highSearch.lteText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:d("qm.table.highSearch.inText")},{value:"nin",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:d("qm.table.highSearch.inText")},{value:"nlike",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"^=",label:d("qm.table.highSearch.startsWithText")},{value:"=$",label:d("qm.table.highSearch.endsWithText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}]}return t},T=e=>{switch(e.type){case"number":return l().createElement(K.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{w("value",e,C(t)?"":t)}});case"date":return l().createElement(U,{popupClassName:ai.popupClassName,defaultValue:ir(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{w("value",e,lr(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const t=n.find((t=>t.dataIndex===e.fieldName))?.dictItems||[];return l().createElement(K.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{w("value",e,t)}},t.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return l().createElement(K.Input,{value:e.value,style:{width:150},disabled:xr(e.expression),onChange:t=>{w("value",e,t.target.value)}})}};return l().createElement(K.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,d("qm.pivotGrid.filter.title")),!!m.length&&l().createElement(K.Select,{value:f,options:x,style:{width:130},onChange:e=>g(e)})),l().createElement("div",{className:"list"},r.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(K.Select,{value:n.fieldName||void 0,options:p,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:e=>w("fieldName",n,e)}),l().createElement(K.Select,{value:n.expression||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),options:S(n.type),style:{width:100,margin:"0 10px"},onChange:e=>w("expression",n,e)}),T(n),l().createElement(Ee.CloseOutlined,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(n)}))));var n}))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:E},l().createElement(Ee.PlusOutlined,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:ve()("action-btn",{active:!!m.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ee.FilterOutlined,{className:"icon"}),d("qm.pivotGrid.filter.text"),m.length?`(${m.length})`:null))},sl=()=>{const{prefixCls:e,pivotRef:t,columns:n,gridData:r,sorterList:a,setSorterList:i,setGridData:o}=il(),{onSorterChange:s}=t.current.props,{t:c}=le(),d=l().useMemo((()=>a.filter((e=>e.fieldName&&e.order))),[a]),u=l().useMemo((()=>n.map((e=>({label:cr(e.title),value:e.dataIndex,disabled:a.some((t=>t.fieldName===e.dataIndex))})))),[a,n]);qe((()=>{f(),s?.(d)}),[l().useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]),l().useLayoutEffect((()=>{d.length&&f()}),[]);const m=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],p=(e,t)=>"number"==typeof e&&"number"==typeof t?e-t:"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():0,f=()=>{var e,t;o((e=r,(t=d).length||(t=[{fieldName:"index",order:"ascend"}]),e.sort(((e,n)=>{for(const r of t){const{fieldName:t,order:a}=r,i=Jn(e,t),l=Jn(n,t),o=p(i,l);if(0!==o)return"ascend"===a?o:-o}return 0})).slice(0)))},g=()=>{i([...a,{fieldName:"",order:"ascend"}])},y=(e,t,n)=>{Object.assign(t,{[e]:n}),i([...a])};return l().createElement(K.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.sorter.title"))),l().createElement("div",{className:"list"},l().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.fieldName)),n=a.map((e=>e.fieldName));(0,h.isEqual)(t,n)||i(e)}},a.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(Ee.HolderOutlined,{className:"icon handle"}),l().createElement(K.Select,{value:n.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:e=>y("fieldName",n,e)}),l().createElement(K.Select,{value:n.order,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:e=>y("order",n,e)}),l().createElement(Ee.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(a.filter((t=>t!==e)))})(n)}))));var n})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:g},l().createElement(Ee.PlusOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:ve()("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ee.SortAscendingOutlined,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},cl=()=>{const{prefixCls:e,getRowKey:t,gridData:n,columns:r,searchResults:a,switchIndex:i,setSearchResults:o,setSwitchIndex:s}=il(),{t:c}=le(),{getTitleFromCellValue:d}=hi(),[u,m]=l().useState(!1),p=l().useMemo((()=>a.length),[a]);qe((()=>{u||setTimeout((()=>{s(0),o([])}),200)}),[u]);const h=(e,n)=>{const a=[];return e.forEach(((e,i)=>{r.forEach(((r,l)=>{const o=d(e,r,i,l)+"";o.includes(n)&&a.push({value:o,rowKey:t(e,e.index),dataIndex:r.dataIndex})})),Array.isArray(e.children)&&a.push(...h(e.children,n))})),a},f=Et((e=>{const t=e.target.value.trim();s(0),o(t?h(n,t):[])}),200),g=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&y()},y=()=>{p&&s((i+1)%p)};return l().createElement(K.Dropdown,{open:u,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.search.title")),l().createElement("button",{className:"button-icon",onClick:()=>m(!1)},l().createElement(Ee.CloseOutlined,null))),l().createElement("div",{className:"list search",style:{margin:"10px 0"}},l().createElement(K.Input,{autoFocus:!0,style:{width:280},suffix:l().createElement("div",{className:"search-switch"},l().createElement("button",{className:"button-icon",onClick:()=>{p&&s((i-1+p)%p)}},l().createElement(Ee.LeftOutlined,null)),l().createElement("span",{className:"num"},p>0?i+1:i,"/",p),l().createElement("button",{className:"button-icon",onClick:()=>y()},l().createElement(Ee.RightOutlined,null))),onChange:f,onKeyUp:g}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},l().createElement("span",{onClick:()=>m(!u)},l().createElement(Ee.MonitorOutlined,{className:"icon"}),c("qm.pivotGrid.search.text")))},dl=(e,t)=>e.map((e=>(e.children&&(e.children=dl(e.children,t)),t(e)))),ul=()=>{const{prefixCls:e,pivotRef:t,columns:n,setColumns:r}=il(),{uniqueKey:a,onColumnsChange:i}=t.current.props,{t:o}=le(),s=l().useMemo((()=>a?`grid_field_${a}`:""),[a]);l().useLayoutEffect((()=>{c()}),[]),qe((()=>{u(n)}),[n]);const c=()=>{const e=m();e&&i?.(e)},d=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=d(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}})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));(0,h.isEqual)(t,n)||localStorage.setItem(s,JSON.stringify(t))},m=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));return e?(0,h.xor)(e.map((e=>e.dataIndex)),n.map((e=>e.dataIndex))).length>0?dl(n,(t=>{const n=e.find((e=>e.dataIndex===t.dataIndex));return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):dl(e,(e=>{const t=n.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0},p=l().useMemo((()=>{let e=0;for(let t=0;t<n.length-1&&("left"!==n[t].fixed||n[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let r=0;r<n.length;r++)r===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(n[r]);return t}),[n]);return l().createElement(K.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},l().createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},l().createElement("span",null,o("qm.pivotGrid.field.title"))),l().createElement("div",{className:"list"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:p,setList:e=>{const t=e.map((e=>e.dataIndex)),n=p.map((e=>e.dataIndex));(0,h.isEqual)(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const a=e[r];r<t?a.fixed="left":delete a.fixed,r!==t&&n.push(a)}i?i(n):r(n)})(yr(e))}},p.map((e=>"__divider__"!==e.dataIndex?l().createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},l().createElement(Ee.HolderOutlined,{className:"handle"}),l().createElement("span",{className:"label"},l().createElement("span",{className:"title"},cr(e.title)),l().createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...n];i?i(t):r(t)})(e)},e.hidden?l().createElement(Ee.EyeInvisibleOutlined,null):l().createElement(Ee.EyeOutlined,null)))):l().createElement("li",{key:e.dataIndex,className:"divider"})))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},l().createElement("span",null,l().createElement(Ee.SettingOutlined,{className:"icon"}),o("qm.pivotGrid.field.text")))},ml=()=>{const{prefixCls:e,size:t,setContext:n}=il(),{t:r}=le(),a=[{label:r("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:r("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:r("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return l().createElement(K.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},a.map((e=>l().createElement("li",{key:e.value,className:ve()("ant-dropdown-menu-item check-item",{active:t===e.value}),onClick:()=>n({size:e.value})},l().createElement("span",{className:"label"},e.label),l().createElement("i",{className:"icon"},l().createElement(Ee.CheckOutlined,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},l().createElement("span",null,l().createElement(Ee.ColumnHeightOutlined,{className:"icon"}),r("qm.pivotGrid.lineHeight.text")))},pl="606060",hl="thin",fl="d4d4d4",gl=(e,t)=>{t&&(e.height=Math.floor(.75*t))},yl=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},bl=()=>({top:{style:hl,color:{argb:fl}},left:{style:hl,color:{argb:fl}},bottom:{style:hl,color:{argb:fl}},right:{style:hl,color:{argb:fl}}}),vl=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},xl=()=>{const{prefixCls:e,pivotRef:t,columns:n,countMethod:r,summationData:a}=il(),{t:i}=le(),{exportXLSX:o}=(()=>{const{size:e}=il(),{t}=le(),{rowHeightMaps:n}=ai,r=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(r,a,i,l)=>{const{columns:o,footSummation:s}=r,c=n[e],d=Fn(o),u=[],m=[],p=[];let h=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=cr(e.title),p.push({key:t,width:(n||r)/8})})),u.push(f),h+=u.length;const y=a.map(((e,t)=>{const n={};return d.forEach(((r,a)=>{const i=["percent","finance"].includes(r.formatType);n[r.dataIndex]=i?Jn(e,r.dataIndex):l(e,t,r,a)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));h+=y.length,s&&i(d,a).forEach(((e,n)=>{const r={};d.forEach(((n,i)=>{const{dataIndex:l,summation:o}=n,s=o?.render?o.render(a):Jn(e,l);r[l]=0===i&&""===s?t("qm.table.config.summaryText"):g(s)?sr(s).join(""):s})),m.push(r)}));const{sheetName:b,useStyle:v}=r,x=new(bi().Workbook),E=x.addWorksheet(b);E.columns=p,E.addRows(u).forEach((e=>{v&&gl(e,c),e.eachCell((e=>{const t=E.getColumn(e.col),n=$n(o,t.key),{align:r,theadAlign:a}=n;yl(e,a||r),v&&Object.assign(e,{font:{bold:!0,color:{argb:pl}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:bl()})}))})),E.addRows(y).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=y[t];v&&gl(e,c),e.eachCell(((e,t)=>{const a=E.getColumn(e.col),i=$n(o,a.key),{align:l}=i;yl(e,1===t||void 0===r?l:"right"),Object.assign(e,vl(i)),v&&Object.assign(e,{font:{color:{argb:pl}},border:bl()}),1===Number(e.col)&&n&&(e.alignment={...e.alignment,indent:n})}))})),s&&E.addRows(m).forEach((e=>{v&&gl(e,c),e.eachCell(((e,t)=>{const n=E.getColumn(e.col),r=$n(o,n.key),{align:a}=r;yl(e,1===t?a:"right"),Object.assign(e,vl(r)),v&&Object.assign(e,{font:{color:{argb:pl}},border:bl()})}))})),[].forEach((({s:e,e:t})=>{E.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const w=await x.xlsx.writeBuffer();return new Blob([w],{type:"application/octet-stream"})},importXLSX:(e,n)=>{const{columns:a,file:i}=e,l=Fn(a),o=new FileReader;o.onerror=()=>{K.message.error(t("qm.table.import.error"))},o.onload=e=>{const a=l.map((e=>cr(e.title))),i=new(bi().Workbook),o=e.target;o?i.xlsx.load(o.result).then((e=>{const i=e.worksheets[0];if(i){const e=i.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(a,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{let r=e;Array.isArray(r?.richText)&&(r=r.richText.map((e=>e.text)).join("")),(0,h.isPlainObject)(r)&&"text"in r&&(r=r.text),(0,h.isDate)(r)&&(r=lr(r,Wa)),r?.formula&&(r=r.result??r.value),t[s[n]]=r}));const n={};return a.forEach(((e,a)=>{const{dataIndex:i,dictItems:o}=l[a];Array.isArray(o)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>r(o,e))).filter((e=>""!==e)):t[e]=r(o,t[e])),er(n,i,t[e])})),n}));n?.(t)}else K.message.error(t("qm.table.import.error"))}else K.message.error(t("qm.table.import.error"))})):K.message.error(t("qm.table.import.error"))},o.readAsArrayBuffer(i)}}})(),{getTitleFromCellValue:s}=hi(),d=[{text:i("qm.pivotGrid.count.records"),value:"count"},{text:i("qm.pivotGrid.count.unique"),value:"unique"},{text:i("qm.pivotGrid.count.empty"),value:"empty"},{text:i("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:i("qm.pivotGrid.count.sum"),value:"sum"},{text:i("qm.pivotGrid.count.max"),value:"max"},{text:i("qm.pivotGrid.count.min"),value:"min"},{text:i("qm.pivotGrid.count.avg"),value:"avg"}],u={columns:_n(n),fileName:c()().format(Ba),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},m=(e,t,n,r)=>{const{dataIndex:a,precision:i,formatType:l,outputRender:o}=n;if(Zi(e))return Jn(e,a);if(o)return o(Jn(e,a),e,n,t,r);let c=s(e,n,t,r);return i>=0&&!l&&""!==c&&(c=Number(c)),c},p=()=>{if(!r||!Object.keys(r).length)return[];const e={};return u.columns.map((e=>e.dataIndex)).forEach(((t,n)=>{if(n>0){let n="";r?.[t]&&(n=d.find((e=>e.value===r[t])).text+" "+a.total[t]),er(e,t,n)}})),[e]},f=async e=>{const t=await o({...u,footSummation:!!Object.keys(r).length},e,p,m);qt(t,`${c()().format(Ba)}.xlsx`)},y=[{key:"1",label:l().createElement(l().Fragment,null,l().createElement(Ee.FolderOutlined,{style:{marginRight:4}})," ",i("qm.pivotGrid.export.group")),onClick:()=>{f((()=>{const e=[];let i=0;return t.current.flatGroupData.forEach((t=>{const l={...t};Zi(t)?(l._level=t._groupLevel,u.columns.map((e=>e.dataIndex)).forEach(((e,i)=>{if(0===i){const r=n.find((e=>e.dataIndex===t._fieldName)),a=r.outputRender?r.outputRender(Jn(t._record,r.dataIndex),t._record,r,0,0):s(t._record,r,0,0);er(l,e,a)}else{let n="";r?.[e]&&(n=d.find((t=>t.value===r[e])).text+" "+Ji(a,t.id).subtotal[e]),er(l,e,n)}})),i=t._groupLevel):i>0&&(l._level=t._level+i+1),e.push(l)})),e})())}},{key:"2",label:l().createElement(l().Fragment,null,l().createElement(Ee.BarsOutlined,{style:{marginRight:4}})," ",i("qm.pivotGrid.export.list")),onClick:()=>{f(Array.from(t.current.keyRecordMap.values()))}}];return l().createElement(K.Dropdown,{trigger:["click"],menu:{items:y},className:ve()("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},l().createElement("span",null,l().createElement(Ee.DownloadOutlined,{className:"icon"}),i("qm.pivotGrid.export.text")))},El=()=>{const{prefixCls:e,pivotRef:t,groupList:n,filterList:r,sorterList:a,colorList:i,countMethod:o,setContext:s}=il(),{uniqueKey:d}=t.current.props,{t:u}=le(),m=l().useMemo((()=>d?`grid_conf_${d}`:""),[d]),p=l().useRef({}),[h,f]=l().useState([]),[g,y]=l().useState({}),[b,v]=l().useState(""),x=(e,t)=>{y((n=>Object.assign({},n,{[e]:t??!n[e]})))};l().useLayoutEffect((()=>{w()}),[]),qe((()=>{C()}),[h]);const w=async()=>{try{if(!m)return;const e=await Wi().getItem(m);Array.isArray(e)&&(f(e),y(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}},C=async()=>{try{if(!m)return;await Wi().setItem(m,h)}catch(e){}},S=()=>{const e=or();f([{id:e,label:c()().format(Ba),value:{groupList:n,filterList:r,sorterList:a,colorList:i,countMethod:o}},...h]),E((()=>x(e,!0)))};return l().createElement(K.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},l().createElement("span",null,u("qm.pivotGrid.saved.title"))),l().createElement("div",{className:"list"},l().createElement("ul",null,h.map((e=>l().createElement("li",{key:e.id,className:ve()("ant-dropdown-menu-item sort-item",{active:e.id===b}),onClick:()=>(e=>{if(g[e.id])return;const t=b!==e.id,n=t?e.value:p.current;s({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList,colorList:n.colorList,countMethod:n.countMethod}),v(t?e.id:"")})(e)},l().createElement("div",{className:"label",style:{width:200}},g[e.id]?l().createElement(K.Input,{size:"small",autoFocus:!0,defaultValue:e.label,style:{width:"100%",marginLeft:-8},onBlur:t=>{const{value:n}=t.target;n!==e.label&&(e.label=n,f([...h])),x(e.id,!1)}}):l().createElement("span",null,e.label)),l().createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),x(e.id)}},g[e.id]?l().createElement(Ee.CheckOutlined,null):l().createElement(Ee.EditOutlined,null)),l().createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,f(h.filter((e=>e.id!==n)))}},l().createElement(Ee.CloseOutlined,null))))))),l().createElement("div",{className:"add-record",style:{padding:10}},l().createElement("span",{className:"insert",onClick:S},l().createElement(Ee.PlusOutlined,{className:"icon"}),u("qm.pivotGrid.saved.add")))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomRight",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:n,filterList:r,sorterList:a,colorList:i,countMethod:o}:{},p.current=t}},l().createElement("span",null,l().createElement(Ee.SaveOutlined,{className:"icon"}),u("qm.pivotGrid.saved.text")))},wl=()=>{const{gridData:e}=il(),{t}=le();return l().createElement("div",{className:"alert-info"},l().createElement(Ee.InfoCircleOutlined,{className:"icon"}),t("qm.table.alert.total",{total:(()=>{let t=0;return function e(n){n.forEach((n=>{Array.isArray(n.children)&&e(n.children),t+=1}))}(e),t})()}))},Cl={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},Sl={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},Nl=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Tl(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(Cl).forEach((e=>{const c={...r&&Sl[e]||Cl[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,Nl.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-o-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=o+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-o-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=o+a}const d=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?8:r}}({contentRadius:i,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":c.offset[0]=d.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":c.offset[1]=2*-d.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":c.offset[1]=2*d.arrowOffsetHorizontal-o}c.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const a=r&&"object"==typeof r?r:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+n,i.shiftX=!0,i.adjustX=!0}const l={...i,...a};return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,d,t,n),l&&(c.htmlRegion="visibleFirst")})),s}const Il=require("@rc-component/trigger");var Rl=r.n(Il);const Ol=require("@rc-component/color-picker");var kl=r.n(Ol);const Ll=e=>{const{value:t,defaultValue:n,disabled:r,disabledAlpha:a,className:i,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=ri("",{value:t,defaultValue:n}),m=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),p=Tl({offset:0,arrowWidth:16,borderRadius:6}),h=xe("color-picker");return l().createElement(Rl(),{action:["click"],prefixCls:h,popupPlacement:"bottomLeft",builtinPlacements:p,popup:()=>l().createElement(kl(),{prefixCls:h,value:d,disabled:r,disabledAlpha:a,onChange:(e,t)=>{u(e.toRgbString()),s?.(m(e),t)},onChangeComplete:(e,t)=>{c?.(m(e),t)}})},l().createElement("div",{className:ve()(`${h}-btn`,i),style:o},l().createElement(Ol.ColorBlock,{color:d,prefixCls:h})))};Ll.displayName="ColorPicker";const Pl=Ll,Al=()=>{const{prefixCls:e,pivotRef:t,getRowKey:n,columns:r,colorList:a,setColorList:i,setFillColor:o}=il(),{flatGroupData:s}=t.current,{t:c}=le(),d=l().useRef([]),u=l().useMemo((()=>a.filter((e=>e.fieldName&&e.color&&(xr(e.expression)||!C(e.value)||"col"===e.mode)))),[a]),m=l().useMemo((()=>r.map((e=>({label:cr(e.title),value:e.dataIndex})))),[r]),p=l().useMemo((()=>Xi(r)),[r]),f=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"},{label:c("qm.pivotGrid.fillColor.col"),value:"col"}];qe((()=>{g()}),[l().useMemo((()=>{const e=u.map((e=>({[e.color]:`${e.mode},${e.fieldName},${e.expression},${e.value??""}`})));return(0,h.isEqual)(e,d.current)?d.current:(d.current=e,e)}),[u])]);const g=Et((()=>{const e=[];u.forEach((t=>{const r=ur([{...N(t,["value"]),condition:t.value}]),a=An(s.filter((e=>!Zi(e))),"col"!==t.mode?r:"");if("cell"===t.mode||"col"===t.mode)for(let r=0;r<a.length;r++)e.push({color:t.color,rowKey:n(a[r],a[r].index),dataIndex:t.fieldName});if("row"===t.mode)for(let r=0;r<a.length;r++){const i=n(a[r],a[r].index);for(let n=0;n<p.length;n++)e.push({color:t.color,rowKey:i,dataIndex:p[n].dataIndex})}})),o(e)}),200),y=()=>{i([...a,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},b=(e,t,n)=>{if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=r.find((e=>e.dataIndex===n)).filter?.type||"text";Object.assign(t,{type:e,expression:v(e)[0].value,value:""})}"expression"===e&&xr(n)&&Object.assign(t,{value:""}),i([...a])},v=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:c("qm.table.highSearch.gtText")},{value:"<",label:c("qm.table.highSearch.ltText")},{value:">=",label:c("qm.table.highSearch.gteText")},{value:"<=",label:c("qm.table.highSearch.lteText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:c("qm.table.highSearch.inText")},{value:"nin",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:c("qm.table.highSearch.inText")},{value:"nlike",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"^=",label:c("qm.table.highSearch.startsWithText")},{value:"=$",label:c("qm.table.highSearch.endsWithText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}]}return t};return l().createElement(K.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.fillColor.title"))),l().createElement("div",{className:"list"},l().createElement(ga.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.fieldName)),n=a.map((e=>e.fieldName));(0,h.isEqual)(t,n)||i(e)}},a.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(Ee.HolderOutlined,{className:"icon handle"}),l().createElement(Pl,{defaultValue:n.color,style:{marginLeft:5},onChangeComplete:e=>b("color",n,e.hex)}),l().createElement(K.Select,{value:n.mode,options:f,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:e=>b("mode",n,e)}),l().createElement(K.Select,{value:n.fieldName||void 0,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:e=>b("fieldName",n,e)}),"col"!==n.mode&&l().createElement(K.Select,{value:n.expression||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:v(n.type),style:{width:100,margin:"0 10px"},onChange:e=>b("expression",n,e)}),"col"!==n.mode&&(e=>{switch(e.type){case"number":return l().createElement(K.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{b("value",e,C(t)?"":t)}});case"date":return l().createElement(U,{popupClassName:ai.popupClassName,defaultValue:ir(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{b("value",e,lr(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const t=r.find((t=>t.dataIndex===e.fieldName))?.dictItems||[];return l().createElement(K.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{b("value",e,t)}},t.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return l().createElement(K.Input,{value:e.value,style:{width:150},disabled:xr(e.expression),onChange:t=>{b("value",e,t.target.value)}})}})(n),l().createElement(Ee.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(a.filter((t=>t!==e)))})(n)}))));var n})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:y},l().createElement(Ee.PlusOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:ve()("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ee.BgColorsOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Fl=()=>l().createElement("div",{className:"top-bar"},l().createElement(ye,{size:4},l().createElement(wl,null),l().createElement(K.Divider,{type:"vertical"}),l().createElement(ul,null),l().createElement(ll,null),l().createElement(ol,null),l().createElement(sl,null),l().createElement(K.Divider,{type:"vertical"}),l().createElement(Al,null),l().createElement(ml,null),l().createElement(cl,null),l().createElement(K.Divider,{type:"vertical"}),l().createElement(xl,null)),l().createElement(ye,{size:4},l().createElement(El,null))),_l=l().createContext(void 0),ql=e=>{const{scrollbar:t}=e,{pivotRef:n,getRowKey:r,columns:a,groupGridData:i,setPivotGridRef:o}=il(),{rowSelection:s,treeExpandable:c,rowHighlight:d}=n.current.props,u=c?.defaultExpandAllRows??!0,m=l().useRef({bodyEl:null,rowVirtualizer:null}),[p,h]=l().useState({gridRef:m,scrollbarRef:t,selectionKeys:s?.defaultSelectedRowKeys??[],treeExpandKeys:u?jn(n.current.originGridData,(e=>r(e,e.index))):[],highlightKey:"",checkedColumnKey:"",clicked:[],isPingLeft:!1}),f=l().useMemo((()=>Math.max(0,el(i)-1)),[i]),g=l().useMemo((()=>Xi(a)),[a]),y=l().useMemo((()=>g.filter((e=>"left"===e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0)+f*Yi.indentWidth),[f,g]),b=e=>{h((t=>{const n={...t};let r=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))},v=(e,t)=>{p.gridRef.current[e]=t};l().useLayoutEffect((()=>{T()}),[a]),l().useLayoutEffect((()=>{s?.selectedRowKeys&&b({selectionKeys:s.selectedRowKeys})}),[s?.selectedRowKeys]),l().useLayoutEffect((()=>{void 0!==d?.currentRowKey&&b({highlightKey:d.currentRowKey})}),[d?.currentRowKey]);const x=e=>{Array.isArray(s?.selectedRowKeys)||b({selectionKeys:e})},E=e=>{b({treeExpandKeys:e})},w=e=>{void 0===d?.currentRowKey&&b({highlightKey:e})},C=e=>{b({checkedColumnKey:e})},S=e=>{br(e,p.clicked,!0)||b({clicked:e})},N=e=>{b({isPingLeft:e})},T=()=>{const e=t.current.container.clientWidth,{defaultColumnWidth:n}=ai,r=[];let i=0;if(a.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,r.push(e))})),r.length>0){const t=a.reduce(((e,t)=>e+(t.width||t.minWidth||n)),0);if(t<=e){const a=e-t;if(1===r.length)r[0].renderWidth=(r[0].minWidth||n)+a;else{const e=a/r.reduce(((e,t)=>e+(t.minWidth||n)),0);let t=0;r.forEach(((r,a)=>{if(0===a)return;const i=Math.floor((r.minWidth||n)*e);t+=i,r.renderWidth=(r.minWidth||n)+i})),r[0].renderWidth=(r[0].minWidth||n)+a-t}}else r.forEach((e=>{e.renderWidth=e.minWidth||n}))}else i=a.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||n)),0)},I=l().useMemo((()=>({...p,indentDepth:f,fixedWidth:y,gridColumns:g,setContext:b,setGridLayoutRef:v,setSelectionKeys:x,setTreeExpandKeys:E,setHighlightKey:w,setCheckColumnKey:C,setClicked:S,setPingLeft:N,updateColumnsWidth:T})),[p,f,g]);return l().createElement(_l.Provider,{value:I},e.children)},Dl=()=>l().useContext(_l),Hl=require("@rc-component/portal");var $l=r.n(Hl);const Ml=e=>{const{column:t}=e,{pivotRef:n,columns:r,setColumns:a}=il(),{scrollbarRef:i}=Dl(),{onColumnsChange:o}=n.current.props,s=l().useRef(null),[c,d]=l().useState(!1),u=l().useRef(document.onselectstart),m=l().useRef({startX:0,originSizeX:0,columnWidth:0}),p=e=>{m.current=Object.assign({},m.current,e)},h=e=>{if(1!==e.buttons)return f();const n=e.clientX-m.current.startX,r=(t.width||t.renderWidth)+n;r<(t.minWidth||ai.defaultColumnWidth)||(p({columnWidth:r}),s.current.style.left=`${m.current.originSizeX+n}px`)},f=()=>{i.current.container.classList.remove("col-resize"),t.width=m.current.columnWidth;const e=[...r];o?o(e):a(e),E((()=>d(!1))),He(document,"mousemove",h),He(document,"mouseup",f),p({startX:0,originSizeX:0,columnWidth:0}),g()},g=()=>{document.onselectstart!==u.current&&(document.onselectstart=u.current)};return l().createElement(l().Fragment,null,l().createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault(),i.current.container.classList.add("col-resize");const n=Xn(e.target,i.current.container).left-i.current.scrollLeft+3;p({startX:e.clientX,originSizeX:n,columnWidth:t.width||t.renderWidth||0}),De(document,"mousemove",h),De(document,"mouseup",f),d(!0),E((()=>s.current.style.left=`${n}px`)),u.current=document.onselectstart,document.onselectstart=()=>!1}}),l().createElement($l(),{open:c,getContainer:i.current?.container},l().createElement("div",{ref:s,className:"resize-line"})))},Kl=e=>{const{left:t}=e,{pivotRef:n,columns:r,setColumns:a}=il(),{scrollbarRef:i,gridColumns:o,indentDepth:s,isPingLeft:c,setPingLeft:d}=Dl(),{onColumnsChange:u}=n.current.props,{indentWidth:m}=Yi,p=l().useRef(document.onselectstart),h=l().useRef({startX:0,originSizeX:0}),f=e=>{h.current=Object.assign({},h.current,e)},g=()=>{x(t),R(t)},[y,b]=l().useState(0),[v,x]=l().useState(t),[E,w]=l().useState(t),C=l().useRef(!1),S=e=>C.current=e;qe((()=>{C.current||g()}),[t]);const N=e=>e.width||e.renderWidth||0,T=e=>o.slice(0,e).reduce(((e,t)=>e+N(t)),0)+s*m,I=e=>{let t=-1;for(let n=1;n<o.length;n++){const r=T(n-1)+N(o[n-1])/2,a=T(n)+N(o[n])/2;if(e>r&&e<a){T(n)<i.current.container.offsetWidth&&(t=n);break}}return t},R=Xt((e=>{const t=I(e);t<0||w(T(t))}),60);l().useEffect((()=>{const e=e=>d(e.target.scrollLeft>1),t=i.current.scrollElement;return t.addEventListener("scroll",e),De(t,"scroll",e),()=>He(t,"scroll",e)}),[]);const O=oe((e=>{if(1!==e.buttons)return k();const t=e.clientX-h.current.startX,n=h.current.originSizeX+t;x(n),R(n)})),k=oe((()=>{i.current.container.classList.remove("col-resize"),S(!1),(e=>{const t=I(e);if(t<0)return g();r.forEach(((e,n)=>{n<t-1?e.fixed="left":delete e.fixed})),x(T(t)),R(e),u?u([...r]):a([...r])})(v),He(document,"mousemove",O),He(document,"mouseup",k),f({startX:0,originSizeX:0}),L()})),L=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)};return l().createElement($l(),{open:!0,getContainer:i.current?.container},l().createElement("div",{className:ve()("fixed-line",{leave:c}),style:{left:t}}),l().createElement("div",{className:ve()("fixed-bar",{active:C.current}),style:{left:v},onMouseMove:e=>{const{top:t,height:n}=e.target.getBoundingClientRect(),r=e.clientY-t;let a=Math.max(0,r-16);a=Math.min(a,n-32),b(a)},onMouseDown:e=>{e.preventDefault(),i.current.container.classList.add("col-resize"),i.current.SET_SCROLL_LEFT(0),S(!0),f({startX:e.clientX,originSizeX:e.target.offsetLeft}),De(document,"mousemove",O),De(document,"mouseup",k),p.current=document.onselectstart,document.onselectstart=()=>!1}},l().createElement("span",{className:"thumb",style:{top:y}})),C.current&&l().createElement("div",{className:"fixed-line active",style:{left:E}}))},zl=()=>{const{pivotRef:e}=il(),{indentDepth:t,fixedWidth:n,gridColumns:r,checkedColumnKey:a,selectionKeys:i,setSelectionKeys:o,setCheckColumnKey:s}=Dl(),{rowSelection:c}=e.current.props,{selectionColumn:d}=ai,{indentWidth:u,selectionColumnDefine:m}=Yi,p=l().useMemo((()=>r.filter((e=>"left"===e.fixed))),[r]),h=l().useMemo((()=>r.filter((e=>"left"!==e.fixed))),[r]),f=l().useMemo((()=>"radio"!==c?.type),[c]),g=l().useMemo((()=>i.length>0&&i.length===e.current.keyRecordMap.size),[i]),y=l().useMemo((()=>i.length>0&&i.length<e.current.keyRecordMap.size),[i]),b=(r,i)=>l().createElement("div",{className:ve()(i?"fixed-left":"no-fixed"),style:{width:i?n:""}},r.map(((n,p)=>{const{dataIndex:h,title:b,align:v,width:x,renderWidth:E}=n,w={"selection-column":h===d,"col--center":"center"===v,"col--right":"right"===v,"col--checked":a===h},C=p===(i?r.length>1?1:0:r.length-1)?t*u:0,S={width:`${(x||E||0)+C}px`,minWidth:`${(x||E||0)+C}px`};return l().createElement("div",{key:h,className:ve()("table-cell",w),style:S,onClick:()=>{return e=h,void([m.dataIndex].includes(e)||s(a!==e?e:""));var e}},h!==d?l().createElement("span",{className:"cell"},b):c&&f?l().createElement(K.Checkbox,{checked:g,indeterminate:y,onChange:t=>(t=>{const n=t?Array.from(e.current.keyRecordMap.keys()):[];o(n),c?.onChange?.(n,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}):"#",h!==d&&l().createElement(Ml,{column:n}))})));return l().createElement("div",{className:"header"},b(p,!0),b(h),l().createElement(Kl,{left:n}))},Vl=require("react-dom");function jl(e,t,n){let r,a=n.initialDeps??[];function i(){let i;n.key&&n.debug?.()&&(i=Date.now());const l=e(),o=l.length!==a.length||l.some(((e,t)=>a[t]!==e));if(!n.noCache?.()&&!o)return r;let s;if(a=l,n.key&&n.debug?.()&&(s=Date.now()),r=t(...l),n.key&&n.debug?.()){const e=Math.round(100*(Date.now()-i))/100,t=Math.round(100*(Date.now()-s))/100,r=t/16,a=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${a(t,5)} /${a(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange?.(r),r}return i.updateDeps=e=>{a=e},i}function Wl(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const Bl=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,a)),n)}};function Ul(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gl=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Yl=e=>e,Xl=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},Ql=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const a=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(a(Gl(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver((t=>{const r=()=>{const e=t[0];if(e?.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void a({width:t.inlineSize,height:t.blockSize})}a(Gl(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()}));return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Zl={passive:!0},Jl="undefined"==typeof window||"onscrollend"in window,eo=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let a=0;const i=e.options.useScrollendEvent&&Jl?()=>{}:Bl(r,(()=>{t(a,!1)}),e.options.isScrollingResetDelay),l=r=>()=>{const{horizontal:l,isRtl:o}=e.options;a=l?n.scrollLeft*(o?-1:1):n.scrollTop,i(),t(a,r)},o=l(!0),s=l(!1);s(),n.addEventListener("scroll",o,Zl);const c=e.options.useScrollendEvent&&Jl;return c&&n.addEventListener("scrollend",s,Zl),()=>{n.removeEventListener("scroll",o),c&&n.removeEventListener("scrollend",s)}},to=(e,t,n)=>{if(t?.borderBoxSize){const e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},no=(e,{adjustments:t=0,behavior:n},r)=>{const a=e+t;r.scrollElement?.scrollTo?.({[r.options.horizontal?"left":"top"]:a,behavior:n})};class ro{constructor(e){Ul(this,"unsubs",[]),Ul(this,"options",void 0),Ul(this,"scrollElement",null),Ul(this,"targetWindow",null),Ul(this,"isScrolling",!1),Ul(this,"measurementsCache",[]),Ul(this,"itemSizeCache",new Map),Ul(this,"pendingMeasuredCacheIndexes",[]),Ul(this,"scrollRect",null),Ul(this,"scrollOffset",null),Ul(this,"scrollDirection",null),Ul(this,"scrollAdjustments",0),Ul(this,"shouldAdjustScrollPositionOnItemSizeChange",void 0),Ul(this,"elementsCache",new Map),Ul(this,"observer",(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver((e=>{e.forEach((e=>{const t=()=>{this._measureElement(e.target,e)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()}))})):null);return{disconnect:()=>{t()?.disconnect(),e=null},observe:e=>t()?.observe(e,{box:"border-box"}),unobserve:e=>t()?.unobserve(e)}})()),Ul(this,"range",null),Ul(this,"setOptions",(e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options={debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Yl,rangeExtractor:Xl,onChange:()=>{},measureElement:to,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}})),Ul(this,"notify",(e=>{this.options.onChange?.(this,e)})),Ul(this,"maybeNotify",jl((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:!1,noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]})),Ul(this,"cleanup",(()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null})),Ul(this,"_didMount",(()=>()=>{this.cleanup()})),Ul(this,"_willUpdate",(()=>{const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e)return void this.maybeNotify();this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach((e=>{this.observer.observe(e)})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,(e=>{this.scrollRect=e,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})))}})),Ul(this,"getSize",(()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0))),Ul(this,"getScrollOffset",(()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0))),Ul(this,"getFurthestMeasurement",((e,t)=>{const n=new Map,r=new Map;for(let a=t-1;a>=0;a--){const t=e[a];if(n.has(t.lane))continue;const i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort(((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end))[0]:void 0})),Ul(this,"getMeasurementOptions",jl((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,a)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a})),{key:!1})),Ul(this,"getMeasurements",jl((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((e=>{this.itemSizeCache.set(e.key,e.size)})));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,l);for(let a=l;a<e;a++){const e=r(a),l=1===this.options.lanes?o[a-1]:this.getFurthestMeasurement(o,a),s=l?l.end+this.options.gap:t+n,c=i.get(e),d="number"==typeof c?c:this.options.estimateSize(a),u=s+d,m=l?l.lane:a%this.options.lanes;o[a]={index:a,start:s,size:d,end:u,key:e,lane:m}}return this.measurementsCache=o,o}),{key:!1,debug:()=>this.options.debug})),Ul(this,"calculateRange",jl((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};let i=ao(0,a,(t=>e[t].start),n),l=i;if(1===r)for(;l<a&&e[l].end<n+t;)l++;else if(r>1){const o=Array(r).fill(0);for(;l<a&&o.some((e=>e<n+t));){const t=e[l];o[t.lane]=t.end,l++}const s=Array(r).fill(n+t);for(;i>=0&&s.some((e=>e>=n));){const t=e[i];s[t.lane]=t.start,i--}i=Math.max(0,i-i%r),l=Math.min(a,l+(r-1-l%r))}return{startIndex:i,endIndex:l}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null),{key:!1,debug:()=>this.options.debug})),Ul(this,"getVirtualIndexes",jl((()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]}),((e,t,n,r,a)=>null===r||null===a?[]:e({startIndex:r,endIndex:a,overscan:t,count:n,offset:this.getScrollOffset()})),{key:!1,debug:()=>this.options.debug})),Ul(this,"indexFromElement",(e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)})),Ul(this,"_measureElement",((e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const a=r.key,i=this.elementsCache.get(a);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(a,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))})),Ul(this,"resizeItem",((e,t)=>{const n=this.measurementsCache[e];if(!n)return;const r=t-(this.itemSizeCache.get(n.key)??n.size);0!==r&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))})),Ul(this,"measureElement",(e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach(((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))}))})),Ul(this,"getVirtualItems",jl((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,a=e.length;r<a;r++){const a=t[e[r]];n.push(a)}return n}),{key:!1,debug:()=>this.options.debug})),Ul(this,"getVirtualItemForOffset",(e=>{const t=this.getMeasurements();if(0!==t.length)return Wl(t[ao(0,t.length-1,(e=>Wl(t[e]).start),e)])})),Ul(this,"getOffsetForAlignment",((e,t,n=0)=>{const r=this.getSize(),a=this.getScrollOffset();"auto"===t&&(t=e>=a+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r);const i=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(i,e),0)})),Ul(this,"getOffsetForIndex",((e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),a=this.getScrollOffset();if("auto"===t)if(n.end>=a+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=a+this.options.scrollPaddingStart))return[a,t];t="start"}const i="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,n.size),t]})),Ul(this,"isDynamicMode",(()=>this.elementsCache.size>0)),Ul(this,"scrollToOffset",((e,{align:t="start",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})})),Ul(this,"scrollToIndex",((e,{align:t="auto",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const a=t=>{if(!this.targetWindow)return;const r=this.getOffsetForIndex(e,t);if(!r)return void console.warn("Failed to get offset for index:",e);const[a,l]=r;this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame((()=>{const t=this.getScrollOffset(),n=this.getOffsetForIndex(e,l);var r,a;n?(r=n[0],a=t,Math.abs(r-a)<1.01||i(l)):console.warn("Failed to get offset for index:",e)}))},i=t=>{this.targetWindow&&(r++,r<10?this.targetWindow.requestAnimationFrame((()=>a(t))):console.warn(`Failed to scroll to index ${e} after 10 attempts.`))};a(t)})),Ul(this,"scrollBy",((e,{behavior:t}={})=>{"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})})),Ul(this,"getTotalSize",(()=>{const e=this.getMeasurements();let t;if(0===e.length)t=this.options.paddingStart;else if(1===this.options.lanes)t=e[e.length-1]?.end??0;else{const n=Array(this.options.lanes).fill(null);let r=e.length-1;for(;r>=0&&n.some((e=>null===e));){const t=e[r];null===n[t.lane]&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter((e=>null!==e)))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)})),Ul(this,"_scrollToOffset",((e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)})),Ul(this,"measure",(()=>{this.itemSizeCache=new Map,this.notify(!1)})),this.setOptions(e)}}const ao=(e,t,n,r)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else{if(!(i>r))return a;t=a-1}}return e>0?e-1:0},io="undefined"!=typeof document?i.useLayoutEffect:i.useEffect;function lo(e){return function(e){const t=i.useReducer((()=>({})),{})[1],n={...e,onChange:(n,r)=>{r?(0,Vl.flushSync)(t):t(),e.onChange?.(n,r)}},[r]=i.useState((()=>new ro(n)));return r.setOptions(n),io((()=>r._didMount()),[]),io((()=>r._willUpdate())),r}({observeElementRect:Ql,observeElementOffset:eo,scrollToFn:no,...e})}const oo=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,so=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>t?.contains(e.target))),co=(e,t)=>{const n=e.target;return!("button"in e&&e.button>0||n&&!oo(n).contains(n)||t.current?.contains(n))};function uo({ref:e,handler:t,enabled:n=!0,omitClassNames:r=[]}){const a=oe(t),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});i.useEffect((()=>{if(!n)return;const i=t=>{co(t,e)&&(l.current.isPointerDown=!0)},o=n=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:t&&l.current.isPointerDown&&co(n,e)&&so(n,r)&&(l.current.isPointerDown=!1,a(n))},s=n=>{l.current.ignoreEmulatedMouseEvents=!0,t&&l.current.isPointerDown&&co(n,e)&&so(n,r)&&(l.current.isPointerDown=!1,a(n))},c=oo(e.current);return c.addEventListener("mousedown",i,!0),c.addEventListener("mouseup",o,!0),c.addEventListener("touchstart",i,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",i,!0),c.removeEventListener("mouseup",o,!0),c.removeEventListener("touchstart",i,!0),c.removeEventListener("touchend",s,!0)}}),[t,e,a,l,n])}const mo=e=>{const{pivotRef:t,getRowKey:n,size:r}=il(),{scrollbarRef:a,clicked:i,setHighlightKey:o,setClicked:s}=Dl(),{flatGroupData:c}=t.current,{rowHighlight:d}=t.current.props,u=l().useMemo((()=>2*ai.rowHeightMaps[r]),[r]),m=l().useMemo((()=>c.filter((e=>!Zi(e)))),[c]),p=oe((t=>{const{keyCode:r}=t;if(!C(i)&&(27===r&&(o(""),s([])),38===r||40===r)){$e(t);const l=m.length;let c=m.findIndex((e=>n(e,e.index)===i[0]));const p=38===r?(--c+l)%l:++c%l,h=m[p],f=n(h,h.index);d&&!d.disabled?.(h)&&(o(f),d.onChange?.(f,h)),((t,n,r)=>{const i=m.length,l=e.find((e=>e.key===r)),o=a.current.scrollTop,s=a.current.container.offsetHeight,c=l.top,d=l.height;"top"===t?c<o?a.current.SET_SCROLL_TOP(c):n===i-1&&a.current.SET_SCROLL_TOP(c-(s-d)):c+d>o+(s-u)?a.current.SET_SCROLL_TOP(c-(s-u-d)):0===n&&a.current.SET_SCROLL_TOP(c)})(38===r?"top":"bottom",p,f),s([f,i[1]])}}));l().useLayoutEffect((()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p))),[])},po=()=>l().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"})),ho=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M839.111111 269.198222V122.908444A9.159111 9.159111 0 0 0 829.980444 113.777778H208.213333A9.159111 9.159111 0 0 0 199.111111 122.908444v146.289778c0 5.034667 4.124444 9.159111 9.130667 9.159111h64a9.159111 9.159111 0 0 0 9.159111-9.159111V196.067556h192v640h-105.159111a9.159111 9.159111 0 0 0-9.130667 9.130666v64c0 5.034667 4.124444 9.159111 9.130667 9.159111h301.738666a9.159111 9.159111 0 0 0 9.130667-9.159111v-64a9.159111 9.159111 0 0 0-9.130667-9.130666h-105.159111v-640h192v73.130666c0 5.034667 4.124444 9.159111 9.159111 9.159111h64a9.159111 9.159111 0 0 0 9.130667-9.159111z"})),fo=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M887.65217391 606.59279489a31.26857185 31.26857185 0 0 1-31.26857185-31.26857087v-363.48819946L158.38608696 909.83354065a31.26857185 31.26857185 0 1 1-44.21962762-44.21962761l697.99751609-698.06906805h-363.48819945a31.26857185 31.26857185 0 0 1 0-62.46559075h439.04795087c17.17267109 0 31.26857185 13.95279489 31.26857086 31.19701891v439.04795087a31.26857185 31.26857185 0 0 1-31.3401238 31.26857087z"})),go=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M606.4 103.424a64 64 0 0 1 0.704 0.64l320.256 280.32a64 64 0 0 1 7.104 89.024l-330.432 398.72 320.448 0.128a32 32 0 0 1 0 64.064H397.632a32.128 32.128 0 0 1-6.208-0.64h-20.736a64 64 0 0 1-42.304-16.064l-238.08-210.112A64 64 0 0 1 83.84 620.16l432.32-509.312a64 64 0 0 1 90.24-7.36zM242.048 537.536l-87.04 101.76a32 32 0 0 0 3.584 45.248l213.12 180.672a32 32 0 0 0 20.736 7.616l-0.64-0.064a32.192 32.192 0 0 1 5.76-0.512h102.016a32 32 0 0 0 18.176-10.496l40.96-47.232-316.672-276.992zM592.96 177.28a32 32 0 0 0-45.12 3.456L283.712 488.96l316.928 277.248 264.512-304.96a32 32 0 0 0 1.024-40.704l-3.904-4.16-268.928-238.72a32 32 0 0 0-0.384-0.32z"})),yo=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M607.75537778 291.05948444H223.6416l115.34336-115.41617778a36.37248 36.37248 0 1 0-51.48216889-51.44576L132.61937778 279.04455111c-13.54410667 13.50769778-21.04433778 31.67573333-21.11715556 50.97244444a71.72551111 71.72551111 0 0 0 21.11715556 51.51857778l154.88341333 154.91982222a36.29966222 36.29966222 0 0 0 51.48216889 0 36.37248 36.37248 0 0 0 0-51.48216889l-121.46005333-121.16878222H607.75537778c130.70791111 0 237.02186667 106.16832 237.02186667 236.65777777s-106.31395555 236.65777778-237.02186667 236.65777778h-254.13404445a36.40888889 36.40888889 0 0 0 0 72.81777779h254.13404445c170.83050667 0 309.83964445-138.82709333 309.83964444-309.47555557 0-170.64846222-139.00913778-309.47555555-309.83964444-309.47555555"})),bo=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M512 680.20451555l354.04003555-354.04003556a48.54556445 48.54556445 0 0 1 68.64213334 68.64213334L546.32220445 783.16999111a48.54556445 48.54556445 0 0 1-68.64213334 0L89.31555555 394.80775111a48.54556445 48.54556445 0 0 1 68.64327112-68.64327112L512 680.20451555z"})),vo=e=>{const{column:t,keyPath:n,type:r}=e,{prefixCls:a,countMethod:i,summationData:o,setCountMethod:s}=il(),{t:c}=le(),{dataIndex:d,filter:u}=t,[m,p]=l().useState(!1),h=l().useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:nl.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:nl.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:nl.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:nl.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:nl.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:nl.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:nl.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:nl.avg}];return"number"===u?.type?e:e.slice(0,-4)}),[]),f=l().useMemo((()=>{const e=i[d];if(!e)return c("qm.pivotGrid.count.statistic");const t=h.find((t=>t.value===e)).text,a=((e,t)=>t?Ji(e,t):e)(o,n)?.[r]?.[d]??"";return t+" "+rr(a)}),[o,i]);return l().createElement(K.Dropdown,{open:m,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},h.map((e=>{const t=e.value===i[d];return l().createElement("li",{key:e.value,className:ve()("ant-dropdown-menu-item check-item",{active:t}),onClick:()=>{s({[d]:t?void 0:e.value}),p(!1)}},l().createElement("span",{className:"label"},e.text),l().createElement("i",{className:"icon"},l().createElement(Ee.CheckOutlined,null)))})))),className:ve()("count-select",{show:!!i[d]}),overlayClassName:`${a}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},l().createElement("span",null,f," ",l().createElement(Ee.CaretDownOutlined,{className:"icon"})))},xo=(e,t)=>{const{pivotRef:n,columns:r,expandedKeys:a,searchResults:i,switchIndex:o,fillColorCells:s,setExpandedKeys:c}=il(),{gridRef:d,indentDepth:u,highlightKey:m,checkedColumnKey:p,selectionKeys:h,treeExpandKeys:f,setSelectionKeys:g,setTreeExpandKeys:y,setHighlightKey:b,setClicked:v}=Dl(),{keyRecordMap:x,isTree:E}=n.current,{bodyEl:w,rowVirtualizer:S}=d.current,{rowSelection:N,treeExpandable:T,rowHighlight:I,openRowDraggable:R,onRowEdit:O,onRowClick:k}=n.current.props,{t:L}=le(),{renderText:P,getTitleFromCellNode:A}=hi(),{selectionColumn:F,operationColumn:_,treeTable:q}=ai,{indentWidth:D}=Yi,H=l().useMemo((()=>t?0:Xi(r).length-e.length),[r,e]),$=l().useMemo((()=>"radio"!==N?.type),[N]),M=(e,t)=>{const n=$?e?[...h,t]:h.filter((e=>e!==t)):[t];g(n),N?.onSelect?.(e,x.get(t)),N?.onChange?.(n,z(n))},z=e=>{const t=[];return e.forEach((e=>t.push(x.get(e)))),t},V=(e,t)=>i[o]?.rowKey===e&&i[o]?.dataIndex===t,j=(e,t)=>{const n=w.querySelectorAll(`li.table-row[data-row-key='${e}']`);Array.from(n).forEach((e=>{e.classList[t&&!S?.isScrolling?"add":"remove"]("row--hover")}))},W=(n,i,o,s)=>{const{dataIndex:d,width:m,renderWidth:p}=n,h={"expandable-column":d===F},f=i===(t?e.length>1?1:0:-1)?(u-o._groupLevel)*D:0,g={width:`${(m||p||0)+f}px`,minWidth:`${(m||p||0)+f}px`};return l().createElement("div",{key:d,className:ve()("label-cell",h),style:g},d!==F?l().createElement(l().Fragment,null,1===i&&l().createElement("span",{className:"title"},(e=>{const{_record:t,_fieldName:n}=e,a=Jn(t,n),i=r.find((e=>e.dataIndex===n));return C(a)||!i?l().createElement("span",{className:"empty"},L("qm.pivotGrid.group.empty")):i.render?i.render(a,t,i,0,0):P(a,i,t)})(o)),d!==_&&l().createElement(vo,{column:n,keyPath:o.id,type:"subtotal"})):(e=>l().createElement("button",{className:ve()("button-icon",{expand:a.includes(e.id)}),onClick:()=>{return t=e.id,void c(a.includes(t)?a.filter((e=>e!==t)):[...a,t]);var t}},l().createElement(Ee.CaretRightOutlined,null)))(o))},B=(e,t,n,r,a)=>{const{dataIndex:i,width:o,renderWidth:c,align:d,render:u}=e,m=Jn(n,i),g=u?u(m,n,e,n.index,t):P(m,e,n),w=A(g),C=h.includes(a),S={"selection-column":i===F,"col--center":"center"===d,"col--right":"right"===d,"col--checked":p===i,active:V(a,i)},L={width:`${o||c||0}px`,minWidth:`${o||c||0}px`,backgroundColor:s.get(`${a}|${i}`)};return l().createElement("div",{key:i,"data-col-index":t,title:w,className:ve()("table-cell",S),style:L,onClick:t=>{[F,_].includes(i)||(v([a,i]),I&&!I.disabled?.(n)&&(b(a),I.onChange?.(a,n)),k?.(n,e,t))}},i!==F?l().createElement(l().Fragment,null,E&&1===t&&l().createElement(l().Fragment,null,(D=n._level)?l().createElement("span",{key:D,className:`cell--indent indent-level-${D}`,style:{marginTop:-1,width:D*q.textIndent}},new Array(D).fill(null).map(((e,t)=>l().createElement("i",{key:t,className:"line"})))):null,((e,t)=>{const n=T?.rowExpandable?.(e);return e.children?.length?l().createElement("span",{className:ve()("cell--expand",{fold:!f.includes(t),disabled:n}),onClick:()=>{n||(e=>{const t=f.includes(e),n=t?f.filter((t=>t!==e)):[...f,e];y(n),T?.onExpand?.(!t,x.get(e)),T?.onChange?.(n)})(t)}},l().createElement("span",{className:"anticon icon"},l().createElement(bo,null))):l().createElement("span",{className:"cell--indent",style:{marginTop:-1,width:q.textIndent}})})(n,a)),l().createElement("span",{className:"cell"},g)):l().createElement("div",{className:"action"},R?l().createElement("span",{className:"drag-icon"},l().createElement(Ee.HolderOutlined,null)):l().createElement("span",{style:{width:20}}),l().createElement("div",{className:"middle"},l().createElement("span",{className:"order"},((e,t)=>E?0===e._level?e._varIndex+1:null:t+1)(n,r)),N&&l().createElement(l().Fragment,null,$?l().createElement(K.Checkbox,{className:"checkbox",checked:C,disabled:N?.disabled?.(n),onChange:e=>M(e.target.checked,a)}):l().createElement(K.Radio,{className:"checkbox",checked:C,disabled:N?.disabled?.(n),onChange:e=>M(e.target.checked,a)}))),O?l().createElement("span",{className:"expand-icon",onClick:()=>O(n,r)},l().createElement(Ee.ExpandAltOutlined,null)):l().createElement("span",{style:{width:20}})));var D};return{renderGroupRow:(t,n)=>l().createElement("div",{className:"label-row"},e.map(((e,n)=>W(e,H+n,t)))),renderRow:(t,n,r)=>{const a={"row--selection":h.includes(r),"row--highlight":m===r};return l().createElement("li",{key:r,"data-row-key":r,className:ve()("table-row",a),onMouseEnter:()=>j(r,!0),onMouseLeave:()=>j(r)},e.map(((e,a)=>B(e,H+a,t,n,r))))}}},Eo=e=>{const{layout:t,displayList:n,virtualRows:r,notGroup:a}=e,{fixedWidth:i,gridColumns:o}=Dl(),s=l().useMemo((()=>o.filter((e=>"left"===e.fixed))),[o]),{renderGroupRow:c,renderRow:d}=xo(s,!0);return l().createElement("div",{className:"left-panel",style:{width:i}},l().createElement("div",{className:ve()("container",{"no-group":a})},r.map((e=>{const r=e.index,a=t[r],i=n[r];if(Zi(i))return l().createElement("div",{key:i.id,className:ve()("group-label",`level${i._groupLevel}`),style:{top:a.top,left:a.left,right:0,height:a.height}},c(i,a.key));const o=r===t.length-1||Zi(n[r+1]);return l().createElement("div",{key:a.key,className:ve()("row-item",{"is-leaf":i._level,last:o}),style:{top:a.top,left:a.left,right:0,height:a.height}},d(i,i._varIndex,a.key))}))))},wo=e=>{const{layout:t,displayList:n,virtualRows:r,notGroup:a}=e,{pivotRef:i}=il(),{gridColumns:o}=Dl(),s=l().useMemo((()=>o.filter((e=>"left"!==e.fixed))),[o]),{renderGroupRow:c,renderRow:d}=xo(s);return l().createElement("div",{className:"main-panel"},l().createElement("div",{className:ve()("container",{"no-group":a})},r.map((e=>{const r=e.index,a=t[r],i=n[r];if(Zi(i))return l().createElement("div",{key:i.id,className:ve()("group-label",`level${i._groupLevel}`),style:{top:a.top,left:0,right:a.right,height:a.height}},c(i,a.key));const o=r===t.length-1||Zi(n[r+1]);return l().createElement("div",{key:a.key,className:ve()("row-item",{last:o}),style:{top:a.top,left:0,right:a.right,height:a.height}},d(i,i._varIndex,a.key))}))))},Co=()=>{const{pivotRef:e,getRowKey:t,prefixCls:n,size:r,groupGridData:a,expandedKeys:i,searchResults:o,switchIndex:s}=il(),{scrollbarRef:c,gridColumns:d,treeExpandKeys:u,setGridLayoutRef:m}=Dl(),{flatGroupData:p}=e.current,{contextMenues:h}=e.current.props,{groupMargin:f}=Yi,{rowHeightMaps:g}=ai,y=l().useRef(null),b=l().useMemo((()=>Array.isArray(a)),[a]),{contextMenu:v,closeMenu:x}=(({ref:e,popup:t,getTriggerContainer:n,prevent:r,prefixCls:a="",enabled:i=!0})=>{const o=l().useRef(null),s=l().useRef(null),c=e=>{s.current=e},[d,u]=l().useState(!1),[m,p]=l().useState(null),h={width:150,height:200,zIndex:9999};uo({ref:o,handler:()=>f()});const f=()=>{u(!1),p(null),c(null)},g=oe((e=>{if(e.preventDefault(),r?.(e.target))return f();c(e),u(!0),E((()=>{const{width:t,height:n}=o.current?.getBoundingClientRect()||h,r=t,a=n,i=window.innerWidth,l=window.innerHeight;let s=e.clientX,c=e.clientY;s+r>i&&(s=Math.max(s-r,0)),c+a>l&&(c=Math.max(c-a,0)),p({x:s,y:c})}))}));l().useEffect((()=>{const t=n?.(e.current)||e.current;return i&&t&&t.addEventListener("contextmenu",g),()=>{t&&t.removeEventListener("contextmenu",g)}}),[e]);const y={position:"fixed",top:`${m?.y||0}px`,left:`${m?.x||0}px`,zIndex:h.zIndex};return{contextMenu:l().createElement($l(),{open:d},l().createElement("div",{ref:o,className:`${a}__context-menu`,style:y},s.current?t(s.current):null)),closeMenu:f}})({ref:y,prevent:e=>e.offsetParent.classList.contains("group-label"),prefixCls:n,enabled:!!h,popup:e=>{const n=We(e.target,"table-cell"),r=n?.parentNode?.getAttribute("data-row-key")||"",a=p.find((e=>t(e,e.index)==r)),i=Number(n?.getAttribute("data-col-index")||-1),o=d[i];return l().createElement("ul",{className:"ant-dropdown-menu",style:{padding:5}},h.map((e=>{const t=e.disabled?.(a,o)||!1;return l().createElement("li",{key:e.key,className:ve()("ant-dropdown-menu-item",{"ant-dropdown-menu-item-disabled":t}),onClick:()=>{t||(E((()=>x())),e.onClick?.(a,o))}},e.prefix&&l().createElement("span",{className:"prefix"},e.prefix),l().createElement("span",{className:"label"},e.label),e.suffix&&l().createElement("span",{className:"suffix"},e.suffix))})))}}),w=e=>{const t=p[e];for(let n=e+1;n<p.length;n++)if(p[n]._parentRowKey?.startsWith(t.id)){Object.assign(t,{_record:p[n]});break}},C=l().useMemo((()=>{const e=new Map,n=[];return p.forEach(((r,a)=>{if(Zi(r)){if(0===r._groupLevel)return e.set(r.id,i.includes(r.id)),w(a),void n.push(r);const t=r.id.slice(0,r.id.lastIndexOf(Yi.separator));return void(i.includes(t)&&e.get(t)&&(e.set(r.id,i.includes(r.id)),w(a),n.push(r)))}const l=t(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(l,u.includes(l)),n.push(r))})),e.clear(),n}),[a,i,u]),S=l().useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],a=[],i=n,l=Yi.indentWidth,o=Yi.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;a.length>0&&a[a.length-1]._level>=e._groupLevel;){const e=a.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,a.length>0){const t=a[a.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}a[a.length-1];const t={key:e.id,top:s,left:l*e._groupLevel,right:l*e._groupLevel,height:i,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),a.push(t),s+=i}else{const n=a[a.length-1]||{left:0,right:0},l={key:t(e,e.index),top:s,left:n.left,right:n.right,height:i};r.push(l),s+=i,a.length>0&&(n._childHeight+=i)}}));a.length>0;){const e=a.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,a.length>0){const t=a[a.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(C,{getRowKey:t,rowHeight:g[r]})),[C,r]);mo(S);const N=l().useMemo((()=>!C.length),[C]),T=l().useMemo((()=>{if(N)return 106;if(b)return S.reduce(((e,t)=>e+t.height),0)+2*f;const e=S.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*f+2*f}),[N,b,S]),{rowVirtualizer:I,virtualRows:R}=(e=>{const{layout:t,isGroup:n}=e,{size:r}=il(),{scrollbarRef:a}=Dl(),{rowHeightMaps:i}=ai,o=l().useMemo((()=>a.current?.scrollElement||null),[a.current]),s=lo({count:t.length,getScrollElement:()=>o,estimateSize:e=>t[e].height,overscan:1,noCache:n,rangeExtractor:e=>{if(!n)return Xl(e);const a=e.offset,l=s.scrollElement.offsetHeight,o=[];for(let n=0;n<e.count;n++){const e=t[n];a>e.top+e.height+i[r]||a+l+i[r]<e.top||o.push(n)}return o}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:S,isGroup:!b});qe((()=>{const e=p.findIndex((e=>t(e,e.index)===o[s]?.rowKey));e>=0&&c.current.SET_SCROLL_TOP(e*g[r]);const n=d.findIndex((e=>e.dataIndex===o[s]?.dataIndex));if(n>=0){const e=d.slice(0,n).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);c.current.SET_SCROLL_LEFT(e)}}),[s,o]),l().useLayoutEffect((()=>{m("bodyEl",y.current),m("rowVirtualizer",I)}),[]);const O={layout:S,displayList:C,virtualRows:R,notGroup:b};return l().createElement("div",{ref:y,className:"body",style:{height:T}},N?l().createElement(ct,{className:"content-empty"}):l().createElement(l().Fragment,null,l().createElement(Eo,O),l().createElement(wo,O),v))},So=()=>{const{groupGridData:e,countMethod:t,setSummationData:n}=il(),{indentDepth:r,fixedWidth:a,gridColumns:i}=Dl(),{selectionColumn:o}=ai,{indentWidth:s}=Yi,c=l().useMemo((()=>i.filter((e=>"left"===e.fixed))),[i]),d=l().useMemo((()=>i.filter((e=>"left"!==e.fixed))),[i]);qe((()=>{n(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const a=e.map((e=>S(e,r)));n[r]=t[r](a)}return n},a=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const i={},l={};Object.keys(t).forEach((e=>{l[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>S(e,n)));e[n]=t[n](r),l[n].push(...r)}i[r]={subtotal:e}}else{const e=a(o);i[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&l[n].push(t)}}}if(0===n.length)return i;const o={};for(const e in t)o[e]=t[e](l[e]);return i.subtotal=o,i},i=Array.isArray(e)?{total:r(e)}:a(e);return n.length>0&&(i.total=r(n)),delete i.subtotal,i})(e,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:nl[e[n]]});return t})(t)))}),[t,e]);const u=(e,t)=>l().createElement("div",{className:ve()(t?"fixed-left":"no-fixed"),style:{width:t?a:""}},e.map(((n,a)=>{const{dataIndex:i,width:c,renderWidth:d}=n,u={"selection-column":i===o,"col--right":!0},m=a===(t?e.length>1?1:0:e.length-1)?r*s:0,p={width:`${(c||d||0)+m}px`,minWidth:`${(c||d||0)+m}px`};return l().createElement("div",{key:i,className:ve()("table-cell",u),style:p},i!==o?l().createElement(vo,{column:n,keyPath:"",type:"total"}):null)})));return l().createElement("div",{className:"footer"},u(c,!0),u(d))},No=()=>{const{prefixCls:e,size:t}=il(),n=l().useRef(null);return l().createElement(ql,{scrollbar:n},l().createElement(At,{ref:n,wrapStyle:{height:"100%",maxHeight:"inherit"},className:ve()(`${e}__layout`,t)},l().createElement(zl,null),l().createElement(Co,null),l().createElement(So,null)))},To=()=>l().createElement("div",{className:"wrapper"},l().createElement(No,null)),Io={rowKey:"id",columns:[],dataSource:[]},Ro=e=>{const t=R(Io,e),{rowKey:n,fromTable:r,columns:a,dataSource:i,height:o,maxHeight:s,className:c,style:d}=t,{$size:u}=se(t),m=oe(((e,t)=>{const r="function"==typeof n?n(e,t):e?.[n];return void 0===r?(ue("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r})),p=(e,t="",n=0)=>e.map(((e,r)=>{const a=m(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=p(e.children,a,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),h=l().useMemo((()=>(e=>{let t=(e=>e.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex"].includes(e.dataIndex))))(e).map((e=>({...e,fixed:"left"===e.fixed?"left":void 0,editRender:void 0})));return r&&(t=t.filter((e=>![ai.operationColumn].includes(e.dataIndex)))),t})(a)),[a]),f=l().useMemo((()=>p(i)),[i]),g=xe("pivot-grid"),y={[g]:!0,"is-from-table":r},b={height:o,maxHeight:s},v={prefixCls:g,size:u,getRowKey:m,flatColumns:h,tableData:f,pivotProps:N(t,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return l().createElement("div",{className:ve()(y,c),style:{...d,...b}},l().createElement(al,v,l().createElement(Fl,null),l().createElement(To,null)))};Ro.displayName="PivotGrid";const Oo=Ro,ko=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{tableRef:r,prefixCls:a,flattenColumns:i}=l().useContext(Ha),{rowKey:o,uniqueKey:s}=r.current.props,{t:c}=le(),{tableFullData:d}=r.current,[u,m]=l().useState(!1),p=()=>{m(!0)};l().useImperativeHandle(t,(()=>({clickHandle:p})));const h={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>m(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${a}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>p()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.LineChartOutlined,null))),l().createElement(yn,h,l().createElement(Oo,{fromTable:!0,rowKey:o,uniqueKey:s,columns:i,dataSource:d})))}));ko.displayName="PivotGrid";const Lo=ko,Po=e=>{const{columns:t,group:n,summary:r}=e,{tableRef:a,$size:i,pagination:o,fetchParams:s,isFetch:d}=l().useContext(Ha),{fetch:u}=a.current.props,{t:m}=le(),p=e=>{const n=t.find((t=>t.dataIndex===e));return{title:n.title,precision:n.precision,dictItems:n.dictItems??[]}},f=n.map((e=>({dataIndex:e.group,...p(e.group)}))),g=r.map((e=>e.summary===ai.groupSummary.total.value?{dataIndex:e.summary,title:ai.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),y=l().useMemo((()=>Object.assign({},s,{[ai.sorterFieldName]:void 0,[ai.groupSummary.summaryFieldName]:r.map((e=>`${e.formula}|${e.summary}`)).join(","),[ai.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[ai.currentPageName]:1})),[s,n,r]),[b,v]=l().useState(((e,n)=>[{title:m("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...n.map((e=>{const n=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let r=n?{summation:n}:null;return e.dataIndex===ai.groupSummary.total.value&&(r={dataIndex:ai.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),{...e,..."count"===e.formula||"sum"===e.formula?r:null}}))])(f,g)),[x]=l().useState(d?[]:(e=>{const t=mr(e,n.map((e=>e.group))),a=[];return t.forEach((e=>{const t={};b.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&er(t,r,Jn(e[0],r))})),r.forEach((n=>{const r=n.summary!==ai.groupSummary.total.value?n.summary:ai.groupSummary.recordTotalIndex,a=n.formula;"count"===a&&er(t,r,e.length),"sum"===a&&er(t,r,(0,h.sumBy)(e,r)),"max"===a&&er(t,r,(0,h.maxBy)(e,r)[r]),"min"===a&&er(t,r,(0,h.minBy)(e,r)[r]),"avg"===a&&er(t,r,((0,h.sumBy)(e,r)/e.length).toFixed(2))})),a.push(t)})),a})(a.current.tableFullData)),E={size:i,height:400,...d?{fetch:{api:u.api,params:y,dataKey:u?.dataKey}}:{dataSource:x},columns:b,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${c()().format(Ba)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>v(e)};return l().createElement(Tc,E)},Ao=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,prefixCls:a,$size:i,flattenColumns:s}=l().useContext(Ha),{uniqueKey:c}=r.current.props,{t:d}=le(),u=l().useRef(null),m=l().useRef(null),[p,h]=l().useState(!1),[f,g]=l().useState([]),[y,b]=l().useState(""),[v,x]=l().useState("");qe((()=>{if(v){const{group:e,summary:t}=f.find((e=>e.value===v)).list;I(e),L(t)}else{const e=_();I(e?.group||[]),L(e?.summary||[])}}),[v]),l().useEffect((()=>{q()}),[]);const E=l().useMemo((()=>c?`summary_${c}`:""),[c]),w=l().useMemo((()=>s.filter((e=>![ai.expandableColumn,ai.selectionColumn,"index","pageIndex",ai.operationColumn].includes(e.dataIndex)))),[s]),C=w.filter((e=>!e.groupSummary)).map((e=>({text:cr(e.title),value:e.dataIndex}))),S=[ai.groupSummary.total,...w.filter((e=>!!e.groupSummary)).map((e=>({text:cr(e.title),value:e.dataIndex})))],N=[{text:d("qm.table.groupSummary.sumText"),value:"sum"},{text:d("qm.table.groupSummary.maxText"),value:"max"},{text:d("qm.table.groupSummary.minText"),value:"min"},{text:d("qm.table.groupSummary.avgText"),value:"avg"},{text:d("qm.table.groupSummary.countText"),value:"count"}],[T,I]=l().useState([]),[R,O]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(he,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(t)}},d("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:d("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:C.map((e=>({...e,disabled:T.findIndex((t=>t.group===e.value))>-1})))})}]),[k,L]=l().useState([]),[P,A]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(he,{type:"text",onClick:()=>{m.current.REMOVE_RECORDS(t)}},d("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:d("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:S.map((e=>({...e,disabled:k.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:d("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===ai.groupSummary.total.value?N.slice(N.length-1):N})}]),F=l().useMemo((()=>{const e=T.length&&T.every((e=>Object.values(e).every((e=>""!==e)))),t=k.length&&k.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[T,k]),_=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},q=async()=>{if(!E)return;const e=_();if(e){const{group:t,summary:n}=e;I(t),L(n)}let t=await Wi().getItem(E);t||(t=await D(E),Array.isArray(t)&&await Wi().setItem(E,t)),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))},D=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},H=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},$={visible:p,title:d("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>h(!1)};return l().createElement("div",{className:`${a}-group-summary__setting`},l().createElement("div",{className:"main"},l().createElement("div",{style:{width:"30%"}},l().createElement(Tc,{ref:u,size:i,columns:R,dataSource:T,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>O(e),onDataChange:e=>{I(e)}},l().createElement(he,{type:"primary",icon:l().createElement(Ee.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"container line"},l().createElement(Tc,{ref:m,size:i,columns:P,dataSource:k,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>A(e),onDataChange:e=>{L(e)}},l().createElement(he,{type:"primary",icon:l().createElement(Ee.PlusOutlined,null),onClick:()=>{m.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(K.Input,{size:i,value:y,placeholder:d("qm.table.groupSummary.configText"),disabled:F,onChange:e=>{const{value:t}=e.target;b(t)}}),l().createElement(he,{type:"primary",disabled:!y||F,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return ue("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=or(),t=[...f,{text:y,value:e,list:{group:T.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}}];g(t),x(e),b(""),await Wi().setItem(E,t),await H(E,t)})()},d("qm.table.groupSummary.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${ai.rowHeightMaps[i]}px`}},l().createElement("span",null,d("qm.table.groupSummary.savedSetting"))),l().createElement("ul",null,f.map((e=>l().createElement("li",{key:e.value,className:ve()({selected:e.value===v}),title:e.text,onClick:()=>{return t=e.value,void x(t!==v?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:d("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));g(t),e===v&&x(""),await Wi().setItem(E,t),await H(E,t)})(e.value)}},l().createElement(Ee.CloseCircleOutlined,null))))),!f.length&&l().createElement("div",{style:{padding:Ka}},l().createElement(ct,null)))))),l().createElement(yn,$,l().createElement(Po,{columns:w,group:T,summary:k})),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(he,{onClick:()=>t(),style:{marginRight:8}},d("qm.table.groupSummary.closeButton")),l().createElement(he,{type:"primary",disabled:F,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:T.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))})),void h(!0))},d("qm.table.groupSummary.confirmButton"))))},Fo=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r}=l().useContext(Ha),{t:a}=le(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c={visible:i,title:a("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${r}-group-summary`,title:a("qm.table.groupSummary.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.PieChartOutlined,null))),l().createElement(yn,c,l().createElement(Ao,{onClose:()=>o(!1)})))}));Fo.displayName="GroupSummary";const _o=Fo,qo=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,$size:a,prefixCls:i,flattenColumns:s,setSuperFilters:c,clearTableFilter:d,clearPagerFilter:u}=l().useContext(Ha),{uniqueKey:m}=r.current.props,{t:p}=le(),h=l().useRef(null),[f,g]=l().useState([]),[y,b]=l().useState([]),[v,x]=l().useState(""),[E,w]=l().useState("");qe((()=>{g(E?y.find((e=>e.value===E)).list:D()||[])}),[E]),l().useEffect((()=>{H()}),[]);const C=l().useMemo((()=>m?`superSearch_${m}`:""),[m]),S=l().useMemo((()=>s.filter((e=>!!e.filter))),[s]),T=ur(f),I=l().useMemo((()=>!(T&&Pn(T))),[T]),R=l().useMemo((()=>!!f.length&&I),[f,I]),O=[{value:"and",text:p("qm.table.highSearch.andText")},{value:"or",text:p("qm.table.highSearch.orText")}],k=s.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:cr(e.title)}))),L=e=>["in","nin"].includes(e),P=(e,t)=>{let n;switch(e){case"number":n="number";break;case"date":n="date";break;case"checkbox":case"radio":n=t?"select-multiple":"select";break;default:n="text"}return n},A=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")},{value:"nil",text:p("qm.table.highSearch.nullText")},{value:"nnil",text:p("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":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")},{value:"nil",text:p("qm.table.highSearch.nullText")},{value:"nnil",text:p("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",text:p("qm.table.highSearch.inText")},{value:"nlike",text:p("qm.table.highSearch.ninText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")},{value:"^=",text:p("qm.table.highSearch.startsWithText")},{value:"=$",text:p("qm.table.highSearch.endsWithText")},{value:"nil",text:p("qm.table.highSearch.nullText")},{value:"nnil",text:p("qm.table.highSearch.notNullText")}]}return t},[F,_]=l().useState([{title:p("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(he,{type:"text",onClick:()=>{h.current.REMOVE_RECORDS(t)}},p("qm.table.highSearch.removeText")))},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,t)=>l().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:k,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:p("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const n=Object.values(t)[0],r=S.find((e=>e.dataIndex===n))?.filter.type,a=A(r);e.fieldType=r,e.expression=n?a[0]?.value:"",e.condition=L(e.expression)?[]:"",n||(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=S.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:A(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=L(e.expression)?[]:""}}}},{title:p("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=S.find((t=>t.dataIndex===e.fieldName)),n=t?.filter.type,r=t?.filter?.items??t?.dictItems??[];return{type:P(n,L(e.expression)),editable:!0,items:r,extra:{disabled:!e.fieldName||xr(e.expression),cornerSign:!1}}}},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,t)=>l().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:O,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),q=()=>{C&&sessionStorage.setItem(C,JSON.stringify(f.filter((e=>!!e.fieldName))))},D=()=>{if(!C)return;const e=sessionStorage.getItem(C);return e?JSON.parse(e):null},H=async()=>{if(!C)return;const e=D();e&&g(e);let t=await Wi().getItem(C);t||(t=await $(C),Array.isArray(t)&&await Wi().setItem(C,t)),Array.isArray(t)&&t.length&&(b(t),!e&&w(t[0].value))},$=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},M=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}};return l().createElement("div",{className:`${i}-super-search__setting`},l().createElement("div",{className:"main"},l().createElement("div",{className:"container"},l().createElement(Tc,{ref:h,size:a,columns:F,dataSource:f,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>_(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(n)&&("bracketLeft"===n&&(e[n]=e[n]?"":"("),"bracketRight"===n&&(e[n]=e[n]?"":")"),g([...f]))},onDataChange:e=>{g(e)}},l().createElement(he,{type:"primary",icon:l().createElement(Ee.PlusOutlined,null),onClick:()=>{h.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),ai.highSearch.showSQL&&T&&l().createElement("code",{className:"lang-js"},T)),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(K.Input,{size:a,value:v,placeholder:p("qm.table.highSearch.configText"),disabled:I,onChange:e=>{const{value:t}=e.target;x(t)}}),l().createElement(he,{type:"primary",disabled:!v||I,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!C)return ue("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=or(),t=[...y,{text:v,value:e,list:f.filter((e=>!!e.fieldName))}];b(t),w(e),x(""),await Wi().setItem(C,t),await M(C,t)})()},p("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${ai.rowHeightMaps[a]}px`}},l().createElement("span",null,p("qm.table.highSearch.savedSetting"))),l().createElement("ul",null,y.map((e=>l().createElement("li",{key:e.value,className:ve()({selected:e.value===E}),title:e.text,onClick:()=>{return t=e.value,void w(t!==E?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=y.filter((t=>t.value!==e));b(t),e===E&&w(""),await Wi().setItem(C,t),await M(C,t)})(e.value)}},l().createElement(Ee.CloseCircleOutlined,null))))),!y.length&&l().createElement("div",{style:{padding:Ka}},l().createElement(ct,null)))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(he,{onClick:()=>t(),style:{marginRight:8}},p("qm.table.highSearch.closeButton")),l().createElement(he,{type:"primary",disabled:R,onClick:()=>(d(),u(),c(f.map((e=>N(e,["index","pageIndex"])))),q(),void t())},p("qm.table.highSearch.searchButton"))))},Do=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r}=l().useContext(Ha),{t:a}=le(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c={visible:i,title:a("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${r}-super-search`,title:a("qm.table.highSearch.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.FunnelPlotOutlined,null))),l().createElement(yn,c,l().createElement(qo,{onClose:()=>o(!1)})))}));Do.displayName="SuperSearch";const Ho=Do,$o=l().forwardRef(((e,t)=>{const{tableColumns:n,showFullScreen:r,showReload:a,showPrint:i,showImport:s,showExport:c,showClipboard:d,showCollection:u,showFastSearch:m,showSuperSearch:p,showPivotGrid:h,showGroupSummary:f,showToolBox:g}=e,{global:y}=l().useContext(o),{tableRef:b,$size:v,prefixCls:E,isFullScreen:w}=l().useContext(Ha),{uniqueKey:C,exportExcel:S}=b.current.props,{t:N}=le(),T=l().useRef(null),I=l().useRef(null),R=l().useRef(null),O=l().useRef(null),k=l().useRef(null),L=l().useRef(null),P=l().useRef(null),A=l().useRef(null),F=l().useRef(null),_=l().useRef(null),q=l().useRef(null),D=l().useRef(!1),H=l().useMemo((()=>C?`toolBox_${C}`:""),[C]),[$,M]=l().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),z={fullScreen:r,reload:a,print:i,import:s,export:c&&!S?.hideIcon,clipboard:d,collection:u,fastSearch:m,superSearch:p,pivotGrid:h,groupSummary:f},[V,j]=l().useState(!1);qe((()=>{D.current&&(B(),D.current=!1)}),[$]),l().useEffect((()=>{W()}),[]),l().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!k.current)return ue("Table","执行导出需要配置 `exportExcel` 参数");k.current.clickHandle()}})));const W=()=>{if(!H||!g)return;const e=JSON.parse(localStorage.getItem(H));e||U(H).then((e=>{e&&(M(Object.assign({},$,e)),localStorage.setItem(H,JSON.stringify(e)))})).catch((()=>{})),e&&M(Object.assign({},$,e))},B=()=>{if(!H||!g)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(H,JSON.stringify(e)),G(H,e)},U=async e=>{const t=y?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},G=async(e,t)=>{const n=y?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},Y=async e=>{j(!1),await x(100),e.current.clickHandle()},X=(e,t)=>{D.current=!0,M(Object.assign({},$,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${E}--lg`]:"large"===v,[`${E}--sm`]:"small"===v};return l().createElement(l().Fragment,null,r&&l().createElement(ui,{ref:T,isFullScreen:w,open:!g||$.fullScreen}),a&&l().createElement(pi,{ref:I,open:!g||$.reload}),i&&l().createElement(gi,{ref:R,tableColumns:n,open:!g||$.print}),s&&l().createElement(Li,{ref:O,tableColumns:n,open:!g||$.import}),c&&l().createElement(Di,{ref:k,tableColumns:n,open:(!g||$.export)&&!S?.hideIcon}),d&&l().createElement(Mi,{ref:L,open:!g||$.clipboard}),u&&l().createElement(Vi,{ref:P,columns:n,open:!g||$.collection}),m&&l().createElement(Gi,{ref:A,open:!g||$.fastSearch}),h&&l().createElement(Lo,{ref:F,open:!g||$.pivotGrid}),f&&l().createElement(_o,{ref:_,open:!g||$.groupSummary}),p&&l().createElement(Ho,{ref:q,open:!g||$.superSearch}),g&&l().createElement(K.Dropdown,{open:V,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.screen.full"))),onClick:()=>Y(T)},{key:"reload",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.refresh.text"))),onClick:()=>Y(I)},{key:"print",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.print.text"))),onClick:()=>Y(R)},{key:"import",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.import.textNoSpace"))),onClick:()=>Y(O)},{key:"export",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.export.textNoSpace"))),onClick:()=>Y(k)},{key:"clipboard",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.clipboard.textNoSpace"))),onClick:()=>Y(L)},{key:"collection",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.selectCollection.text"))),onClick:()=>Y(P)},{key:"fastSearch",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.fastSearch.text"))),onClick:()=>Y(A)},{key:"pivotGrid",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.pivotGrid.text"))),onClick:()=>Y(F)},{key:"groupSummary",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.groupSummary.text"))),onClick:()=>Y(_)},{key:"superSearch",label:l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{checked:$.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,N("qm.table.highSearch.text"))),onClick:()=>Y(q)}];return l().createElement(K.Menu,{items:e.filter((e=>z[e.key]))})})(),overlayClassName:ve()(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{j(e)}},l().createElement("span",{className:`${E}-toolbox`,title:N("qm.table.toolbox.text")},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.AppstoreAddOutlined,null)))))}));$o.displayName="ToolBox";const Mo=$o,Ko=(e,t)=>e.map((e=>(e.children&&(e.children=Ko(e.children,t)),t(e)))),zo=l().forwardRef(((e,t)=>{const{columns:n}=e,{global:r}=l().useContext(o),{tableRef:a,prefixCls:i,$size:s}=l().useContext(Ha),{showColumnDefine:c,uniqueKey:d,onlyShowIcon:u,columnsChange:m}=a.current.props,{t:p}=le(),f=l().useRef([]),[g,y]=l().useState(!1),b=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(n)),[n]),v=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(n)),[n]),x=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(n)),[n]),E=l().useMemo((()=>d?`table_${d}`:""),[d]);qe((()=>{w(n)}),[n]),l().useLayoutEffect((()=>{C()}),[]),l().useImperativeHandle(t,(()=>({initialHandler:C})));const w=e=>{if(!E)return;const t=qn(e),n=JSON.parse(localStorage.getItem(E));a.current.columnsDefined&&!(0,h.isEqual)(t,n)&&(localStorage.setItem(E,JSON.stringify(t)),(async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(E,t))},C=()=>{const e=(()=>{if(!E)return;const e=JSON.parse(localStorage.getItem(E));return e||(async e=>{const t=r?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(E).then((e=>{e?(localStorage.setItem(E,JSON.stringify(e)),C()):r?.getComponentConfigApi&&w(n)})).catch((()=>{})),e?(0,h.xor)(Dn(e).map((e=>e.dataIndex)),Dn(n).map((e=>e.dataIndex))).length>0?Ko(n,(t=>{const n=$n(e,t.dataIndex);return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Ko(e,(e=>{const t=$n(n,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();var t;e&&(t=S(e),f.current=t,m?.(e))},S=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((n,r)=>{const a=n.colSpan;a>1&&e.slice(r+1,r+a).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+a))})),t},N=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:a}=n;if(0===r)return;if(1===r)return t.push(n);const i=f.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(a)));if(-1===i)return t.push(n);t.push(...f.current[i].map((({dataIndex:t},r)=>{const a=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(a.hidden=n.hidden),void 0!==n.fixed?a.fixed=n.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),m?.(t)},T=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,N(n))},I=(e,t)=>{const{colSpan:r,noFixed:a}=e;if(0===r)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=cr(e.title),o=["svgicon","handle",`${t}-handle`],s=l().createElement("li",{key:e.dataIndex,className:"item"},l().createElement(K.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,N(n)}}),l().createElement("i",{className:ve()(o),title:p("qm.table.columnFilter.draggable")},l().createElement(Ee.HolderOutlined,null)),l().createElement("span",{className:"text",title:i},i),"main"===t?l().createElement("span",{className:ve()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>T(e,"left")},l().createElement(Ee.StepBackwardOutlined,null)),l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>T(e,"right")},l().createElement(Ee.StepForwardOutlined,null))):"sub"!==t?l().createElement("span",{className:ve()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>T(e)},l().createElement(Ee.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?l().createElement(K.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:R(e.children,e.dataIndex)},s):s},R=(e,t)=>l().createElement("div",{className:"column-filter--wrap"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:r=>{const a=r.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,h.isEqual)(a,i)||((e,t)=>{$n(n,t).children=e,m?.([...n])})(yr(r),t)}},e.map((e=>I(e,"sub"))))),O={[`${i}__popper`]:!0,"column-filter__popper":!0,[`${i}--lg`]:"large"===s,[`${i}--sm`]:"small"===s},k=[`${i}-column-filter`,{selected:g}];return c?l().createElement(Ai(),{action:["click"],popupVisible:g,popup:l().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"reset"},l().createElement(he,{type:"text",size:"small",onClick:()=>{const e=Dn(n),t=n=>n.filter((t=>e.find((e=>e.dataIndex===t.dataIndex)))).map((n=>{const r=e.find((e=>e.dataIndex===n.dataIndex)),a=Object.assign({},r,n);return delete a.renderWidth,void 0===n.hidden&&delete a.hidden,void 0===n.fixed&&delete a.fixed,void 0===n.width&&delete a.width,n.children&&(a.children=t(n.children)),a}));m?.(t(a.current.originColumns))}},p("qm.table.columnFilter.reset"))),l().createElement("div",{className:"left"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),n=b.map((e=>e.dataIndex));(0,h.isEqual)(t,n)||N([...yr(e),...x,...v])}},b.map((e=>I(e,"left"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"main"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:x,setList:e=>{const t=e.map((e=>e.dataIndex)),n=x.map((e=>e.dataIndex));(0,h.isEqual)(t,n)||N([...b,...yr(e),...v])}},x.map((e=>I(e,"main"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"right"},l().createElement(ga.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),n=v.map((e=>e.dataIndex));(0,h.isEqual)(t,n)||N([...b,...x,...yr(e)])}},v.map((e=>I(e,"right")))))),popupClassName:ve()(O),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{y(e)},builtinPlacements:Ua,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:ve()(k),title:u?p("qm.table.columnFilter.text"):void 0},l().createElement("i",{className:"svgicon icon"},l().createElement(Ee.SettingOutlined,null)),!u&&l().createElement("span",null,p("qm.table.columnFilter.text")))):null}));zo.displayName="ColumnFilter";const Vo=zo,jo=l().createContext({}),Wo=()=>l().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().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"})),Bo=l().forwardRef(((e,t)=>{const{dataIndex:n,className:r,style:a}=e;return l().createElement("li",{ref:t,"data-index":n,className:ve()("list-item",r),style:a},e.children)}));Bo.displayName="ListItem";const Uo=Bo,Go=l().forwardRef(((e,t)=>{const{dataSource:n=[],height:r,maxHeight:a,itemHeight:i,renderItem:o,onScroll:s,className:c}=e,d=l().useRef(null),u=lo({count:n.length,getScrollElement:()=>d.current?.scrollElement||null,estimateSize:()=>i||40,overscan:3,onChange:(e,t)=>s?.(e,t)}),m=u.getVirtualItems();l().useImperativeHandle(t,(()=>({SCROLL_TO_INDEX:e=>u.scrollToIndex(e),SCROLL_TO_OFFSET:e=>u.scrollToOffset(e)})));const p=xe("virtual-list");return l().createElement(At,{ref:d,wrapStyle:{height:r,maxHeight:a},className:ve()(p,c),style:e.style},l().createElement("div",{className:"container",style:{height:u.getTotalSize()}},l().createElement("ul",{style:{transform:`translateY(${m[0]?.start??0}px)`}},m.map((e=>l().createElement(Uo,{ref:u.measureElement,key:e.index,dataIndex:e.index,style:{height:i}},o?.(n[e.index],e.index)))))))}));Go.displayName="VirtualList";const Yo=Go,Xo=e=>{const{column:t,isEnum:n,style:r,onChange:a}=e,{tableRef:i,$size:o,flattenColumns:s,isFetch:c,filters:d,superFilters:u,pagerFilter:m,setPagerFilter:p}=l().useContext(Ha),{dataKey:f,filterValue:g={}}=l().useContext(jo),{t:y}=le(),{getTitleFromCellValue:b}=hi(),v=f.split("|")[0],{recordsMap:x,tableOriginData:E,isOriginTree:w}=i.current,{[v]:S,...N}=m,T=l().useRef(!1),I=l().useMemo((()=>s.indexOf(t)),[s,t]),R=l().useRef(0),O=e=>n?[{text:y("qm.table.highSearch.nullText"),value:""},...t.filter.items||t.dictItems||[]]:Array.from((e=>{let n=Vn((()=>{if(!(c||C(d)&&C(u))){const e=u.length?ur(u):ur(d);return An(E,e,w)}return E})());var r;e||(n=((e,t,n)=>{if(!Object.keys(t).length||!e.length)return e;if(!n)return e.filter((e=>Er(e,t)));const r=new Map,a=new Set;for(const n of e)if(r.set(n._rowKey,n),Er(n,t)){let e=n;for(;e&&!a.has(e._rowKey);)a.add(e._rowKey),e=r.get(e._parentRowKey)}return e.filter((e=>a.has(e._rowKey)))})(n,N,w),r=n.length,R.current=r);const a=new Map;return n.forEach((e=>{const n=Jn(e,v);a.has(n)||a.set(n,b(e,t,e.index,I))})),a})(e).entries()).map((([e,t])=>({text:t,value:e}))),k=l().useMemo((()=>O()),[]),L=l().useMemo((()=>C(N)?k:O(!0)),[]),[P,A]=l().useState(k),F=l().useMemo((()=>new Map(P.map((e=>[e.value,null])))),[P]),[_,q]=l().useState(""),[D,H]=l().useReducer(((e,t)=>{const n=t(e),r=[...new Set(n)];return(0,h.isEqual)(e,r)?e:r}),(n?g.in:m[v])||L.map((e=>e.value))),$=l().useMemo((()=>Array.from(F.keys()).every((e=>D.includes(e)))),[D,F]),M=l().useMemo((()=>{const e=Array.from(F.keys()).filter((e=>D.includes(e)));return e.length>0&&e.length<P.length}),[D,P,F]),z=l().useMemo((()=>D.length===L.length),[D]);qe((()=>{a?.(D,z)}),[D]),qe((()=>{const e=z?null:D;if(!(0,h.isEqual)(e,m[v]))return e?void p({...m,[v]:e}):p(N)}),[P,D]);const V=Et((e=>{const t=k.filter((t=>t.text.includes(e))),n=t.map((e=>e.value));A(t),H((e=>[...n,...e.filter((e=>!F.has(e)))]))}),200),j=e=>{q(e),T.current||V(e)};return l().createElement("div",{className:"list-panel",style:r},l().createElement(K.Input,{value:_,size:o,style:{width:200},placeholder:y("qm.table.filter.keywordSearch"),suffix:l().createElement(Ee.SearchOutlined,null),autoFocus:!0,allowClear:!0,onCompositionStart:()=>{T.current=!0},onCompositionEnd:e=>{T.current=!1,j(e.target.value)},onChange:e=>j(e.target.value)}),l().createElement("div",{className:"select-all"},l().createElement("div",{className:"action"},l().createElement(K.Checkbox,{checked:$,indeterminate:M,disabled:!P.length,onChange:e=>{H((t=>e.target.checked?[...t,...Array.from(F.keys())]:t.filter((e=>!F.has(e)))))}},y("qm.table.filter.selectAll")),l().createElement("i",{className:"divider"},"|"),l().createElement("button",{className:"btn invert",disabled:!P.length,onClick:()=>{H((e=>[...Array.from(F.keys()).filter((t=>!e.includes(t))),...e.filter((e=>!F.has(e)))]))}},y("qm.table.filter.invert"))),l().createElement("div",{className:"total"},n?null:`${x.size}/${R.current}`)),l().createElement(Yo,{className:"select-list",maxHeight:180,itemHeight:26,dataSource:P,renderItem:(e,t)=>l().createElement(l().Fragment,null,l().createElement(K.Checkbox,{key:t,checked:D.includes(e.value),onChange:t=>{H((n=>t.target.checked?[...n,e.value]:n.filter((t=>t!==e.value))))}},e.text),l().createElement("button",{className:"btn right",onClick:()=>{H((t=>{const n=[e.value,...t.filter((e=>!F.has(e)))];return(0,h.isEqual)(t,n)?t:n}))}},y("qm.table.filter.onlyItem")))}))},Qo=l().forwardRef(((e,t)=>{const{value:n,style:r}=e,{$size:a,filters:i,pagerFilter:o,setPagerFilter:s}=l().useContext(Ha),{dataKey:c,onChange:d}=l().useContext(jo),{t:u}=le(),m=c.split("|")[0],p=e=>{if(!e){const{[c]:e,...t}=i;return t}const t={...e};for(const e in t)(""===(n=t[e])||null==n)&&delete t[e];var n;return Object.keys(t).length?Object.assign({},i,{[c]:t}):p()},h=(e,t)=>{d(p(e??n),t??!0)};return l().useImperativeHandle(t,(()=>({doFinish:h}))),l().createElement(K.Space,{className:"footer",style:{...r,justifyContent:"flex-end"}},l().createElement(he,{size:a,onClick:()=>(()=>{if(o[m]){const{[m]:e,...t}=o;s(t)}d(p(),!0)})()},u("qm.table.filter.reset")),l().createElement(he,{type:"primary",size:a,onClick:()=>h()},u("qm.table.filter.search")))}));Qo.displayName="FooterPanel";const Zo=Qo,Jo=e=>{const{column:t}=e,{$size:n}=l().useContext(Ha),{filterValue:r={}}=l().useContext(jo),{t:a}=le(),i=l().useRef(null),{openFilterList:o=!0}=t.filter,[s,c]=l().useState(Object.keys(r)[0]||"like"),[d,u]=l().useState(r[s]&&!xr(s)?r[s]:""),m=l().useMemo((()=>d?{[s]:d}:xr(s)?{[s]:1}:null),[s,d]),p=[{value:"like",label:a("qm.table.highSearch.inText")},{value:"nlike",label:a("qm.table.highSearch.ninText")},{value:"==",label:a("qm.table.highSearch.eqText")},{value:"!=",label:a("qm.table.highSearch.neqText")},{value:"^=",label:a("qm.table.highSearch.startsWithText")},{value:"=$",label:a("qm.table.highSearch.endsWithText")},{value:"nil",label:a("qm.table.highSearch.nullText")},{value:"nnil",label:a("qm.table.highSearch.notNullText")}];return l().createElement(l().Fragment,null,l().createElement("div",{className:"filter-box"},l().createElement(K.Select,{value:s,options:p,size:n,className:"condition",style:{width:70,marginRight:6},onChange:e=>{c(e),xr(e)&&u("")}}),l().createElement(K.Input,{value:d,size:n,autoFocus:!0,style:{width:124,paddingLeft:6,paddingRight:2},placeholder:a("qm.table.filter.searchText",{text:cr(t.title)}),disabled:xr(s),onChange:e=>{u(e.target.value)},onKeyDown:e=>{13===e.keyCode&&i.current.doFinish()}})),o&&l().createElement(Xo,{column:t,style:{marginTop:6}}),l().createElement(Zo,{ref:i,value:m}))},es=e=>{const{onChange:t}=e,{filterValue:n={}}=l().useContext(jo),{t:r}=le(),[a,i]=l().useState({nil:n.nil??0,nnil:n.nnil??0});return qe((()=>{const e={};for(const t in a)a[t]&&(e[t]=1);t(e)}),[a]),l().createElement("div",{style:e.style},l().createElement(K.Checkbox,{checked:!!a.nil,onChange:e=>{const t=e.target.checked?1:0;i((e=>Object.assign({},e,t?{nnil:0}:null,{nil:t})))}},r("qm.table.highSearch.nullText")),l().createElement(K.Checkbox,{checked:!!a.nnil,onChange:e=>{const t=e.target.checked?1:0;i((e=>Object.assign({},e,t?{nil:0}:null,{nnil:t})))}},r("qm.table.highSearch.notNullText")))},ts=e=>{const{column:t}=e,{$size:n}=l().useContext(Ha),{filterValue:r={}}=l().useContext(jo),{t:a}=le(),i=l().useRef(null),{openFilterList:o=!0}=t.filter,s="likes",[c,d]=l().useState(r[s]??""),[u,m]=l().useState({}),p=l().useMemo((()=>Object.keys(u).length?u:c?{[s]:c}:null),[c,u]);return l().createElement(l().Fragment,null,l().createElement("div",{className:"filter-box"},l().createElement(K.Input.TextArea,{value:c,size:n,autoFocus:!0,placeholder:a("qm.table.filter.searchAreaText",{text:cr(t.title)}),style:{width:200},disabled:!!Object.keys(u).length,onChange:e=>{d(e.target.value)},onKeyDown:e=>{13===e.keyCode&&i.current.doFinish()}})),l().createElement(es,{style:{marginTop:6},onChange:e=>{Object.keys(e).length&&d(""),m(e)}}),o&&l().createElement(Xo,{column:t,style:{marginTop:6}}),l().createElement(Zo,{ref:i,value:p}))};function ns(){return ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ns.apply(null,arguments)}const rs=e=>{const{$size:t}=l().useContext(Ha),{filterValue:n={}}=l().useContext(jo),{t:r}=le(),a=l().useRef(null),[i,o]=l().useState(n),s=e=>({value:i[e],size:t,disabled:Object.keys(i).some((e=>xr(e))),onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o((n=>Object.assign({},n,{[e]:t})))},onKeyDown:e=>{13===e.keyCode&&a.current.doFinish()}});return l().createElement(l().Fragment,null,l().createElement("div",{className:"filter-list"},l().createElement("ul",null,l().createElement("li",null,l().createElement("span",{className:"label"},"> "),l().createElement(K.InputNumber,ns({},s(">"),{placeholder:r("qm.table.highSearch.gtText"),style:{width:150}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"< "),l().createElement(K.InputNumber,ns({},s("<"),{placeholder:r("qm.table.highSearch.ltText"),style:{width:150}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"= "),l().createElement(K.InputNumber,ns({},s("=="),{placeholder:r("qm.table.highSearch.eqText"),style:{width:150}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"!="),l().createElement(K.InputNumber,ns({},s("!="),{placeholder:r("qm.table.highSearch.neqText"),style:{width:150}}))))),l().createElement(es,{style:{paddingLeft:20},onChange:e=>o(e)}),l().createElement(Zo,{ref:a,value:i}))};function as(){return as=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},as.apply(null,arguments)}const is=e=>{const{$size:t}=l().useContext(Ha),{filterValue:n={}}=l().useContext(jo),{t:r}=le(),[a,i]=l().useState(n),o=e=>({value:ir(a[e],ja),format:ja,size:t,disabled:Object.keys(a).some((e=>xr(e))),onChange:t=>{i((n=>Object.assign({},n,{[e]:lr(t,ja)})))}});return l().createElement(l().Fragment,null,l().createElement("div",{className:"filter-list"},l().createElement("ul",null,l().createElement("li",null,l().createElement("span",{className:"label"},"> "),l().createElement(U,as({},o(">"),{placeholder:r("qm.table.highSearch.gtText"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"< "),l().createElement(U,as({},o("<"),{placeholder:r("qm.table.highSearch.ltText"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"= "),l().createElement(U,as({},o("=="),{placeholder:r("qm.table.highSearch.eqText"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",{className:"label"},"!="),l().createElement(U,as({},o("!="),{placeholder:r("qm.table.highSearch.neqText"),style:{width:"150px"}}))))),l().createElement(es,{style:{paddingLeft:20},onChange:e=>i(e)}),l().createElement(Zo,{value:a}))},ls=e=>{const{column:t}=e,n=l().useRef(null),r="in";return l().createElement(l().Fragment,null,l().createElement(Xo,{column:t,isEnum:!0,onChange:(e,t)=>{n.current.doFinish(t?null:{[r]:e},!1)}}),l().createElement(Zo,{ref:n,style:{display:"none"}}))},os=(e,t,n)=>{let r;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[n]===t)))r=i[n];else{const e=os(i.children,t,n);e&&(r=e)}}return r},ss=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&ss(e.children,t),t(e)||e.children&&e.children.length))),cs=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...cs(e.children,t)),t(e)&&n.push(e)})),n},ds=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=ds(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},us=(e,t,n,r)=>e.map((e=>e[n]===t?{...e,children:r}:e.children?{...e,children:us(e.children,t,n,r)}:e)),ms=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ms(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},ps=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][n]===t)return[t];if(Array.isArray(e[r].children)){const a=ps(e[r].children,t,n);if(a)return[e[r][n],a].flat()}}},hs=(e,t)=>{const n=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>n.push(...hs(e,t)))),n},fs=l().forwardRef(((e,t)=>{const{className:n,style:r,filterable:a=!0,multiple:i,draggable:o,dataSource:s,fetch:c,autoFocus:d,asyncLoad:u,checkStrictly:m,checkStrategy:p="SHOW_CHILD",placeholder:f,fieldsDefine:g,value:y,height:b,defaultSelectedKeys:v=[],defaultExpandedKeys:x=[],defaultExpandAll:E=!0,showSearchBar:w=!0,showCollapse:S=!0,onSelectChange:N,onCheckChange:T,onDragStart:I,onDragChange:R,onExpand:O}=e,{$size:k}=se(e),{t:L}=le(),P=g?.valueKey||"value",A=g?.textKey||"text",F=l().useRef(null),_=l().useRef(null),q=vt(F),[D,H]=ri(b,{value:b}),[$,M]=l().useState(!1),z=Et((()=>{H(F.current.offsetHeight-te.current.offsetHeight-10)}),5);xt((()=>{b||z()}),[q.height]);const[V,j]=l().useState([]),[W,B]=l().useState({}),[U,G]=l().useState([]),[Y,X]=l().useState([]),[Q,Z]=l().useState(""),[J,ee]=l().useState(E),te=l().useRef(null),ne=l().useRef([]),re=l().useRef([]);l().useEffect((()=>{Array.isArray(s)&&(ae(s),G(ie(s)),B({}))}),[s]),l().useEffect((()=>{de(),d&&_.current?.focus()}),[]),qe((()=>{de()}),[c?.params]),qe((()=>{X(ce())}),[W]),l().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=ds(V,(t=>e===t[P]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],ae([...V]))},REMOVE_RECORD:e=>{const t=os(V,e,P);if(void 0===t&&V.find((t=>t[P]===e)))ae(V.filter((t=>t[P]!==e)));else{const n=ds(V,(e=>t===e[P]));if(!n)return;const r=n.children?.findIndex((t=>e===t[P]));r>=0&&(n.children.splice(r,1),ae([...V]))}},UPDATE_RECORD:(e,t)=>{const n=ds(V,(t=>e===t[P]));n&&((0,h.merge)(n,t),ae([...V]))}})));const ae=e=>{j(e),ne.current=e,re.current=ms(e,P)},ie=e=>{if(i)return v;const t=cs(e,(e=>v.includes(e[A])));return 1===t.length?[t[0][P]]:[]},oe=e=>ps(V,e,P)?.slice(0,-1)||[],ce=()=>{if(E)return re.current;const e=[];return U.forEach((t=>{if(i){if("SHOW_ALL"===p&&!re.current.includes(t)&&e.push(...oe(t)),"SHOW_CHILD"===p&&e.push(...oe(t)),"SHOW_PARENT"===p){const n=jr(V,t);if(n){const r=oe(t),a=hs(n,P);e.push(...r,...[t,...a].filter((e=>re.current.includes(e))))}}}else e.push(...oe(t))})),[...new Set([...x,...e])]},de=async()=>{if(!c)return;const{api:e,params:t,dataKey:n,afterFetch:r,callback:a}=c;try{M(!0);const i=await e(t);if(200===i.code){let e=Array.isArray(i.data)?i.data:(0,h.get)(i.data,n)??[];e="function"==typeof r?await r(e):e,ae(e),G(ie(e)),B({}),a?.(e)}}catch(e){}M(!1)},ue=e=>`${e}|${ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,me=xe("search-tree"),pe={[me]:!0,[`${me}--lg`]:"large"===k,[`${me}--sm`]:"small"===k};return l().createElement("div",{ref:F,className:ve()(pe,n),style:r},l().createElement("div",{ref:te,className:"topper",style:{display:w||S?"":"none"}},w&&l().createElement(K.Input,{ref:_,value:Q,size:k,placeholder:f||L("qm.form.inputPlaceholder"),suffix:l().createElement(Ee.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{if(!a)return;const t=ss(ne.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==ue(n).indexOf(e)}));Z(e),j(t),X(E||e?ms(t,P):ce())})(e.target.value)}),S&&l().createElement("a",{className:"trigger",onClick:()=>{ee(!J),X(J?[]:re.current)}},J?l().createElement(Ee.UpOutlined,null):l().createElement(Ee.DownOutlined,null)," ",L(J?"qm.form.collect":"qm.form.spread"))),l().createElement(ut,{spinning:$},l().createElement(K.Tree,{fieldNames:{title:A,key:P,children:"children"},multiple:i,draggable:o,blockNode:o,checkable:i,selectable:!i,height:D,disabled:e.disabled,checkStrictly:m,selectedKeys:y??U,checkedKeys:y??U,expandedKeys:Y,treeData:V,loadData:u?async({key:e,children:t})=>{if(!c||t)return;const{api:n,params:r,dataKey:a,formatter:i=e=>e,afterFetch:l}=c;try{const t=await n(i({...r,[P]:e}));if(200===t.code){let n=Array.isArray(t.data)?t.data:(0,h.get)(t.data,a)??[];n="function"==typeof l?await l(n):n;const r=us(ne.current,e,P,n);ae(r)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!Q)return!1;const t=e[A]||"";return-1!==ue(t).indexOf(Q)},onDragStart:I,onDragEnter:e=>{X(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),a=e.dropPosition-Number(r[r.length-1]),i=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][P]===t)return n(e[r],r,e);e[r].children&&i(e[r].children,t,n)}},l=[...V];let o;if(i(l,n,((e,t,n)=>{n.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,n=[];i(l,t,((t,r,a)=>{n=a,e=r})),-1===a?n.splice(e,0,o):n.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));ae(l)},onDragEnd:e=>{R?.(e,V)},onExpand:(e,t)=>{C(e)&&ee(!1),re.current.every((t=>e.includes(t)))&&ee(!0),X(e),O?.(e,t)},onSelect:e=>{G(e);const t=cs(ne.current,(t=>e.includes((0,h.get)(t,P))));N?.(i?t:t[0])},onCheck:e=>{m&&(e=e.checked),G(e),m||("SHOW_CHILD"===p&&(e=e.filter((e=>!re.current.includes(e)))),"SHOW_PARENT"===p&&(e=e.filter(((e,t,n)=>!n.includes(os(V,e,P))))));const t=cs(ne.current,(t=>e.includes((0,h.get)(t,P))));T?.(i?t:t[0])}})))}));fs.displayName="QmSearchTree";const gs=fs,ys=e=>{const{column:t}=e,{$size:n}=l().useContext(Ha),{filterValue:r={}}=l().useContext(jo),a=l().useMemo((()=>t.filter.items||t.dictItems||[]),[]),i=l().useMemo((()=>{const e=[];return function t(n){n.forEach((n=>{Array.isArray(n.children)?t(n.children):e.push(n.value)}))}(a),e}),[a]),o="in",[s,c]=l().useState(r.in??i),[d,u]=l().useState({}),m=l().useMemo((()=>Object.keys(d).length?d:s.length===i.length?null:{[o]:s}),[s,d]);return l().createElement(l().Fragment,null,l().createElement("div",{className:"tree-panel",style:t.filter.style},l().createElement(gs,{multiple:!0,value:s,dataSource:a,disabled:!!Object.keys(d).length,size:n,style:{height:238},onCheckChange:e=>{c(e.map((e=>e.value)))}})),l().createElement(es,{style:{marginLeft:-10,marginRight:-10,padding:"6px 0 0 20px",borderTop:"1px solid #e8e8e8"},onChange:e=>{Object.keys(e).length&&c([]),u(e)}}),l().createElement(Zo,{value:m}))},bs=e=>{const{column:t,filters:n}=e,{$size:r,prefixCls:a,pagerFilter:i,setFilters:o,clearSuperFilters:s}=l().useContext(Ha),{t:c}=le(),[d,u]=l().useState(!1),m=l().useMemo((()=>{const{dataIndex:e,filter:n}=t;return`${e}|${n.type}`}),[t]),p=l().useMemo((()=>!!Object.keys(n[m]||{}).length||!!i[t.dataIndex]),[n,i]),h=(e,t)=>{s(),o(e),t&&u(!1)},f=l().useMemo((()=>({dataKey:m,filterValue:n[m],onChange:h})),[n]);l().useEffect((()=>{"radio"===t.filter.type&&ue("Table","表头筛选类型 `radio` 即将被弃用,请使用 `checkbox` 替代")}),[]);const g={text:e=>l().createElement(Jo,{column:e}),textarea:e=>l().createElement(ts,{column:e}),number:e=>l().createElement(rs,{column:e}),date:e=>l().createElement(is,{column:e}),radio:e=>g.checkbox(e),checkbox:e=>l().createElement(ls,{column:e}),tree:e=>l().createElement(ys,{column:e})},y={"head-filter__popper":!0,[`${a}--lg`]:"large"===r,[`${a}--sm`]:"small"===r},b=["cell--filter",{selected:d,actived:p}];return l().createElement(Ai(),{action:["click"],popupVisible:d,popup:(()=>{const e=g[t.filter.type];return e?l().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},l().createElement(jo.Provider,{value:f},e(t))):(ue("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:ve()(y),popupStyle:{minWidth:150},onPopupVisibleChange:e=>u(e),builtinPlacements:Ua,destroyPopupOnHide:!0,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("div",{className:ve()(b),title:c("qm.table.filter.text"),onClick:e=>e.stopPropagation()},l().createElement("span",{className:"svgicon icon"},l().createElement(Wo,null))))},vs=e=>{const{column:t}=e,{tableRef:n,bordered:r}=l().useContext(Ha),{columns:a,resizable:i,columnsChange:o=b}=n.current.props,s=l().useMemo((()=>Kn(t)),[t]),c={resizable:!0,"is--line":i&&!r};return l().createElement("div",{className:ve()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:r,scrollBarRef:i}=n.current,l=r.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=Xn(t,r.$table).left-i.current.scrollLeft+c;r.$table.classList.add("c--resize"),l.style.left=`${u}px`,l.style.display="block";const m=s.width||s.renderWidth;let p=m;return document.onmousemove=function(e){if("number"!=typeof m)return;const t=e.clientX-d,n=m+t;n<(s.minWidth||ai.defaultColumnWidth)||(p=Math.floor(n),l.style.left=`${t+u}px`)},document.onmouseup=function(){r.$table.classList.remove("c--resize"),l.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&($n(a,s.dataIndex).width=p,o([...a]))},!1}})},xs=e=>{const{selectionKeys:t}=e,{tableRef:n,getRowKey:r,fetchParams:a,setSelectionKeysEffect:i,setInvalidRowKeys:o,setSpinning:s,pagination:c,isFetch:d,isWebPagination:u,createWebPageData:m}=l().useContext(Ha),{t:p}=le(),{selectionRows:f,recordsMap:g}=n.current,{rowSelection:y}=n.current.props,{fetchAllRowKeys:b,selectAllOnCurrentPage:v,filterable:x,onSelectAll:E}=y,w=l().useRef([]),C=l().useMemo((()=>d&&!!b),[d,b]),S=l().useMemo((()=>!C&&!!v),[C,v]),N=l().useMemo((()=>(x??!0)&&!S),[x,S]),T=()=>{const{disabled:e}=y;return(e?f.filter((t=>!e(t))):f).map((e=>r(e,e.index)))},I=()=>u?Vn(m()):Array.from(g.values()),R=l().useMemo((()=>(()=>{const{disabled:e}=y;if(C)return w.current.length?w.current:(0,h.union)(Array.from(g.keys()),T());if(!S)return e?Array.from(g.keys()).filter((t=>!e(g.get(t)))):Array.from(g.keys());const t=e?I().filter((t=>!e(t))).map((e=>r(e,e.index))):I().map((e=>r(e,e.index)));return(0,h.union)(t,T())})()),[g,w,f,c]),O=t.filter((e=>!R.includes(e))),k=t.length-O.length,L=k>0&&k<R.length,P=!!k&&k===R.length;o(O);const A=async()=>{const e=b;let t=[];s(!0);try{const n=await e.api(a);if(200===n.code){t=Array.isArray(n.data)?n.data:(0,h.get)(n.data,e.dataKey)??[];const{disabled:a}=y;a&&(t=(0,h.xor)(t,I().filter((e=>a(e))).map((e=>r(e,e.index))))),w.current=t}}catch(e){}return s(!1),t},F=async e=>{let t=[];t=C?e?await A():[]:e?R.slice(0):[],t=[...new Set([...t,...O])],i(t),E?.(e,t)};return l().createElement("div",{className:"cell--selection"},l().createElement(K.Checkbox,{checked:P,indeterminate:L,disabled:!R.length,onChange:e=>F(e.target.checked)}),N&&l().createElement(K.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{F(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=C?(0,h.xor)(t,await A()):(0,h.xor)(t,R),e=[...new Set([...e,...O])],i(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{F(!1)}}];return l().createElement(K.Menu,{items:e})})()},l().createElement(Ee.DownOutlined,{className:"svgicon icon"})),S&&l().createElement(K.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},l().createElement(Ee.InfoCircleOutlined,{className:"info"})))},Es=e=>{const{style:t}=e,{tableRef:n,rowExpandedKeys:r,setRowExpandedKeys:a,createAllExpandedKeys:i,filters:o,pagerFilter:s,superFilters:c}=l().useContext(Ha),{expandable:d}=n.current.props,[u,m]=l().useState(d?.defaultExpandAllRows||!1);qe((()=>{p(r)!==u&&m(!u)}),[r]),qe((()=>{n.current.isTreeTable&&(C(o)&&C(s)&&C(c)||E((()=>!p(r)&&a(i()))))}),[o,s,c]);const p=e=>i().every((t=>e.includes(t))),h=xe("expand"),f={[`${h}--icon`]:!0,expanded:u,collapsed:!u};return l().createElement("span",{className:ve()(f),title:"",onClick:e=>{e.stopPropagation(),m(!u),a(u?[]:i())},style:t})},ws=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().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"})),Cs=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().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"})),Ss=e=>{const{tableColumns:t}=e,{tableRef:n,prefixCls:r,layout:a,flattenColumns:i,sorter:o,filters:s,superFilters:c,pagerFilter:d,selectionKeys:u,isFetch:m,treeExpandIndex:p,tableChange:h,setSorter:f,setElementStore:g,resetTableScroll:y,getStickyLeft:b,getStickyRight:v,createTableFullData:x}=l().useContext(Ha),{ellipsis:w,resizable:S,multipleSort:N,rowSelection:T,expandable:I}=n.current.props,[R,O]=ai.sortDirections,{t:k}=le(),L=l().useRef(null),P=l().useMemo((()=>!m),[m]),A=l().useMemo((()=>!I?.hideExpandAll),[I]),F=l().useMemo((()=>!(!T||(m?!T.selectAllOnCurrentPage&&!T.fetchAllRowKeys:T.hideSelectAll))),[m,T]),_=l().useMemo((()=>Object.fromEntries(Object.entries(o).filter((([e,t])=>null!==t)))),[o]);qe((()=>{z(),h(),y()}),[o]),qe((()=>{B(),V(!0),h(),y()}),[s,c]),qe((()=>{G(),V(!0),h(),y()}),[d]),l().useEffect((()=>{!C(o)&&E((()=>z())),!C(s)&&E((()=>B()))}),[]),l().useLayoutEffect((()=>{q()}),[]);const q=()=>{g("$header",L.current)},D=e=>{const{dataIndex:t,type:r,sorter:a,title:i,description:s}=e;if(t===ai.selectionColumn&&"checkbox"===r){if("checkbox"===r)return l().createElement("div",{className:"cell"},F?l().createElement(xs,{selectionKeys:u}):k("qm.table.config.selectionText"));if("radio"===r)return l().createElement("div",{className:"cell"},i)}const c=[];return c.push(l().createElement("div",{key:0,className:"cell",title:cr(i)},n.current.isTreeTable&&t===p&&A?l().createElement(Es,null):null,t===ai.expandableColumn&&A?l().createElement(Es,null):i)),s&&c.push(l().createElement(K.Tooltip,{key:1,placement:"top",title:s},l().createElement(Ee.InfoCircleOutlined,{className:"tip"}))),a&&c.push(H(o[t])),c},H=e=>{const t=["svgicon cell--sorter__asc",{actived:e===R}],n=["svgicon cell--sorter__desc",{actived:e===O}];return l().createElement("div",{key:2,className:"cell--sorter",title:k("qm.table.sorter.text")},l().createElement("span",{className:ve()(t)},l().createElement(ws,null)),l().createElement("span",{className:ve()(n)},l().createElement(Cs,null)))},$=e=>l().createElement(bs,{column:e,filters:s}),M=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=o[r],t=e?e===O?null:O:R;N?(delete o[r],f(Object.assign({},o,{[r]:t}))):f(Object.assign({},{[r]:t}))}},z=()=>{P&&V()},V=e=>{const t=Object.keys(_).length>0;e?t&&W(_):W(t?_:{index:R})},j=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,W=e=>{const t=((e,t)=>e.sort(((e,n)=>{for(const r in t){const a=i.find((e=>e.dataIndex===r)),l=t[r],o=Jn(e,r),s=Jn(n,r),c="function"!=typeof a?.sorter?j(o,s):a.sorter(e,n);if(0!==c)return"ascend"===l?c:-c}return 0})).slice(0))(n.current.tableFullData,e);x(t)},B=()=>{P&&U()},U=()=>{const{tableOriginData:e,isOriginTree:t}=n.current,r=c.length?ur(c):ur(s);let a=An(e,P?r:"",t);a=wr(a,d,t),x(a)},G=()=>{U()},Y=Bn(t),{tableBodyWidth:X}=a;return l().createElement("div",{ref:L,className:`${r}--header-wrapper`},l().createElement("table",{className:`${r}--header`,cellSpacing:"0",cellPadding:"0",style:{width:X?`${X}px`:""}},l().createElement("colgroup",null,i.map((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;return l().createElement("col",{key:t,style:{width:`${n||r}px`,minWidth:`${n||r}px`}})}))),l().createElement("thead",null,(e=>e.map(((e,t)=>l().createElement("tr",{key:t,className:"header--row"},e.map(((t,r)=>((e,t,r)=>{const{dataIndex:a,colSpan:i,rowSpan:s,fixed:c,align:d,theadAlign:u,theadClassName:m="",sorter:p,filter:h,required:f,headRender:g}=e;if(0===i)return null;const y=u||d,x=["header--column",{"col--ellipsis":e.ellipsis??w,"col--center":"center"===y,"col--right":"right"===y,"column--required":!!f,"column-has-sorter":p,"column-has-filter":h,"column--sort":!!o[a],"cell-fix-left":"left"===c,"cell-fix-right":"right"===c,"cell-fix-left-last":"left"===c&&!r[t+(i??1)]?.fixed,"cell-fix-right-first":"right"===c&&!r[t-1]?.fixed,[m]:!!m}],E={left:"left"===c?`${b(a)}px`:"",right:"right"===c?`${v(a,"thead")}px`:""},C=S&&![ai.expandableColumn,ai.selectionColumn].includes(a);return l().createElement("th",{key:a,className:ve()(x),colSpan:i,rowSpan:s,style:{...E},onClick:t=>M(t,e)},l().createElement("div",{className:"cell--wrapper"},g?l().createElement("div",{className:"cell--text cell"},g(e,n.current.tableFullData)):l().createElement(l().Fragment,null,l().createElement("div",{className:"cell--text"},D(e)),h?$(e):null)),C&&l().createElement(vs,{column:e}))})(t,r,e)))))))(Y))))},Ns=l().createContext([]),Ts=(e,t,n,r,a,i,l,o,s,c)=>{const{clientX:d,clientY:u}=e,{top:m,height:p}=e.target.getBoundingClientRect(),h=((a?.x||0)-d-12)/r,f=s.filter((e=>o[e]?.children?.length));let g=Is(o,n.eventKey);if(u<m+p/2){const e=l.findIndex((e=>e===g.key)),t=l[e<=0?0:e-1];g=Is(o,t)}const y=g.key,b=g,v=g.key;let x=0,E=0;if(!f.includes(y))for(let e=0;e<h&&Os(g);e+=1)g=g.parent,E+=1;const w=t.data,C=g.node;let S=!0;return ks(g)&&0===g.level&&u<m+p/2&&i({dragNode:w,dropNode:C,dropPosition:-1})&&g.key===n.eventKey?x=-1:(b.children||[]).length&&f.includes(v)?i({dragNode:w,dropNode:C,dropPosition:0})?x=0:S=!1:0===E?h>-1.5?i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1:i({dragNode:w,dropNode:C,dropPosition:0})?x=c?1:0:i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1:i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1,{dropPosition:x,dropLevelOffset:E,dropTargetKey:g.key,dropTargetPos:g.pos,dragOverNodeKey:v,dropContainerKey:0===x?null:g.parent?.key||null,dropAllowed:S}},Is=(e,t)=>e[t],Rs=e=>e.split("-"),Os=e=>{if(e.parent){const t=Rs(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},ks=e=>{const t=Rs(e.pos);return 0===Number(t[t.length-1])},Ls=(e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const a=Is(r,e);return{eventKey:e,pos:a?a.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}},Ps=({openDragSort:e})=>{const{tableRef:t,getRowKey:n,rowExpandedKeys:r,setRowExpandedKeys:a,createTableData:i,dataChange:o}=l().useContext(Ha),{tableFullData:s,recordsMap:c,isTreeTable:d}=t.current,u=v,m=l().useRef(null),p=l().useRef(null),h=l().useRef(null),f=l().useRef(),[g,y]=l().useState({}),[b,x]=l().useState(null),[E,w]=l().useState([]),[C,S]=l().useState(0),[N,T]=l().useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),I=e=>{T((t=>Object.assign({},t,e)))};l().useLayoutEffect((()=>{e&&y((e=>{const t={},r=(e,a=null,i=0)=>{const l=[];return e.forEach(((e,o)=>{const s=n(e,e.index),c={index:o,key:s,level:i,node:e,parent:a,pos:(d=a?.pos||"0",u=o,`${d}-${u}`),nodes:[...a?.nodes||[],e]};var d,u;Array.isArray(e.children)&&(c.children=r(e.children,c,i+1)),t[s]=c,l.push(c)})),l};return r(e),t})(s))}),[s]),l().useEffect((()=>()=>{window.removeEventListener("dragend",k)}),[]);const R=()=>{I({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},O=()=>{null!==b&&(x(null),I({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),p.current=null,h.current=null},k=e=>{L(e,null,!0),window.removeEventListener("dragend",k)},L=(e,t,n)=>{I({dragOverNodeKey:null}),O(),m.current=null,window.removeEventListener("dragend",k)};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;m.current=t,p.current={x:e.clientX,y:e.clientY};const i=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(r,n);x(n),w(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(Is(t,e).children),n})(n,g)),S(2*ai.treeTable.textIndent),a(i),window.addEventListener("dragend",k)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(h.current!==n&&(h.current=n),!m.current)return void R();const{dropPosition:i,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:y,dropAllowed:v,dragOverNodeKey:x}=Ts(e,m.current,t,C,p.current,u,Array.from(c.keys()),g,r,!d);-1===E.indexOf(o)&&v?(f.current||(f.current={}),Object.keys(f.current).forEach((e=>{clearTimeout(f.current[e])})),m.current.eventKey!==n&&(e.persist(),f.current[n]=window.setTimeout((()=>{if(null===b)return;let e=[...r];const t=Is(g,n);t&&t.children?.length&&(e=((e,t)=>{const n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n})(r,n)),a(e)}),800)),m.current.eventKey!==o||0!==l?I({dragOverNodeKey:x,dropPosition:i,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:y,dropAllowed:v}):R()):R()},onNodeDragOver:(e,t)=>{if(!m.current)return;const{dropPosition:n,dropLevelOffset:a,dropTargetKey:i,dropContainerKey:l,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:h}=Ts(e,m.current,t,C,p.current,u,Array.from(c.keys()),g,r,!d);-1===E.indexOf(i)&&o&&(m.current.eventKey===i&&0===a?null===N.dropPosition&&null===N.dropLevelOffset&&null===N.dropTargetKey&&null===N.dropContainerKey&&null===N.dropTargetPos&&!1===N.dropAllowed&&null===N.dragOverNodeKey||R():n===N.dropPosition&&a===N.dropLevelOffset&&i===N.dropTargetKey&&l===N.dropContainerKey&&s===N.dropTargetPos&&o===N.dropAllowed&&h===N.dragOverNodeKey||I({dropPosition:n,dropLevelOffset:a,dropTargetKey:i,dropContainerKey:l,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:h}))},onNodeDragLeave:(e,t)=>{h.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(R(),h.current=null)},onNodeDragEnd:L,onNodeDrop:(e,t,r=!1)=>{const{dropPosition:a,dropTargetKey:l,dropTargetPos:c,dropAllowed:d,dragOverNodeKey:u}=N;if(!d)return;if(I({dragOverNodeKey:null}),O(),null===l)return;const p={...Ls(l,{dropPosition:a,dragOverNodeKey:u,keyEntities:g}),data:Is(g,l).node};-1!==E.indexOf(l)&&ue("Table Draggable","无法拖放到 `dragNode` 的子节点");const h=Rs(c),f={event:e,node:p,dragNode:m.current,dragNodesKeys:[m.current.eventKey].concat(E),dropToGap:0!==a,dropPosition:a+Number(h[h.length-1])};r||(e=>{const t=e.node.eventKey,r=e.dragNode.eventKey,a=e.node.pos.split("-"),l=e.dropPosition-Number(a[a.length-1]),c=(e,t,r)=>{for(let a=0;a<e.length;a++){if(n(e[a],e[a].index)===t)return r(e[a],a,e);e[a].children&&c(e[a].children,t,r)}},d=[...s];let u;if(c(d,r,((e,t,n)=>{n.splice(t,1),u=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,a)=>{n=a,e=r})),-1===l?n.splice(e,0,u):n.splice(e+1,0,u)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(u)}));i(d),o()})(f),m.current=null},indent:C,dropOptions:N}};function As(){const[,e]=i.useReducer((e=>e+1),0);return e}const Fs=l().forwardRef(((e,t)=>{const{rowKey:n,rowIndex:r,row:a,className:i,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:m,onNodeDragOver:p,onNodeDragLeave:h,onNodeDragEnd:f,onNodeDrop:g}=e,y=l().useRef({eventKey:n,data:a,props:e}),b=l().useRef(!1),[v,x]=l().useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,T=C===n&&0===E,I=C===n&&-1===E,R=C===n&&1===E,O=a._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-w*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-w*s+O*s});break;case 0:Object.assign(k,{bottom:0,left:s+O*s})}const L={"body--row-draggable":!0,"body--row-dragging":v,"drop-target":S===n,"drop-container":N===n,"drag-over":T,"drag-over-gap-top":I,"drag-over-gap-bottom":R};return l().createElement("tr",{ref:t,"data-row-key":n,"data-row-index":r,className:ve()(i,L),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),b.current=t)},onDragStart:e=>{if(e.stopPropagation(),b.current)return e.preventDefault();x(!0),u(e,y.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),m(e,y.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),p(e,y.current)},onDragLeave:e=>{e.stopPropagation(),h(e,y.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,y.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,y.current)}},e.children,C===n&&null!==E&&null!==w&&l().createElement("td",{className:"drop-indicator",style:k}))}));Fs.displayName="DraggableTr";const _s=Fs,qs=e=>{const{selectionKeys:t,column:n,record:r,rowKey:a}=e,{tableRef:i}=l().useContext(Ha),{rowSelection:o}=i.current.props,s=l().useMemo((()=>n.type||""),[n.type]),c=e=>{const{isTreeTable:n,tableFullData:r}=i.current,a=o.checkStrictly??!0;if(!n||a)return!1;const l=hr(r,(t=>t._rowKey===e));return((e,t)=>{const n=new Set(t);let r=!1,a=!1;for(const t of e)if(n.has(t)?r=!0:a=!0,r&&a)break;return r&&a})(Wn(l?.children??[],(e=>e._rowKey)),t)};return"radio"===s?(()=>{const e=o.disabled,n=e?.(r),i=!n&&t[0]===a;return l().createElement(K.Radio,{checked:i,disabled:n})})():(()=>{const e=o.disabled,n=e?.(r),i=!!t.includes(a);return l().createElement(K.Checkbox,{checked:i,indeterminate:c(a),disabled:n})})()},Ds=e=>{const{record:t,rowKey:n,style:r}=e,{tableRef:a,rowExpandedKeys:i,setRowExpandedKeys:o}=l().useContext(Ha),{expandable:s={}}=a.current.props,[c]=l().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=l().useMemo((()=>i.includes(n)),[i,n]);qe((()=>{s.onExpand?.(d,t)}),[d]);const u=xe("expand"),m={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return l().createElement("span",{className:ve()(m),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==n)):[...i,n];o(t)},style:r})},Hs=l().createContext({});function $s(){return $s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$s.apply(null,arguments)}const Ms=l().forwardRef(((e,t)=>{const{$size:n,doFieldValidate:r}=l().useContext(Ha),{dataKey:a,doFieldUpdate:i,cellValueChange:o}=l().useContext(Hs),{column:s,row:c,rowKey:d,columnKey:u,options:m,isTextArea:p}=e,{t:h}=le(),f=As(),g=l().useRef(!1),{dataIndex:y}=s,{type:b,extra:v={},rules:x=[],onInput:E,onChange:w,onEnter:C,onBlur:S}=m,N=Jn(c,y),T=Object.assign({},{minRows:1,maxRows:4},v.autoSize),I=p?{rows:T.minRows,autoSize:T}:null,R=v.password?K.Input.Password:p?K.Input.TextArea:K.Input;return l().createElement(R,$s({ref:t,size:n,value:N,maxLength:v.maxLength,showCount:v.showCount},I,{autoComplete:v.password?"new-password":"off",placeholder:v.placeholder??h("qm.table.editable.inputPlaceholder"),allowClear:v.allowClear,readOnly:v.readOnly,disabled:v.disabled,suffix:v.suffix,onChange:e=>{const t=e.target.value??"";er(c,y,t),r(x,t,d,u,cr(s.title)),f(),E?.({[a]:t}),g.current=!0},onBlur:e=>{const t=e.target.value??"";g.current&&(g.current=!1,i(c,d,u),w?.({[a]:t},c),S?.({[a]:t},c),o())},onKeyUp:e=>{if(13===e.keyCode&&!e.shiftKey){const t=e.target.value??"";C?.({[a]:t},c)}},onKeyDown:e=>{p&&13===e.keyCode&&!e.shiftKey&&C&&e.preventDefault()}}))}));Ms.displayName="TextCell";const Ks=Ms,zs=l().forwardRef(((e,t)=>{const{size:n,defaultValue:r,value:a,min:i,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:m,stringMode:p,allowClear:h,readOnly:f,disabled:g,formatter:y=e=>e.toString(),parser:b=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)<i&&(t=i.toString()),m>=0&&""!==t&&(t=new(Ra())(t).toFixed(m)),t},E=void 0!==a,[w,C]=l().useState(r??""),S=y(E?a:w),N=b(S);return qe((()=>{e.onChange?.(N)}),[w]),l().createElement(K.Input,{ref:t,size:n,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const n=b(t.target.value.replace(/\s+/g,""));let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===m&&n.includes(".")&&(r=!1),i>=0&&n.startsWith("-")&&(r=!1),r){if(!p&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):C(t)})(n)}},onFocus:v,onBlur:()=>{const t=x(N);e.onBlur?.(t,N)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(N),N)}})}));zs.displayName="InputNumber";const Vs=zs,js=l().forwardRef(((e,t)=>{const{$size:n,doFieldValidate:r}=l().useContext(Ha),{dataKey:a,doFieldUpdate:i,cellValueChange:o}=l().useContext(Hs),{column:s,row:c,rowKey:d,columnKey:u,options:m}=e,{t:p}=le(),h=As(),f=l().useRef(!1),{dataIndex:g,precision:y,formatType:b}=s,{type:v,extra:x={},rules:E=[],onInput:w,onChange:C,onEnter:S,onBlur:N}=m,T=Jn(c,g);let I,R;"finance"===b&&(I=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},R=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===b&&(I=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Ra())(e).times(100).toNumber()}`,R=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Ra())(e).times(.01).toString());const O=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"";return l().createElement(Vs,{ref:t,size:n,value:T,min:x.min,max:x.max,precision:y,stringMode:x.stringMode,prefix:x.prefix,suffix:x.suffix??("percent"===b?"%":void 0),placeholder:x.placeholder??p("qm.table.editable.inputPlaceholder"),maxLength:x.maxLength,allowClear:x.allowClear,readOnly:x.readOnly,disabled:x.disabled,formatter:I,parser:R,onChange:e=>{er(c,g,e),r(E,e,d,u,cr(s.title)),h(),w?.({[a]:e}),f.current=!0},onBlur:(e,t)=>{if(!f.current)return;f.current=!1;let n=x.stringMode?e:O(e);"percent"===b&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),er(c,g,n),i(c,d,u),C?.({[a]:n},c),N?.({[a]:n},c),o()},onEnter:(e,t)=>{let n=x.stringMode?e:O(e);"percent"===b&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),S?.({[a]:n},c)}})}));js.displayName="NumberCell";const Ws=js,Bs=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u,isMultiple:m}=e,{t:p}=le(),{dataIndex:h,dictItems:f=[]}=(As(),o),{type:g,extra:y={},rules:b=[],items:v,onChange:x,onEnter:w}=u,C=v||f,S=Jn(s,h);let N=S;return l().createElement(K.Select,{mode:m?"multiple":void 0,size:t,popupClassName:ai.popupClassName,value:S||void 0,placeholder:y.placeholder??p("qm.table.editable.selectPlaceholder"),allowClear:y.allowClear,listHeight:y.listHeight,maxTagCount:y.collapseTags?"responsive":void 0,maxTagTextLength:y.maxTagTextLength,disabled:y.disabled,style:{width:"100%"},showSearch:y.filterable??!0,filterOption:(e,t)=>{const n=t?.children?.toString()||"";return`${n}|${ra.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{er(s,h,e),n(b,e,c,d,cr(o.title)),a(s,c,d),x?.({[r]:e},s),i()},onSelect:e=>{N=e},onInputKeyDown:e=>{13===e.keyCode&&E((()=>w?.({[r]:N},s)))}},C.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},Us=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u,dateType:m}=e,{t:p}=le(),{dataIndex:h}=(As(),o),{type:f,extra:g={},rules:y=[],onChange:b}=u,v=Jn(s,h);return l().createElement(U,{size:t,popupClassName:ai.popupClassName,value:ir(v,Ar[m])??void 0,picker:Pr[m],format:g.format,showTime:"datetime"===m,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=g;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:g.placeholder,allowClear:g.allowClear,disabled:g.disabled,style:{width:"100%"},onChange:e=>{const t=lr(e,Ar[m]);er(s,h,t),n(y,t,c,d,cr(o.title)),a(s,c,d),b?.({[r]:t},s),i()}})},Gs=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{t:m}=le(),{dataIndex:p}=(As(),o),{type:h,extra:f={},rules:g=[],onChange:y}=u,b="HH:mm:ss",v=Jn(s,p);return l().createElement(Q,{size:t,popupClassName:ai.popupClassName,value:ir(v,b)??void 0,format:f.format||b,placeholder:f.placeholder,allowClear:f.allowClear,disabled:f.disabled,style:{width:"100%"},onChange:e=>{const t=lr(e,b);er(s,p,t),n(g,t,c,d,cr(o.title)),a(s,c,d),y?.({[r]:t},s),i()}})},Ys=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{t:m}=le(),{dataIndex:p}=(As(),o),{type:h,extra:f={},rules:g=[],onChange:y}=u,{trueValue:b=za,falseValue:v=Va,disabled:x}=f,E=Jn(s,p);return l().createElement(K.Checkbox,{checked:E===b,disabled:x,onChange:e=>{const t=e.target.checked?b:v;er(s,p,t),n(g,t,c,d,cr(o.title)),a(s,c,d),y?.({[r]:t},s),i()}})},Xs=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{t:m}=le(),{dataIndex:p}=(As(),o),{type:h,extra:f={},rules:g=[],onChange:y}=u,{trueValue:b=za,falseValue:v=Va,disabled:x}=f,E=Jn(s,p);return l().createElement(K.Switch,{checked:E===b,disabled:x,onChange:e=>{const t=e?b:v;er(s,p,t),n(g,t,c,d,cr(o.title)),a(s,c,d),y?.({[r]:t},s),i()}})},Qs=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,doFieldUpdate:a,cellValueChange:i}=l().useContext(Hs),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],render:g,onChange:y}=u;if(!g)return ue("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const b=Jn(s,m),v=e=>{er(s,m,e),n(f,e,c,d,cr(o.title)),a(s,c,d),y?.({[r]:e},s),i()},x=g(s,o,v);return l().isValidElement(x)?l().cloneElement(x,{value:b,disabled:h.disabled,readOnly:h.readOnly,popupClassName:ai.popupClassName,onChange:v}):null},Zs=e=>{const{multiple:t,tree:n={},defaultSelectedKeys:r,className:a,style:i,onClose:o}=e,{$size:s}=se(e),{t:c}=le(),[d,u]=l().useState(),[m]=l().useState(n.fetch?.params),p=xe("tree-helper"),h={[`${p}--wrapper`]:!0},f=n.fetch?{...N(n.fetch,["params","valueKey","textKey"]),params:m}:void 0;return l().createElement("div",{className:ve()(h,a),style:i},l().createElement(gs,{multiple:t,fetch:f,fieldsDefine:{valueKey:n.fetch?.valueKey,textKey:n.fetch?.textKey},autoFocus:!0,asyncLoad:n.asyncLoad,checkStrictly:n.checkStrictly,checkStrategy:n.checkStrategy,defaultSelectedKeys:r,defaultExpandAll:n.defaultExpandAll,onSelectChange:e=>u(e),onCheckChange:e=>u(e)}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Da[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(he,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),l().createElement(he,{type:"primary",disabled:!d,onClick:()=>o(d)},c("qm.dialog.confirm"))))};Zs.displayName="TreeHelper";const Js=Zs,ec=l().forwardRef(((e,t)=>{const{$size:n,flattenColumns:r,doFieldValidate:a}=l().useContext(Ha),{dataKey:i,visible:o,setVisible:s,doFieldUpdate:c,cellValueChange:d}=l().useContext(Hs),{column:u,row:m,rowKey:p,columnKey:f,options:g}=e,{t:y}=le(),b=(As(),!!g.helper?.combinedDataIndex),{dataIndex:x,precision:E}=u,{type:w,extra:C={},rules:S=[],helper:N={},onChange:T,onEnter:I}=g,R=tr(m,b?N.combinedDataIndex:x),O=N.fieldAliasMap;O||ue("Table","helper 需要配置 `fieldAliasMap` 选项");const k="function"==typeof O?O():O||{};Object.keys(k).includes(x)||ue("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),b&&(N.combinedDataIndex.split("|").every((e=>Object.keys(k).includes(e)))||ue("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),k[x].includes("|")&&ue("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const L=e=>{const{beforeOpen:t}=N,n=(t??v)({[i]:R},m,u);n?.then?n.then((()=>{s(!0),e?.()})).catch((()=>{})):!1!==n&&(s(!0),e?.())},P=()=>{s(!1)},A=(e="",t)=>{if((0,h.isPlainObject)(t)&&Object.keys(t).length)for(const e in t){const n=t[e],i=r.find((t=>t.dataIndex===e));if(i){er(m,e,n,i.precision);const t=i.editRender?.(m,i);t&&Array.isArray(t.rules)&&a(t.rules,n,p,e,cr(i.title))}else er(m,e,n)}er(m,x,e,E),a(S,e,p,f,cr(u.title)),c(m,p,f),T?.({[i]:e},m),d()},F={visible:o,title:y("qm.searchHelper.text"),width:N.width??"40%",loading:!1,wrapClassName:ai.popupClassName,bodyStyle:{paddingBottom:`${Da[n]+20}px`},onClose:()=>{P()}},_={...N,defaultSelectedKeys:[R],size:n,onClose:e=>{e?(e=>{const t={};for(const n in k){const r=k[n];n!==x&&(t[n]=tr(e,r))}const n=k[x]?tr(e,k[x]):"";A(n,t);const{closed:r}=N;s(!1),r?.(e)})(e):P()}};return l().createElement(l().Fragment,null,l().createElement(K.Input.Search,{ref:t,value:R,allowClear:C.allowClear??!0,readOnly:C.readOnly,disabled:C.disabled,placeholder:C.placeholder??y("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!o&&L())},onDoubleClick:()=>{L()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?L():A(""))}}),l().createElement(yn,F,l().createElement(Js,_)))}));ec.displayName="TreeHelperCell";const tc=ec,nc=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,visible:a,setVisible:i,doFieldUpdate:o,cellValueChange:s}=l().useContext(Hs),{column:c,row:d,rowKey:u,columnKey:m,options:p}=e,{t:f}=le();As(),l().useLayoutEffect((()=>{p.items&&E(p.items.map((e=>({[b.current.valueKey]:e.value,[b.current.textKey]:e.text}))))}),[]);const[g,y]=l().useState(p.items||[]),b=l().useRef({}),x=l().useRef([]),E=e=>x.current=e,{dataIndex:w}=c,{type:C,extra:S={},items:N=[],rules:T=[],helper:I={},onInput:R,onChange:O,onEnter:k}=p,L=Jn(d,w),P=I.fieldAliasMap;P||ue("Table","helper 需要配置 `fieldAliasMap` 选项");const A="function"==typeof P?P():P||{};Object.keys(A).includes("valueKey")&&Object.keys(A).includes("textKey")||ue("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),b.current=A;const F=e=>{const{beforeOpen:t}=I,n=(t??v)({[r]:L},d,c);n?.then?n.then((()=>{i(!0),e?.()})).catch((()=>{})):!1!==n&&(i(!0),e?.())},_=()=>{i(!1)},q=e=>{er(d,w,e),n(T,e,u,m,cr(c.title)),o(d,u,m),O?.({[r]:e},d,x.current),s()},D={visible:a,title:f("qm.searchHelper.text"),width:I.width??"40%",loading:!1,wrapClassName:ai.popupClassName,bodyStyle:{paddingBottom:`${Da[t]+20}px`},onClose:()=>{_()}},H={...I,size:t,multiple:!0,initialValue:(0,h.merge)({},I.initialValue),defaultSelectedKeys:L,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=A;E(e);const r=x.current.map((e=>({text:e[t],value:e[n]})));y(r),q(r.map((e=>e.value)));const{closed:a}=I;i(!1),a?.(x.current)})(e):_()}};return l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{className:"ant-input-wrapper ant-input-group"},l().createElement(K.Select,{mode:"multiple",open:!1,value:L,placeholder:S.placeholder??f("qm.table.editable.selectPlaceholder"),allowClear:S.allowClear,maxTagCount:S.collapseTags?"responsive":void 0,maxTagTextLength:S.maxTagTextLength,disabled:S.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!a&&F()},onDoubleClick:()=>{S.disabled||F()},onChange:e=>{const{valueKey:t}=A;E(x.current.filter((n=>e.includes(n[t])))),q(e)}},g.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value},e.text)))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(K.Button,{className:"ant-input-search-button",disabled:S.disabled,icon:l().createElement(Ee.SearchOutlined,null),onClick:()=>{F()}})))),l().createElement(yn,D,l().createElement(Js,H)))},rc=l().forwardRef(((e,t)=>{const{$size:n,flattenColumns:r,doFieldValidate:a}=l().useContext(Ha),{dataKey:i,visible:o,setVisible:s,setMatching:c,doFieldUpdate:d,cellValueChange:u}=l().useContext(Hs),{column:m,row:p,rowKey:f,columnKey:g,options:y}=e,{t:b}=le(),x=(As(),!!y.helper?.combinedDataIndex),w=l().useRef(!1),C=l().useRef({}),[S,N]=l().useState(),{dataIndex:T,precision:I}=m,{type:R,extra:O={},rules:k=[],helper:L={},onInput:P,onChange:A,onEnter:F}=y,_=tr(p,x?L.combinedDataIndex:T),q=L.fieldAliasMap;q||ue("Table","helper 需要配置 `fieldAliasMap` 选项");const D="function"==typeof q?q():q||{};Object.keys(D).includes(T)||ue("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),x&&(L.combinedDataIndex.split("|").every((e=>Object.keys(D).includes(e)))||ue("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),D[T].includes("|")&&ue("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const H=e=>{const{filterAliasMap:t}=L,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],a={[T]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if((0,h.isPlainObject)(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](n):n;else a[e]=n})),a},$=e=>{const{autoQueryAssign:t=!0}=L;t&&(C.current=H(e)),s(!0)},M=(e,t)=>{const{beforeOpen:n}=L,r=(n??v)({[i]:_},p,m);r?.then?r.then((()=>{$(e),t?.()})).catch((()=>{})):!1!==r&&($(e),t?.())},z=e=>{const t={};for(const n in D){const r=D[n];n!==T&&(t[n]=tr(e,r))}const n=D[T]?tr(e,D[T]):"";j(n,t);const{closed:r}=L;s(!1),r?.(e)},V=()=>{const{onlySelect:e=!0}=L;w.current&&j(e?"":_),s(!1)},j=(e="",t)=>{if((0,h.isPlainObject)(t)&&Object.keys(t).length)for(const e in t){const n=t[e],i=r.find((t=>t.dataIndex===e));if(i){er(p,e,n,i.precision);const t=i.editRender?.(p,i);t&&Array.isArray(t.rules)&&a(t.rules,n,f,e,cr(i.title))}else er(p,e,n)}x&&!e&&((e,t)=>{if(!t.includes("|"))return er(e,t,"",void 0);const n="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&er(e,t,n[r]?.trim())}))})(p,L.combinedDataIndex),er(p,T,e,I),a(k,e,f,g,cr(m.title)),d(p,f,g),A?.({[i]:e},p),u(),C.current={},w.current=!1,N(void 0)},W={visible:o,title:b("qm.searchHelper.text"),width:L.width??"60%",loading:!1,wrapClassName:ai.popupClassName,bodyStyle:{paddingBottom:`${Da[n]+20}px`},onClose:()=>{V()}},B={...L,size:n,initialValue:Object.assign({},C.current,L.initialValue),onClose:e=>{e?z(e):V()}};return l().createElement(l().Fragment,null,l().createElement(K.Input.Search,{ref:t,value:S??_,placeholder:O.placeholder??b("qm.table.editable.selectPlaceholder"),allowClear:O.allowClear,readOnly:O.readOnly,disabled:O.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:r}=L;if(w.current&&!o)return t&&n&&r?.fetch?.api?(e=>{const{table:t,initialValue:n={}}=L,{beforeFetch:r=v}=t.fetch;return new Promise((async(a,i)=>{const l=(0,h.merge)({},t.fetch.params,{...n,...H(e)},{currentPage:1,pageSize:500});if(!r(l))return i();c(!0);try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,h.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{E((()=>c(!1)))}}))})(t).then((e=>((e=[],t)=>{const n=e.filter((e=>tr(e,D[T]).toString().includes(t)));if(1===n.length)return z(n[0]);M(t)})(e,t))).catch((()=>j(""))):void j(t)},onChange:e=>{const{value:t}=e.target;P?.({[i]:t}),w.current=!0,N(t)},onKeyDown:e=>{if(13===e.keyCode){const t=e.target.value??"";!o&&M(t)}},onDoubleClick:e=>{const{value:t}=e.target;M(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&M(e)}}),l().createElement(yn,W,l().createElement(kc,B)))}));rc.displayName="SearchHelperCell";const ac=rc,ic=e=>{const{$size:t,doFieldValidate:n}=l().useContext(Ha),{dataKey:r,visible:a,setVisible:i,doFieldUpdate:o,cellValueChange:s}=l().useContext(Hs),{column:c,row:d,rowKey:u,columnKey:m,options:p}=e,{t:f}=le(),[g,y]=(As(),l().useState(p.items||[])),b=l().useRef({}),x=l().useRef([]),E=e=>x.current=e;l().useLayoutEffect((()=>{p.items&&E(p.items.map((e=>({[b.current.valueKey]:e.value,[b.current.textKey]:e.text}))))}),[]);const{dataIndex:w}=c,{type:C,items:S=[],extra:N={},rules:T=[],helper:I={},onInput:R,onChange:O,onEnter:k}=p,L=Jn(d,w),P=I.fieldAliasMap;P||ue("Table","helper 需要配置 `fieldAliasMap` 选项");const A="function"==typeof P?P():P||{};Object.keys(A).includes("valueKey")&&Object.keys(A).includes("textKey")||ue("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),b.current=A;const F=e=>{const{beforeOpen:t}=I,n=(t??v)({[r]:L},d,c);n?.then?n.then((()=>{i(!0),e?.()})).catch((()=>{})):!1!==n&&(i(!0),e?.())},_=()=>{i(!1)},q=e=>{er(d,w,e),n(T,e,u,m,cr(c.title)),o(d,u,m),O?.({[r]:e},d,x.current),s()},D={visible:a,title:f("qm.searchHelper.text"),width:I.width??"60%",loading:!1,wrapClassName:ai.popupClassName,bodyStyle:{paddingBottom:`${Da[t]+20}px`},onClose:()=>{_()}},H={...I,size:t,multiple:!0,initialValue:(0,h.merge)({},I.initialValue),defaultSelectedKeys:L,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=A;E((0,h.uniqBy)([...x.current.filter((e=>t.includes(e[r]))),...e],r));const a=x.current.map((e=>({text:e[n],value:e[r]}))),l=(0,h.uniqBy)([...a,...S],"value").filter((e=>t.includes(e.value)));y(l),q(l.map((e=>e.value)));const{closed:o}=I;i(!1),o?.(x.current)})(e,t):_()}};return l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{className:"ant-input-wrapper ant-input-group"},l().createElement(K.Select,{mode:"multiple",open:!1,value:L,placeholder:N.placeholder??f("qm.table.editable.selectPlaceholder"),allowClear:N.allowClear,maxTagCount:N.collapseTags?"responsive":void 0,maxTagTextLength:N.maxTagTextLength,disabled:N.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!a&&F()},onDoubleClick:()=>{N.disabled||F()},onChange:e=>{const{valueKey:t}=A;E(x.current.filter((n=>e.includes(n[t])))),q(e)}},g.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value},e.text)))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(K.Button,{className:"ant-input-search-button",disabled:N.disabled,icon:l().createElement(Ee.SearchOutlined,null),onClick:()=>{F()}})))),l().createElement(yn,D,l().createElement(kc,H)))},lc=l().forwardRef(((e,t)=>{const{column:n,record:r,rowKey:a,columnKey:i}=e,{tableRef:o,updateTableFlatData:s,dataChange:c}=l().useContext(Ha),d=l().useContext(Ns),{store:u,fieldAuth:m}=o.current,p=n.editRender?.(r,n)||{},h=l().useRef(null),f=l().useRef(null),g=l().useRef(null),y=l().useRef(null),[b,v]=l().useState(!1),[x,E]=l().useState(!1),w=`${a}|${i}`,C=2===d.length?`${d[0]}|${d[1]}`:"",S=(p.editable||br(d,[a,i],!0))&&!p.disabled&&!m[i]?.disabled,N=![...u.state.required,...u.state.validate].some((({x:e,y:t})=>e===a&&t===i)),T=u.state.required.find((({x:e,y:t})=>e===a&&t===i))?.text||"",I=u.state.validate.find((({x:e,y:t})=>e===a&&t===i))?.text||"",R=u.state.edited.some((({x:e,y:t})=>e===a&&t===i)),O=S||!N||b||x;l().useEffect((()=>{O&&C===w&&k()}),[d]);const k=()=>{const{type:e}=p;switch(e){case"text":h.current?.focus();break;case"number":f.current?.select();break;case"search-helper":g.current?.focus();break;case"tree-helper":y.current?.focus()}},L=()=>{const{type:e}=p;switch(e){case"text":h.current?.blur();break;case"number":f.current?.blur();break;case"search-helper":g.current?.blur();break;case"tree-helper":y.current?.blur()}},P=oe((()=>{s(),c()})),A=(e,t,n)=>{const{cornerSign:r=!0}=p.extra||{};u.addToUpdated(e),r&&u.addToEdited({x:t,y:n})};l().useImperativeHandle(t,(()=>({focus:k,blur:L,isEditable:()=>!p.disabled,isOpening:()=>b})));const F=l().useMemo((()=>({dataKey:w,visible:b,matching:x,setVisible:v,setMatching:E,doFieldUpdate:A,cellValueChange:P})),[b,x]),_={text:()=>l().createElement(Ks,{ref:h,column:n,row:r,rowKey:a,columnKey:i,options:p}),textarea:()=>l().createElement(Ks,{ref:h,column:n,row:r,rowKey:a,columnKey:i,options:p,isTextArea:!0}),number:()=>l().createElement(Ws,{ref:f,column:n,row:r,rowKey:a,columnKey:i,options:p}),select:()=>l().createElement(Bs,{column:n,row:r,rowKey:a,columnKey:i,options:p}),"select-multiple":()=>l().createElement(Bs,{column:n,row:r,rowKey:a,columnKey:i,options:p,isMultiple:!0}),date:()=>l().createElement(Us,{column:n,row:r,rowKey:a,columnKey:i,options:p,dateType:"exactdate"}),datetime:()=>l().createElement(Us,{column:n,row:r,rowKey:a,columnKey:i,options:p,dateType:"datetime"}),month:()=>l().createElement(Us,{column:n,row:r,rowKey:a,columnKey:i,options:p,dateType:"month"}),year:()=>l().createElement(Us,{column:n,row:r,rowKey:a,columnKey:i,options:p,dateType:"year"}),time:()=>l().createElement(Gs,{column:n,row:r,rowKey:a,columnKey:i,options:p}),checkbox:()=>l().createElement(Ys,{column:n,row:r,rowKey:a,columnKey:i,options:p}),switch:()=>l().createElement(Xs,{column:n,row:r,rowKey:a,columnKey:i,options:p}),"search-helper":()=>l().createElement(ac,{ref:g,column:n,row:r,rowKey:a,columnKey:i,options:p}),"search-helper-multiple":()=>l().createElement(ic,{column:n,row:r,rowKey:a,columnKey:i,options:p}),"tree-helper":()=>l().createElement(tc,{ref:y,column:n,row:r,rowKey:a,columnKey:i,options:p}),"tree-helper-multiple":()=>l().createElement(nc,{column:n,row:r,rowKey:a,columnKey:i,options:p}),custom:()=>l().createElement(Qs,{column:n,row:r,rowKey:a,columnKey:i,options:p})};return l().createElement(l().Fragment,null,O?(()=>{const{type:e}=p,t=_[e];if(!t)return ue("Table","单元格编辑的类型 `type` 配置不正确"),null;const n=["cell--edit",{"is-error":!N}];return l().createElement("div",{className:ve()(n)},l().createElement(Hs.Provider,{value:F},t()),!N&&l().createElement("div",{className:"cell-error"},T||I))})():(()=>{const{disabled:t,extra:n={}}=p,{disabledColor:r,disabledBgColor:a}=n,i=["cell--show",{"is-cell-bg":t&&a}];return l().createElement(l().Fragment,null,l().createElement("span",{className:ve()(i),style:{color:t?r:""}},e.children),t&&a&&l().createElement("i",{className:"cell--bg",style:{background:a}}))})(),R&&l().createElement("i",{className:"cell--sign"}))}));lc.displayName="CellEdit";const oc=lc,sc=require("copy-to-clipboard");var cc=r.n(sc);const dc=e=>{const{text:t,options:n,showMessage:r=!0,onCopy:a}=e,{t:i}=le();return wt(e.children,{onClick:o=>{const s=l().Children.only(e.children),c=cc()(t,n);a?.(t,c),c&&r&&K.message.success(i("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};dc.displayName="QmCopyToClipboard";const uc=dc,mc=l().forwardRef(((e,t)=>{const{column:n,row:r,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c,onUnmount:d}=e,{tableRef:u,selectionKeys:m,treeExpandIndex:p,updateMark:h}=l().useContext(Ha),{dataIndex:f,canCopy:g,render:y,editRender:b,shouldCellUpdate:v}=n,{t:x}=le(),{renderText:E,getTitleFromCellNode:w}=hi(),C=l().useRef(null),S=Jn(r,f),[N,T]=function(e,c){const d=i.useRef({});return"value"in d.current&&!((e,t)=>{if(v){const[,n]=e,[,a]=t;return v(a,n,r)}return!br(e,t,!0)})(d.current.condition,c)||(d.current.value=(()=>{const e=y?y(S,r,n,a,o):E(S,n,r);return[e,b?l().createElement(oc,{ref:t,column:n,record:r,rowKey:s,columnKey:f},e):null]})(),d.current.condition=c),d.current.value}(0,[h,r,S,y,b]);l().useEffect((()=>()=>d?.()),[]),l().useEffect((()=>{if([ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(f))return;const e=C.current.parentNode;c?e.title=w(N):e.removeAttribute("title")}),[c,N]);const I=e=>Array.isArray(e.children);return l().createElement("div",{ref:C,className:"cell"},(()=>{if(f===ai.expandableColumn)return l().createElement(Ds,{record:r,rowKey:s});if(f===ai.selectionColumn)return l().createElement(qs,{selectionKeys:m,column:n,record:r,rowKey:s});if(T)return T;if(u.current.isTreeTable&&f===p)return l().createElement(l().Fragment,null,(e=r._level)?l().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*ai.treeTable.textIndent+"px"}}):null,l().createElement(Ds,{key:"expand",record:r,rowKey:s,style:I(r)?{}:{visibility:"hidden"}}),N);var e;if(g){const e=w(N);return l().createElement("div",{className:"cell--copy"},l().createElement("span",{className:"text"},N),e&&l().createElement(uc,{text:e},l().createElement(Ee.CopyOutlined,{className:"icon",title:x("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return N})())}));mc.displayName="Cell";const pc=mc,hc={open:!1,offsetX:0,offsetY:0},fc=l().forwardRef(((e,t)=>{const{rowVirtualize:n}=e,{tableRef:r,getRowKey:a,prefixCls:i,tableFlatData:o,flattenColumns:s,tableRowHeight:c,mergedTdCells:d,setMergedCells:u}=l().useContext(Ha),{areaSelection:m={}}=r.current.props,{elementStore:p,scrollYLoad:h}=r.current,{t:f}=le(),g=l().useRef(document.onselectstart),y=l().useRef(null),b=l().useRef(null),v=l().useRef(null),x=e=>{v.current=e},[w,C]=l().useState(null),[S,N]=l().useState(null),[T,I]=l().useState(null),R=e=>{if(!e)return I(null);let t=!1;for(const n in e)if(T?.[n]!==e[n]){t=!0;break}t&&I(Object.assign({},T,e))};uo({ref:y,handler:()=>j()}),l().useEffect((()=>{const e=Ut()(p.$tableBody,"mousedown",H),t=Ut()(p.$tableBody,"contextmenu",q),n=Ut()(document,"keydown",D);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const O=()=>{C(null),R(null),x(null),N(null)};l().useImperativeHandle(t,(()=>({blur:O})));const k=e=>{let t=e;for(;t;){if(!p.$tableBody.contains(t))return null;if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},L=e=>({rowIndex:parseInt(e.parentNode.getAttribute("data-row-index"),10),colIndex:parseInt(e.getAttribute("data-col-index"),10),rowspan:Number(e.getAttribute("rowspan")||1),colspan:Number(e.getAttribute("colspan")||1),l:e.offsetLeft,t:e.offsetTop,w:e.offsetWidth,h:e.offsetHeight}),P=e=>({colStart:e.colIndex,colEnd:e.colIndex+e.colspan,rowStart:e.rowIndex,rowEnd:e.rowIndex+e.rowspan}),A=e=>{let[t,n,r,a]=[1/0,-1/0,1/0,-1/0];for(const i of e)t=Math.min(t,i.rowStart),n=Math.max(n,i.rowEnd),r=Math.min(r,i.colStart),a=Math.max(a,i.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:a}},F=Et((e=>{let t=A([P(e),v.current]);d.forEach((e=>{const n=o.findIndex((t=>a(t,t.index)===e.rowKey)),r=s.findIndex((t=>t.dataIndex===e.dataIndex)),i={rowStart:n,rowEnd:n+e.rowSpan,colStart:r,colEnd:r+e.colSpan};var l,c;c=i,(l=t).rowEnd<=c.rowStart||l.rowStart>=c.rowEnd||l.colEnd<=c.colStart||l.colStart>=c.colEnd||(t=A([t,i]))})),R(t)}),5),_=e=>{u(e),m.onCellMerge?.(e),E((()=>O()))},q=oe((e=>{m.cellMerge&&w&&z(e.clientX,e.clientY)?(e.preventDefault(),V(e)):S?.open&&j()})),D=oe((e=>{27===e.keyCode&&O()})),H=oe((e=>{e.stopPropagation();const t=k(e.target);if(1!==e.buttons||!t)return;j();const n=L(t);C(n);const r=P(n);x(r),R(r),document.addEventListener("mousemove",$),document.addEventListener("mouseup",M),g.current=document.onselectstart,document.onselectstart=()=>!1})),$=oe((e=>{const t=k(e.target);t&&F(L(t))})),M=oe((()=>{m.onSelectChange?.((()=>{const e=[];if(!w||!T)return e;for(let t=T.rowStart;t<T.rowEnd;t++)for(let n=T.colStart;n<T.colEnd;n++)e.push({rowKey:a(o[t],o[t].index),dataIndex:s[n].dataIndex,cellValue:Jn(o[t],s[n].dataIndex)});return e})()),document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",M),K()})),K=()=>{document.onselectstart!==g.current&&(document.onselectstart=g.current)},z=(e,t)=>{const{top:n,left:r}=p.$tableBody.parentNode.getBoundingClientRect(),[a,i]=[e-r,t-n],{el:l,et:o,ew:s,eh:c}=Y();return!(a<l||a>l+s||i<o||i>o+c)},V=e=>{const{top:t,left:n,height:r}=b.current.getBoundingClientRect();N({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},j=()=>{N((e=>({...e,open:!1})))},W=e=>({rowIndex:o.findIndex((t=>a(t,t.index)===e.rowKey)),colIndex:s.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),B=()=>{if(!w||!T||(t=T,(e=w).rowIndex===t.rowStart&&e.colIndex===t.colStart&&e.rowspan===t.rowEnd-t.rowStart&&e.colspan===t.colEnd-t.colStart))return O();var e,t;const n={rowKey:a(o[T.rowStart],o[T.rowStart].index),dataIndex:s[T.colStart].dataIndex,rowSpan:T.rowEnd-T.rowStart,colSpan:T.colEnd-T.colStart};_([...d.filter((e=>!((e,t)=>{const n=W(e),r=W(t),[a,i,l,o]=[n.rowIndex,n.colIndex,n.rowIndex+n.rowSpan-1,n.colIndex+n.colSpan-1],[s,c,d,u]=[r.rowIndex,r.colIndex,r.rowIndex+r.rowSpan-1,r.colIndex+r.colSpan-1];return a<=s&&i<=c&&l>=d&&o>=u||s<=a&&c<=i&&d>=l&&u>=o})(e,n))),n])},U=()=>{const e=a(o[T.rowStart],o[T.rowStart].index),t=s[T.colStart].dataIndex;_(d.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},G=e=>{if(h)return n.measurementsCache.slice(0,e).map((e=>e.size)).reduce(((e,t)=>e+t),0);if(e>=o.length)return p.$tableBody.parentNode.offsetHeight;const t=a(o[e],o[e].index),r=p.$tableBody.querySelector(`tbody > tr[data-row-key="${t}"]`);return r?r.offsetTop:c*e},Y=()=>{const{w:e,h:t,l:n,t:r}=w,a=s.slice(0,T.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=G(T.rowStart);return{sl:n,st:r,sw:e,sh:t,el:a,et:i,ew:s.slice(0,T.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-a,eh:G(T.rowEnd)-i}};return l().createElement("div",{className:`${i}--area-select`},(()=>{if(!w||!T)return null;const{sl:e,st:t,sw:n,sh:r,el:a,et:i,ew:o,eh:s}=Y(),{open:c,offsetX:d,offsetY:u}=S||hc,m=l().createElement("ul",{ref:y,className:"ant-dropdown-menu"},l().createElement("li",{className:"ant-dropdown-menu-item",onClick:B},f("qm.table.areaSelect.mergeCell")),l().createElement("li",{className:"ant-dropdown-menu-item",onClick:U},f("qm.table.areaSelect.cancelMerge")));return l().createElement(l().Fragment,null,l().createElement("div",{className:"active-area",style:{left:e,top:t,width:n,height:r}}),l().createElement(Ai(),{popupVisible:c,popup:m,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:ai.popupClassName,builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},l().createElement("div",{ref:b,className:"checked-area",style:{left:a,top:i,width:o,height:s}})))})())}));fc.displayName="AreaSelect";const gc=fc,yc=l().forwardRef(((e,t)=>{const{tableRef:n,getRowKey:r,prefixCls:a,tableFlatData:i,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,tableRowHeight:m,sorter:p,layout:f,showFooter:g,selectionKeys:y,rowExpandedKeys:x,highlightKey:E,activedCell:w,isPingLeft:C,isPingRight:S,isTableEmpty:N,isGroupSubtotal:T,setElementStore:I,setSelectionKeysEffect:R,setHighlightKey:O,setActivedCell:k,getStickyLeft:L,getStickyRight:P,setPingLeft:A,setPingRight:F,setFullScreen:_,scrollBottomDebouncer:q}=l().useContext(Ha),{height:D,minHeight:H,maxHeight:$,rowSelection:M,rowHighlight:K,expandable:z,stripe:V,summation:j,rowHeight:W,rowStyle:B,cellStyle:U,spanMethod:G,tableConfig:Y,areaSelection:X,ellipsis:Q,showHeader:Z,rowDraggable:J,onRowClick:ee,onRowDblclick:te,onRowContextmenu:ne,onRowEnter:re}=n.current.props,ae=l().useRef(null),ie=l().useRef(new Map),le=l().useRef(null),se=l().useRef({prevST:0,prevSL:0}),{onNodeDragStart:ce,onNodeDragEnter:de,onNodeDragOver:ue,onNodeDragLeave:me,onNodeDragEnd:pe,onNodeDrop:he,indent:fe,dropOptions:ge}=Ps({openDragSort:J}),{rowVirtualizer:ye,columnVirtualizer:be,virtualRows:xe,virtualColumns:Ee,resetItemXSize:we,getYIndexes:Ce,virtualTranslateY:Se,virtualTranslateX:Ne,calcVirtualYSize:Te,calcVirtualXSize:Ie,scrollToYIndex:Re}=((e,t)=>{const{tableRef:n,tableRowHeight:r}=l().useContext(Ha),{props:a,scrollBarRef:i}=n.current,o=a.tableConfig?.overscan||1,s=l().useMemo((()=>i.current?.scrollElement||null),[i.current]),c=l().useMemo((()=>{const e=[],n=[];return t.forEach(((t,r)=>{"left"===t.fixed&&e.push(r),"right"===t.fixed&&n.push(r)})),[e,n]}),[t]),d=lo({count:e.length,getScrollElement:()=>s,estimateSize:()=>r,indexAttribute:"data-row-index",overscan:o,enabled:n.current.scrollYLoad}),u=d.getVirtualItems(),m=lo({horizontal:!0,count:t.length,getScrollElement:()=>s,estimateSize:e=>t[e].width||t[e].renderWidth||0,indexAttribute:"data-col-index",overscan:o,enabled:n.current.scrollXLoad,rangeExtractor:e=>[...new Set([...c[0],...Xl(e),...c[1]])]}),p=m.getVirtualItems();return{rowVirtualizer:d,columnVirtualizer:m,virtualRows:u,virtualColumns:p,resetItemXSize:e=>{e.forEach(((e,t)=>{m.resizeItem(t,e.width||e.renderWidth||ai.defaultColumnWidth)}))},getYIndexes:()=>d.getVirtualIndexes()||[],getXIndexes:()=>m.getVirtualIndexes()||[],virtualTranslateY:()=>u[0]?.start||0,virtualTranslateX:()=>{const e=c[0].length;return e?p[e]?.index===e?p[0]?.start||0:(p[e]?.start||0)-p.slice(0,e).reduce(((e,t)=>e+t.size),0):p[0]?.start||0},calcVirtualYSize:()=>d.getTotalSize()||"",calcVirtualXSize:()=>m.getTotalSize()||"",scrollToYIndex:e=>{d.scrollToIndex(e)},scrollToXIndex:e=>{m.scrollToIndex(e)}}})(i,o),Oe=Ce(),ke=e=>{if(e&&!Q)return ye.measureElement(e)},Le=l().useMemo((()=>u.length&&n.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:a,colSpan:i})=>{const l=e+a-1,o=[];for(let t=e;t<=l;t++)r.has(t)&&o.push(t);if(0===o.length)return;const s=o.length;o.forEach(((e,r)=>{0===r&&n.push({row:e,col:t,rowSpan:s,colSpan:i});for(let a=t;a<t+i;a++)0===r&&a===t||n.push({row:e,col:a,rowSpan:0,colSpan:0})}))})),n})(u,Oe):u),[u,Oe.join(",")]),[Pe,Ae]=l().useState([]),Fe=As();uo({ref:ae,omitClassNames:[`.${ai.popupClassName}`],handler:()=>{Qe([]),le.current?.blur()}}),l().useImperativeHandle(t,(()=>({setClickedValues:Qe,createFocus:We,forceUpdate:Fe,resetItemXSize:we,scrollToYIndex:Re}))),qe((()=>{Pe.length&&n.current.tableManager.focus(n.current.uid)}),[Pe]),l().useLayoutEffect((()=>{je();const e=Ut()(document,"keydown",He);return()=>e.remove()}),[]);const _e=l().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:a}=f,i={};return N&&Object.assign(i,{minHeight:"100px"}),H&&Object.assign(i,{minHeight:Qn(H)-e-n+"px"}),$&&Object.assign(i,{maxHeight:Qn($)-e-n+"px"}),D||r||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[D,$,H,N,f]),De=oe((e=>{const{elementStore:t}=n.current,{prevST:r,prevSL:a}=se.current,{scrollTop:i,scrollLeft:l}=e;if(l!==a){Z&&(t.$header.scrollLeft=l),g&&(t.$footer.scrollLeft=l);const e=l>0,n=Math.ceil(l+f.tableWidth)<f.tableBodyWidth;C!==e&&A(e),S!==n&&F(n)}se.current={prevST:i,prevSL:l}})),He=oe((e=>{if(n.current.uid!==n.current.tableManager.getFocusInstance()?.id)return;const{keyCode:t}=e;if(27===t&&(Qe([]),O(""),k({}),_(!1)),Pe.length&&(Be(document.activeElement,ae.current)||"INPUT"!==document.activeElement?.tagName)){if(13===t&&("radio"===M?.type||K)){const t=y[0]??E??null,n=i.find((e=>r(e,e.index)===t))??null;n&&re?.(n,e)}Ye(Pe[0],Pe[1])||(38!==t&&40!==t||($e(e),Me(e)),(9===t||e.shiftKey&&9===t)&&($e(e),Ke(e)))}})),Me=Xt((e=>{if(!Pe.length)return;const t=i.length;let n=i.findIndex((e=>r(e,e.index)===Pe[0]));const a=38===e.keyCode?(--n+t)%t:++n%t,l=i[a],o=r(l,l.index),s=Ge(o,Pe[1]);"radio"!==M?.type||M.disabled?.(l)||s||R([o]),!K||K.disabled?.(l)||s||O(o),ze(38===e.keyCode?"top":"bottom",a),Ue(...Pe),Qe([o,Pe[1]])}),100),Ke=Xt((e=>{if(!Pe.length)return;if(!s.length)return Qe([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Pe[1]));const r=e.shiftKey&&9===e.keyCode?(--n+t)%t:++n%t;Ue(...Pe),Ve(e.shiftKey&&9===e.keyCode?"left":"right",r),Qe([Pe[0],s[r].dataIndex])}),100),ze=(e,t)=>{const{scrollBarRef:r,scrollYLoad:a}=n.current;if(a)return ye.scrollToIndex(t);const l=i.length,o=t,s=ae.current.querySelectorAll("tbody > tr"),c=i.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<r.current.scrollTop?r.current.SET_SCROLL_TOP(c):t===l-1&&r.current.SET_SCROLL_TOP(c-(f.viewportHeight-d)):c+d>r.current.scrollTop+f.viewportHeight?r.current.SET_SCROLL_TOP(c-(f.viewportHeight-d)):0===t&&r.current.SET_SCROLL_TOP(c)},Ve=(e,t)=>{const{scrollBarRef:r}=n.current,a=s.length,i=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),l=o.slice(0,i).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[i].width||o[i].renderWidth,m=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),p=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?l<r.current.scrollLeft+m?r.current.SET_SCROLL_LEFT(l-m):t===a-1&&r.current.SET_SCROLL_LEFT(l-(f.tableWidth-u)+p):l+u>r.current.scrollLeft+(f.tableWidth-p)?r.current.SET_SCROLL_LEFT(l-(f.tableWidth-u)+p):0===t&&r.current.SET_SCROLL_LEFT(l-m)},je=()=>{I("$tableBody",ae.current)},We=(e,t)=>{ie.current.get(`${e}-${t}`)?.focus()},Ue=(e,t)=>{ie.current.get(`${e}-${t}`)?.blur()},Ge=(e,t)=>ie.current.get(`${e}-${t}`)?.isEditable()??!1,Ye=(e,t)=>ie.current.get(`${e}-${t}`)?.isOpening()??!1,Xe=e=>{const t=j.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Qe=e=>{(0,h.isEqual)(e,Pe)||Ae(e)},Ze=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Je=(e,t,r)=>{const{disabled:a}=M||{},{tableFullData:i,recordsMap:l}=n.current,o=hr(i,(t=>t._rowKey===e));let s=[],c=Wn(o?.children||[],(e=>e._rowKey));return a&&(c=c.filter((e=>!l.has(e)||!a(l.get(e))))),s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),(fr(i,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=hr(i,(t=>t._rowKey===e)),n=t?.children?.every((e=>s.includes(e._rowKey)));s=n?[...s,e]:s.filter((t=>t!==e))})),s},et=(e,t,a,i,o)=>{const{dataIndex:s,fixed:u,align:h,className:f=""}=e,{rowSpan:g,colSpan:v}=tt(a,e,i,t);if(!g||!v)return null;const x=e.ellipsis??Q,E=["body--column",{"col--ellipsis":x,"col--center":"center"===h,"col--right":"right"===h,"col-active":w.rowKey===o&&w.dataIndex===s,"column--sort":!!p[s],"cell-fix-left":"left"===u,"cell-fix-right":"right"===u,"cell-fix-left-last":"left"===u&&c[c.length-v]?.dataIndex===s,"cell-fix-right-first":"right"===u&&d[0]?.dataIndex===s,[f]:!!f}],C={left:"left"===u?`${L(s)}px`:"",right:"right"===u?`${P(s)}px`:""},S=B?"function"==typeof B?B(a,i):B:null,N=U?"function"==typeof U?U(a,e,i,t):U:null,I=T?(e=>{const{backgroundColor:t,color:n}=j.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:n}})(a._group):null,k=Object.assign({},C,{height:W?m:""},I,S,N);return l().createElement("td",{key:s,"data-col-index":t,rowSpan:g>1?g:void 0,colSpan:v>1?v:void 0,className:ve()(E),style:k,onClick:t=>((e,t,a)=>{const{dataIndex:i}=a;if([ai.expandableColumn,ai.operationColumn].includes(i))return;const l=r(t,t.index);Qe([l,i]);const o=Ge(l,i),{type:s,selectByClickRow:c=!0,disabled:d=b}=M||{};!s||d(t)||o||(c||i===ai.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:a=!0,onSelect:i}=M||{};if("radio"===r&&R([e]),"checkbox"===r){const r=!y.includes(e),l=n.current.isTreeTable&&!a?Je(e,y,r):Ze(e,y,r);R(l),i?.(r,t,l)}})(l,t),[ai.selectionColumn].includes(i)||(!K||K.disabled?.(t)||o||O(l),ee?.(t,a,e))})(t,a,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(r)||te?.(t,n,e)})(t,a,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(r)||ne?.(t,n,e)})(t,a,e)},l().createElement(pc,{ref:e=>{e&&ie.current.set(`${o}-${s}`,e)},row:a,column:e,rowIndex:i,columnIndex:t,rowKey:o,showTitle:x,onUnmount:()=>ie.current.delete(`${o}-${s}`)}))},tt=(e,t,n,r)=>{let a=1,l=1;const o=G;if("function"==typeof o){const s=o({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(s)?(a=s[0],l=s[1]):(0,h.isPlainObject)(s)&&(a=s.rowSpan,l=s.colSpan);const c=Oe[0]??0;if(e===i[c]&&0===a)for(let e=c;e<i.length;e++){const n=o({row:i[e],column:t,rowIndex:e,columnIndex:r,tableData:i});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;a++}}if(Le.length>0){const e=Le.find((e=>e.row===n&&e.col===r));e&&(a=e.rowSpan,l=e.colSpan)}return{rowSpan:a,colSpan:l}};return l().createElement(At,{ref:n.current.scrollBarRef,wrapClassName:`${a}--body-wrapper`,wrapStyle:_e,innerStyle:{height:Te(),width:Ie()},showTopScrollbar:Y?.doubleXScrollbar,onScroll:De,onReachedEnd:(e,t)=>{"bottom"===e&&q({type:"scroll",target:t,preventDefault:b,stopPropagation:b})}},l().createElement(Ns.Provider,{value:Pe},l().createElement("table",{ref:ae,style:{width:0,marginTop:Se(),marginLeft:Ne()},className:ve()(`${a}--body`,{"virtual-container":n.current.scrollYLoad||n.current.scrollXLoad}),tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=n.current;return l().createElement("colgroup",null,(e?Ee:o).map((t=>{const{dataIndex:n,width:r,renderWidth:a}=e?o[t.index]:t;return l().createElement("col",{key:n,style:{width:`${r||a}px`,minWidth:`${r||a}px`}})})))})(),l().createElement("tbody",null,(e=>{const{scrollYLoad:t,scrollXLoad:a}=n.current,s=[];return(t?e:i).forEach(((e,c)=>{const d=t?i[e.index]:e,u=t?e.index:c,m=r(d,d.index);if(s.push(((e,t,r)=>{const{scrollXLoad:a}=n.current,{disabled:i}=M||{},s=["body--row",{"body--row-striped":V&&t%2!=0,"body--row-selected":y.includes(r)&&!i?.(e),"body--row-current":E===r,...T?Xe(e._group):null}],c=(a?Ee:o).map(((n,i)=>et(a?o[n.index]:n,a?n.index:i,e,t,r)));return J?l().createElement(_s,{key:r,ref:ke,className:ve()(s),rowKey:r,rowIndex:t,row:e,indent:fe,filter:".cell--edit input",dropOption:ge,onNodeDragStart:ce,onNodeDragEnter:de,onNodeDragOver:ue,onNodeDragLeave:me,onNodeDragEnd:pe,onNodeDrop:he},c):l().createElement("tr",{key:r,ref:ke,"data-row-key":r,"data-row-index":t,className:ve()(s)},c)})(d,u,m)),z?.expandedRowRender){const{expandedRowClassName:e,rowExpandable:t=v}=z;x.includes(m)&&t(d)&&s.push(l().createElement("tr",{key:`expand_${m}`,className:"body--row-expanded"},l().createElement("td",{colSpan:(a?Ee:o).length,className:"body--column",style:{paddingLeft:M?2*ai.selectionColumnWidth:ai.selectionColumnWidth}},l().createElement("div",{className:ve()("cell",e)},z.expandedRowRender(d,u)))))}})),s})(xe)))),!!X&&l().createElement(gc,{ref:le,rowVirtualize:ye}))}));yc.displayName="TableBody";const bc=yc,vc=()=>{const{tableRef:e,prefixCls:t,sorter:n,layout:r,flattenColumns:a,leftFixedColumns:i,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=l().useContext(Ha),{footRender:m}=e.current.props,{t:p}=le(),h=l().useRef(null);l().useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",h.current)},{tableBodyWidth:g}=r;return l().createElement("div",{ref:h,className:`${t}--footer-wrapper`},m?m(a,e.current.tableFullData):l().createElement("table",{className:`${t}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:g?`${g}px`:""}},l().createElement("colgroup",null,a.map((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;return l().createElement("col",{key:t,style:{width:`${n||r}px`,minWidth:`${n||r}px`}})}))),l().createElement("tfoot",null,s.map(((t,r)=>l().createElement("tr",{key:r,className:"footer--row"},a.map(((r,a)=>((t,r,a)=>{const{dataIndex:s,fixed:c,align:m,summation:h}=t,f=["footer--column","col--ellipsis",{"col--center":"center"===m,"col--right":"right"===m,"column--sort":!!n[s],"cell-fix-left":"left"===c,"cell-fix-right":"right"===c,"cell-fix-left-last":"left"===c&&i[i.length-1]?.dataIndex===s,"cell-fix-right-first":"right"===c&&o[0]?.dataIndex===s}],g={left:"left"===c?`${d(s)}px`:"",right:"right"===c?`${u(s)}px`:""},y=h?.render?h.render(e.current.tableFullData):Jn(r,`${s}_text`),b=0===a&&""===y?p("qm.table.config.summaryText"):y;return l().createElement("td",{key:s,title:b,className:ve()(f),style:{...g}},l().createElement("div",{className:"cell"},b))})(r,t,a)))))))))};var xc=function(e){return e.small="small",e.middle="default",e.large="default",e}(xc||{});const Ec=e=>{const{current:t,pageSize:n,total:r,onChange:a}=e,{global:i}=l().useContext(o),{tableRef:s,prefixCls:c,$size:d,setElementStore:u}=l().useContext(Ha),{uniqueKey:m,paginationConfig:p,infoBarConfig:h}=s.current.props,f=l().useRef(null),g=l().useMemo((()=>m?`tablePager_${m}`:""),[m]);l().useLayoutEffect((()=>{y(),E()}),[]);const y=()=>{u("$pager",f.current)},b=p?.showSizeChanger??ai.pagination.showSizeChanger,v=p?.showQuickJumper??ai.pagination.showQuickJumper,x=p?.pageSizeOptions||i?.table?.pagination?.pageSizeOptions||ai.pagination.pageSizeOptions,E=async()=>{if(!g)return;const e=await w(g);e&&e!==n&&(a(t,e),localStorage.setItem(g,e.toString()))},w=async e=>{const t=i?.getComponentConfigApi;if(t&&!localStorage.getItem(g))try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},C={[`${c}-pager`]:!0};return l().createElement("div",{ref:f,className:ve()(C)},l().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&l().createElement(ci,{total:r})),l().createElement(K.Pagination,{size:xc[d],showSizeChanger:b,showQuickJumper:v,pageSizeOptions:x,current:t,pageSize:n,total:r,onChange:(e,t)=>{a(e,t)},onShowSizeChange:(e,t)=>{g&&((async(e,t)=>{const n=i?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(g,t),localStorage.setItem(g,`${t}`))}}))},wc=()=>{const{prefixCls:e,layout:t}=l().useContext(Ha),n=l().useMemo((()=>{const{headerHeight:e,viewportHeight:n}=t;return{top:`${e}px`,height:`${n}px`}}),[t]);return l().createElement("div",{className:`${e}--empty`,style:n},l().createElement(ct,null))},Cc=()=>{const{prefixCls:e,setElementStore:t}=l().useContext(Ha),n=l().useRef(null);l().useLayoutEffect((()=>{r()}),[]);const r=()=>{t("$resizableBar",n.current)};return l().createElement("div",{ref:n,className:`${e}--resizable-bar`})};function Sc(){return Sc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sc.apply(null,arguments)}const Nc=l().forwardRef(((e,t)=>{const n=R(Ma,e),{rowKey:r,columns:a,loading:i,resizable:s,customClass:c,areaSelection:d,tablePrint:u,exportExcel:m,infoBarConfig:p,topSpaceAlign:g,showTableInfo:y,showFullScreen:b,showRefresh:v,showToolBox:w,showHeader:C,className:S,style:N}=n,{$size:T}=se(n),I=l().useRef(null),O=l().useRef(null),k=l().useRef(null),L=l().useRef(null),P=l().useRef(null),A=xe("table"),F=oe(((e,t)=>{const n="function"==typeof r?r(e,t):e?.[r];return void 0===n?(ue("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:_,tableFullData:q,setElementStore:D,setOriginColumns:H,setTableFullData:$,setTableOriginData:M,setTableDataMaps:K,setInvalidRowKeys:z,setFieldAuth:V,setColumnsDefined:j,setScrollXLoad:W,setScrollYLoad:B,setResizeState:U,setHandleState:G,setSummaries:Y,setSelectionRows:X,setUnMounted:Q,clearElementStore:Z}=((e,{getRowKey:t})=>{const n=l().useRef({props:e,uid:Qa(),tableManager:Ja,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!e.dynamicThead,scrollBarRef:l().createRef(),store:new ti({getRowKey:t}),resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},isTreeTable:!1,isOriginTree:!1,scrollXLoad:!1,scrollYLoad:!1,selectionRows:[],recordsMap:new Map,unMounted:!1,isIE:!f&&/MSIE|Trident/.test(navigator.userAgent)});var r;r=e,n.current.props=r;const a=(e,n,r="",i=0)=>{e.forEach((e=>{const l=t(e,e.index),o=r?`${r}.${e.index+1}`:`${e.index+1}`;e.indexPath=o,e._level=i,e._rowKey=l,e._parentRowKey=i?n:null,Array.isArray(e.children)&&a(e.children,l,o,i+1),e.children&&e.children.length||(e._isLeaf=1)}))};return{tableRef:n,...n.current,setElementStore:(e,t)=>{n.current.elementStore[e]=t},setOriginColumns:e=>{n.current.originColumns=e},setTableFullData:e=>{n.current.tableFullData=e;const t=e.some((e=>Array.isArray(e.children)));n.current.isTreeTable=t,t&&a(e,"")},setTableOriginData:e=>{n.current.tableOriginData=e,n.current.isOriginTree=e.some((e=>Array.isArray(e.children)))},setTableDataMaps:e=>{const r=Vn(e);n.current.recordsMap=new Map(r.map(((e,n)=>[t(e,e.index),r[n]])))},setInvalidRowKeys:e=>{n.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{n.current.fieldAuth[e]=t},setColumnsDefined:e=>{n.current.columnsDefined=e},setResizeState:e=>{n.current.resizeState=e},setHandleState:e=>{n.current.handleState=e},setSummaries:e=>{n.current.summaries=e},setScrollXLoad:e=>{n.current.scrollXLoad=e},setScrollYLoad:e=>{n.current.scrollYLoad=e},setSelectionRows:e=>{n.current.selectionRows=e},setUnMounted:e=>{n.current.unMounted=e},clearElementStore:()=>{for(const e in n.current.elementStore)n.current.elementStore[e]=null}}})(n,{getRowKey:F}),{tableFlatData:J,setTableFlatData:ee,filters:te,setFilters:ne,sorter:re,setSorter:ae,superFilters:ie,setSuperFilters:le,pagerFilter:ce,setPagerFilter:de,pagination:me,setPagination:pe,selectionKeys:he,setSelectionKeys:fe,rowExpandedKeys:ge,setRowExpandedKeys:ye,highlightKey:be,setHighlightKey:Ee,updateMark:we,forceUpdate:Ce,activedCell:Se,setActivedCell:Ne,mergedTdCells:Te,setMergedCells:Ie,layout:Re,setLayout:Oe,permission:ke,setPermission:Le,spinning:Pe,setSpinning:Ae,isPingLeft:Fe,setPingLeft:_e,isPingRight:De,setPingRight:He,isFullScreen:$e,setFullScreen:Me,updateTableFlatData:Ke}=(e=>{const{uniqueKey:t,initialSorter:n={},initialFilter:r={},paginationConfig:a,rowSelection:i,expandable:s,rowHighlight:c,mergedCells:d}=e,{global:u}=l().useContext(o),m={current:a?.current??ai.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??a?.pageSize??u?.table?.pagination?.pageSize??ai.pagination.pageSize,total:0},p=i?.selectedRowKeys??i?.defaultSelectedRowKeys??[],f=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[g,y]=l().useState([]),[b,v]=l().useReducer(((e,t)=>(0,h.isEqual)(e,t)?e:t),r),[x,E]=l().useReducer(((e,t)=>(0,h.isEqual)(e,t)?e:t),n),[w,C]=l().useReducer(((e,t)=>(0,h.isEqual)(e,t)?e:t),[]),[S,N]=l().useReducer(((e,t)=>(0,h.isEqual)(e,t)?e:t),{}),[T,I]=l().useState(m),[R,O]=l().useReducer(((e,t)=>(0,h.isEqual)(e,t)?e:t),p),[k,L]=l().useReducer(((e,t)=>(0,h.isEqual)(e,t)?e:t),f),[P,A]=l().useState(c?.currentRowKey??""),[F,_]=l().useReducer((e=>e+1),0),[q,D]=l().useReducer(((e,t)=>(0,h.isEqual)(e,t)?e:t),{}),[H,$]=ri([],{value:d}),[M,K]=l().useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[z,V]=l().useState({export:!0,import:!0,print:!0}),[j,W]=l().useState(!1),[B,U]=l().useState(!1),[G,Y]=l().useState(!1),[X,Q]=l().useState(!1);return{tableFlatData:g,setTableFlatData:y,filters:b,setFilters:v,sorter:x,setSorter:E,superFilters:w,setSuperFilters:C,pagerFilter:S,setPagerFilter:N,pagination:T,setPagination:I,selectionKeys:R,setSelectionKeys:O,rowExpandedKeys:k,setRowExpandedKeys:L,highlightKey:P,setHighlightKey:A,updateMark:F,forceUpdate:_,activedCell:q,setActivedCell:D,mergedTdCells:H,setMergedCells:$,layout:M,permission:z,setPermission:V,setLayout:K,spinning:j,setSpinning:W,isPingLeft:B,setPingLeft:U,isPingRight:G,setPingRight:Y,isFullScreen:X,setFullScreen:Q,updateTableFlatData:()=>y([...g])}})(n),{isFetch:ze,isWebPagination:Ve,isScrollPagination:je,showPagination:We,tableColumns:Be,flattenColumns:Ue,editableColumns:Ge,summationColumns:Ye,leftFixedColumns:Xe,rightFixedColumns:Qe,tableRowHeight:Ze,derivedMergeCells:Je,treeExpandIndex:et,showSummary:tt,showFooter:nt,isHeadGroup:rt,bordered:at,isHeadSorter:it,isHeadFilter:lt,isServiceSummation:ot,isSelectCollection:st,isTableImport:ct,isTableClipboard:dt,isSuperSearch:mt,isFastSearch:pt,isPivotGrid:ht,isGroupSummary:ft,isGroupSubtotal:gt,isTableEmpty:yt,summationRows:bt,fetchParams:vt}=li(n,{getRowKey:F,tableRef:_,$size:T,tableFullData:q,tableFlatData:J,updateMark:we,sorter:re,filters:te,superFilters:ie,selectionKeys:he,pagination:me,mergedTdCells:Te}),{createElementStore:xt,tableStyles:Et,getSpan:wt,getStickyLeft:Ct,getStickyRight:St,scrollXToColumn:Nt,scrollYToRecord:Tt,calcTableHeight:It,resetTableScroll:Rt,createTableFocus:Ot,doLayout:kt}=((e,t)=>{const{height:n,minHeight:r,maxHeight:a,ellipsis:i,showHeader:o,spanMethod:s,rowSelection:c}=e,{getRowKey:d,tableRef:u,topElementRef:m,tableElementRef:p,tableBodyRef:f,$size:g,tableColumns:y,flattenColumns:b,leftFixedColumns:v,derivedMergeCells:x,tableFlatData:w,selectionKeys:C,highlightKey:S,layout:N,tableRowHeight:T,showFooter:I,showPagination:R,isFullScreen:O,setLayout:k,setElementStore:L}=t,P=l().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=N,i={};return r&&Object.assign(i,{minHeight:`${Qn(r)}px`}),a&&Object.assign(i,{maxHeight:`${Qn(a)}px`}),O?{...i,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...i,height:"auto"!==n?`${Qn(n)}px`:`${t}px`}:i}),[n,a,r,O,N]),A=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r}=u.current;if(void 0!==t&&t>=0)if(t<w.length)if(r)f.current.scrollToYIndex(t);else{const e=F(d(w[t],w[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*T);else if(r){const t=w.findIndex((t=>e===d(t,t.index)));t>=0&&f.current.scrollToYIndex(t)}else{const t=F(e);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}},F=e=>u.current.elementStore.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);return{createElementStore:()=>{L("$toper",m.current),L("$table",p.current)},tableStyles:P,getSpan:(e,t,n,r,a)=>{let i=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:a});Array.isArray(o)?(i=o[0],l=o[1]):(0,h.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan)}if(x.length>0){const e=x.find((e=>e.row===n&&e.col===r));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{if(b.findIndex((t=>t.dataIndex===e))<0){const t=$n(y,e);e=t?Mn(t).dataIndex:""}let t=0;for(let n=0;n<b.length;n++){const r=b[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{if(b.findIndex((t=>t.dataIndex===e))<0){const t=$n(y,e);e=t?Kn(t).dataIndex:""}const n="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let n=[];return e.forEach((e=>{e.colSpan>0&&n.length>0&&(t.push(n),n=[]),n.push(e)})),n.length>0&&t.push(n),t.map((e=>{const[t,n]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...n,...t.reverse()]})).flat()})(b):b;let r=0;for(let t=n.length-1;t>=0;t--){const a=n[t];if(a.dataIndex===e)break;r+=a.width||a.renderWidth||0}return r},scrollXToColumn:(e,t)=>{const n=void 0===t?b.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const{scrollBarRef:r}=u.current,a=v.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=b.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-a)},scrollYToRecord:A,calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=u.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(R?Da["small"!==g?"middle":g]+Ka:0)-Ka;k((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{A("",0)},createTableFocus:()=>{S&&f.current.setClickedValues([S,""]),"radio"===c?.type&&C.length&&f.current.setClickedValues([C[0],""])},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=u.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=ai,a=[];let i=0;if(b.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,a.push(e))})),a.length>0){const e=b.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===a.length)a[0].renderWidth=(a[0].minWidth||r)+t;else{const e=t/a.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;a.forEach(((t,a)=>{if(0===a)return;const i=Math.floor((t.minWidth||r)*e);n+=i,t.renderWidth=(t.minWidth||r)+i})),a[0].renderWidth=(a[0].minWidth||r)+t-n}}else a.forEach((e=>{e.renderWidth=e.minWidth||r}));k((t=>({...t,tableBodyWidth:Math.max(e,n)})))}else i=b.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),k((e=>({...e,tableBodyWidth:i})));k((e=>({...e,tableWidth:n}))),t&&f.current.resetItemXSize(b)})(),E((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=u.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,a=o?e.$header.offsetHeight:N.headerHeight,i=I?e.$footer.offsetHeight:N.footerHeight,l=r-a-i,s=e.$tableBody.offsetHeight;let c=0;if(O){const t=e.$toper?e.$toper.offsetHeight+Ka:0,r=e.$pager?e.$pager.offsetHeight+Ka:0;c=n.winHeight-t-r-20}k((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:l,tableBodyHeight:s,tableFullHeight:c})))})()))}}})(n,{getRowKey:F,tableRef:_,topElementRef:I,tableElementRef:O,tableBodyRef:k,$size:T,tableColumns:Be,flattenColumns:Ue,leftFixedColumns:Xe,derivedMergeCells:Je,tableFlatData:J,selectionKeys:he,highlightKey:be,tableRowHeight:Ze,layout:Re,showFooter:nt,showPagination:We,isFullScreen:$e,setLayout:Oe,setElementStore:D}),{initialTable:Lt,checkDataIndex:Pt,createTableFullData:At,createWebPageData:Ft,getTableData:_t,createTableData:qt,createGroupData:Dt,createAllExpandedKeys:Ht,setSelectionKeysEffect:$t,doFieldValidate:Mt,getTableLog:Kt,dataChange:zt,tableChange:Vt,toLastPage:jt,toFirstPage:Wt,getPageCount:Bt,pagerChangeHandle:Ut,scrollBottomDebouncer:Gt,clearTableSorter:Yt,clearTableFilter:Xt,clearSuperFilters:Qt,clearPagerFilter:Zt,clearRowSelection:Jt,clearRowHighlight:en,clearTableLog:tn,destroy:nn}=oi(n,{getRowKey:F,tableRef:_,tableElementRef:O,$size:T,tableColumns:Be,flattenColumns:Ue,tableFullData:q,pagination:me,layout:Re,filters:te,sorter:re,superFilters:ie,pagerFilter:ce,fetchParams:vt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:be,summationColumns:Ye,isFetch:ze,isWebPagination:Ve,isScrollPagination:je,isServiceSummation:ot,isGroupSubtotal:gt,doLayout:kt,setTableFlatData:ee,setTableFullData:$,setTableOriginData:M,setTableDataMaps:K,setPagination:pe,setPingRight:He,setPingLeft:_e,setSpinning:Ae,setSorter:ae,setFilters:ne,setSuperFilters:le,setPagerFilter:de,setSelectionKeys:fe,setRowExpandedKeys:ye,setHighlightKey:Ee,setSelectionRows:X,setScrollXLoad:W,setScrollYLoad:B,setFieldAuth:V,setResizeState:U,setSummaries:Y,setPermission:Le,resetTableScroll:Rt,createTableFocus:Ot,clearElementStore:Z});((e,t)=>{const{columns:n,summation:r,rowSelection:a,expandable:i,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:f,summationRows:g,showSummary:y,isWebPagination:b,isScrollPagination:v,checkDataIndex:x,toLastPage:w,toFirstPage:C,getPageCount:S,setHandleState:N,scrollYToRecord:T,setSelectionKeysEffect:I,setOriginColumns:R,setRowExpandedKeys:O,setHighlightKey:k,setResizeState:L,setUnMounted:P,calcTableHeight:A,initialTable:F,destroy:_}=t,q=l().useRef(g);qe((()=>{if(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),Gn(m)||e?.(m,s.current.selectionRows),Yn(m)}),[m]),qe((()=>{if(!i)return;const{onChange:e}=i;Gn(p)||e?.(p,p.map((e=>s.current.recordsMap.get(e)))),Yn(p)}),[p]),qe((()=>{o&&(c.current.setClickedValues(f?[f,""]:[]),o.onChange?.(f,s.current.recordsMap.get(f)??null))}),[f]),qe((()=>{(0,h.isEqual)(g,q.current)||(q.current=g,y&&r&&r.onChange?.(g))}),[g]),qe((()=>{const e=a.selectedRowKeys||[];(0,h.isEqual)(e,m)||I(Un(e))}),[a?.selectedRowKeys]),qe((()=>{const e=i.expandedRowKeys||[];(0,h.isEqual)(e,p)||O(Un(e))}),[i?.expandedRowKeys]),qe((()=>{const{currentRowKey:e}=o;e!==f&&k(e??"")}),[o?.currentRowKey]),qe((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(b&&("after"===e?w():C()),T("","after"===e?1e5:0)),t&&u.current>S()&&w(),(e||t)&&N({insert:null,remove:!1})}),[u.total]),qe((()=>{A()}),[d]),qe((()=>{(s.current.scrollYLoad||v)&&(e.height||e.maxHeight||ue("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,v]),si({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(L(Object.assign({},e,{winHeight:n})),A())},delay:16}),l().useEffect((()=>(R(qn(n)),F(),x(),E((()=>A())),()=>{_(),P(!0)})),[])})(n,{tableRef:_,tableBodyRef:k,$size:T,pagination:me,selectionKeys:he,rowExpandedKeys:ge,highlightKey:be,showSummary:tt,summationRows:bt,isWebPagination:Ve,isScrollPagination:je,checkDataIndex:Pt,toLastPage:jt,toFirstPage:Wt,getPageCount:Bt,setHandleState:G,scrollYToRecord:Tt,setOriginColumns:H,setSelectionKeysEffect:$t,setRowExpandedKeys:ye,setHighlightKey:Ee,setResizeState:U,setUnMounted:Q,calcTableHeight:It,initialTable:Lt,destroy:nn});const rn=l().useMemo((()=>({getRowKey:F,tableRef:_,tableBodyRef:k,prefixCls:A,$size:T,tableFlatData:J,flattenColumns:Ue,editableColumns:Ge,leftFixedColumns:Xe,rightFixedColumns:Qe,treeExpandIndex:et,sorter:re,filters:te,superFilters:ie,pagerFilter:ce,layout:Re,bordered:at,showFooter:nt,showSummary:tt,summationRows:bt,tableRowHeight:Ze,pagination:me,fetchParams:vt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:be,activedCell:Se,mergedTdCells:Te,derivedMergeCells:Je,updateMark:we,isFetch:ze,isPingLeft:Fe,isPingRight:De,isHeadSorter:it,isHeadFilter:lt,isFullScreen:$e,isTableEmpty:yt,isHeadGroup:rt,isGroupSubtotal:gt,isWebPagination:Ve,dataChange:zt,tableChange:Vt,getTableData:_t,setElementStore:D,createTableFullData:At,createWebPageData:Ft,createGroupData:Dt,createAllExpandedKeys:Ht,updateTableFlatData:Ke,setSorter:ae,setFilters:ne,setSuperFilters:le,setPagerFilter:de,setHighlightKey:Ee,setRowExpandedKeys:ye,setSelectionRows:X,setSelectionKeysEffect:$t,setInvalidRowKeys:z,setActivedCell:Ne,setMergedCells:Ie,getSpan:wt,getStickyLeft:Ct,getStickyRight:St,scrollXToColumn:Nt,scrollYToRecord:Tt,setPagination:pe,setPingLeft:_e,setPingRight:He,setSpinning:Ae,setFullScreen:Me,doFieldValidate:Mt,createTableData:qt,scrollBottomDebouncer:Gt,resetTableScroll:Rt,clearTableSorter:Yt,clearTableFilter:Xt,clearSuperFilters:Qt,clearPagerFilter:Zt,clearRowSelection:Jt,clearRowHighlight:en})),[T,J,Ue,re,te,ie,ce,Re,at,nt,tt,bt,Ze,me,vt,he,ge,be,Se,Je,we,ze,Fe,De,it,lt,$e,yt,rt,gt,Ve]);((e,t)=>{const{getRowKey:n,tableRef:r,toolBoxRef:a,tableBodyRef:i,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:f,isFetch:g,dataChange:y,getTableData:b,createTableData:v,calcTableHeight:E,scrollXToColumn:w,scrollYToRecord:C,doFieldValidate:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:P,getTableLog:A,clearRowSelection:F,clearRowHighlight:_,clearTableSorter:q,clearTableFilter:D,clearSuperFilters:H,clearPagerFilter:$,clearTableLog:M}=t,{columns:K,columnsChange:z}=r.current.props,V=(e,t,r,a=0)=>e.filter((e=>{const i=n(e,e.index);e.children&&(e.children=V(e.children,t,r,a+1));const l=t.includes(i);return l&&r(e,i,a),!l}));l().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:async e=>{g&&(await x(0),await b(),e?.())},GET_LOG:()=>A(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{g||(F(),_(),q(),D(),H(),$(),M(),v([]))},CLEAR_LOG:()=>{M(),P()},CREATE_FOCUS:(e,t)=>{i.current.createFocus(e,t)},FORCE_UPDATE:()=>{P()},DO_EXPORT:()=>{a.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{w(e)},SET_SELECTION:(e,t)=>{I(t?Un([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?Un([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{v(e)},DEFINE_INITIAL_COLUMNS:e=>{L(qn(e)),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=$n(K,e);if(!r)return ue("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,h.isPlainObject)(t))return ue("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return ue("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,h.set)(r,e,t[e]);n&&(z?z([...K]):ue("Table","需要设置 `columnsChange` 参数"),P())},INSERT_RECORDS:(e,t)=>{const{store:a,tableFullData:i,tableOriginData:l}=r.current,o=(Array.isArray(e)?e:[e]).filter((e=>(0,h.isPlainObject)(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[ai.expandableColumn,ai.selectionColumn,ai.operationColumn].includes(n)||er(e,n,Jn(e,n))})),a.addToInserted(e)}));const c="before"===t?.mode,d=void 0===t?.parentRowKey,u=[...i];if(d)c?u.unshift(...o):u.push(...o),c?l.unshift(...o):l.push(...o);else{const e=hr(u,(e=>t.parentRowKey===n(e,e.index)));if(e){const r=hr(l,(e=>t.parentRowKey===n(e,e.index))),a=vr(e,r);Array.isArray(e.children)?(c?e.children.unshift(...o):e.children.push(...o),!a&&r&&(c?r.children.unshift(...o):r.children.push(...o))):(e.children=o,!a&&r&&(r.children=o))}}d&&N(Object.assign({},r.current.handleState,{insert:c?"before":"after"})),v(l,(()=>u)),y()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:a,tableOriginData:i}=r.current,l=(Array.isArray(e)?e:[e]).map((e=>(0,h.isPlainObject)(e)?n(e,e.index):e));if(!l.length)return;let o=!1;const s=V([...a],l,((e,r,a)=>{if(t.addToRemoved(e),c.forEach((n=>{const{dataIndex:a,editRender:i}=n,l=i?.(e,n);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),a<=0){const e=i.findIndex((e=>n(e,e.index)===r));i.splice(e,1)}else if(!vr(e,hr(i,(e=>n(e,e.index)===r)))){const t=hr(i,(t=>n(t,t.index)===e._parentRowKey));t&&(t.children=t.children.filter((e=>n(e,e.index)!==r)))}o=!0}));o&&(N(Object.assign({},r.current.handleState,{remove:!0})),I(m.filter((e=>!l.includes(e)))),l.includes(f)&&_(),R(p.filter((e=>!l.includes(e)))),v(i,(()=>s)),y())},VALIDATE_FIELDS:(e,t)=>{Array.from(r.current.recordsMap.values()).forEach((r=>{c.forEach((a=>{const{dataIndex:i,title:l,editRender:o}=a,s=o?.(r,a);if(!s)return;const c=n(r,r.index);if(e&&!e.includes(c))return;if(t&&!t.includes(i))return;const{rules:d=[],disabled:u}=s;u||S(d,Jn(r,i),c,i,cr(l))}))}));const{required:a,validate:i}=A(),l=[...a,...i];return l.length&&C(l[0].rowKey),P(),{required:a,validate:i}}})))})(t,{getRowKey:F,tableRef:_,toolBoxRef:L,tableBodyRef:k,columnFilterRef:P,flattenColumns:Ue,editableColumns:Ge,pagination:me,fetchParams:vt,selectionKeys:he,rowExpandedKeys:ge,highlightKey:be,isFetch:ze,dataChange:zt,getTableData:_t,createTableData:qt,calcTableHeight:It,scrollXToColumn:Nt,scrollYToRecord:Tt,doFieldValidate:Mt,setHandleState:G,setColumnsDefined:j,setSelectionKeysEffect:$t,setRowExpandedKeys:ye,setHighlightKey:Ee,setSelectionRows:X,setOriginColumns:H,forceUpdate:Ce,getTableLog:Kt,clearRowSelection:Jt,clearRowHighlight:en,clearTableSorter:Yt,clearTableFilter:Xt,clearSuperFilters:Qt,clearPagerFilter:Zt,clearTableLog:tn}),l().useLayoutEffect((()=>{xt(),_.current.tableManager.register(_.current.uid,t??{current:null})}),[]);const an={[`${A}--wrapper`]:!0,[`${A}--lg`]:"large"===T,[`${A}--sm`]:"small"===T,[`${A}--maximize`]:$e,[c]:!!c},ln={[A]:!0,"is--border":at,"is--fixed":Xe.length||Qe.length,"is--sortable":it,"is--filterable":lt,"is--head-group":rt,"is--area-select":!!d,"is--ping-left":Fe,"is--ping-right":De};return l().createElement(Ha.Provider,{value:rn},l().createElement("div",{className:ve()(an,S),style:N},y&&l().createElement("div",{ref:I,className:`${A}-top`},l().createElement("div",{className:`${A}-top__space`},"bottom"!==p?.position&&l().createElement(ci,{total:me.total}),l().createElement("div",{className:`${A}-top__space-slot`,style:{justifyContent:Ga[g]}},n.children)),l().createElement("div",{className:`${A}-top__actions`},l().createElement(Mo,{ref:L,showFullScreen:b,showReload:v&&ze,showPrint:ke.print&&!!u,showImport:ke.import&&ct,showExport:ke.export&&!!m,showClipboard:dt,showCollection:st,showFastSearch:pt,showSuperSearch:mt,showPivotGrid:ht,showGroupSummary:ft,showToolBox:w,tableColumns:Be}),l().createElement(Vo,{ref:P,columns:a}))),l().createElement(ut,{spinning:i??Pe},l().createElement("div",{ref:O,className:ve()(ln),style:Et},l().createElement("div",{className:`${A}--main-wrapper`},C&&l().createElement(Ss,{tableColumns:Be}),l().createElement(bc,{ref:k}),nt&&l().createElement(vc,null)),at&&l().createElement("div",{className:`${A}--border-line`}),yt&&l().createElement(wc,null),s&&l().createElement(Cc,null))),We&&l().createElement(Ec,Sc({},me,{onChange:(e,t)=>Ut({current:e,pageSize:t})}))))}));Nc.displayName="QmTable";const Tc=Nc,Ic=Tc;function Rc(){return Rc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rc.apply(null,arguments)}const Oc=e=>{const{uniqueKey:t,multiple:n,initialValue:r,selectionRows:a,defaultSelectedKeys:i=[],filters:o=[],table:s={},className:c,style:d,onClose:u}=e,{$size:m}=se(e),{t:p}=le(),f=l().useRef(null),g=l().useRef(null),y=l().useRef(null),b=vt(f),[E,w]=l().useState(s),[C,S]=l().useState(),[N,T]=l().useState(i),[I,R]=l().useState(!1),[O,k]=l().useState(300),[L,P]=l().useState(o),[A,F]=l().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[_,q]=l().useState((0,h.merge)({},s.fetch?.params,r)),[D,H]=l().useState([]),$=()=>{const e=f.current,t=e.querySelector(".form-wrap");k(e.offsetHeight-t.offsetHeight-2*Da[m]-30)},M=Et($,5);xt((()=>{M()}),[b.width]),qe((()=>{(0,h.isEqual)(o,L)||P(o)}),[o]),l().useEffect((()=>{K()}),[_]),l().useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{r&&g.current?.SET_FIELDS_VALUE(r)}),[]);const K=async()=>{const{webPagination:e,fetch:t}=E;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=v}=t;if(i(_)){R(!0);try{const e=await r(_);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,h.get)(e.data,a)??[];n||(T([]),await x(0)),H(t)}}catch(e){}R(!1)}},z=e=>{n||(S(e),u(e))},V=e=>{q(Object.assign({},_,e))},j=xe("search-helper"),W={[`${j}--wrapper`]:!0},B=E.webPagination?{dataSource:D,loading:I,webPagination:!0}:{fetch:{...E.fetch,params:_}};return l().createElement("div",{ref:f,className:ve()(W,c),style:d},l().createElement("div",{className:"form-wrap"},L.length?l().createElement(Nm,{ref:g,items:L,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>P(e),onCollapse:()=>$(),onFinish:e=>V(e),onReset:async()=>{const[e,t]=await g.current.GET_FORM_DATA();e||V(t)}}):null),l().createElement("div",null,l().createElement(Ic,Rc({ref:y,uniqueKey:t,height:O,columns:A,rowKey:E.rowKey||"pageIndex"},B,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:N,onChange:(e,t)=>{T(e),S(n?t:t[0])}},topSpaceAlign:"left",paginationConfig:E.paginationConfig,columnsChange:e=>F(e),onRowDblclick:z,onRowEnter:z}),E.topBarExtra)),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Da[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(he,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),l().createElement(he,{type:"primary",disabled:!C,onClick:()=>u(C,n?N:void 0)},p("qm.dialog.confirm"))))};Oc.displayName="QmSearchHelper";const kc=Oc;function Lc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:Pc}=K.Input;class Ac extends i.Component{constructor(e){super(e),Lc(this,"context",void 0),Lc(this,"deriveParams",void 0),Lc(this,"valueKey",void 0),Lc(this,"_is_change",!1),Lc(this,"_record",void 0),Lc(this,"_prevValue",null),Lc(this,"state",{visible:!1,loading:!1}),Lc(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),Lc(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),Lc(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Lc(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||ue("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||ue("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&ue("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Lc(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Lc(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Lc(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=e=>e,dataKey:r,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(e&&!C(d)){this.setState({loading:!0});try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,h.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Kr(t,this.alias,s),c&&zr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Mr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})}})),Lc(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),Lc(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:n}=this.searchHelper,r=""!==e?e:void 0,a=("function"==typeof n?n():n)||[],i={[t]:r};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,h.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i})),Lc(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=v,formatter:a=e=>e}=t.fetch;return new Promise((async(i,l)=>{const o=(0,h.merge)({},this.searchHelper.table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!r(o))return l();this.setState({loading:!0});try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,h.get)(e.data,t.fetch.dataKey)??[]):l()}catch(e){l(e)}finally{E((()=>this.setState({loading:!1})))}}))})),Lc(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const a=Mr(e,this.alias[r]);void 0!==a&&(t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a),r===n&&t.setViewValue(n,a))}for(const n in this.extras){const r=Mr(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}})),Lc(this,"resetSearchHelperValue",(async(e=[],t)=>{const{fieldName:n}=this.props.option,r=e.filter((e=>Mr(e,this.alias[n])?.toString().toLowerCase().includes(t.toLowerCase())));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(t)})),Lc(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,a=(r??v)(n.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),Lc(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){if(r===n)continue;const a=Mr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Mr(e,this.extras[n])});const r=Mr(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Lc(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)})),Lc(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const n in this.alias)n!==t&&(e.SET_FIELDS_VALUE({[n]:void 0}),n===this.valueKey&&(this._prevValue=null));for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),Lc(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),Lc(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e)})),Lc(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Lc(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||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(){this.echoSearchHelper()}render(){const{$$form:e}=this.context,{visible:t,loading:n}=this.state,{value:r}=this.props,{type:a,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:y,maxLength:b}=o,v={visible:t,title:p("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?l().createElement(ia,{value:r,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Pc,{ref:e=>this[`${a}_Ref`]=e,value:r,title:r,loading:n,placeholder:d,style:c,prefix:g,suffix:y,maxLength:b,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:n}=e.target,{onlySelect:r=!0,table:a}=this.searchHelper;this.triggerBlur(n),this._is_change&&!t&&(n?r?a?.fetch?.api&&this.getSearchHelperTableData(n).then((e=>this.resetSearchHelperValue(e,n))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(n):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:n}=e.target;!t&&this.openSearchHelper(n)}},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):E((()=>this.clearSearchHelperValue())))}}),l().createElement(yn,v,l().createElement(kc,x)))}}Lc(Ac,"contextType",xn);class Fc extends i.Component{constructor(e,{$$form:t}){super(e),Lc(this,"context",void 0),Lc(this,"promiseRef",void 0),Lc(this,"searchRef",void 0),Lc(this,"state",{searchHelper:{}}),Lc(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){de("Form","搜索帮助获取定义信息的接口出错")}})),Lc(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return ue("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[]}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(r),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":I(c)},required:e.getFormItemRequired(h)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ac,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(i,t)}}))),m&&l().createElement(K.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(K.Col,{flex:I(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Lc(Fc,"contextType",xn);const _c=Fc;function qc(){return qc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qc.apply(null,arguments)}function Dc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hc=e=>{class t extends i.Component{constructor(...e){super(...e),Dc(this,"startClick",void 0),Dc(this,"event1",null),Dc(this,"event2",null),Dc(this,"$el",null),Dc(this,"omitClassNames",[]),Dc(this,"state",{clickOutside:!1}),Dc(this,"mousedownHandler",(e=>{this.startClick=e})),Dc(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Dc(this,"documentHandler",((e,t)=>{const n=e.target,r=t?.target,a=!n||!r,i=this.$el?.contains(n)||this.$el?.contains(r),l=this.$el===n,o=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=o.some((e=>e?.contains(n)))||o.includes(r);let c;c=!(a||i||l||s),this.setState({clickOutside:c})})),Dc(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Dc(this,"setOmitClassNames",((e=[])=>{this.omitClassNames=e}))}componentDidMount(){this.event1=Ut()(document,"mousedown",this.mousedownHandler),this.event2=Ut()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:n}=this.state;return l().createElement(e,qc({ref:t},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Dc(t,"displayName",`OutsideClick(${e.displayName||e.name})`),l().forwardRef(((e,n)=>l().createElement(t,qc({},e,{forwardedRef:n}))))};var $c,Mc;function Kc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let zc=Hc((Mc=class extends i.Component{constructor(e){super(e),Kc(this,"context",void 0),Kc(this,"searchRef",l().createRef()),Kc(this,"_records",[]),Kc(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Kc(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),Kc(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||ue("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||ue("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Kc(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Kc(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Kc(this,"setItemList",(e=>{this.setState({itemList:e})})),Kc(this,"setRecords",(e=>{this._records=e})),Kc(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Kc(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),Kc(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??v)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),Kc(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords((0,h.uniqBy)([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Kc(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),t?.(e),n(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:r=[],clickOutside:a}=this.props;(0,h.isEqual)(n,r)||(0,h.isEqual)(r,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:n,params:r={},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(n){if(C(c))return this.setRecords([]);this.setState({loading:!0});try{const o=await n(a({...r,keys:c}));if(200===o.code){let n=Array.isArray(o.data)?o.data:(0,h.get)(o.data,i)??[];n.forEach((n=>{s?.valueKey&&s.valueKey!==t&&(n[t]=n[s.valueKey]),s?.textKey&&s.textKey!==e&&(n[e]=n[s.textKey])})),n=n.filter((e=>c.includes(e[t])));const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),this.setViewValue(c),l?.(n)}}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:t,visible2:n,loading:r,itemList:a}=this.state,{value:i}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:f=!0,readOnly:g,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:v}=s,x={visible:t,title:p("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},E={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,h.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},w=a.filter((e=>i?.includes(e.value))),C=l().createElement("ul",{className:"ant-dropdown-menu"},w.length?w.map((e=>l().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):l().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),S=this.searchRef.current?this.searchRef.current.offsetWidth:300,N=xe("form-multiple-search-helper"),{size:T}=e.context,I={[N]:!0,[`${N}--lg`]:"large"===T,[`${N}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${N}`]);const R=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(ia,{value:R,bordered:m}):l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},l().createElement(Ai(),{popupVisible:!y&&n,popup:C,popupClassName:ve()(I),popupStyle:{minWidth:S},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Lr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement(K.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:v,open:!1,value:i,placeholder:u,loading:r,bordered:m,allowClear:f,disabled:y,style:{width:"100%",...d},title:R,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:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(K.Button,{className:"ant-input-search-button",disabled:y,icon:l().createElement(Ee.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),l().createElement(yn,x,l().createElement(kc,E)))}},Kc(Mc,"contextType",xn),$c=Mc))||$c;class Vc extends i.Component{constructor(e,{$$form:t}){super(e),Kc(this,"context",void 0),Kc(this,"promiseRef",void 0),Kc(this,"state",{searchHelper:{}}),Kc(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){de("Form","搜索帮助获取定义信息的接口出错")}})),Kc(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return ue("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(r),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":I(c)},required:e.getFormItemRequired(h)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(zc,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(i,n)}}))),m&&l().createElement(K.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(K.Col,{flex:I(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Kc(Vc,"contextType",xn);const jc=Vc;function Wc(){return Wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wc.apply(null,arguments)}const Bc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Bc(e.children)),e.children&&t.push(e.value)})),t},Uc=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Uc(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Gc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Gc(e.children,t),t(e)||e.children&&e.children.length))),Yc=e=>{const{uniqueKey:t,multiple:n,initialValue:r,selectionRows:a,defaultSelectedKeys:i=[],filters:o=[],table:s={},tree:c={},className:d,style:u,onClose:m}=e,{$size:p}=se(e),{t:f}=le(),g=l().useRef(null),y=l().useRef(null),b=l().useRef(null),E=vt(g),[w,C]=l().useState(s),[S,N]=l().useState(),[T,I]=l().useState(i),[R,O]=l().useState(!1),[k,L]=l().useState(300),[P,A]=l().useState(300),[F,_]=l().useState(o),[q,D]=l().useState([{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[H,$]=l().useState((0,h.merge)({},s.fetch?.params,r)),[M,z]=l().useState([]),V=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");L(e.offsetHeight-n.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*Da[p]-30)},j=Et(V,5);xt((()=>{j()}),[E.width]),qe((()=>{(0,h.isEqual)(o,F)||_(o)}),[o]),l().useEffect((()=>{W()}),[H]),l().useEffect((()=>{a&&b.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{r&&y.current?.SET_FIELDS_VALUE(r),ne()}),[]);const W=async()=>{const{webPagination:e,fetch:t}=w;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=v}=t;if(i(H)){O(!0);try{const e=await r(H);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,h.get)(e.data,a)??[];n||(I([]),await x(0)),z(t)}}catch(e){}O(!1)}},B=e=>{n||(N(e),m(e))},U=e=>{$(Object.assign({},H,e))},[G,Y]=l().useState([]),[X,Q]=l().useState([]),[Z,J]=l().useState(""),ee=l().useRef(G),te=l().useRef([]);qe((()=>{Q(Bc(G))}),[G]);const ne=async()=>{if(!c.fetch)return;const{api:e,params:t,dataKey:n,valueKey:r="value",textKey:a="text"}=c.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,h.get)(i.data,n)??[],t=Vr(e,r,a);Y(t),ee.current=t,te.current=e}}catch(e){}},re=e=>`${e}|${ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ae=xe("tree-table-helper"),ie={[`${ae}--wrapper`]:!0},oe=w.webPagination?{dataSource:M,loading:R,webPagination:!0}:{fetch:{...w.fetch,params:H}};return l().createElement("div",{ref:g,className:ve()(ie,d),style:u},l().createElement(tt,{defaultValue:200,style:{height:"100%"}},l().createElement(tt.Pane,{min:100,style:{overflowY:"auto"}},l().createElement(K.Input,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),suffix:l().createElement(Ee.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{const t=Gc(ee.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==re(n).indexOf(e)}));J(e),Y(t)})(e.target.value)}),l().createElement(K.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:k,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==re(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=c.fetch;(e=>{if(!c.tableParamsMap)return ue("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof c.tableParamsMap?c.tableParamsMap():c.tableParamsMap,n={};for(const r in t)n[r]=(0,h.get)(e,t[r]);U(n)})(Uc(te.current,(n=>(0,h.get)(n,t)===e[0]))||{})}})),l().createElement(tt.Pane,{className:"split-pane"},l().createElement("div",{className:"form-wrap"},F.length?l().createElement(Nm,{ref:y,items:F,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>_(e),onCollapse:()=>V(),onFinish:e=>U(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||U(t)}}):null),l().createElement("div",null,l().createElement(Ic,Wc({ref:b,uniqueKey:t,height:P,columns:q,rowKey:w.rowKey||"pageIndex"},oe,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:T,onChange:(e,t)=>{I(e),N(n?t:t[0])}},topSpaceAlign:"left",paginationConfig:w.paginationConfig,columnsChange:e=>D(e),onRowDblclick:B,onRowEnter:B}),w.topBarExtra)))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Da[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(he,{onClick:()=>m(null),style:{marginRight:8}},f("qm.dialog.cancel")),l().createElement(he,{type:"primary",disabled:!S,onClick:()=>m(S,n?T:void 0)},f("qm.dialog.confirm"))))};Yc.displayName="TreeTableHelper";const Xc=Yc;function Qc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:Zc}=K.Input;class Jc extends i.Component{constructor(e){super(e),Qc(this,"context",void 0),Qc(this,"valueKey",void 0),Qc(this,"_record",void 0),Qc(this,"_prevValue",null),Qc(this,"state",{visible:!1,loading:!1}),Qc(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),Qc(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),Qc(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Qc(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||ue("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||ue("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&ue("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Qc(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Qc(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Qc(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=e=>e,dataKey:r,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(e&&!C(d)){this.setState({loading:!0});try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,h.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Kr(t,this.alias,s),c&&zr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Mr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})}})),Qc(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const a=Mr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a),r===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Mr(e,this.extras[n])})})),Qc(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??v)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),Qc(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){if(r===n)continue;const a=Mr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Mr(e,this.extras[n])});const r=Mr(e,this.alias[n]);this.triggerChange(r);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Qc(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const n in this.alias)n!==t&&(e.SET_FIELDS_VALUE({[n]:void 0}),n===this.valueKey&&(this._prevValue=null));for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),Qc(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this._record)})),Qc(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(){this.echoSearchHelper()}render(){const{$$form:e}=this.context,{visible:t,loading:n}=this.state,{value:r=""}=this.props,{type:a,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:f,disabled:g}=this.props.option,{prefix:y,suffix:b,maxLength:v}=o,x={visible:t,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},E={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,h.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?l().createElement(ia,{value:r,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Zc,{ref:e=>this[`${a}_Ref`]=e,value:r,title:r,loading:n,placeholder:d,style:c,prefix:y,suffix:b,maxLength:v,bordered:u,allowClear:m,readOnly:f,disabled:g,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())}}),l().createElement(yn,x,l().createElement(Xc,E)))}}Qc(Jc,"contextType",xn);class ed extends i.Component{constructor(e,{$$form:t}){super(e),Qc(this,"context",void 0),Qc(this,"promiseRef",void 0),Qc(this,"state",{searchHelper:{}}),Qc(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){de("Form","搜索帮助获取定义信息的接口出错")}})),Qc(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return ue("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(r),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":I(c)},required:e.getFormItemRequired(h)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Jc,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(i,t)}}))),m&&l().createElement(K.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(K.Col,{flex:I(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Qc(ed,"contextType",xn);const td=ed;var nd,rd;function ad(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let id=Hc((rd=class extends i.Component{constructor(e){super(e),ad(this,"context",void 0),ad(this,"searchRef",l().createRef()),ad(this,"_records",[]),ad(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),ad(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),ad(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||ue("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||ue("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),ad(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ad(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ad(this,"setItemList",(e=>{this.setState({itemList:e})})),ad(this,"setRecords",(e=>{this._records=e})),ad(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),ad(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),ad(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??v)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),ad(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords((0,h.uniqBy)([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ad(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),t?.(e),n(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:r=[],clickOutside:a}=this.props;(0,h.isEqual)(n,r)||(0,h.isEqual)(r,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:n,params:r={},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(n){if(C(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await n(a({...r,keys:s}));if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,h.get)(l.data,i)??[];n.forEach((n=>{o?.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),o?.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t])));const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),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:t,visible2:n,loading:r,itemList:a}=this.state,{value:i}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:f=!0,readOnly:g,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:v}=s,x={visible:t,title:p("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},E={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,h.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},w=a.filter((e=>i?.includes(e.value))),C=l().createElement("ul",{className:"ant-dropdown-menu"},w.length?w.map((e=>l().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):l().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),S=this.searchRef.current?this.searchRef.current.offsetWidth:300,N=xe("form-multiple-tree-table-helper"),{size:T}=e.context,I={[N]:!0,[`${N}--lg`]:"large"===T,[`${N}--sm`]:"small"===T};this.props.setOmitClassNames?.([`.${N}`]);const R=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(ia,{value:R,bordered:m}):l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},l().createElement(Ai(),{popupVisible:!y&&n,popup:C,popupClassName:ve()(I),popupStyle:{minWidth:S},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Lr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement(K.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:v,open:!1,value:i,placeholder:u,loading:r,bordered:m,allowClear:f,disabled:y,style:{width:"100%",...d},title:R,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:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(K.Button,{className:"ant-input-search-button",disabled:y,icon:l().createElement(Ee.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),l().createElement(yn,x,l().createElement(Xc,E)))}},ad(rd,"contextType",xn),nd=rd))||nd;class ld extends i.Component{constructor(e,{$$form:t}){super(e),ad(this,"context",void 0),ad(this,"promiseRef",void 0),ad(this,"state",{searchHelper:{}}),ad(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){de("Form","搜索帮助获取定义信息的接口出错")}})),ad(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return ue("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(r),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":I(c)},required:e.getFormItemRequired(h)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(id,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(i,n)}}))),m&&l().createElement(K.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(K.Col,{flex:I(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ad(ld,"contextType",xn);const od=ld;function sd(){return sd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sd.apply(null,arguments)}const cd="_startSign",dd="_endSign",ud=e=>{const{uniqueKey:t,initialValue:n,filters:r=[],table:a={},onClose:i}=e,{$size:o}=se(e),{t:s}=le(),c=l().useRef(null),d=l().useRef(null),u=l().useRef(null),m=vt(c),[p,f]=l().useState(a),[g,y]=l().useState(!1),[b,x]=l().useState([]),[E,w]=l().useState(300),[C,S]=l().useState(r),[N,T]=l().useState([{title:s("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},{title:s("qm.form.rangeSearchHelper")[0],dataIndex:cd,width:80,align:"right",render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)},...a.columns||[],{title:s("qm.form.rangeSearchHelper")[1],dataIndex:dd,fixed:"right",width:80,render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)}]),[I,R]=l().useState((0,h.merge)({},a.fetch?.params,n)),[O,k]=l().useState([]),L=l().useMemo((()=>b.map((e=>e?.pageIndex))),[b]),P=l().useMemo((()=>2===L.length&&L.every((e=>void 0!==e))),[L]),A=()=>{const e=c.current.parentNode.children[0],t=e.querySelector(".form-wrap");w(e.offsetHeight-t.offsetHeight-2*Da[o]-30)},F=Et(A,5);xt((()=>{F()}),[m.width]),qe((()=>{(0,h.isEqual)(r,C)||S(r)}),[r]),l().useEffect((()=>{_()}),[I]);const _=async()=>{const{webPagination:e,fetch:t}=p;if(!e||!t?.api)return;const{api:n,dataKey:r,beforeFetch:a=v}=t;if(a(I)){y(!0);try{const e=await n(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,h.get)(e.data,r)??[];k(t)}}catch(e){}y(!1)}},q=(e,t)=>{delete e[t]},D=()=>{b.forEach((e=>{e&&(q(e,cd),q(e,dd))})),x([])},H=e=>{D(),R(Object.assign({},I,e))},$=xe("range-helper"),M=p.webPagination?{dataSource:O,loading:g,webPagination:!0}:{fetch:{...p.fetch,params:I}};return l().createElement("div",{ref:c,className:`${$}--wrapper`},l().createElement("div",{className:"form-wrap"},C.length?l().createElement(Nm,{ref:d,items:C,initialValues:n,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>S(e),onCollapse:()=>A(),onFinish:e=>H(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||H(t)}}):null),l().createElement("div",null,l().createElement(Ic,sd({ref:u,height:E,columns:N,rowKey:p.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=L[0]&&e.pageIndex<=L[1]?{backgroundColor:"#f5f5f5"}:{}},M,{columnsChange:e=>T(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[cd,dd].includes(n)&&(n===cd&&(e[n]?(q(e,n),x([void 0,b[1]])):e.pageIndex>L[1]?K.message.warning(s("qm.searchHelper.rangeStartTip")):(b[0]&&q(b[0],n),e[n]="[",x([e,b[1]]))),n===dd&&(e[n]?(q(e,n),x([b[0],void 0])):e.pageIndex<L[0]?K.message.warning(s("qm.searchHelper.rangeEndTip")):(b[1]&&q(b[1],n),e[n]="]",x([b[0],e]))),u.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===L[0]&&(e[cd]="["),e.pageIndex===L[1]&&(e[dd]="]")}))}}),l().createElement(he,{type:"primary",icon:l().createElement(Ee.ClearOutlined,null),title:s("qm.table.alert.clear"),onClick:()=>D()}))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Da[o]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(he,{onClick:()=>i(null),style:{marginRight:8}},s("qm.dialog.cancel")),l().createElement(he,{type:"primary",disabled:!P,onClick:()=>i(b.map((e=>(e=>{const t={};for(const n in e)[cd,dd].includes(n)||(t[n]=e[n]);return t})(e))))},s("qm.dialog.confirm"))))};ud.displayName="RangeTableHelper";const md=ud;function pd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const hd=new Array(2).fill("");class fd extends i.Component{constructor(e){super(e),pd(this,"context",void 0),pd(this,"_is_change",!1),pd(this,"_ceho_data",void 0),pd(this,"_records",[]),pd(this,"_is_clear",!1),pd(this,"state",{visible:!1,loading:!1,itemList:[],textValue:hd}),pd(this,"getSearchHelper",vn()((e=>Object.assign({},this.props.helperConfig,e)))),pd(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||ue("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||ue("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),pd(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),pd(this,"setItemList",(e=>{this.setState({itemList:e})})),pd(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),pd(this,"setTextValue",(e=>{this.setState({textValue:e})})),pd(this,"setRecords",(e=>{this._records=e})),pd(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),pd(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,t?.(e),n(e,this.createViewText(),this._records)})),pd(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(hd),this.triggerChange([])})),pd(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:n}=this.alias,r=e.map((e=>({value:e[t],text:e[n]})));this.setRecords(e),this.setItemList(r),this.setTextValue(r.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),pd(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??v)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),pd(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,n=C(e)?void 0:e;return{[t]:n}})),pd(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=v,formatter:a=e=>e}=t.fetch;return new Promise((async(i,l)=>{const o=(0,h.merge)({},this.searchHelper.table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!r(o))return l();this.setState({loading:!0});const e=await t.fetch.api(o);if(E((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,h.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}l()}))})),pd(this,"resetSearchHelperValue",(async(e=[])=>{const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{const r=e[n]?.toString().toLowerCase();return t.some((e=>r?.includes(e.toLowerCase())))}));if(2===r.length)return this.closeSearchHelper(r);this.openSearchHelper()})),pd(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:n=[]}=this.props;(0,h.isEqual)(t,n)||(0,h.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:a}=this.props.option;if(!(0,h.isEqual)(r[a],this._ceho_data)&&(this._ceho_data=r[a],this.setItemList(r[a]),n.length)){const e=hd.map(((e,t)=>r[a].find((e=>e.value===n[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:n,params:r={},formatter:a=e=>e,dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(n){if(C(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await n(a({...r,keys:s}));if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,h.get)(l.data,i)??[];n.forEach((n=>{o?.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),o?.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t]))).slice(0,2);const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),this.setTextValue(r.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:t=[]}=this.props,{visible:n,loading:r,textValue:a}=this.state,{fieldName:i,options:o={},searchHelper:s={},placeholder:c=p("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:f=!0}=this.searchHelper||s,g=a.every((e=>$r(e)))?"":a.join(" - "),y={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Da[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},b={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,h.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?l().createElement(ia,{value:g,bordered:d}):l().createElement(l().Fragment,null,l().createElement(K.Input.Group,null,l().createElement(K.Input,{value:a[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;f||(this._is_change=!0,this.setTextValue([t,a[1]]))}}),l().createElement(K.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),l().createElement(K.Input.Search,{value:a[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:r,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:f||(this._is_change=!0,this.setTextValue([a[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),l().createElement(yn,y,l().createElement(md,b)))}}pd(fd,"contextType",xn);class gd extends i.Component{constructor(e,{$$form:t}){super(e),pd(this,"context",void 0),pd(this,"promiseRef",void 0),pd(this,"state",{searchHelper:{}}),pd(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){de("Form","搜索帮助获取定义信息的接口出错")}})),pd(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return ue("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(p)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(fd,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{h(t,r),e.setViewValue(i,n)}}))),u&&l().createElement(K.Col,null,e.renderFormItemButton(i,u)),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...d}))))}}pd(gd,"contextType",xn);const yd=gd;function bd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const vd=e=>{const{$$form:t}=l().useContext(xn),{value:n,items:r,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,p=C(m)?r:m,h=e=>p.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?l().createElement(ia,{value:h(n),bordered:c}):l().createElement(K.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{a?.(e),i(e,h(e))})(e)}},p.map((e=>l().createElement(K.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class xd extends i.Component{constructor(...e){super(...e),bd(this,"context",void 0),bd(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,h.isEqual)(t,n)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,h.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(r),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":I(c)},required:e.getFormItemRequired(p)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(vd,{option:this.props.option,items:t,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&l().createElement(K.Col,{flex:I(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}bd(xd,"contextType",xn);const Ed=xd;function wd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cd=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{options:i={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=t.isFormDisabled}=e.option,{allowHalf:u,count:m=5,tooltips:p}=i;return l().createElement(K.Rate,{value:n,count:m,style:o,allowHalf:u,allowClear:s,tooltips:p,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;r?.(e),a(e,(t=e,p?p[Math.ceil(t)-1]:t.toString()))})(e)}})};class Sd extends i.Component{constructor(...e){super(...e),wd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Cd,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}wd(Sd,"contextType",xn);const Nd=Sd;function Td(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Id=e=>{const{$$form:t}=l().useContext(xn),{value:n,items:r,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=t.isFormDisabled}=e.option,{itemList:m=[]}=o,p=C(m)?r:m,h=e=>p.find((t=>t.value===e))?.text??"";return t.isOnlyShow?l().createElement(ia,{value:h(n),bordered:c}):l().createElement(K.Radio.Group,{value:n,style:{width:"100%",...s},disabled:u||t.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e,h(e))})(t)}},p.map((e=>l().createElement(K.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Rd extends i.Component{constructor(...e){super(...e),Td(this,"context",void 0),Td(this,"state",{itemList:[]}),Td(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,h.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,h.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(r),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":I(c)},required:e.getFormItemRequired(p)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Id,{option:this.props.option,items:t,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&l().createElement(K.Col,{flex:I(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Td(Rd,"contextType",xn);const Od=Rd;function kd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ld=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=Rr,trueValue:p=Ir}=o,{t:h}=le();return l().createElement(l().Fragment,null,l().createElement(K.Switch,{checked:n===p,style:s,disabled:d||t.isOnlyShow,checkedChildren:l().createElement(Ee.CheckOutlined,null),unCheckedChildren:l().createElement(Ee.CloseOutlined,null),onChange:e=>{(e=>{r?.(e),a(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(e?p:m)}}),u?l().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},i):null)};class Pd extends i.Component{constructor(...e){super(...e),kd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option,{labelToSwitch:h}=o;return l().createElement(K.Form.Item,{label:h?" ":e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Ld,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}kd(Pd,"contextType",xn);const Ad=Pd;function Fd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const _d=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=le(),{options:o={},style:s={},placeholder:c=i("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:g}=e.option,{showCount:y,maxLength:b,autoSize:v}=o,x=Object.assign({},{minRows:1,maxRows:3},v);return l().createElement(K.Input.TextArea,{value:n,placeholder:c,style:s,maxLength:b,showCount:y,autoSize:x,bordered:d,allowClear:u,readOnly:m||t.isOnlyShow,disabled:p,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;n?.(t)})(n),f?.(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g?.(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{r?.(e),a(e)})(t)}})};class qd extends i.Component{constructor(...e){super(...e),Fd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(_d,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Fd(qd,"contextType",xn);const Dd=qd;function Hd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $d=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=le(),{fieldName:o,options:s={},style:d={},placeholder:u=i("qm.form.datePlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:y,disabledDate:b,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=s,w=l().createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),r?.(e),a(e,S(e))},S=e=>$r(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Hr(c()().subtract(e,"day"),Ar[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return t.isOnlyShow?l().createElement(ia,{value:S(n),bordered:m}):l().createElement(U,{ref:w,style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:Pr[g],format:y,bordered:m,showToday:!1,showTime:"datetime"===g&&{defaultValue:c()("00:00:00","HH:mm:ss")},allowClear:p,disabled:f,inputReadOnly:h,disabledDate:b??(e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[v,x])),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():l().createElement(l().Fragment,null,l().createElement(K.Tag,{color:"processing",onClick:()=>N(0)},i("qm.form.datePickers")[0]),l().createElement(K.Tag,{color:"processing",onClick:()=>N(1)},i("qm.form.datePickers")[1]),l().createElement(K.Tag,{color:"processing",onClick:()=>N(7)},i("qm.form.datePickers")[2]),l().createElement(K.Tag,{color:"processing",onClick:()=>N(30)},i("qm.form.datePickers")[3])):void 0,value:Dr(n,Ar[g]),onChange:(e,t)=>{C(Hr(e,Ar[g]))}})};class Md extends i.Component{constructor(...e){super(...e),Hd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement($d,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Hd(Md,"contextType",xn);const Kd=Md;function zd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Vd=e=>[c()().subtract(e,"day"),c()()],jd=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=le(),{fieldName:o,options:s={},style:d={},placeholder:u=i("qm.form.daterangePlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f=t.isFormDisabled}=e.option,{dateType:g="date",format:y,disableds:b=[!1,!1],allowEmpty:v,disabledDate:x,minDateTime:E,maxDateTime:w,shortCuts:S=!0}=s,N={[i("qm.form.dateRangePickers")[0]]:Vd(7),[i("qm.form.dateRangePickers")[1]]:Vd(30),[i("qm.form.dateRangePickers")[2]]:Vd(90),[i("qm.form.dateRangePickers")[3]]:Vd(180)},T=e=>$r(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?l().createElement(ia,{value:T(n),bordered:m}):l().createElement(U.RangePicker,{style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:Pr[g],format:y,bordered:m,showTime:"datetime"===g&&{defaultValue:[c()("00:00:00","HH:mm:ss"),c()("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:v,disabled:f?[!0,!0]:b,inputReadOnly:h,disabledDate:x??(e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[E,w])),ranges:S&&g.includes("date")?N:void 0,value:C(n)?null:[Dr(n?.[0],Ar[g]),Dr(n?.[1],Ar[g])],onChange:(e,t)=>{(e=>{"date"===g&&(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=[]),r?.(e),a(e,T(e))})([Hr(e?.[0],Ar[g]),Hr(e?.[1],Ar[g])])}})};class Wd extends i.Component{constructor(...e){super(...e),zd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(jd,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}zd(Wd,"contextType",xn);const Bd=Wd;function Ud(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gd=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=le(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.timePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:y=1,secondStep:b=1}=s;return t.isOnlyShow?l().createElement(ia,{value:n,bordered:u}):l().createElement(Q,{style:{width:"100%",...c},popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:y,secondStep:b,allowClear:m,disabled:h,inputReadOnly:p,format:Fr[f],value:Dr(n,Fr[f]),onChange:(e,t)=>{(e=>{const t=Hr(e,Fr[f]);r?.(t),a(t)})(e)}})};class Yd extends i.Component{constructor(...e){super(...e),Ud(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Gd,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ud(Yd,"contextType",xn);const Xd=Yd;function Qd(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Zd=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{t:i}=le(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h=t.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],allowEmpty:y,hourStep:b=1,minuteStep:v=1,secondStep:x=1}=s,E=e=>$r(e)?"":e.join(" - ");return t.isOnlyShow?l().createElement(ia,{value:E(n),bordered:u}):l().createElement(Q.RangePicker,{style:{width:"100%",...c},popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:b,minuteStep:v,secondStep:x,allowClear:m,allowEmpty:y,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Fr[f],value:C(n)?null:[Dr(n?.[0],Fr[f]),Dr(n?.[1],Fr[f])],onChange:(e,t)=>{(e=>{const t=[Hr(e?.[0],Fr[f]),Hr(e?.[1],Fr[f])];r?.(t),a(t,E(t))})(e)}})};class Jd extends i.Component{constructor(...e){super(...e),Qd(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Zd,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Qd(Jd,"contextType",xn);const eu=Jd;function tu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class nu extends i.Component{constructor(e){super(e),tu(this,"context",void 0),tu(this,"searchRef",l().createRef()),tu(this,"valueKey",void 0),tu(this,"_clicking",!1),tu(this,"_record",void 0),tu(this,"_prevValue",null),tu(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),tu(this,"getSearchHelper",vn()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),tu(this,"paramsChangeHandler",(async(e,t)=>{await this.props.waiting(),(0,h.isEqual)(e,t)||this.getItemList()})),tu(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),tu(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(r||ue("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(e)||ue("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&ue("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&ue("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),tu(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),tu(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=e=>e,dataKey:r,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(e&&!C(d))try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,h.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Kr(t,this.alias,s),c&&zr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Mr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}})),tu(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){const a=Mr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===this.valueKey&&(this._prevValue=a),r===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Mr(e,this.extras[n])})})),tu(this,"fetchHandle",(0,h.debounce)(this.getItemList,200)),tu(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),tu(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this._record)})),tu(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),tu(this,"clickHandle",((e,t)=>{const{$$form:n}=this.context,{fieldName:r}=this.props.option;for(const t in this.alias){if(t===r)continue;const a=Mr(e,this.alias[t]);n.SET_FIELDS_VALUE({[t]:a}),t===this.valueKey&&(this._prevValue=e?a:null)}for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:Mr(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Mr(e,this.alias[r]);this.triggerChange(a),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,n=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;this.paramsChangeHandler(n,t),this.echoSearchHelper()}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:n,params:r={},formatter:a=e=>e,dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(n){this.setState({loading:!0});try{const l=await n(a({...r,[t]:e}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,h.get)(l.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:t,loading:n,itemList:r,inputText:a}=this.state,{value:i}=this.props,{fieldName:s,options:c={},style:d={},placeholder:u=p("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:f=!0,readOnly:g,disabled:y}=this.props.option,{listHeight:b=Or}=c,{hideHeader:v,onlySelect:x=!0}=this.searchHelper||c,E=this.searchHelper.columns||[],w=xe("form-immediate"),C=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,S=l().createElement(K.Spin,{spinning:n},r.length?l().createElement("table",{cellSpacing:0,cellPadding:0,className:ve()("table")},!v&&l().createElement("thead",null,l().createElement("tr",null,E.filter((e=>!e.hidden)).map((e=>l().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),l().createElement("tbody",null,r.map(((e,t)=>l().createElement("tr",{key:t,className:this.state.activeIndex===t?"active":"",onMouseEnter:()=>{this.setState({activeIndex:t})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},E.filter((e=>!e.hidden)).map((t=>l().createElement("td",{key:t.dataIndex},(0,h.get)(e,t.dataIndex))))))))):l().createElement(ct,null));return l().createElement(o.Consumer,null,(n=>{const o={[w]:!0,[`${w}--lg`]:"large"===n?.size,[`${w}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(ia,{value:i,bordered:m}):l().createElement(Ai(),{action:y?[]:["click"],popupVisible:!y&&t,popup:S,popupClassName:ve()(o,`form-popper__${s}`),popupStyle:{minWidth:C,maxHeight:b},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Lr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(K.Input,{ref:this.searchRef,placeholder:u,allowClear:f,bordered:m,readOnly:g,disabled:y,style:{width:"100%",...d},value:a??i,title:i,onFocus:()=>{!r.length&&this.fetchHandle(i)},onBlur:e=>{x&&!this._clicking&&a!==i&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(r[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 n=40===e.keyCode?++t%r.length:(--t+r.length)%r.length;this.setState({activeIndex:n})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),x?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}})))}))}}tu(nu,"contextType",xn);class ru extends i.Component{constructor(e,{$$form:t}){super(e),tu(this,"context",void 0),tu(this,"promiseRef",void 0),tu(this,"state",{searchHelper:{}}),tu(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){de("Form","搜索帮助获取定义信息的接口出错")}})),tu(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return ue("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:n});if(200===l.code){const n=Gr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(r),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":I(c)},required:e.getFormItemRequired(h)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(nu,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(i,t)}}))),m&&l().createElement(K.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(K.Col,{flex:I(u.labelWidth||Tr)},e.renderFormItemExtra({fieldName:i,...u}))))}}tu(ru,"contextType",xn);const au=ru;function iu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class lu extends i.Component{constructor(...e){super(...e),iu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,fieldName:r,className:a,style:i={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=b}=o,m=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===r))??[],n=c??t.length-1;t.slice(n+1).forEach((t=>{const n=d.find((e=>e.fieldName===t.fieldName));if(!n)return;const r=n.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&m.push({...t,text:`${r}${a}`})}))}return l().createElement(K.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},l().createElement(Ce,{id:r,label:n,className:a,extra:m.map((e=>e.text)).join(" | "),style:{...i},collapse:s[r],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[r]:t})}))),u(t)}}))}}iu(lu,"contextType",xn);const ou=lu;function su(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cu(){return cu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cu.apply(null,arguments)}const du=(e,t,n,r)=>e.map((e=>e[n]===t?{...e,children:r}:e.children?{...e,children:du(e.children,t,n,r)}:e)),uu=e=>{const{$$form:t}=l().useContext(xn),{value:n,items:r,multiple:a,loading:i,onChange:o,onValuesChange:s}=e,{t:c}=le(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,asyncLoad:y,readOnly:b,disabled:v}=e.option,{itemList:x,filterable:w=!0,listHeight:S=Or,checkStrictly:N,checkStrategy:T="SHOW_CHILD",collapseTags:I,echoRequest:R,defaultExpandAll:O=!y,defaultExpandedKeys:k,dropdownStyle:L,openPyt:P=!0}=u,[A,F]=l().useState(C(x)?r:x),[_,q]=l().useState([]),[D,H]=l().useState(!1),[$,M]=l().useState(!1),z=l().useRef(null),V=l().useRef(null),j=l().useRef(A),W=l().useRef($),B=l().useRef(null),U=e=>{M(e),W.current=e};uo({ref:V,handler:()=>U(!1)}),l().useEffect((()=>{n!==B.current&&(X(),B.current=n),V.current=z.current?.querySelector(".ant-select-selection-overflow-item-rest")||null}),[n]),qe((()=>{const e=C(x)?r:x;y?(0,h.isEqual)(e,j.current)||(F((t=>[...e,...t.filter((e=>!!e.style))])),j.current=e):F(e)}),[x,r]),qe((()=>{F((e=>[...e,..._.filter((t=>!e.some((e=>e.value===t.value))))]))}),[_]);const G=e=>jr(A,e)?.text||e?.toString()||"",Y=e=>(N&&Array.isArray(n)&&n.every((e=>(0,h.isPlainObject)(e)))&&(e=e.map((e=>e.value))),a?e?.map((e=>G(e))).join(",")||"":G(e)),X=async()=>{if(!R)return;if(!y)return ue("Form","TREE_SELECT 的 echoRequest 选项必须组合 `asyncLoad` 一起使用");const{fetchApi:e,params:t,dataKey:r,callback:a,formatter:i=e=>e}=R||{},{textKey:l="text",valueKey:o="value"}=y;if(e&&!C(n))try{const s=await e(i({...t,[o]:n}));if(200===s.code){const e=Array.isArray(s.data)?s.data:(0,h.get)(s.data,r)??[];if(e.length){const t=Vr(e,o,l);q(t.map((e=>({...e,style:{display:"none"}})))),a?.(e)}}}catch(e){}};return t.isOnlyShow?l().createElement(ia,{value:Y(n),bordered:f}):l().createElement(Ai(),{popupVisible:!v&&$,popup:(()=>{if(!a)return null;const e=n?.map((e=>G(e)))||[];return l().createElement("ul",{className:"ant-dropdown-menu"},e.length?e.map(((e,t)=>l().createElement("li",{key:`${e}-${t}`,className:"ant-dropdown-menu-item"},e))):l().createElement("li",{className:"ant-dropdown-menu-item"},c("qm.table.config.emptyText")))})(),popupStyle:{minWidth:z.current?.offsetWidth},onPopupVisibleChange:e=>U(e),builtinPlacements:Lr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",{ref:z,style:{width:"100%"}},l().createElement(K.TreeSelect,cu({open:D,fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:a,treeCheckable:a,treeCheckStrictly:N,showCheckedStrategy:K.TreeSelect[T],popupClassName:`form-popper__${d}`,dropdownStyle:L,placeholder:p,listHeight:S,style:m,loading:i,bordered:f,allowClear:g,disabled:v,treeDefaultExpandAll:O,treeDefaultExpandedKeys:k,showSearch:w,maxTagCount:I?"responsive":void 0,loadData:y?async({key:e,children:t})=>{if(!y||t)return;const{fetchApi:n,params:r,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=e=>e}=y;if(n)try{const t=await n(s({...r,[l]:e}));if(200===t.code){const n=Array.isArray(t.data)?t.data:(0,h.get)(t.data,a)??[],r=du(A,e,l,Vr(n,l,i));F(r),o?.(n)}}catch(e){}}:void 0,treeData:A},a?{title:Y(n)}:null,{filterTreeNode:(e,t)=>{const n=t?.text?.toString()||"",r=ra.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(P?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onMouseDown:e=>{e.target.classList.contains("ant-select-selection-overflow-item-rest")&&(U(!0),H(!1))},onDropdownVisibleChange:e=>{if(!e)return H(e);E((()=>{W.current||H(e)}))},onChange:e=>{(e=>{o?.(e),s(e,Y(e),A)})(e),B.current=e}}))))};class mu extends i.Component{constructor(...e){super(...e),su(this,"context",void 0),su(this,"state",{itemList:[],loading:!1}),su(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,h.get)(e.data,r)??[],n=Vr(t,a,i);this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,h.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:n}=this.state,{type:r,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(a),className:ve()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":I(d)},required:e.getFormItemRequired(h)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(uu,{option:this.props.option,items:t,loading:n,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&l().createElement(K.Col,{flex:I(m.labelWidth||Tr)},e.renderFormItemExtra({fieldName:o,...m}))))}}su(mu,"contextType",xn);const pu=mu;function hu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fu(){return fu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fu.apply(null,arguments)}const gu=e=>{const{$$form:t}=l().useContext(xn),{value:n,multiple:r,items:a}=e,{t:i}=le(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,asyncLoad:p,readOnly:f,disabled:g}=e.option,{itemList:y,changeOnSelect:b,checkStrictly:v,checkStrategy:x="SHOW_PARENT",filterable:E=!0,dropdownStyle:w,openPyt:S=!0}=s,[N,T]=l().useState(C(y)?a:y),I=l().useRef(N);qe((()=>{const e=C(y)?a:y;p?(0,h.isEqual)(e,I.current)||(T(e),I.current=e):T(e)}),[y,a]);const R=e=>Wr(N,e??"").map((e=>e.text)).join("/"),O=e=>r?e?.map((e=>R(e))).join(",")||"":R(e);return t.isOnlyShow?l().createElement(ia,{value:O(n),bordered:u}):l().createElement(K.Cascader,fu({value:(e=>C(e)?[]:r?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:N,multiple:r,maxTagCount:"responsive",changeOnSelect:b||v,showCheckedStrategy:K.Cascader[x],popupClassName:`form-popper__${o}`,dropdownStyle:w,placeholder:d,style:c,bordered:u,allowClear:m,disabled:g,showSearch:E&&!p&&{filter:(e,t)=>t.some((t=>{const n=t?.text?.toString()||"",r=ra.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(S?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?async e=>{const t=e[e.length-1];if(!p||t.children)return;const{fetchApi:n,params:r,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=e=>e}=p;if(n)try{const e=await n(s({...r,[l]:t.value}));if(200===e.code){const n=Array.isArray(e.data)?e.data:(0,h.get)(e.data,a)??[],r=du(N,t.value,l,Vr(n,l,i));T(r),o?.(n)}}catch(e){}}:void 0},r?{title:O(n)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;n?.(t),r(t,O(t),N)})(((e=[])=>r?e.map((e=>e.join(","))):e.join(","))(t))}}))};class yu extends i.Component{constructor(...e){super(...e),hu(this,"context",void 0),hu(this,"state",{itemList:[],loading:!1}),hu(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,h.get)(e.data,r)??[],n=Vr(t,a,i);this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,h.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:n}=this.state,{type:r,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(a),className:ve()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":I(d)},required:e.getFormItemRequired(h)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(gu,{option:this.props.option,multiple:t,items:n,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&l().createElement(K.Col,{flex:I(m.labelWidth||Tr)},e.renderFormItemExtra({fieldName:o,...m}))))}}hu(yu,"contextType",xn);const bu=yu,vu=require("china-area-data");var xu=r.n(vu);function Eu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const wu=["110000","120000","310000","500000"],Cu=["810000","820000"],Su=[{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"}],Nu=[{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"}],Tu=e=>ra.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Iu=(e,t,n=1)=>{if(!(n>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...wu,...Cu].includes(e))):Object.keys(e[t])).map((r=>({l:Tu(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:Iu(e,r,n+1)})))},Ru=(e,t)=>t.map((t=>({l:Tu(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Ou extends i.Component{constructor(e){super(e),Eu(this,"context",void 0),Eu(this,"searchRef",l().createRef()),Eu(this,"scrollRef",l().createRef()),Eu(this,"zxsAndGa",void 0),Eu(this,"provinces",void 0),Eu(this,"allCities",void 0),Eu(this,"letterCities",void 0),Eu(this,"state",{visible:!1,select_type:"0",active_key:""}),Eu(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Eu(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(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}),Yt()(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:Ru(xu(),wu)},{l:"Z2",n:"港澳",c:"",p:"",children:Ru(xu(),Cu)}]}createProvince(){return(Iu(xu(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Nu.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...wu,...Cu].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return l().createElement(K.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}))}},l().createElement(K.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),l().createElement(K.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:t}=this.state;return("0"===t?Su:Nu).map((t=>l().createElement("li",{key:t.value,className:ve()({tag:!0,actived:t.value===e}),onClick:()=>this.scrollHandle(t.value.toString())},t.text)))}renderSelect(){const{value:e}=this.props;return l().createElement(K.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=>l().createElement(K.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:t}=this.state;return("0"===t?this.provinces:this.letterCities).map(((t,n)=>l().createElement("div",{key:n},l().createElement("dt",{ref:e=>this[`${t.l}Ref`]=e},t.n,":"),l().createElement("dd",null,t.children?.map((t=>l().createElement("li",{key:t.c,className:ve()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:n}=this.props,{fieldName:r,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=xe("form-city-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(n),y=l().createElement("div",{className:"container",style:{...i}},l().createElement("div",{className:"city-drop"},l().createElement("div",{className:"city-drop-toper"},l().createElement("div",{className:"city-drop-toper__type"},this.renderType()),l().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),l().createElement("div",{className:"city-drop-letter"},this.renderLetter()),l().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},l().createElement("dl",null,this.renderCity(n)))));return l().createElement(o.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(ia,{value:g,bordered:c}):l().createElement(Ai(),{action:m?[]:["click"],popupVisible:!m&&t,popup:y,popupClassName:ve()(a,`form-popper__${r}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Lr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(K.Input,{ref:this.searchRef,placeholder:s,allowClear:d,bordered:c,readOnly:u,disabled:m,style:{width:"100%",...i},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Eu(Ou,"contextType",xn);class ku extends i.Component{constructor(...e){super(...e),Eu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Ou,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(a,n)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Eu(ku,"contextType",xn);const Lu=ku;function Pu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Au=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Au(e,n)})))};class Fu extends i.Component{constructor(e){super(e),Pu(this,"context",void 0),Pu(this,"searchRef",l().createRef()),Pu(this,"prevText",void 0),Pu(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Pu(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Au(xu(),"86")||[];this.state={results:t,visible:!1,values:[],tabs:[t.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.state.values.join(",")!==(n??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}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 n=this.state.tabs.slice(0,1);for(let r=0;r<t.length;r++){const a=jr(e,t[r]);if(a&&C(a.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(a?.children)&&(n[r+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:n,formatter:r=e=>e,dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(n)try{const t=await n(r({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,h.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,t=this.state.tabs.map(((t,n)=>{const r=t.find((t=>t.value===e[n]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return l().createElement(on.TabPane,{key:n.toString(),tab:r},l().createElement("div",{className:"region-box"},t.map((t=>l().createElement("span",{key:t.value,className:ve()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[n]=t.value.toString(),e=e.slice(0,n+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},t.text)))))}));return t.length?l().createElement(on,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):l().createElement(ct,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:n}=this.props,{fieldName:r,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=xe("form-region-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=l().createElement("div",{className:"container"},this.renderTabs());let y=this.prevText;if(!t){const e=this.createTextValue(n);(""===e||e.split("/").every((e=>""!==e)))&&(y=e,this.prevText=y)}return l().createElement(o.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(ia,{value:y,bordered:c}):l().createElement(Ai(),{action:m?[]:["click"],popupVisible:!m&&t,popup:g,popupClassName:ve()(a,`form-popper__${r}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Lr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(K.Input,{ref:this.searchRef,placeholder:s,allowClear:d,bordered:c,style:{width:"100%",...i},readOnly:u,disabled:m,value:y,title:y,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&E((()=>this.initial()))}})))}))}}Pu(Fu,"contextType",xn);class _u extends i.Component{constructor(...e){super(...e),Pu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Fu,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(a,n)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Pu(_u,"contextType",xn);const qu=_u,Du=zt;function Hu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $u=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{options:i={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:p,draggable:f,editable:g,batchDownload:y,fileDirection:b,onPreview:v,onDownload:x,onRemove:E,onSortChange:w,onEditChange:C}=i,{action:S,headers:N,params:T,withCredentials:I=!1,dataKey:R="",downloadWithHeaders:O,fieldAliasMap:k,beforeUpload:L,button:P}=o,A="function"==typeof k?k():k||{},{t:F}=le();return l().createElement(Du,{name:"file",action:S,multiple:d,headers:N,data:T,withCredentials:I,downloadWithHeaders:O,beforeUpload:L,maxCount:u,fileTypes:m,fileSize:p,draggable:f,editable:g,batchDownload:y,fileDirection:b,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,button:P,showUploadList:{showDownloadIcon:!0,downloadIcon:l().createElement(Ee.DownloadOutlined,null)},fileList:n,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},n={};for(const r in A)n[r]=e[r]||t.data?.[A[r]]||"";return e.response&&200!==t.code&&K.message.error(t.message||F("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...n,url:e.url||(R?(0,h.get)(t.data,R):t.data)||"",status:e.status}}));r?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onPreview:v,onDownload:x,onRemove:E,onSortChange:w,onEditChange:C})};class Mu extends i.Component{constructor(...e){super(...e),Hu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement($u,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Hu(Mu,"contextType",xn);const Ku=Mu,zu=require("cropperjs");var Vu=r.n(zu);const ju=l().forwardRef(((e,t)=>{const n=R({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},e),{className:r,style:a,src:i,alt:o,imgStyle:s,...c}=n,d=l().useRef(null),u=l().useRef(null);l().useEffect((()=>{const e={};for(const t in c)void 0!==n[t]&&(e[t]=n[t]);return u.current=new(Vu())(d.current,e),()=>{b(),u.current=null}}),[]);const m=()=>u.current?.reset(),p=()=>u.current?.clear(),h=()=>u.current?.crop(),f=(e,t=!1)=>u.current?.replace(e,t),g=()=>u.current?.enable(),y=()=>u.current?.disable(),b=()=>u.current?.destroy(),v=(e,t)=>u.current?.move(e,t),x=(e,t=e)=>u.current?.moveTo(e,t),E=(e,t)=>u.current?.zoom(e),w=(e,t)=>u.current?.zoomTo(e,t),C=e=>u.current?.rotate(e),S=e=>u.current?.rotateTo(e),N=e=>u.current?.scaleX(e),T=e=>u.current?.scaleY(e),I=(e,t=e)=>u.current?.scale(e,t),O=(e=!1)=>u.current?.getData(e),k=e=>u.current?.setData(e),L=()=>u.current?.getContainerData(),P=()=>u.current?.getImageData(),A=()=>u.current?.getCanvasData(),F=e=>u.current?.setCanvasData(e),_=()=>u.current?.getCropBoxData(),q=e=>u.current?.setCropBoxData(e),D=(e={})=>u.current?.getCroppedCanvas(e),H=e=>u.current?.setAspectRatio(e),$=e=>u.current?.setDragMode(e);l().useImperativeHandle(t,(()=>({reset:m,clear:p,initCrop:h,replace:f,enable:g,disable:y,destroy:b,move:v,moveTo:x,relativeZoom:E,zoomTo:w,rotate:C,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:O,setData:k,getContainerData:L,getImageData:P,getCanvasData:A,setCanvasData:F,getCropBoxData:_,setCropBoxData:q,getCroppedCanvas:D,setAspectRatio:H,setDragMode:$})));const M=xe("cropper"),K={[M]:!0};return l().createElement("div",{className:ve()(K,r),style:a},l().createElement("img",{ref:d,src:i,alt:o,style:{maxWidth:"100%",...s}}))}));ju.displayName="Cropper";const Wu=ju,Bu=e=>{const{fileTypes:t=[],fileSize:n,fixedSize:r,quality:a,beforeCrop:i,className:o}=e,{t:s}=le(),c=l().useRef(null),d=l().useRef(),u=l().useRef(),m=l().useRef(),p=l().useRef(),[h,f]=l().useState(""),g=e=>{c.current.relativeZoom(e)},y=e=>{c.current.rotate(e)},b=()=>{f("")},v=xe("cropper-preview");return l().createElement(l().Fragment,null,(()=>{const t=Array.isArray(e.children)?e.children[0]:e.children;if(!t)return null;const{beforeUpload:n,...r}=t.props;return d.current=n,l().createElement(t.type,{...r,beforeUpload:(e,t)=>new Promise((async(n,r)=>{const a=()=>n(K.Upload.LIST_IGNORE);if(i&&!await i(e,t))return void a();u.current=e,m.current=n,p.current=a;const l=new FileReader;l.onload=()=>{f(l.result),l.onload=null},l.readAsDataURL(e)}))})})(),h&&l().createElement(K.Modal,{open:!0,wrapClassName:ve()(v,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{(async()=>{const{type:e,name:n,uid:r}=u.current;c.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===e?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async a=>{let i=new File([a],n,{type:e});if(Object.assign(i,{uid:r}),t.length&&!t.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return K.message.warning(s("qm.upload.tooltip",{type:t.join(",")})),p.current("file type is error");if("function"!=typeof d.current)return m.current(i);const l=d.current(i,[i]);if("boolean"==typeof l||l){if(!0===l)return m.current(i);if(!1===l)return p.current("not upload");if(l&&"function"==typeof l.then)try{const e=await l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),m.current(i)}catch(e){p.current(e)}}else ue("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),e,a),await x(100),b()})()},onCancel:b,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:r?`calc(380px * ${r[1]/r[0]})`:"auto"};return l().createElement("div",{className:"cropper-preview"},l().createElement("div",{className:"cropper-area"},l().createElement("div",{className:"img-cropper"},l().createElement(Wu,{ref:c,aspectRatio:r?r[0]/r[1]:r,src:h,dragMode:"move",preview:".preview"})),l().createElement("div",{className:"actions"},l().createElement(K.Space,{size:"small"},l().createElement(K.Button,{type:"primary",size:"middle",icon:l().createElement(Ee.ZoomInOutlined,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),l().createElement(K.Button,{type:"primary",size:"middle",icon:l().createElement(Ee.ZoomOutOutlined,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),l().createElement(K.Button,{type:"primary",size:"middle",icon:l().createElement(Ee.RotateRightOutlined,null),onClick:()=>y(90)},s("qm.uploadCropper.rotatePlus")),l().createElement(K.Button,{type:"primary",size:"middle",icon:l().createElement(Ee.RotateLeftOutlined,null),onClick:()=>y(-90)},s("qm.uploadCropper.rotateSubtract"))))),l().createElement("div",{className:"preview-area"},l().createElement("div",{className:"preview",style:e})))})()))};function Uu(){return Uu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uu.apply(null,arguments)}const Gu=e=>{const t=R({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:n=[],openCropper:r=!0,fixedSize:a,quality:i=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:m,className:p,popupClassName:h,beforeCrop:f,onSortChange:g,onChange:y}=t,{t:b}=le(),{$size:v}=se(t),x=l().useRef(null),E=l().useRef(null),w=l().useRef(!1),[C,S]=l().useState(!1),[T,I]=l().useState(0),O=l().useMemo((()=>u||m),[u,m]),k=l().useMemo((()=>!c||n.length<c),[n,c]);l().useEffect((()=>(P(),document.addEventListener("paste",F),()=>{E.current?.destroy(),document.removeEventListener("paste",F)})),[]),qe((()=>{k||(w.current=!1)}),[n]);const L=oe((e=>{const{oldIndex:t,newIndex:r}=e;if(t!==r){const e=[...n],[a]=e.splice(t,1);e.splice(r,0,a),g?.(e),y?.({file:n[t],fileList:e})}})),P=()=>{d&&(E.current=_t().create(We(x.current,xe("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:L}))},A=(e,n)=>new Promise((async(r,a)=>{const{fileTypes:i=[],fileSize:l,beforeUpload:o}=t,s=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!l||e.size/1024/1024<l,d=s&&c;if(s||K.message.warning(b("qm.upload.tooltip",{type:i.join(",")})),c||K.message.warning(b("qm.upload.sizeLimit",{size:l})),!d)return K.Upload.LIST_IGNORE;if(o){const t=o(e,n);if(!0===t)return r(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{r(await t)}catch(e){a(e)}}else r(e)})),F=oe((async e=>{const{action:r,data:a,headers:i}=t;if(w.current&&k&&r)for(const t of e.clipboardData.items)if("file"===t.kind&&t.type.startsWith("image/")){const e=t.getAsFile(),l=Date.now(),o=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${l}`});try{await A(o,[...n,o]);const e=new FormData;if(e.append("file",o),a)for(const t in a)e.append(t,a[t]);const t="string"==typeof r?r:await r(o),l=await fetch(t,{method:"POST",body:e,headers:i});if(!l.ok)throw new Error(b("qm.upload.uploadError"));const s=await l.json();y?.({file:o,fileList:[...n,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})),_=xe("upload-img"),q={[_]:!0,[`${_}--lg`]:"large"===v,[`${_}--sm`]:"small"===v},D=l().createElement(K.Upload,Uu({className:ve()(q,p)},N(t,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:A,disabled:O,onPreview:e=>{const t=n.findIndex((t=>t.url===e.url));t<0||(I(t),S(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,n,r)=>l().createElement("div",{className:ve()("upload-item",{handle:d})},e,!O&&l().createElement(Ee.CloseOutlined,{title:b("qm.upload.remove"),className:"icon",onClick:()=>r.remove()}))}),l().createElement("span",{className:"inner",ref:x},k&&!(m&&n.length)&&l().createElement(l().Fragment,null,l().createElement("p",{className:"ant-upload-drag-icon"},l().createElement(Ee.InboxOutlined,null)),l().createElement("p",{className:"ant-upload-text"},b("qm.uploadCropper.dragableText")),l().createElement("button",{className:ve()("ant-upload-button",{disabled:O}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},b("qm.uploadCropper.pasteText")))));return l().createElement(l().Fragment,null,r?l().createElement(Bu,{className:h,fixedSize:a,quality:i,fileTypes:o,fileSize:s,beforeCrop:f},D):D,l().createElement("div",{style:{display:"none"}},l().createElement(K.Image.PreviewGroup,{key:n.map((e=>e.uid||"")).join(","),preview:{visible:C,current:T,rootClassName:h,onVisibleChange:e=>S(e)}},n.map(((e,t)=>l().createElement(K.Image,{key:e.uid||t,src:e.url,alt:""}))))))};Gu.displayName="QmUploadImg";const Yu=Gu;function Xu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qu=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{options:i={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:p,openCropper:f,fileTypes:g,fileSize:y,draggable:b,onRemove:v,onSortChange:x}=i,{action:E,headers:w,params:C,withCredentials:S=!1,dataKey:N="",popupClassName:T,fieldAliasMap:I,beforeUpload:R}=o,O="function"==typeof I?I():I||{},{t:k}=le();return l().createElement(Yu,{name:"file",action:E,multiple:d,headers:w,data:C,withCredentials:S,popupClassName:T,beforeUpload:R,maxCount:u,fixedSize:m,quality:p,openCropper:f,fileTypes:g,fileSize:y,draggable:b,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,fileList:n,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},n={};for(const r in O)n[r]=e[r]||t.data?.[O[r]]||"";return e.response&&200!==t.code&&K.message.error(t.message||k("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...n,url:e.url||(N?(0,h.get)(t.data,N):t.data)||"",status:e.status}}));r?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onRemove:v,onSortChange:x})};class Zu extends i.Component{constructor(...e){super(...e),Xu(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Qu,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Xu(Zu,"contextType",xn);const Ju=Zu,em={onActivate:Cr.func,onAddUndo:Cr.func,onBeforeAddUndo:Cr.func,onBeforeExecCommand:Cr.func,onBeforeGetContent:Cr.func,onBeforeRenderUI:Cr.func,onBeforeSetContent:Cr.func,onBeforePaste:Cr.func,onBlur:Cr.func,onChange:Cr.func,onClearUndos:Cr.func,onClick:Cr.func,onContextMenu:Cr.func,onCommentChange:Cr.func,onCopy:Cr.func,onCut:Cr.func,onDblclick:Cr.func,onDeactivate:Cr.func,onDirty:Cr.func,onDrag:Cr.func,onDragDrop:Cr.func,onDragEnd:Cr.func,onDragGesture:Cr.func,onDragOver:Cr.func,onDrop:Cr.func,onExecCommand:Cr.func,onFocus:Cr.func,onFocusIn:Cr.func,onFocusOut:Cr.func,onGetContent:Cr.func,onHide:Cr.func,onInit:Cr.func,onKeyDown:Cr.func,onKeyPress:Cr.func,onKeyUp:Cr.func,onLoadContent:Cr.func,onMouseDown:Cr.func,onMouseEnter:Cr.func,onMouseLeave:Cr.func,onMouseMove:Cr.func,onMouseOut:Cr.func,onMouseOver:Cr.func,onMouseUp:Cr.func,onNodeChange:Cr.func,onObjectResizeStart:Cr.func,onObjectResized:Cr.func,onObjectSelected:Cr.func,onPaste:Cr.func,onPostProcess:Cr.func,onPostRender:Cr.func,onPreProcess:Cr.func,onProgressState:Cr.func,onRedo:Cr.func,onRemove:Cr.func,onReset:Cr.func,onSaveContent:Cr.func,onSelectionChange:Cr.func,onSetAttrib:Cr.func,onSetContent:Cr.func,onShow:Cr.func,onSubmit:Cr.func,onUndo:Cr.func,onVisualAid:Cr.func,onSkinLoadError:Cr.func,onThemeLoadError:Cr.func,onModelLoadError:Cr.func,onPluginLoadError:Cr.func,onIconsLoadError:Cr.func,onLanguageLoadError:Cr.func},tm={apiKey:Cr.string,id:Cr.string,inline:Cr.bool,init:Cr.object,initialValue:Cr.string,onEditorChange:Cr.func,value:Cr.string,tagName:Cr.string,cloudChannel:Cr.string,plugins:Cr.oneOfType([Cr.string,Cr.array]),toolbar:Cr.oneOfType([Cr.string,Cr.array]),disabled:Cr.bool,textareaName:Cr.string,tinymceScriptSrc:Cr.string,rollback:Cr.oneOfType([Cr.number,Cr.oneOf([!1])]),scriptLoading:Cr.shape({async:Cr.bool,defer:Cr.bool,delay:Cr.number}),...em},nm=e=>"function"==typeof e,rm=e=>e in em,am=e=>e.substr(2),im=(e,t,n,r,a)=>((t,n,r,a,i,l,o)=>{const s=Object.keys(i).filter(rm),c=Object.keys(l).filter(rm),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=am(e),n=o[t];r(t,n),delete o[t]})),u.forEach((r=>{const a=((t,n)=>r=>t(n)?.(r,e))(t,r),i=am(r);o[i]=a,n(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,n,r);let lm=0;const om=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return lm++,e+"_"+n+lm+String(t)},sm=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),cm=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),dm=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},um=()=>({listeners:[],scriptId:om("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),mm=(()=>{let e=um();return{load:(t,n,r,a,i,l)=>{const o=()=>((t,n,r,a,i)=>{const l=n.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=t,l.src=r,l.async=a,l.defer=i;const o=()=>{l.removeEventListener("load",o),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};l.addEventListener("load",o),n.head&&n.head.appendChild(l)})(e.scriptId,t,n,r,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=um()}}})(),pm=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function hm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class fm extends i.Component{constructor(e){super(e),hm(this,"editor",void 0),hm(this,"id",void 0),hm(this,"elementRef",void 0),hm(this,"inline",void 0),hm(this,"currentContent",void 0),hm(this,"boundHandlers",void 0),hm(this,"rollbackTimer",void 0),hm(this,"valueCursor",void 0),hm(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})),hm(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){}})),hm(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),hm(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))}})),hm(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),hm(this,"initialise",((e=0)=>{const t=this.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,n=e.parentNode;for(;null!=n;)t=n,n=t.parentNode;return t===e.ownerDocument}return e.isConnected})(t)){if(0===e)setTimeout((()=>this.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>this.initialise(e+1)),100)}return}const n=pm(this.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const r={...this.props.init,selector:void 0,target:t,readonly:this.props.disabled,inline:this.inline,plugins:(a=this.props.init?.plugins,i=this.props.plugins,cm(a).concat(cm(i))),toolbar:this.props.toolbar??this.props.init?.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!sm(t)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&nm(this.props.init.setup)&&this.props.init.setup(e)},init_instance_callback:e=>{const t=this.getInitialValue();this.currentContent=this.currentContent??e.getContent(),this.currentContent!==t&&(this.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=this.props.disabled??!1;dm(this.editor,n?"readonly":"design"),this.props.init&&nm(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}};var a,i;this.inline||(t.style.visibility=""),sm(t)&&(t.value=this.getInitialValue()),n.init(r)})),this.id=this.props.id||om("tiny-react"),this.elementRef=i.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 n=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const r of[t,n])if(r)try{e.selection.moveToBookmark(r),this.valueCursor=r;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;dm(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==pm(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&mm.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=pm(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:e="div"}=this.props;return i.createElement(e,{ref:this.elementRef,id:this.id})}renderIframe(){return i.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){im(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,n=t(e),r=t(this.props);!n&&r?(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)):n&&!r&&(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))}}}hm(fm,"propTypes",tm),hm(fm,"defaultProps",{cloudChannel:"6"});var gm=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(gm||{});const ym=e=>{const{className:t,style:n,tinymce:r={},upload:a={},thresholdSize:i=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:m}=e,{global:p}=l().useContext(o),{$size:f}=se(e),{$locale:g,t:y}=le(),b={height:r.height||400,plugins:r.plugins||"preview importcss searchreplace autolink save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons",toolbar:r.toolbar||"undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl",menubar:r.menubar||"file edit view insert format tools table help",font_family_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",font_size_formats:"10px 12px 14px 16px 18px 20px 24px 36px 48px 56px 72px",language:gm[g],skin:"tinymce-5",...N(r,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>{const{action:t,headers:n,dataKey:r,customHandler:l}=a;return l?l(e):new Promise((async(a,l)=>{const o=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(t&&c/1024/1024>i)try{const e=await fetch(t,{method:"POST",body:s,headers:n});if(!e.ok)throw l(""),new Error(y("qm.upload.uploadError"));const i=await e.json();200===i.code&&a(r?(0,h.get)(i.data,r):i.data)}catch(e){K.message.error(y("qm.uploadCropper.uploadError"))}else a(o)}))},setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;u?.({width:n,height:r},t)}))}},v=xe("tinymce"),x={[v]:!0,[`${v}--lg`]:"large"===f,[`${v}--sm`]:"small"===f},E={init:b,value:d,disabled:c,tinymceScriptSrc:s||p?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{m?.(t.getContent(),t)}};return l().createElement("div",{className:ve()(x,t),style:n},l().createElement(fm,E))};ym.displayName="QmTinymce";const bm=ym;function vm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xm=e=>{const{$$form:t}=l().useContext(xn),{value:n,onChange:r,onValuesChange:a}=e,{options:i={},upload:o,style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{tinymce:u,thresholdSize:m,onResizeEditor:p}=i;return l().createElement(bm,{value:n,tinymce:u,upload:o,thresholdSize:m,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:p,onChange:e=>{(e=>{r?.(e),a(e)})(e)}})};class Em extends i.Component{constructor(...e){super(...e),vm(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=b}=this.props.option;return l().createElement(K.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":I(s)},required:e.getFormItemRequired(m)},l().createElement(K.Row,{wrap:!1,gutter:4},l().createElement(K.Col,{flex:"auto"},l().createElement(K.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(xm,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(K.Col,{flex:I(d.labelWidth||Tr)},e.renderFormItemExtra({fieldName:a,...d}))))}}vm(Em,"contextType",xn);const wm=Em;function Cm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Sm extends i.Component{constructor(e){super(e),Cm(this,"context",void 0),Cm(this,"provide",{$$form:this,echo_data:{}}),Cm(this,"_initialValues",void 0),Cm(this,"_initialOthers",void 0),Cm(this,"_initialExtras",void 0),Cm(this,"_fieldAuth",{}),Cm(this,"wrapperRef",l().createRef()),Cm(this,"formRef",l().createRef()),Cm(this,"originItems",[]),Cm(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Cm(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})})),Cm(this,"resizeListenerHandle",(0,h.debounce)(this.resizeObserveHandler,10)),Cm(this,"getFormItems",vn()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Cm(this,"getFlattenItems",vn()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,h.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),Cm(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Cm(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Cm(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Cm(this,"finishFailedHandle",(({values:e,errorFields:t})=>{this.props.onFinishFailed?.(t)})),Cm(this,"openValidateInfo",(e=>{const t=l().createElement("ul",null,e.map((e=>{const{label:t}=this.formItems.find((t=>t.fieldName===e.name[0]));return l().createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof t?`${t}: `:"")+e.errors.join(","),"]")})));K.notification.error({message:p("qm.form.validatePrompt"),description:t,duration:10})})),Cm(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Yt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){yt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){bt(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&&ue("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(e=[]){return e.some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return Object.assign({},n)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,h.isPlainObject)(e.extra))).forEach((n=>{t[n.fieldName]=e[n.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,h.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:n,options:r}=e;return t=t??void 0,kr.includes(n)&&(t=t??[]),"CHECKBOX"!==n&&"SWITCH"!==n||(t=t??r?.falseValue??Rr),t}createFormValue(e){const t={};return this.flattenItems.forEach((n=>{t[n.fieldName]=this.getInitialValue(n,e[n.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)}createOriginItems(){this.originItems=this.props.items.map((e=>({fieldName:e.fieldName,hidden:e.hidden})))}getOriginItems(){return this.originItems}setViewValue(e,t=""){t!==this.getViewValue(e)&&this.setState((n=>({viewData:Object.assign({},n.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){e!==this.state.collapse&&this.setState({collapse:e},(()=>{E((()=>this.props.onCollapse?.(e)))}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:n}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!n||setTimeout((()=>this.CREATE_FOCUS(n)))}getFormItemLabel(e){if(Br(e))return Ur(e);if((0,h.isPlainObject)(e)){const{fieldName:t,label:n,options:r={}}=e;if(Br(n))return Ur(n);const{itemList:a=[]}=r,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,n=this.dividers.length;t<n;t++){const n=this.formItems.findIndex((e=>e===this.dividers[t]));let r=this.formItems.findIndex((e=>e===this.dividers[t+1]));r=r>-1?r:void 0,e.push(this.formItems.slice(n,r).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){if("DIVIDER"===e)return!0;const n=this.getBlockDerivedItems();for(let e=0,r=n.length;e<r;e++){const r=n[e],a=this.dividers.find((e=>e.fieldName===r[0].fieldName)),i=a?.collapse?.showLimit??r.length-1;for(let e=1;e<r.length;e++)if(r[e].fieldName===t&&e>i)return this.state.expand[r[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const n=e[t];if($r(n)&&(e[t]=""),Array.isArray(n)&&n.forEach(((n,r)=>{$r(n)&&(e[t][r]="")})),t.includes("|")&&Array.isArray(n)){const[r,a]=t.split("|");e[r]=n[0]??"",e[a]=n[1]??""}}if(this.isFilterType)for(const t in e)C(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=N(e,["fetch"]);if(e.fetch){const{api:n,params:r,dataKey:a}=e.fetch;try{const e=await n(r);200===e.code&&(t=(a?(0,h.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:n}=e,r=t.fieldList.find((e=>e.dataIndex===n));if(r){const t=this.originItems.find((e=>e.fieldName===n)),{visible:a=1,disabled:i,secretName:l}=r;a||(e.noAuth=!0,t.noAuth=!0),i&&(e.disabled=!0,t.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},t.options=Object.assign({},t.options,{secretType:l})),this.setFieldAuth(n,{visible:a,disabled:i,secretName:l})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return l().createElement(wa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return l().createElement(Ta,{option:e})}INPUT_NUMBER(e){return l().createElement(Pa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return l().createElement(qa,{option:e})}SEARCH_HELPER(e){return l().createElement(_c,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return l().createElement(jc,{option:e})}TREE_TABLE_HELPER(e){return l().createElement(td,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return l().createElement(od,{option:e})}RANGE_SEARCH_HELPER(e){return l().createElement(yd,{option:e})}CHECKBOX(e){return l().createElement(fa,{option:e})}MULTIPLE_CHECKBOX(e){return l().createElement(Ed,{option:e})}RATE(e){return l().createElement(Nd,{option:e})}RADIO(e){return l().createElement(Od,{option:e})}SWITCH(e){return l().createElement(Ad,{option:e})}TEXT_AREA(e){return l().createElement(Dd,{option:e})}DATE(e){return l().createElement(Kd,{option:e})}RANGE_DATE(e){return l().createElement(Bd,{option:e})}TIME(e){return l().createElement(Xd,{option:e})}RANGE_TIME(e){return l().createElement(eu,{option:e})}SELECT(e){return l().createElement(ua,{option:e})}MULTIPLE_SELECT(e){return l().createElement(ua,{option:e,multiple:!0})}IMMEDIATE(e){return l().createElement(au,{option:e})}DIVIDER(e){return l().createElement(ou,{option:e})}TREE_SELECT(e){return l().createElement(pu,{option:e})}MULTIPLE_TREE_SELECT(e){return l().createElement(pu,{option:e,multiple:!0})}CASCADER(e){return l().createElement(bu,{option:e})}MULTIPLE_CASCADER(e){return l().createElement(bu,{option:e,multiple:!0})}CITY_SELECT(e){return l().createElement(Lu,{option:e})}REGION_SELECT(e){return l().createElement(qu,{option:e})}UPLOAD_FILE(e){return l().createElement(Ku,{option:e})}UPLOAD_IMG(e){return l().createElement(Ju,{option:e})}TINYMCE(e){return l().createElement(wm,{option:e})}renderFormLabel(e){if(Br(e)||!(0,h.isPlainObject)(e))return e;const{type:t,fieldName:n,label:r,options:a={},onChange:i=b}=e,{itemList:o=[]}=a;return"SELECT"===t?l().createElement(K.Form.Item,{name:n,noStyle:!0},l().createElement(ca,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>i(e,t)})):"CHECKBOX"===t?l().createElement(l().Fragment,null,l().createElement("span",{style:{paddingRight:5}},r),l().createElement(K.Form.Item,{name:n,noStyle:!0},l().createElement(pa,{option:e,onValuesChange:e=>i(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:n,style:r={},render:a}=e,{extra:i}=this.state;if(n)return l().createElement(K.Tooltip,{className:"extra-tooltip",title:i[t]},l().createElement(Ee.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===t));return l().createElement("div",{className:"extra-text",title:a?"":i[t],style:r},l().createElement("span",{className:"extra-overflow-cut"},a?a(o,this):i[t]))}renderFormItemButton(e,t){const n=this.formItems.find((t=>t.fieldName===e)),r="function"==typeof t?t(n):t;return this.isOnlyShow?null:r}renderFormItem(e){const{label:t,fieldName:n,invisible:r,tooltip:a,className:i,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return l().createElement(K.Form.Item,{label:this.renderFormLabel(t),name:n,rules:c,tooltip:a,hidden:r,className:ve()(i),style:{width:"100%",...d},labelCol:{flex:this.verticalLayout?"initial":I(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(t)}},this.formRef.current?u(e,this):l().createElement(l().Fragment,null))}createFormItem(e){return(0,h.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(ue("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:t,defaultRows:n,isFieldsDefine:r}=this.props,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<n;e++)a.push({})}));const i=24/e,o=[],s=a.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return o.push(r),r}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,d=[],u=a.map(((t,n)=>{let{selfCol:r=1}=t;const{type:a,fieldName:s}=t;r=r>=24||"DIVIDER"===a||"TINYMCE"===a?e:r;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(o[n]),l().createElement(K.Col,{key:s??n,className:s,span:r*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},a?this.createFormItem(T(t)):null)}));return r&&"default"===t&&u.push(l().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(e=0){const{flexCols:t,collapse:n}=this.state,{searchButtonCols:r,isSearchBtn:a,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const o=24/t,s=r||1,c=t-e%t-s;return a?l().createElement(K.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},l().createElement(K.Space,{style:{marginBottom:12}},l().createElement(he,{type:"primary",size:this.$size,icon:l().createElement(Ee.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),l().createElement(he,{size:this.$size,icon:l().createElement(Ee.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),i?this.createFieldsDefine():null,this.showFilterCollapse&&l().createElement("a",{onClick:()=>this.setExpandHandle(!n)},n?l().createElement(Ee.UpOutlined,null):l().createElement(Ee.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const r=24/e;return n&&"default"===t?l().createElement(K.Row,{gutter:0},l().createElement(K.Col,{key:"-",span:r},l().createElement(K.Form.Item,null,l().createElement(K.Space,{style:{marginBottom:12}},l().createElement(he,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),l().createElement(he,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:n}=this.props;return l().createElement(ba,{uniqueKey:e,items:t,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[n,r]=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:[]})));n||a.length?t((n||[]).concat(a)):e(r)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),n=Object.keys(this._initialOthers),r=t.filter((e=>!n.includes(e))),a={};return r.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){ue("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:a}=this.props,i=r.find((t=>t.fieldName===e));if(!i)return ue("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,h.isPlainObject)(t))return ue("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return ue("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||(0,h.set)(i,n,t[n]));n&&(a?a([...r]):ue("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:n,disabled:r,labelWidth:a,labelAlign:i,labelWrap:o,customClass:s}=this.props,c=xe("form"),d={required:"${label}"+p("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return l().createElement("div",{ref:this.wrapperRef,className:ve()(u,e),style:t},l().createElement(K.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:i,labelWrap:o,colon:!1,disabled:r,labelCol:{flex:this.verticalLayout?"initial":I(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},l().createElement(xn.Provider,{value:this.provide},l().createElement(K.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Cm(Sm,"contextType",o),Cm(Sm,"propTypes",_r),Cm(Sm,"defaultProps",qr);const Nm=Sm,Tm=e=>null!=e;function Im(e,t,n,r){const[a,i]=l().useState(void 0);l().useLayoutEffect((()=>{const t="function"==typeof e?e():e;i(t||null)}));const[o,s]=l().useState(null),c=()=>{if(a){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:a,bottom:i,left:l}=e.getBoundingClientRect();return r>=0&&l>=0&&a<=t&&i<=n})(a)&&t&&a.scrollIntoView(r);const{left:e,top:n,width:i,height:l}=a.getBoundingClientRect(),o={left:e,top:n,width:i,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};return l().useLayoutEffect((()=>{c()}),[a,t]),si({handler:c}),[l().useMemo((()=>{if(!o)return o;const e=n?.offset||6,t=n?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,n]),a]}function Rm(){return Rm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rm.apply(null,arguments)}const Om={fill:"transparent",pointerEvents:"auto"},km=e=>{const{prefixCls:t,rootClassName:n,pos:r,showMask:a,style:i={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${Qa()}`,m="object"==typeof c?c?.placeholder:c;return l().createElement($l(),{open:s,autoLock:!0},l().createElement("div",{className:ve()(`${t}-mask`,n),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...i}},a?l().createElement("svg",{style:{width:"100%",height:"100%"}},l().createElement("defs",null,l().createElement("mask",{id:u},l().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),r&&l().createElement("rect",{x:r.left,y:r.top,rx:r.radius,width:r.width,height:r.height,fill:"black",className:m?`${t}-placeholder-animated`:""}))),l().createElement("rect",Rm({},r?null:Om,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),r&&l().createElement(l().Fragment,null,l().createElement("rect",Rm({},Om,{x:"0",y:"0",width:"100%",height:`${r.top}px`})),l().createElement("rect",Rm({},Om,{x:"0",y:"0",width:r.left,height:"100%"})),l().createElement("rect",Rm({},Om,{x:"0",y:r.top+r.height,width:"100%",height:`calc(100vh - ${r.top+r.height}px)`})),l().createElement("rect",Rm({},Om,{x:r.left+r.width,y:"0",width:`calc(100vw - ${r.left+r.width}px)`,height:"100%"})))):null))},Lm=e=>{const{prefixCls:t,zIndex:n,open:r,onPause:a,onPlay:i}=e,[o,s]=ri(void 0,{value:r,postState:e=>e??!0}),c=l().useRef(null),d=l().useRef(!1),u=oe((e=>{m(e),e.shiftKey&&32===e.keyCode&&p()}));l().useEffect((()=>{const e=Ut()(document,"keyup",u);return()=>e.remove()}),[]);const m=e=>{e.stopPropagation(),e.preventDefault()},p=()=>{d.current?d.current=!1:(s(!o),o?a?.():i?.())};return l().createElement("div",{ref:c,className:`${t}-control`,style:{zIndex:n+1},onMouseDown:e=>{m(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,l=e.clientX-je(t).x,o=e.clientY-je(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>a-n-1&&(s=a-n-1),c<0&&(c=0),c>i-r-1&&(c=i-r-1),Ke(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>p()},o?l().createElement(Ee.PauseOutlined,null):l().createElement(Ee.CaretRightOutlined,null))},Pm=e=>{const{prefixCls:t,current:n,total:r=0,cover:a,title:i,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:m,onNext:p,onFinish:h,className:f,indicatorsRender:g}=e,{t:y}=le(),b="primary"!==c?"primary":"default",v=oe((e=>{C(e),40===e.keyCode&&(n<r-1?p?.():h?.()),38===e.keyCode&&n>0&&m?.()}));l().useEffect((()=>{const e=Ut()(document,"keyup",v);return()=>e.remove()}),[]);const x=Tm(a)?l().createElement("div",{className:`${t}-cover`},a):null,E=Tm(o)?l().createElement("div",{className:`${t}-description`},o):null;let w;w=g?g(n,r):[...Array.from({length:r}).keys()].map(((e,r)=>l().createElement("span",{key:e,className:ve()(r===n&&`${t}-indicator-active`,`${t}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return l().createElement("div",{className:ve()(`${t}-content`,f)},l().createElement("div",{className:`${t}-inner`},l().createElement(Ee.CloseOutlined,{className:`${t}-close`,onClick:u}),s.content&&l().createElement(K.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},l().createElement(Ee.QuestionCircleOutlined,{className:ve()(`${t}-close`,"help-icon")})),x,l().createElement("div",{className:`${t}-header`},l().createElement("div",{className:`${t}-title`},i)),E,l().createElement("div",{className:`${t}-footer`},r>1&&l().createElement("div",{className:`${t}-indicators`},w),l().createElement(ye,{className:`${t}-buttons`},0!==n?l().createElement(he,{className:`${t}-prev-btn`,size:"small",onMouseDown:C,onClick:m},y("qm.tour.prevStep")):null,n===r-1?l().createElement(he,{className:`${t}-finish-btn`,type:b,size:"small",onClick:h},y("qm.tour.finish")):l().createElement(he,{className:`${t}-next-btn`,type:b,size:"small",onMouseDown:C,onClick:p},y("qm.tour.nextStep"))))))},Am=e=>{const{current:t,renderPanel:n}=e;return l().createElement(l().Fragment,null,"function"==typeof n?n(e,t):l().createElement(Pm,e))};function Fm(){return Fm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fm.apply(null,arguments)}const _m={left:"50%",top:"50%",width:1,height:1},qm=l().forwardRef(((e,t)=>{const{steps:n=[],defaultCurrent:r,current:a,onChange:i,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:m=!0,control:p=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:y,zIndex:b,renderPanel:v,indicatorsRender:E,gap:w,animated:C=!0,scrollIntoViewOptions:S=!0,...N}=e,T=l().useRef(),[I,R]=ri(0,{value:a,defaultValue:r}),[O,k]=ri(void 0,{value:c,postState:e=>!(I<0||I>=n.length)&&(e??!1)}),[L,P]=ri(1051,{value:b,defaultValue:b}),[A,F]=l().useState(),_=l().useRef(O);l().useLayoutEffect((()=>{O&&!_.current&&R(0),_.current=O,F(O)}),[O]),l().useImperativeHandle(t,(()=>({OPEN:()=>k(!0),CLOSE:()=>k(!1),SET_ZINDEX:e=>P(e)})));const{target:q,type:D,placement:H,trigger:$,delay:M,style:K,arrow:z,className:V,mask:j,scrollIntoViewOptions:W,zIndex:B,action:U}=n[I]||{},G=B||L,Y=D||d,X=O&&(j??u),Q=W??S,[Z,J]=Im(q,!!c,w,Q),ee=((e,t,n)=>n??t??(null===e?"center":"bottom"))(J,g,H),te=!!J&&(void 0===z?m:z),ne="object"==typeof te&&te.pointAtCenter;l().useLayoutEffect((()=>{T.current?.forceAlign()}),[ne,I]),qe((()=>{O&&(ie(),U?.(J,I))}),[O,J]);const re=e=>{R(e),i?.(e)},ae=()=>{k(!1),o?.(I)},ie=()=>{if(!J)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||"none"===Me(r=n,"display")||"hidden"===Me(r,"visibility")||"0"===Me(r,"opacity")||e.push(n);for(const e of Array.from(n.childNodes))t(e)}}(J),e.length&&e[0].focus()};if(void 0===J)return null;const le=async()=>{if(!$||!J)return;const{left:e,top:t}=J.getBoundingClientRect(),n=J.offsetWidth,r=J.offsetHeight,[a,i]=[e+n/2,t+r/2],l=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),o=document.elementFromPoint(a,i);o&&(o.dispatchEvent(l),await x(M??320))},oe="boolean"==typeof X?X:!!X,se="boolean"==typeof X?void 0:X,ce=Object.assign({},f,K),de=xe("tour"),ue=[{[`${de}-primary`]:"primary"===Y},h,V],me=Tl({arrowPointAtCenter:ne,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(km,{zIndex:G,prefixCls:de,pos:Z,showMask:oe,style:se?.style,fill:se?.color,open:A,animated:C,rootClassName:h}),l().createElement($l(),{open:A,autoLock:!0},l().createElement(Rl(),Fm({ref:T},N,{zIndex:G,builtinPlacements:me,popupStyle:ce,popupPlacement:ee,popupVisible:A,popupClassName:ve()(ue),prefixCls:de,popup:()=>l().createElement(Am,Fm({key:"content",arrow:te,prefixCls:de,total:n.length,helper:y,renderPanel:v,indicatorsRender:E,onPrev:async()=>{await le(),re(I-1)},onNext:async()=>{await le(),re(I+1)},onClose:ae,current:I,onFinish:()=>{ae(),s?.()}},Object.assign({},n[I],{zIndex:G,type:Y}))),arrow:!!te,getTriggerDOMNode:e=>e||J||document.body,forceRender:!1,destroyPopupOnHide:!0}),l().createElement("div",{className:ve()(h,`${de}-target-placeholder`),style:{...Z||_m,position:"fixed",pointerEvents:"none"}}))),p&&l().createElement($l(),{open:O},l().createElement(Lm,{zIndex:G,prefixCls:de,onPause:()=>F(!1),onPlay:()=>F(!0)})))}));qm.displayName="QmTour";const Dm=qm,Hm={previewWidth:1100,defaultDistance:.45,logoHeight:60},$m=(0,i.createContext)(void 0);var Mm=null;function Km(){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),n=e.match(/MSIE\D?\d+/i),r=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!n&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){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 zm(e,t){var n;try{var r=navigator.userAgent,a=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(Km()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void K.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&r.match(/x64/i),e||t?n=a?e:t:Mm?n=Mm:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),Mm=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n;return n.VERSION<"6.2.2.6"&&Km(),n}catch(e){K.message.error("getLodop 出错:"+e)}}Km();const Vm=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:n}=window.screen;if(t&&n)e[0]=t,e[1]=n;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)},jm=l().forwardRef(((e,t)=>{const{templateRender:n,directPrint:r}=e,{global:a}=l().useContext(o),{$$preview:i}=l().useContext($m),{state:s,isWindowsPrinter:c,pageSize:d}=i,u=l().useRef(null),m=l().useRef({}),p=l().useRef([]),h=l().useRef([]),f=l().useRef([]),[g,y]=l().useState(!0);l().useImperativeHandle(t,(()=>({createPreviewDom:L,createExportHtml:A,createPrintHtml:P,SHOW_PREVIEW:F,DIRECT_PRINT:_}))),qe((()=>{k()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),l().useEffect((()=>{m.current.templateEl=u.current.querySelector(".origin-template").children[0],m.current.previewEl=u.current.querySelector(".workspace")}),[]);const b=l().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*Hm.defaultDistance+10*Hm.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[s,c,d]),v=l().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*Hm.defaultDistance+10*Hm.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),E=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Vm(b-10*(e.left-Hm.defaultDistance)-10*(e.right-Hm.defaultDistance))}),[s,b]),w=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Vm(v-10*(e.top-Hm.defaultDistance)-10*(e.bottom-Hm.defaultDistance))}),[s,v]),C=s.form.scale,S=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:Vm(10*e.left),right:Vm(10*e.right),top:Vm(10*e.top),bottom:Vm(10*e.bottom)}}),[s]),N=l().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:n,top:r,bottom:a}=S,i=E+t+n,l=Hm.previewWidth-i<=0?0:(Hm.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>Hm.previewWidth?0:l>0?o:(Hm.previewWidth-(i-2*o))/2),{width:`${E}px`,height:"stylus"===e?"auto":w+"px",paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${C})`,opacity:g?0:1}}),[s,g,S,C,w,E]),T=(p.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=a?.print?.leftLogo??"",t=a?.print?.rightLogo??"";return[`<tr style="height: ${Hm.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),I=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=m.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},O=()=>{const e=m.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const a=e[r].clientHeight;e[r].style.height=a+"px",n.push(a),t.push(e[r].outerHTML)}h.current=n,p.current=t},k=()=>{if(!p.current.length)return;const{form:{setting:e,printerType:t}}=s;if(r)return f.current.push([I(),T(),...p.current]);const n=e.fixedLogo?w-Hm.logoHeight:w;let a=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[T()]:[],...p.current]);else{let t=0;for(let r=0,i=h.current.length;r<i;r++){const l=p.current[r],o=h.current[r];e.fixedLogo||0!==r||(t+=Hm.logoHeight),t+=o,t<=n?a.push(l):(f.current.push([I(),...e.fixedLogo?[T()]:[],...a]),a=[],t=0,r-=1),r===i-1&&a.length&&f.current.push([I(),...e.fixedLogo?[T()]:[],...a])}}e.fixedLogo||f.current[0]?.splice(1,0,T());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>');i.setState({currentPage:1,totalPage:f.current.length}),L()},L=()=>{const{currentPage:e}=s;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${m.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",m.current.previewEl.innerHTML=t,m.current.previewEl.parentNode.scrollTop=0},P=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${m.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},A=()=>{const e=[];for(let t=0;t<p.current.length;t++)e[t]=p.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+T()+I()+e.join("")+"</table>"},F=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return q();m.current.previewEl.innerHTML||(R(),await x(0),O(),k(),y(!1))},_=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return q();R(),await x(0),O(),k(),y(!1),i.doPrint(P()),await x(0),i.doClose()},q=()=>{ue("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D=xe("print-container"),H={[D]:!0,"no-visible":r};return l().createElement("div",{ref:u,className:ve()(H)},l().createElement(ut,{wrapperClassName:"spin",spinning:g,tip:"Loading..."},l().createElement("div",{className:"preview"},l().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},n?.()),l().createElement("div",{className:"workspace",style:N}))))}));jm.displayName="Container";const Wm=jm;function Bm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Um extends i.Component{constructor(...e){super(...e),Bm(this,"context",void 0),Bm(this,"formRef",l().createRef()),Bm(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:Hm.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:Hm.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:Hm.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:Hm.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),Bm(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})})),Bm(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")}))),Bm(this,"state",{formList:this.createFormList()}),Bm(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())})),Bm(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return l().createElement(l().Fragment,null,l().createElement(Nm,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(he,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),l().createElement(he,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}Bm(Um,"contextType",o);const Gm=Um;function Ym(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Xm extends i.Component{constructor(...e){super(...e),Ym(this,"context",void 0),Ym(this,"provide",{$$preview:this}),Ym(this,"containRef",l().createRef()),Ym(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Hm.defaultDistance,right:Hm.defaultDistance,top:Hm.defaultDistance,bottom:Hm.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Ym(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Ym(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Ym(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 Wi().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Ym(this,"doClose",(()=>{this.props.onClose?.()})),Ym(this,"getPrintConfig",(async e=>{const t=this.context.global,n=t?.getComponentConfigApi;if(n)try{const t=await n({key:e});if(200===t.code)return t.data}catch(e){}})),Ym(this,"savePrintConfig",(async(e,t)=>{const n=this.context.global,r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})),Ym(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 ')),Ym(this,"doPrint",(e=>{const t=zm();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Hm,{left:d,right:u,top:m,bottom:h}=a.distance;t.PRINT_INIT(n??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),a.doubleSide&&("auto"===a.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===l&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():K.message.error(p("qm.print.printError"))},t.PRINT()})),Ym(this,"doExport",(e=>{const t=zm();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(n??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&this.doClose():K.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(`${c()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:p("qm.print.laserPrinter"),value:"laser"},{text:p("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=zm(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const n=e.GET_PRINTER_COUNT();for(let r=0;r<n;r++)t.push({text:e.GET_PRINTER_NAME(r),value:r})}catch(e){ue("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 Wi().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,h.isPlainObject)(e)&&await Wi().setItem(this.printerKey,e)),(0,h.isPlainObject)(e)&&Object.keys(e).length&&(0,h.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:t}=this.props,{visible:n,form:r,currentPage:a,totalPage:i,printPage:o}=this.state,s=xe("print-preview"),c={visible:n,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?l().createElement(l().Fragment,null,l().createElement("div",{className:ve()(d)},l().createElement("div",{className:"outer"},l().createElement("div",{className:"header"},l().createElement("span",null,p("qm.print.printer"),":",l().createElement(K.Select,{value:r.printerName,onChange:e=>{this.setState((t=>(0,h.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",null,p("qm.print.type"),":",l().createElement(K.Select,{value:r.printerType,onChange:e=>{this.setState((t=>(0,h.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>l().createElement(K.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",null,p("qm.print.copies"),":",l().createElement(K.InputNumber,{value:r.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,h.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),l().createElement("span",null,p("qm.print.printPage.0"),l().createElement(K.InputNumber,{value:o,min:1,max:i,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),p("qm.print.printPage.1")),l().createElement("span",null,l().createElement(K.Pagination,{size:"small",current:a,pageSize:1,total:i,onChange:this.pageChangeHandle})),l().createElement("span",null,l().createElement(he,{type:"text",icon:l().createElement(Ee.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),l().createElement("span",null,l().createElement(he,{type:"text",icon:l().createElement(Ee.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),l().createElement("span",null,l().createElement(he,{icon:l().createElement(Ee.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),l().createElement("div",{className:"main"},l().createElement($m.Provider,{value:this.provide},l().createElement(Wm,{ref:this.containRef,templateRender:t,directPrint:!1}))),l().createElement("div",{className:"footer"},l().createElement("span",null,p("qm.print.scale"),":",l().createElement(K.Slider,{value:r.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,h.merge)({},t,{form:{scale:e}})))}}),l().createElement("em",{className:"scale-text"},`${Math.floor(100*r.scale)}%`)),l().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),l().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:a,totalPage:i}))))),l().createElement(yn,c,l().createElement(Gm,{setting:r.setting,onChange:e=>{this.setState((t=>(0,h.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):l().createElement($m.Provider,{value:this.provide},l().createElement(Wm,{ref:this.containRef,templateRender:t,directPrint:!0}))}}Ym(Xm,"contextType",o);const Qm=Xm;function Zm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Jm extends i.Component{constructor(...e){super(...e),Zm(this,"context",void 0),Zm(this,"previewRef",l().createRef()),Zm(this,"state",{visible:!1,loading:!1}),Zm(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})})),Zm(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:n,defaultConfig:r,preview:a,closeAfterPrint:i}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${Hm.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:n,defaultConfig:r,preview:a,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return a?l().createElement(yn,o,l().createElement(Qm,s)):e?l().createElement(Qm,s):null})),Zm(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await x(0),this.setState({visible:!0}),await x(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:t,icon:n,type:r,disabled:a,shape:i}=this.props,o={size:t||this.context.size||"",type:r,shape:i,icon:n,loading:e,disabled:a,click:this.clickHandle};return l().createElement(l().Fragment,null,this.props.children&&l().createElement(he,o,this.props.children),this.createRender())}}Zm(Jm,"propTypes",{size:(e,t,n)=>{if(!Nr(e[t]||""))return de("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Sr().elementType}),Zm(Jm,"defaultProps",{preview:!0,type:"primary",icon:l().createElement(Ee.PrinterOutlined,null)}),Zm(Jm,"contextType",o);const ep=Jm;function tp(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function np(e){const t=tp(e);return t?t.frameElement:null}function rp(e){const t=lp(e);return ap([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function ap(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function ip(e,t){const n=np(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let a=n,i=!1;for(;a;){const e=rp(a);if(r.push(e),a=np(a),i)break;a&&tp(a)===t&&(i=!0)}return ap(r)}return e.getBoundingClientRect()}function lp(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function op(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sp=Object.assign;class cp{constructor(e,t){op(this,"node",void 0),op(this,"border",void 0),op(this,"padding",void 0),op(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=pp.border,this.padding.style.borderColor=pp.padding,this.content.style.backgroundColor=pp.background,sp(this.node.style,{borderColor:pp.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){mp(t,"margin",this.node),mp(t,"border",this.border),mp(t,"padding",this.padding),sp(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),sp(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class dp{constructor(e,t){op(this,"tip",void 0),op(this,"nameSpan",void 0),op(this,"dimSpan",void 0),this.tip=e.createElement("div"),sp(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),sp(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),sp(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,n){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(n)+"px"}updatePosition(e,t){const n=this.tip.getBoundingClientRect(),r=function(e,t,n){const r=Math.max(n.height,20),a=Math.max(n.width,60);let i;i=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-r<=t.top+t.height?e.top-r-5<t.top+5?t.top+5:e.top-r-5:t.top+t.height-r-5;let l=e.left+5;return e.left<t.left&&(l=t.left+5),e.left+a>t.left+t.width&&(l=t.left+t.width-a-5),i+="px",l+="px",{style:{top:i,left:l}}}(e,t,{width:n.width,height:n.height});sp(this.tip.style,r.style)}}class up{constructor(){op(this,"window",void 0),op(this,"tipBoundsWindow",void 0),op(this,"container",void 0),op(this,"tip",void 0),op(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const n=e.document;this.container=n.createElement("div"),this.container.style.zIndex="10000000",this.tip=new dp(n,this.container),this.rects=[],n.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const n=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>n.length;){const e=this.rects.pop();e?.remove()}if(0===n.length)return;for(;this.rects.length<n.length;)this.rects.push(new cp(this.window.document,this.container));const r={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};n.forEach(((e,t)=>{const n=ip(e,this.window),a=lp(e);r.top=Math.min(r.top,n.top-a.marginTop),r.right=Math.max(r.right,n.left+n.width+a.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+a.marginBottom),r.left=Math.min(r.left,n.left-a.marginLeft),this.rects[t].update(n,a)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const a=ip(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:r.top,left:r.left,height:r.bottom-r.top,width:r.right-r.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function mp(e,t,n){sp(n.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const pp={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let hp=null,fp=null;function gp(){null!=window.document&&(hp=null,null!==fp&&(fp.remove(),fp=null))}function yp(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class bp{constructor(e){yp(this,"_isRunning",void 0),yp(this,"_selectIgnore",void 0),yp(this,"_lastHoveredNode",null),yp(this,"excludeSelectors",void 0),yp(this,"onSelect",void 0),yp(this,"iframesListeningTo",new Set),yp(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),yp(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),yp(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),yp(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Be(t,window.document.querySelector(e)))))return this._selectIgnore=!0,gp();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var n;n=[t],null!=window.document?(null!==hp&&clearTimeout(hp),null!=n&&(null===fp&&(fp=new up),fp.inspect(n,null))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}})),yp(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),yp(this,"selectFiberForNode",(0,h.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let n=e;const r=[];for(;n!==t&&null!==n;){let e=n.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,r=Array.from(n.classList).reverse();e<r.length;e++)t.test(r[e])&&n.classList.remove(r[e]);if(n.id&&/^rc-\w+/.test(n.id)&&n.removeAttribute("id"),n.id)e+=`#${n.id}`;else{const t=Array.from(n.parentElement.children).filter((e=>e.tagName===n.tagName)),r=n.className.trim();if(t.filter((e=>e.className.includes(r))).length<=1){if(r){const t=r.split(/\s+/);let n="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(n+=`.${t[e]}`);e+=n}}else n.getAttribute("name")?e+=`[name=${n.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(n)+1})`}n.nodeType!==Node.TEXT_NODE&&r.unshift(e),n=n.parentElement}return r.join(" > ")}(e))}),200,{leading:!1})),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){gp(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function vp(e){return document.querySelector(e)}const xp=e=>{const{action:t,onConfirm:n,onCancel:r,onFinish:a}=e,{t:i}=le();return l().createElement(l().Fragment,null,l().createElement("div",{style:{height:100}},i("qm.table.config.emptyText")),l().createElement(ye,{style:{width:"100%",justifyContent:"flex-end"}},l().createElement(he,{size:"small",onClick:()=>r?.()},i("qm.guideTracker.closeButton")),l().createElement(he,{size:"small",onClick:()=>n?.()},i("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),l().createElement(he,{size:"small",onClick:()=>a?.()},i("qm.guideTracker.finishButton"))))},Ep={left:"50%",top:"50%",width:1,height:1},wp=l().forwardRef(((e,t)=>{const{open:n,current:r,defaultCurrent:a,steps:i=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:m,zIndex:p,helper:f={},selectFilter:g=e=>e,onSelect:y,onChange:b,onClose:v,onFinish:x}=e,{t:E}=le(),w=l().useRef(),C=l().useRef(i.length),[S,N]=ri(0,{value:r,defaultValue:a}),[T,I]=ri(void 0,{value:n,postState:e=>e??!1}),[R,O]=ri(1051,{value:p,defaultValue:p}),[k,L]=l().useState({}),[P,A]=l().useState(!1),[F,_]=l().useState(T),[q,D]=l().useState(!1),[H,$]=Im(k.node,!!n),[M,z]=l().useState(22),V=l().useRef(!1),j=l().useMemo((()=>S>=i.length?"add":"edit"),[S,i]),W=l().useMemo((()=>`${S+1} / ${i.length}`),[S,i]);l().useLayoutEffect((()=>{w.current=new bp({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=g(t),L({id:or(),node:e,path:t}),N(C.current),A(!0),U(),y?.(t,e)}})}),[]),l().useEffect((()=>(T?B():U(),T?setTimeout((()=>_(!0)),16):_(!1),()=>{U()})),[T]),l().useEffect((()=>{C.current=i.length}),[i]);const B=()=>{w.current.startHandle()},U=()=>{w.current.stopHandle()},G=e=>{e.stopPropagation(),e.preventDefault()};l().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:S,selector:k.path})})));const Y=xe("guide-tracker"),X=[{[`${Y}-primary`]:!0}],Q=Tl({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement($l(),{open:T&&P,autoLock:!0},l().createElement(Rl(),{zIndex:R,builtinPlacements:Q,popupPlacement:o,popupVisible:T&&P,popupClassName:ve()(X,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{A(!1),B()};return l().createElement("div",{className:`${Y}-content`},l().createElement("div",{className:`${Y}-inner`},l().createElement(Ee.CloseOutlined,{className:`${Y}-close`,onClick:()=>{v?.(S),e()}}),l().createElement(K.Dropdown,{open:q,trigger:["click"],dropdownRender:()=>i.length?l().createElement("div",{className:"ant-dropdown-menu step-list"},l().createElement(ga.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.id)),n=i.map((e=>e.id));if((0,h.isEqual)(t,n))return;const r=t.findIndex((e=>e===k.id)),a=-1!==r?r:S;N(a),b?.(yr(e),a)}},i.map(((e,t)=>l().createElement("li",{key:t,className:ve()("item",{actived:e.id===k.id})},l().createElement(Ee.HolderOutlined,{className:"handle",title:E("qm.form.draggable")}),l().createElement("span",{className:"box"},l().createElement("span",{className:"title",title:e.title,onClick:()=>{t!==S&&(L({id:e.id,node:vp(e.selector),path:e.selector}),N(t),z(22===M?M+1:M-1),b?.(i,t))}},e.title),l().createElement(K.Popconfirm,{title:E("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const n=i.filter((t=>t.id!==e.id)),r=t===S;let a=t<=S?S-1:S;if(a=a<0?0:a,a=a>n.length?n.length:a,r&&n[a]){const{id:e,selector:t}=n[a];L({id:e,node:vp(t),path:t})}N(a),b?.(n,a)}},l().createElement(Ee.CloseOutlined,{className:"close-icon"})))))))):l().createElement(l().Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>D(e)},l().createElement(Ee.MenuOutlined,{className:ve()(`${Y}-close`,"menu-icon"),style:{width:M}})),f.content&&l().createElement(K.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:f.content,title:f.title},l().createElement(Ee.QuestionCircleOutlined,{className:ve()(`${Y}-close`,"help-icon")})),l().createElement("div",{className:"panel-label"},l().createElement("span",{className:"title"},E("qm.guideTracker.label")),l().createElement("span",{className:"step"},E("qm.guideTracker.currentStep"),W)),m?m({id:k.id,selector:k.path,actionStatus:j,DO_CLOSE:e},S):l().createElement(xp,{action:j,onConfirm:()=>{b?.("add"===j?[...i,{id:k.id,selector:k.path,title:"Guide Title"}]:[...i],S),e()},onCancel:()=>{v?.(S),e()},onFinish:()=>{e(),v?.(S),x?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},l().createElement("div",{className:ve()(`${Y}-target-placeholder`),style:{...H||Ep,position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:G,onClick:G}))),s&&l().createElement($l(),{open:F},l().createElement(Lm,{zIndex:R,prefixCls:Y,onPause:()=>{V.current=P,A(!1),U()},onPlay:()=>{V.current?A(!0):B()}})))}));wp.displayName="QmGuideTracker";const Cp=wp,Sp=e=>{const{content:t,image:n,width:r,height:a,font:o={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:m=1,antiTamper:p=!0,grayscale:h,className:f,style:g}=e,y=l().useRef(null),b=l().useRef(new Map),v=o.fontSize??16,x=o.fontWeight??"normal",E=o.fontStyle??"normal",w=o.fontFamily??"sans-serif",C=o.color??"rgba(0, 0, 0, 0.15)",S=o.textAlign??"center",N=Array.isArray(t)?t:[t],T=s[0],I=s[1],R=T/2,O=I/2,k=c[0]??R,L=c[1]??O,P=l().useMemo((()=>{const e=k-R,t=L-O;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:u}}),[R,O,k,L,u]),A=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const i=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[l,o]=(e=>{let t=120,i=64;if(!n&&e.measureText){e.font=`${v}px ${w}`;const n=N.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...n)),i=v*N.length+3*(N.length-1)}return[r??t,a??i]})(t),s=l*i,c=o*i,u=(T+l)*i,p=(I+o)*i,f=T/2*i,g=I/2*i,R=u/2,O=p/2,k=2*(T+l);e.width=2*u,e.height=2*p,t.globalAlpha=m,t.save(),t.translate(R,O),t.rotate(Math.PI/180*d),t.translate(-R,-O);const L=()=>{t.restore(),t.drawImage(e,0,0,u,p,u,p,u,p),h&&(e=>{const t=e.getContext("2d");if(!t)return;const n=t.getImageData(0,0,e.width,e.height),{data:r}=n;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}t.putImageData(n,0,0)})(e),((e,t)=>{if(y.current){const n=b.current.get(y.current);n&&(y.current.contains(n)&&y.current.removeChild(n),b.current.delete(y.current));const r=document.createElement("div");r.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${n=e,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var n})).join(";"))({...P,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),y.current?.append(r),b.current.set(y.current,r)}})(e.toDataURL(),k)},A=()=>{const e=Number(v)*i;t.font=`${E} normal ${x} ${e}px/${o}px ${w}`,t.fillStyle=C,t.textAlign=S,t.textBaseline="top",t.translate(s/2,0),N.forEach(((n,r)=>{t.fillText(n??"",f,g+r*(e+3*i))})),L()};if(n){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),L()},e.onerror=()=>{A()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=n}else A()},F=e=>Array.from(b.current.values()).includes(e);l().useEffect((()=>{A()}),[t,n,r,a,o,s,c,d,u,m,p,h]),function(e,t,n={}){const r=window&&"MutationObserver"in window,a=i.useRef(),l=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};i.useLayoutEffect((()=>(l(),r&&e.current&&(a.current=new MutationObserver(t),a.current.observe(e.current,n)),()=>l())),[e])}(y,(e=>{if(p)for(const t of e){const e=Array.from(t.removedNodes).some((e=>F(e))),n="attributes"===t.type&&F(t.target);if(e||n){A();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const _=xe("watermark");return l().createElement("div",{ref:y,className:ve()(_,f),style:{position:"relative",...g}},e.children)},Np=new Map,Tp=new WeakMap;let Ip=0;function Rp(e,t,n={},r=undefined){if(void 0===window.IntersectionObserver&&void 0!==r){const a=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:a,intersectionRect:a,rootBounds:a}),()=>{}}const{id:a,observer:i,elements:l}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(Tp.has(n)||(Ip+=1,Tp.set(n,Ip.toString())),Tp.get(n)):"0"):e[t]}`;var n})).toString()}(e);let n=Np.get(t);if(!n){const r=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const n=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=n),r.get(t.target)?.forEach((e=>{e(n,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:r},Np.set(t,n)}return n}(n),o=l.get(e)||[];return l.has(e)||l.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(l.delete(e),i.unobserve(e)),0===l.size&&(i.disconnect(),Np.delete(a))}}const Op=e=>{const{forceRender:t,height:n,placeholder:r=null,unmountIfInvisible:a,className:i,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:t,threshold:n,triggerOnce:r,fallbackInView:a,trackVisibility:i,skip:o,delay:s,onChange:c}={})=>{const[d,u]=l().useState(null),[m,p]=l().useState({inView:!1,entry:void 0}),h=l().useRef(c);l().useEffect((()=>{if(o||!d)return;let l;return l=Rp(d,((e,t)=>{p({inView:e,entry:t}),h.current?.(e,t),t.isIntersecting&&r&&l&&(l(),l=void 0)}),{root:e,rootMargin:t,threshold:n,trackVisibility:i,delay:s},a),()=>{l&&l()}}),[Array.isArray(n)?n.toString():n,d,e,t,r,o,i,a,s]);const f=m.entry?.target,g=l().useRef();d||!f||r||o||g.current===f||(g.current=f,p({inView:!1,entry:void 0}));const y=[u,m.inView,m.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!a}));l().useEffect((()=>{n||ue("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=xe("lazy-load"),m={[u]:!0};return l().createElement("div",{ref:s,className:ve()(m,i),style:o},t||c?e.children:l().createElement("div",{className:"placeholder",style:{height:n}},r))},kp=require("html2canvas");var Lp=r.n(kp);function Pp(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ap{constructor(e,t,n,r){if(Pp(this,"x",void 0),Pp(this,"y",void 0),Pp(this,"pressure",void 0),Pp(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class Fp{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Fp(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,a=e.y-t.y,i=t.x-n.x,l=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+a*a),m=Math.sqrt(i*i+l*l),p=m/(u+m),h=c+(o-c)*p,f=d+(s-d)*p,g=t.x-h,y=t.y-f;return{c1:new Ap(o+g,s+y),c2:new Ap(c+g,d+y)}}constructor(e,t,n,r,a,i){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=a,this.endWidth=i}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const a=r/10,i=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),l=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=i-e,a=l-t;n+=Math.sqrt(r*r+a*a)}e=i,t=l}return n}point(e,t,n,r,a){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+a*e*e*e}}function _p(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class qp{constructor(e,t){_p(this,"canvas",void 0),_p(this,"ctx",void 0),_p(this,"textInput",void 0),_p(this,"width",320),_p(this,"height",200),_p(this,"ratio",Math.max(window.devicePixelRatio||1,1)),_p(this,"penColor","rgba(0,0,0,1)"),_p(this,"backgroundColor","rgba(0,0,0,0)"),_p(this,"canAddHistory",!1),_p(this,"mode",void 0),_p(this,"openSmooth",!0),_p(this,"dotSize",0),_p(this,"throttle",16),_p(this,"minDistance",5),_p(this,"velocityFilterWeight",.7),_p(this,"compositeOperation","source-over"),_p(this,"minWidth",.5),_p(this,"maxWidth",2.5),_p(this,"fontSize",16),_p(this,"eraserSize",20),_p(this,"lineHeight",1.25),_p(this,"degreeOfBlur",5),_p(this,"textInputPos",{x:0,y:0}),_p(this,"onStart",(()=>{})),_p(this,"onEnd",(()=>{})),_p(this,"_drawingStroke",!1),_p(this,"_lastPoints",[]),_p(this,"_data",[]),_p(this,"_historyList",[]),_p(this,"_lastVelocity",0),_p(this,"_lastWidth",0),_p(this,"_strokeMoveUpdate",void 0),_p(this,"setCanvasSize",(()=>{this.canvas.style.height=`${this.height}px`,this.canvas.style.width=`${this.width}px`,this.canvas.height=this.height*this.ratio,this.canvas.width=this.width*this.ratio,1!==this.ratio&&this.ctx.scale(this.ratio,this.ratio)})),_p(this,"setTextInput",(()=>{this.openSmooth||(this.textInput.setAttribute("class","signature__text-input"),this.textInput.setAttribute("contentEditable","true"),this.textInput.setAttribute("spellCheck","false"),this.canvas.parentNode.appendChild(this.textInput))})),_p(this,"isTouchEvent",(e=>"touches"in e)),_p(this,"addListener",(()=>{this.removeListener(),this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",("ontouchstart"in window||navigator.maxTouchPoints)&&(this.canvas.addEventListener("touchstart",this.onDrawStart,{passive:!1}),this.canvas.addEventListener("touchmove",this.onDrawMove,{passive:!1}),document.addEventListener("touchcancel",this.onDrawEnd,{passive:!1}),document.addEventListener("touchend",this.onDrawEnd,{passive:!1})),this.canvas.addEventListener("mousedown",this.onDrawStart),this.canvas.addEventListener("mousemove",this.onDrawMove),document.addEventListener("mouseup",this.onDrawEnd),this.textInput.addEventListener("blur",this.onInputBlur)})),_p(this,"removeListener",(()=>{this.canvas.style.touchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("touchstart",this.onDrawStart),this.canvas.removeEventListener("touchmove",this.onDrawMove),document.removeEventListener("touchend",this.onDrawEnd),document.removeEventListener("touchcancel",this.onDrawEnd),this.canvas.removeEventListener("mousedown",this.onDrawStart),this.canvas.removeEventListener("mousemove",this.onDrawMove),document.removeEventListener("mouseup",this.onDrawEnd),this.textInput.removeEventListener("blur",this.onInputBlur)})),_p(this,"_isLeftButtonPressed",((e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),_p(this,"_pointerEventToSignatureEvent",(e=>({event:e,type:e.type,x:this.isTouchEvent(e)?e.touches[0]?.clientX:e.clientX,y:this.isTouchEvent(e)?e.touches[0]?.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}))),_p(this,"_getPointGroupOptions",(e=>({penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}))),_p(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),n={...t,points:[]};this._data.push(n),this._reset(t),this._strokeUpdate(e,!1)})),_p(this,"_strokeUpdate",((e,t=!0)=>{if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);const n=this._createPoint(e.x,e.y,e.pressure),r=this._data[this._data.length-1],a=r.points,i=a.length>0&&a[a.length-1],l=!!i&&n.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(r);if(!i||!i||!l){const e=this._addPoint(n,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(n,o)),a.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}})),_p(this,"_strokeEnd",((e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)})),_p(this,"_reset",(e=>{this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this.ctx.fillStyle=e.penColor,this.ctx.globalCompositeOperation=e.compositeOperation})),_p(this,"_drawDot",((e,t)=>{const n=this.ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()})),_p(this,"_drawCurve",((e,t)=>{const n=this.ctx,r=e.endWidth-e.startWidth,a=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<a;n+=1){const i=n/a,l=i*i,o=l*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*l*e.control2.x,u+=o*e.endPoint.x;let m=d*e.startPoint.y;m+=3*c*i*e.control1.y,m+=3*s*l*e.control2.y,m+=o*e.endPoint.y;const p=Math.min(e.startWidth+o*r,t.maxWidth);this._drawCurveSegment(u,m,p)}n.closePath(),n.fill()})),_p(this,"_drawCurveSegment",((e,t,n)=>{const r=this.ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1)})),_p(this,"_createPoint",((e,t,n)=>{const r=this.canvas.getBoundingClientRect();return new Ap(e-r.left,t-r.top,n,(new Date).getTime())})),_p(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),_p(this,"_addPoint",((e,t)=>{const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=Fp.fromPoints(n,e);return n.shift(),r}return null})),_p(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),_p(this,"_calculateCurveWidths",((e,t,n)=>{const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(r,n),i={end:a,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=a,i})),_p(this,"onDrawStart",(e=>{e.preventDefault(),this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&(this._strokeBegin(this._pointerEventToSignatureEvent(e)),this.ctx.strokeStyle=this.penColor,this.ctx.lineWidth=this.maxWidth,"line"===this.mode&&this.createPencil(e),"eraser"===this.mode&&this.createEraser(e),"text"===this.mode&&this.createTextInput(e),this.onStart?.(e))})),_p(this,"onDrawMove",(e=>{e.preventDefault(),"text"!==this.mode&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?window.requestAnimationFrame?window.requestAnimationFrame((()=>this.drawHandler(e))):this.drawHandler(e):this._strokeEnd(this._pointerEventToSignatureEvent(e)))})),_p(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),_p(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),_p(this,"drawHandler",(e=>{switch(this.mode){case"line":this.drawLine(e);break;case"square":this.drawSquare(e);break;case"round":this.drawRound(e);break;case"arrow":this.drawArrow(e);break;case"mosaic":this.drawMosaic(e);break;case"text":this.drawText(e);break;case"eraser":this.drawEraser(e)}this.canAddHistory=!0})),_p(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,a-n),this.ctx.stroke(),this.ctx.restore()})),_p(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(r,t),l=Math.min(a,n),o=.5*(Math.max(r,t)-i),s=.5*(Math.max(a,n)-l),c=i+o,d=l+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()})),_p(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(n-a,t-r)/Math.PI,l=(i+25)*Math.PI/180,o=(i-25)*Math.PI/180,s=15*Math.cos(l),c=15*Math.sin(l),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,a),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,a);const m=r+s,p=a+c;this.ctx.lineTo(m,p);const h=r+d,f=a+u;this.ctx.lineTo(h,f),this.ctx.lineTo(r,a),this.ctx.fill(),this.ctx.restore()})),_p(this,"getAxisColor",((e,t,n)=>{const r=e.width,a=e.data,i=[];return i[0]=a[4*(n*r+t)],i[1]=a[4*(n*r+t)+1],i[2]=a[4*(n*r+t)+2],i[3]=a[4*(n*r+t)+3],i})),_p(this,"setAxisColor",((e,t,n,r)=>{const a=e.width,i=e.data;i[4*(n*a+t)]=r[0],i[4*(n*a+t)+1]=r[1],i[4*(n*a+t)+2]=r[2],i[4*(n*a+t)+3]=r[3]})),_p(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),r=this.ctx.getImageData(t*this.ratio,n*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),a=r.width,i=r.height,l=a/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<l;t++){const n=this.getAxisColor(r,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let a=0;a<this.degreeOfBlur;a++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(r,t*this.degreeOfBlur+i,e*this.degreeOfBlur+a,n)}this.ctx.putImageData(r,t*this.ratio,n*this.ratio)})),_p(this,"drawText",(e=>{const{x:t,y:n}=this.textInputPos;if(0===t&&0===n)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const r=this.fontSize*this.lineHeight,a=this.width-t,i=e.target.innerText,l=[];let o="";for(let e=0;e<i.length;e++){const t=o+i[e];this.ctx.measureText(t).width>a&&o.length>0?(l.push(o),o=i[e]):o=t}l.push(o),l.forEach(((e,a)=>{this.ctx.fillText(e,t+1,n+a*r+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),_p(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)})),_p(this,"drawPencil",(e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.restore()})),_p(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)})),_p(this,"drawEraser",(e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),_p(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),_p(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=n?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())})),_p(this,"setInputStyle",(()=>{if(!this._lastPoints.length)return;const{x:e,y:t}=this._lastPoints[0];this.textInput.style.left=e+"px",this.textInput.style.lineHeight=this.lineHeight.toString(),this.textInput.style.fontSize=this.fontSize+"px",this.textInput.style.color=this.penColor,this.textInput.style.top=t-Math.floor((this.textInput.offsetHeight-2)/2)+"px",this.textInputPos={x:e,y:t}})),_p(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),_p(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),_p(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),_p(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),_p(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),_p(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),_p(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),_p(this,"setDrawMode",(e=>{this.mode=e})),_p(this,"setLineWidth",(e=>{this.maxWidth=e})),_p(this,"setPenColor",(e=>{this.penColor=e})),_p(this,"setFontSize",(e=>{this.fontSize=e})),_p(this,"isEmpty",(()=>{const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this.canvas.width,e.height=this.canvas.height,1!==this.ratio&&t.scale(this.ratio,this.ratio),this.backgroundColor&&(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)),e.toDataURL()===this.canvas.toDataURL()})),_p(this,"toDataURL",((e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const n=document.createElement("canvas");return n.width=this.width,n.height=this.height,n.getContext("2d").drawImage(this.canvas,0,0,n.width,n.height),n.toDataURL(e,t)})),_p(this,"getPNG",(()=>this.toDataURL())),_p(this,"getJPG",((e=.8)=>this.toDataURL("image/jpeg",e))),this.initial(e,t)}initial(e,t={}){e&&(this.canvas=e,this.ctx=e.getContext("2d"),this.textInput=document.createElement("div"),this.width=t.width||e.clientWidth||this.width,this.height=t.height||e.clientHeight||this.height,this.penColor=t.penColor||this.penColor,this.fontSize=t.fontSize||this.fontSize,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this.backgroundColor=this.openSmooth&&t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,a,i=0,l=null;const o=()=>{i=Date.now(),l=null,n=e.apply(r,a),l||(r=null,a=[])};return function(...s){const c=Date.now(),d=t-(c-i);return r=this,a=s,d<=0||d>t?(l&&(clearTimeout(l),l=null),i=c,n=e.apply(r,a),l||(r=null,a=[])):l||(l=window.setTimeout(o,d)),n}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}_p(qp,"dataURLToBlob",(e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),a=r.length,i=new Uint8Array(a);for(let e=0;e<a;++e)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})})),_p(qp,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),_p(qp,"canvasToBlob",(e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}))));const Dp=qp,Hp=l().forwardRef(((e,t)=>{const{open:n,width:r,height:a,imageName:i,penColor:o,penMode:s,minWidth:d,maxWidth:u,backgroundColor:m,className:p,style:h,onOk:f,onCancel:g}=e,{t:y}=le(),b=l().useRef(),v=l().useRef(null),E=l().useRef(null),w=l().useRef(null),C=[2,4,6],S=[14,16,18,20,24,28],N=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[T,I]=ri(void 0,{value:n,postState:e=>e??!1}),R=l().useMemo((()=>!!e.children),[e.children]),[O,k]=l().useState(s||(R?"square":"line")),[L,P]=l().useState(C[0]),[A,F]=l().useState(R?N[0]:N[4]),[_,q]=l().useState(S[1]),[D,H]=l().useState("bottomLeft"),[$,M]=l().useState(!1),[z,V]=l().useState(!1);l().useEffect((()=>{const e={width:r??E.current?.offsetWidth,height:a??E.current?.offsetHeight,maxWidth:L,mode:O,penColor:A,fontSize:_,backgroundColor:m,openSmooth:!R};return e.openSmooth&&Object.assign(e,{penColor:o,minWidth:d,maxWidth:u}),b.current=new Dp(v.current,e),()=>b.current.destroy()}),[]);const j=e=>{const[t,n]=[r??E.current?.offsetWidth,a??E.current?.offsetHeight],{width:i,height:l}=b.current;let o=!1;t&&t!==i&&(b.current.width=t,o=!0),n&&n!==l&&(b.current.height=n,o=!0),(o||e)&&b.current.update()};qe((()=>{R&&T&&j()}),[T,R]),qe((()=>{b.current.setDrawMode(O)}),[O]),qe((()=>{b.current.setLineWidth(L)}),[L]),qe((()=>{b.current.setPenColor(A)}),[A]),qe((()=>{b.current.setFontSize(_)}),[_]);const W=async()=>{const e=R?E.current.parentNode:v.current;if(e)try{const t=await Lp()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===w.current||e.classList.contains("spinning")});return Dp.canvasToDataURL(t)}catch(e){ue("Signature","生成合成图片失败!")}},B=()=>{b.current.clear(),g?.()};l().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),CLEAR:()=>b.current.clear(),UNDO:()=>b.current.undo(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:j,GET_DATE_URL:W})));const U=e=>{e&&H((()=>{const e=w.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},G=e=>l().createElement("div",{className:ve()("ant-dropdown-menu","content")},"text"!==e?l().createElement("div",{className:"lineWidth"},C.map((e=>l().createElement("span",{key:e,className:ve()("dot",`s${e}`,{active:e===L}),onClick:()=>P(e)})))):l().createElement("div",{className:"fontSize"},l().createElement(K.Select,{size:"small",value:_,options:S.map((e=>({value:e,label:e.toString()}))),onChange:e=>q(e)})),l().createElement("span",{className:"divider"}),l().createElement("div",{className:"penColor"},N.map((e=>l().createElement("span",{key:e,className:ve()("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>F(e)},l().createElement(Ee.CheckOutlined,{className:"icon"})))))),Y=xe("signature"),X={[Y]:!0,"is-annotation":R},Q=r?{...h,width:r}:h;return l().createElement("div",{className:ve()(X,p),style:Q},R&&l().createElement(l().Fragment,null,l().createElement("div",{ref:E,className:"content"},e.children),z&&l().createElement(ut,{spinning:!0,className:"spinning"})),l().createElement("div",{className:ve()("signature",{show:T})},l().createElement("canvas",{ref:v,className:O}),R&&l().createElement("div",{ref:w,className:"signature__tool-bar"},l().createElement("div",{className:"wrapper"},l().createElement("div",{className:ve()("actions",{hidden:$})},l().createElement(K.Dropdown,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:U},l().createElement("button",{className:"btn",onClick:()=>k("square")},l().createElement(Ee.BorderOutlined,null))),l().createElement(K.Dropdown,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:U},l().createElement("button",{className:"btn",onClick:()=>k("round")},l().createElement(po,null))),l().createElement(K.Dropdown,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:U},l().createElement("button",{className:"btn",onClick:()=>k("arrow")},l().createElement(fo,null))),l().createElement(K.Dropdown,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:U},l().createElement("button",{className:"btn",onClick:()=>k("line")},l().createElement(Ee.EditOutlined,null))),l().createElement(K.Dropdown,{dropdownRender:()=>G("text"),overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:U},l().createElement("button",{className:"btn",onClick:()=>k("text")},l().createElement(ho,null))),l().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{V(!0);const e=await W();if(e){const t=i?i.slice(0,i.lastIndexOf(".")>0?i.lastIndexOf("."):void 0):c()().format(Ba);qt(Dp.dataURLToBlob(e),`${t}.png`)}V(!1)})(),B()}},l().createElement(Ee.DownloadOutlined,null)),l().createElement("button",{className:"btn",onClick:()=>k("eraser")},l().createElement(go,null)),l().createElement("button",{className:"btn",onClick:()=>b.current.undo()},l().createElement(yo,null)),l().createElement("button",{className:"btn",onClick:()=>b.current.clear()},l().createElement(Ee.ClearOutlined,null)),l().createElement("span",{className:"divider"}),l().createElement("button",{className:"btn",onClick:()=>g?.()},l().createElement(Ee.CloseOutlined,null)),l().createElement("button",{className:"btn",onClick:async()=>{V(!0),await x(10);const e=await W();V(!1),B(),f?.(e)}},l().createElement(Ee.CheckOutlined,null))),l().createElement("button",{className:"btn btn-fold",title:y($?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!$)},$?l().createElement(Ee.LeftOutlined,null):l().createElement(Ee.RightOutlined,null))))))}));Hp.displayName="QmSignature";const $p=Hp,Mp="1.12.11";return a})()));
|