@jiaozhiye/qm-design-react 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/lib/_utils/resize-event.d.ts +2 -2
  2. package/lib/_utils/types.d.ts +15 -15
  3. package/lib/anchor/src/anchor-item.d.ts +3 -3
  4. package/lib/anchor/src/anchor-nav.d.ts +2 -2
  5. package/lib/anchor/src/anchor.d.ts +5 -5
  6. package/lib/antd/TimePicker.d.ts +1 -1
  7. package/lib/button/src/button.d.ts +4 -4
  8. package/lib/collapse/src/collapse.d.ts +2 -2
  9. package/lib/config-provider/context.d.ts +1 -1
  10. package/lib/config-provider/src/config-provider.d.ts +4 -4
  11. package/lib/copy-to-clipboard/src/copy-to-clipboard.d.ts +2 -2
  12. package/lib/countup/src/countup.d.ts +3 -3
  13. package/lib/cropper/src/cropper.d.ts +4 -4
  14. package/lib/divider/src/divider.d.ts +4 -4
  15. package/lib/download/src/download.d.ts +9 -9
  16. package/lib/drawer/src/drawer.d.ts +6 -6
  17. package/lib/empty/src/empty.d.ts +3 -3
  18. package/lib/form/src/context.d.ts +1 -1
  19. package/lib/form/src/fields-filter.d.ts +4 -4
  20. package/lib/form/src/form-cascader.d.ts +3 -3
  21. package/lib/form/src/form-checkbox-group.d.ts +3 -3
  22. package/lib/form/src/form-checkbox.d.ts +2 -2
  23. package/lib/form/src/form-city-select.d.ts +2 -2
  24. package/lib/form/src/form-date.d.ts +2 -2
  25. package/lib/form/src/form-divider.d.ts +2 -2
  26. package/lib/form/src/form-immediate.d.ts +3 -3
  27. package/lib/form/src/form-input-number.d.ts +2 -2
  28. package/lib/form/src/form-input.d.ts +2 -2
  29. package/lib/form/src/form-item-view.d.ts +1 -1
  30. package/lib/form/src/form-multiple-search-helper.d.ts +3 -3
  31. package/lib/form/src/form-multiple-tree-table-helper.d.ts +3 -3
  32. package/lib/form/src/form-radio.d.ts +3 -3
  33. package/lib/form/src/form-range-date.d.ts +2 -2
  34. package/lib/form/src/form-range-input-number.d.ts +2 -2
  35. package/lib/form/src/form-range-input.d.ts +2 -2
  36. package/lib/form/src/form-range-search-helper.d.ts +3 -3
  37. package/lib/form/src/form-range-time.d.ts +2 -2
  38. package/lib/form/src/form-rate.d.ts +2 -2
  39. package/lib/form/src/form-region-select.d.ts +2 -2
  40. package/lib/form/src/form-search-helper.d.ts +3 -3
  41. package/lib/form/src/form-select.d.ts +3 -3
  42. package/lib/form/src/form-switch.d.ts +2 -2
  43. package/lib/form/src/form-text-area.d.ts +2 -2
  44. package/lib/form/src/form-time.d.ts +2 -2
  45. package/lib/form/src/form-tinymce.d.ts +2 -2
  46. package/lib/form/src/form-tree-select.d.ts +3 -3
  47. package/lib/form/src/form-tree-table-helper.d.ts +3 -3
  48. package/lib/form/src/form-upload-file.d.ts +2 -2
  49. package/lib/form/src/form-upload-img.d.ts +2 -2
  50. package/lib/form/src/form.d.ts +14 -13
  51. package/lib/form/src/types.d.ts +28 -25
  52. package/lib/form/style/index.less +1 -1
  53. package/lib/hooks/useDebounce.d.ts +1 -1
  54. package/lib/index.esm.js +2 -2
  55. package/lib/index.full.js +1 -1
  56. package/lib/index.js +2 -2
  57. package/lib/locale/index.d.ts +2 -2
  58. package/lib/locale/index.js +5 -5
  59. package/lib/modal/src/modal.d.ts +6 -6
  60. package/lib/print/src/container.d.ts +2 -2
  61. package/lib/print/src/context.d.ts +1 -1
  62. package/lib/print/src/preview.d.ts +3 -3
  63. package/lib/print/src/print.d.ts +6 -6
  64. package/lib/print/src/setting.d.ts +3 -3
  65. package/lib/range-table-helper/src/range-table-helper.d.ts +3 -3
  66. package/lib/search-helper/src/search-helper.d.ts +3 -3
  67. package/lib/search-tree/src/search-tree.d.ts +3 -3
  68. package/lib/space/src/space.d.ts +3 -3
  69. package/lib/spin/src/spin.d.ts +4 -4
  70. package/lib/split/src/context.d.ts +1 -1
  71. package/lib/split/src/resize-bar.d.ts +1 -1
  72. package/lib/split/src/split-pane.d.ts +2 -2
  73. package/lib/split/src/split.d.ts +2 -2
  74. package/lib/style/index.css +2 -2
  75. package/lib/style/index.min.css +1 -1
  76. package/lib/table/src/alert/index.d.ts +1 -1
  77. package/lib/table/src/body/index.d.ts +1 -1
  78. package/lib/table/src/body/useMergeCell.d.ts +2 -1
  79. package/lib/table/src/clipboard/index.d.ts +1 -1
  80. package/lib/table/src/clipboard/setting.d.ts +1 -1
  81. package/lib/table/src/column-filter/index.d.ts +1 -1
  82. package/lib/table/src/context/index.d.ts +1 -1
  83. package/lib/table/src/edit/InputNumber.d.ts +1 -1
  84. package/lib/table/src/edit/index.d.ts +1 -1
  85. package/lib/table/src/expandable/all.d.ts +1 -1
  86. package/lib/table/src/expandable/index.d.ts +1 -1
  87. package/lib/table/src/export/define.d.ts +1 -1
  88. package/lib/table/src/export/index.d.ts +2 -2
  89. package/lib/table/src/export/setting.d.ts +1 -1
  90. package/lib/table/src/export/useExport.d.ts +2 -2
  91. package/lib/table/src/fast-search/index.d.ts +1 -1
  92. package/lib/table/src/fast-search/setting.d.ts +1 -1
  93. package/lib/table/src/filter/index.d.ts +1 -1
  94. package/lib/table/src/footer/index.d.ts +1 -1
  95. package/lib/table/src/full-screen/index.d.ts +1 -1
  96. package/lib/table/src/group-summary/index.d.ts +1 -1
  97. package/lib/table/src/group-summary/result.d.ts +1 -1
  98. package/lib/table/src/group-summary/setting.d.ts +1 -1
  99. package/lib/table/src/header/index.d.ts +1 -1
  100. package/lib/table/src/hooks/useImperativeMethod.d.ts +1 -1
  101. package/lib/table/src/hooks/useTableCore.d.ts +1 -1
  102. package/lib/table/src/hooks/useTableEffect.d.ts +1 -1
  103. package/lib/table/src/hooks/useTableLayout.d.ts +1 -1
  104. package/lib/table/src/hooks/useTableMemo.d.ts +1 -1
  105. package/lib/table/src/hooks/useTableRef.d.ts +2 -2
  106. package/lib/table/src/hooks/useTableState.d.ts +1 -1
  107. package/lib/table/src/import/SelectFile.d.ts +1 -1
  108. package/lib/table/src/import/index.d.ts +1 -1
  109. package/lib/table/src/import/setting.d.ts +1 -1
  110. package/lib/table/src/manager/index.d.ts +1 -1
  111. package/lib/table/src/pager/index.d.ts +1 -1
  112. package/lib/table/src/print/index.d.ts +1 -1
  113. package/lib/table/src/reload/index.d.ts +1 -1
  114. package/lib/table/src/resizable/index.d.ts +1 -1
  115. package/lib/table/src/select-collection/index.d.ts +1 -1
  116. package/lib/table/src/select-collection/result.d.ts +1 -1
  117. package/lib/table/src/selection/all.d.ts +1 -1
  118. package/lib/table/src/selection/index.d.ts +1 -1
  119. package/lib/table/src/store/index.d.ts +2 -2
  120. package/lib/table/src/super-search/index.d.ts +1 -1
  121. package/lib/table/src/super-search/result.d.ts +1 -1
  122. package/lib/table/src/table/index.d.ts +1 -1
  123. package/lib/table/src/table/props.d.ts +5 -5
  124. package/lib/table/src/table/types.d.ts +45 -45
  125. package/lib/table/src/toolbox/index.d.ts +1 -1
  126. package/lib/tabs/src/tab-pane.d.ts +4 -4
  127. package/lib/tabs/src/tabs.d.ts +3 -3
  128. package/lib/tinymce/src/Events.d.ts +2 -2
  129. package/lib/tinymce/src/ScriptLoader.d.ts +1 -1
  130. package/lib/tinymce/src/Utils.d.ts +1 -1
  131. package/lib/tinymce/src/components/Editor.d.ts +1 -1
  132. package/lib/tinymce/src/components/EditorPropTypes.d.ts +2 -2
  133. package/lib/tinymce/src/index.d.ts +3 -3
  134. package/lib/tree-helper/src/tree-helper.d.ts +2 -2
  135. package/lib/tree-table-helper/src/tree-table-helper.d.ts +3 -3
  136. package/lib/upload-file/src/upload-file.d.ts +5 -5
  137. package/lib/upload-img/src/cropper-preview.d.ts +4 -4
  138. package/lib/upload-img/src/upload-img.d.ts +5 -5
  139. package/package.json +19 -19
package/lib/index.full.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={787:t=>{t.exports=e}},l={};function n(e){var a=l[e];if(void 0!==a)return a.exports;var r=l[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var l in t)n.o(t,l)&&!n.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{n.r(a),n.d(a,{Affix:()=>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:()=>H,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:()=>q,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:()=>At,QmButton:()=>he,QmCollapse:()=>qe,QmConfigProvider:()=>G,QmCopyToClipboard:()=>ks,QmCountup:()=>it,QmCropper:()=>Dr,QmDivider:()=>Ne,QmDownload:()=>vt,QmDrawer:()=>Vt,QmEmpty:()=>dt,QmForm:()=>pr,QmModal:()=>Wt,QmPrint:()=>wc,QmRangeTableHelper:()=>oc,QmSearchHelper:()=>Gs,QmSearchTree:()=>oi,QmSpace:()=>ve,QmSpin:()=>pt,QmSplit:()=>et,QmTable:()=>Us,QmTabs:()=>_t,QmTinymce:()=>kr,QmTreeHelper:()=>lc,QmTreeTableHelper:()=>ec,QmUploadFile:()=>jr,QmUploadImg:()=>Xr,Radio:()=>R.Radio,Rate:()=>R.Rate,Result:()=>R.Result,Row:()=>R.Row,Select:()=>R.Select,Skeleton:()=>R.Skeleton,Slider:()=>R.Slider,Space:()=>R.Space,Spin:()=>R.Spin,Statistic:()=>R.Statistic,Steps:()=>R.Steps,Switch:()=>R.Switch,Tabs:()=>R.Tabs,Tag:()=>R.Tag,TimePicker:()=>K,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:()=>ha,version:()=>Ic});var e=n(787),t=n.n(e);const l=require("prop-types");var r=n.n(l);const i=(0,e.createContext)({locale:"zh-cn",size:"middle"}),o=require("dayjs");var s=n.n(o);const c={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传"},uploadCropper:{dragableText:"拖放或点击",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},mergeCell:{cancel:"恢复",confirm:"合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let d=c;function u(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,l)=>t[l])):e}const p=function(){for(var e=arguments.length,t=new Array(e),l=0;l<e;l++)t[l]=arguments[l];const[n,a]=t;let r;const i=n.split(".");let o=d;for(let e=0,t=i.length;e<t;e++){if(r=o[i[e]],e===t-1)return u(r,a);if(!r)return"";o=r}return""},h=e=>{d=e||d,d.name&&s().locale(d.name)};class m extends Error{constructor(e){super(e),this.name="QmDesignError"}}function f(e,t){throw new m(`[${e}] ${t}`)}function g(e,t){console.warn(new m(`[${e}] ${t}`))}const b=e=>["","small","middle","large"].includes(e),y=require("dayjs/plugin/localeData");var v=n.n(y);const x=require("dayjs/plugin/advancedFormat");var E=n.n(x);const C=require("dayjs/plugin/customParseFormat");var S=n.n(C);const w=require("dayjs/plugin/quarterOfYear");var I=n.n(w);const N=require("dayjs/plugin/weekOfYear");var T=n.n(N);s().extend(v()),s().extend(E()),s().extend(S()),s().extend(I()),s().extend(T());const R=require("antd"),O=require("rc-picker/es/generate/dayjs");var A=n.n(O);const P=require("antd/es/calendar/generateCalendar");var F=n.n(P);require("antd/es/calendar/style");const H=F()(A()),k=require("antd/es/date-picker/generatePicker");var L=n.n(k);require("antd/es/date-picker/style/index");const q=L()(A());function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},_.apply(this,arguments)}const $=e.forwardRef(((t,l)=>e.createElement(q,_({},t,{picker:"time",mode:void 0,ref:l}))));$.displayName="TimePicker";const D=e.forwardRef(((t,l)=>e.createElement(q.RangePicker,_({},t,{picker:"time",mode:void 0,ref:l}))));D.displayName="RangePicker",$.RangePicker=D;const K=$,V={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload"},uploadCropper:{dragableText:"Drop or click",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},mergeCell:{cancel:"reset",confirm:"merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},M=require("antd/lib/locale/zh_CN");var j=n.n(M);const z=require("antd/lib/locale/en_GB");function U(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const B={[V.name]:{qm:V,antd:n.n(z)()},[c.name]:{qm:c,antd:j()}};class W extends e.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},h(B[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:l,size:n}=t.value,{locale:a,size:r}=e;return a!==l&&h(B[a].qm),a!==l||r!==n?{value:Object.assign({},t.value,{locale:a,size:r})}:null}render(){const{global:e}=this.props,{value:l}=this.state;return t().createElement(i.Provider,{value:l},t().createElement(R.ConfigProvider,{locale:B[l.locale].antd,componentSize:l.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}U(W,"propTypes",{locale:r().string,size:(e,t,l)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")},theme:r().string,global:r().object}),U(W,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const G=W,Y=require("omit.js");var X=n.n(Y);const Q=require("lodash-es"),Z="undefined"==typeof window,J=e=>t().isValidElement(e),ee=e=>J(e)&&e.type===t().Fragment,te=()=>{},le=()=>!0,ne=async e=>new Promise((t=>setTimeout(t,e))),ae=e=>{Promise.resolve().then(e)},re=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),ie=e=>!!(!e&&0!==e||(0,Q.isArray)(e)&&!e.length||(0,Q.isPlainObject)(e)&&!Object.keys(e).length);function oe(e,t){let l=-1;const n=e.length;for(;++l<n;)t(e[l],l);return e}const se=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,Q.isPlainObject)(e)||(0,Q.isArray)(e)){const l=Array.isArray(e),n=l?[]:{};if(t.get(e))return e;t.set(e,n);const a=l?void 0:Object.keys(e);return oe(a||e,((l,r)=>{a&&(r=l),n[r]=se(e[r],t)})),n}return e},ce=e=>(0,Q.isNumber)(e)?`${e}px`:e.toString();function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},de.apply(this,arguments)}function ue(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class pe extends e.Component{constructor(){super(...arguments),ue(this,"state",{isLoading:!1}),ue(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{var t,l;await(null===(t=(l=this.props).click)||void 0===t?void 0:t.call(l,e))}catch(e){g("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:l,authConfig:n,click:a,confirm:r}=this.props,{isLoading:i}=this.state,o=e||this.context.size||"",s=(0,Q.isFunction)(a)?{onClick:this.clickHandle}:null,c={...X()(this.props,["authConfig","click","confirm"]),size:o,loading:i||l||!1,...s};if(n){const{visible:e=1,disabled:t}=n||{};if(!e)return null;t&&(c.disabled=!0)}return r?t().createElement(R.Popconfirm,{title:r.title||p("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{var t,l;null===(t=r.onConfirm)||void 0===t||t.call(r),null===(l=c.onClick)||void 0===l||l.call(c,e)},onCancel:e=>{var t;null===(t=r.onCancel)||void 0===t||t.call(r,e)}},t().createElement(R.Button,de({},c,{onClick:te}),this.props.children)):t().createElement(R.Button,c,this.props.children)}}ue(pe,"propTypes",{click:r().func,confirm:r().shape({title:r().node,onConfirm:r().func,onCancel:r().func})}),ue(pe,"contextType",i);const he=pe;var me,fe,ge,be;!function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(me||(me={}));class ye extends e.Component{render(){const{size:e}=this.props,l=e||this.context.size||"",n=(0,Q.isNumber)(e)?e:me[e||l||"default"],a={...this.props,size:n};return t().createElement(R.Space,a,this.props.children)}}be=i,(ge="contextType")in(fe=ye)?Object.defineProperty(fe,ge,{value:be,enumerable:!0,configurable:!0,writable:!0}):fe[ge]=be;const ve=ye,xe=require("classnames");var Ee=n.n(xe);const Ce=e=>`qm-${e}`,Se=require("@ant-design/icons");function we(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Ie extends e.Component{constructor(){super(...arguments),we(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=te}=this.props;t(!e)}))}render(){const{size:e,label:l,extra:n,collapse:a,disabled:r,className:i,style:o,id:s}=this.props,c=e||this.context.size||"",d=Ce("divider"),u={[d]:!0,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c};return t().createElement("div",{id:s,className:Ee()(u,i),style:o},t().createElement("span",{className:Ee()(`${d}__title`)},l),t().createElement("div",{className:Ee()(`${d}__extra`)},n),void 0!==a&&t().createElement(R.Button,{type:"link",className:Ee()(`${d}__collapse`),disabled:r,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(Se.UpOutlined,null):t().createElement(Se.DownOutlined,null)))}}we(Ie,"propTypes",{label:r().string,size:(e,t,l)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")},extra:r().oneOfType([r().element,r().string]),collapse:r().bool}),we(Ie,"contextType",i);const Ne=Ie,Te=()=>({height:0,opacity:0}),Re=(e,t)=>"height"===t.propertyName,Oe={motionName:"rc-collapse-motion",onEnterStart:Te,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Te,onEnterEnd:Re,onLeaveEnd:Re,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},Ae=require("rc-motion");var Pe=n.n(Ae);const Fe=t().forwardRef(((e,l)=>{const{forceRender:n,className:a,style:r,boxStyle:i,isActive:o}=e,[s,c]=t().useState(o||n);if(t().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const d=Ce("collapse");return t().createElement("div",{ref:l,className:Ee()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},a),style:r},t().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));Fe.displayName="PanelContent";const He=Fe;function ke(){return ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},ke.apply(this,arguments)}const Le=e=>{const{defaultActive:l,label:n,extra:a,className:r,style:i,containerStyle:o,disabled:s,forceRender:c,destroyOnClose:d=!1,onChange:u}=e,[p,h]=t().useState(!!l),m=Ce("collapse"),f=Ee()({[`${m}`]:!0,[`${m}-active`]:p,[`${m}-disabled`]:s},r);return t().createElement("div",{className:f,style:i},t().createElement(Ne,{label:n,extra:a,collapse:p,disabled:s,onCollapseChange:e=>{h(e),null==u||u(e)}}),t().createElement(Pe(),ke({visible:p},Oe,{leavedClassName:`${m}-content-hidden`,forceRender:c,removeOnLeave:d}),((l,n)=>{let{className:a,style:r}=l;return t().createElement(He,{ref:n,prefixCls:m,className:a,style:r,boxStyle:o,isActive:p,forceRender:c},e.children)})))};Le.displayName="QmCollapse";const qe=Le,_e=t().createContext(void 0);function $e(t,l){const n=e.useRef(!1);e.useEffect((()=>{n.current?t():n.current=!0}),l)}const De=require("react-draggable");var Ke=n.n(De);const Ve=(e,t,l)=>{e&&t&&l&&e.addEventListener(t,l,!1)},Me=(e,t,l)=>{e&&t&&l&&e.removeEventListener(t,l,!1)},je=e=>e.stopPropagation(),ze=e=>e.preventDefault(),Ue=(e,t,l)=>{!Z&&e&&t&&((0,Q.isPlainObject)(t)?Object.keys(t).forEach((l=>{Ue(e,l,t[l])})):(t=re(t),e.style[t]=l))},Be=e=>{let t=0,l=e;for(;l;)t+=l.offsetTop,l=l.offsetParent;return t},We=(e,t)=>{let l=e;for(;l;){var n;if(null!==(n=l.classList)&&void 0!==n&&n.contains(t))return l;l=l.parentNode}return null},Ge=e=>{const{minValues:l,onDragChange:n,onDragging:a}=e,{splitRef:r,direction:i}=t().useContext(_e),[o,s]=t().useState(),[c,d]=t().useState(0),u="vertical"===i?"y":"x",h={[`${Ce("split")}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return t().createElement(Ke(),{bounds:o,axis:u,position:{x:0,y:0},positionOffset:{[u]:-1*c},onStart:()=>{n(!0),(()=>{const e=r.current.children[0];if(!e)return;const t=(()=>{const{w:e,h:t}={w:r.current.offsetWidth,h:r.current.offsetHeight};return[l[0],("vertical"===i?t:e)-l[1]]})(),n=e.offsetWidth,a=e.offsetHeight;s({left:t[0]-n,right:t[1]-n,top:t[0]-a,bottom:t[1]-a})})()},onDrag:(e,t)=>{d(t[u]),a(t[u])},onStop:()=>n(!1)},t().createElement("div",{className:Ee()(h),title:p("qm.split.resize")}))};Ge.displayName="ResizeBar";const Ye=Ge,Xe=t().forwardRef(((e,l)=>{const{offset:n,className:a,style:r}=e,{direction:i,dragging:o}=t().useContext(_e),s="vertical"===i?"height":"width",c={[Ce("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===i,vertical:"vertical"===i,[a]:!!a},d=void 0!==n?{[s]:ce(n)}:{flex:1,[s]:0};return t().createElement("div",{ref:l,className:Ee()(c),style:{...d,...r}},e.children)}));Xe.displayName="QmSplitPane";const Qe=Xe;function Ze(){return Ze=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Ze.apply(this,arguments)}const Je=e=>{const{direction:l="horizontal",defaultValue:n="50%",uniqueKey:a,className:r,style:o,onDragStart:s,onDrag:c=te,onDragEnd:d}=e,{global:u}=t().useContext(i),p=t().useRef(null),h=t().useRef(null),m=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=>{var t;const l=Number.parseInt((null===(t=e.props)||void 0===t?void 0:t.min)||0);return l>=0?l:0},b=t().useMemo((()=>a?`split_${a}`:""),[a]),[y,v]=t().useState(!1),[x,E]=t().useState(m(n)),C=t().useRef(0);$e((()=>{y?(C.current="vertical"===l?h.current.offsetHeight:h.current.offsetWidth,null==s||s(f(x))):(null==d||d(f(x)),localStorage.setItem(b,x),I(b,x))}),[y]),t().useEffect((()=>{S()}),[]);const S=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(m(e)):w(b).then((e=>{localStorage.setItem(b,m(e||n)),S()})).catch((()=>{}))},w=async e=>{const t=null==u?void 0:u.getComponentConfigApi;if(t)try{const l=await t({key:e});if(200===l.code)return l.data}catch(e){}},I=async(e,t)=>{const l=null==u?void 0:u.saveComponentConfigApi;if(l)try{await l({[e]:t})}catch(e){}},N=t().useMemo((()=>({splitRef:p,direction:l,dragging:y})),[l,y]),T=[];t().Children.map(e.children,(e=>{var t;J(e)&&!ee(e)&&"QmSplitPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&T.push(e)}));const[R,O]=T,A=t().useMemo((()=>[g(R),g(O)]),[R,O]),P={[Ce("split")]:!0,vertical:"vertical"===l};return t().createElement(_e.Provider,{value:N},t().createElement("div",{ref:p,className:Ee()(P,r),style:o},t().createElement(Qe,Ze({},R.props,{ref:h,offset:x})),t().createElement(Ye,{minValues:A,onDragChange:e=>v(e),onDragging:e=>{const t=C.current+e;E(`${t}px`),c(t)}}),t().createElement(Qe,O.props)))};Je.Pane=Qe,Je.displayName="QmSplit";const et=Je,tt=require("react-countup");var lt=n.n(tt);function nt(){return nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},nt.apply(this,arguments)}function at(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class rt extends e.Component{render(){const{size:e,className:l,style:n}=this.props,a=e||this.context.size||"",r=Ce("countup"),i={[r]:!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a};return t().createElement(lt(),nt({},this.props,{className:Ee()(i,l),style:n}),this.props.children)}}at(rt,"defaultProps",{duration:2}),at(rt,"contextType",i);const it=rt;function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},ot.apply(this,arguments)}function st(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class ct extends e.Component{render(){const{size:e,className:l}=this.props,n=e||this.context.size||"",a=Ce("empty"),r={...this.props,image:R.Empty.PRESENTED_IMAGE_SIMPLE},i={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return t().createElement(R.Empty,ot({},r,{className:Ee()(i,l)}))}}st(ct,"contextType",i),st(ct,"propTypes",{size:(e,t,l)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")}});const dt=ct;class ut extends e.Component{render(){const{fullHeight:e,style:l={}}=this.props,n={[`${Ce("spin")}-full-height`]:e},a={wrapperClassName:Ee()(n),...X()(this.props,["fullHeight"]),style:{...l,maxHeight:"none"}};return t().createElement(R.Spin,a,this.props.children)}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(ut,"defaultProps",{tip:"Loading...",fullHeight:!1});const pt=ut,ht=require("axios");var mt=n.n(ht);const ft=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const l=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=l,n.download=decodeURI(t),n.click(),n=null}};function gt(){return gt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},gt.apply(this,arguments)}function bt(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class yt extends e.Component{constructor(){super(...arguments),bt(this,"state",{loading:!1}),bt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{var e,t;const{action:l,beforeDownload:n=le}=this.props,a=(0,Q.isString)(l)?l:await this.getActionUrl();if(!a)return g("Download","参数 `action` 有误!");if(!n(a))return;await this.downloadFile(a),await ne(100),null===(e=(t=this.props).onSuccess)||void 0===e||e.call(t),R.message.success(p("qm.download.success"))}catch(e){var l,n;null===(l=(n=this.props).onError)||void 0===l||l.call(n,e),R.message.error(p("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}async downloadFile(e){const{fileName:t,headers:l,params:n,withCredentials:a}=this.props,r=await mt()({url:e,params:n,headers:l,withCredentials:a,responseType:"blob"}),i=r.data,o=r.headers["content-disposition"],s=t||(o?o.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));ft(i,s)}render(){const{size:e}=this.props,{loading:l}=this.state,n=e||this.context.size||"",a=X()(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t().createElement(R.Button,gt({},a,{size:n,loading:l,onClick:this.downloadHandle}),this.props.children)}}bt(yt,"propTypes",{action:r().oneOfType([r().string,r().shape({api:r().func.isRequired,params:r().object})]),size:(e,t,l)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")},fileName:r().string,headers:r().object,withCredentials:r().bool,params:r().object,beforeDownload:r().func,onSuccess:r().func,onError:r().func}),bt(yt,"defaultProps",{icon:t().createElement(Se.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),bt(yt,"contextType",i);const vt=yt,xt=require("add-dom-event-listener");var Et=n.n(xt);const Ct=require("scroll-into-view-if-needed");var St=n.n(Ct);class wt extends e.Component{renderLabel(){const{activeKey:e,labels:l,onTabClick:n}=this.props;return l.map(((l,a)=>{const r={item:!0,actived:a===e};return t().createElement("div",{key:a,className:Ee()(r),onClick:e=>n(a,e)},t().createElement("span",null,l))}))}render(){return t().createElement(t().Fragment,null,this.renderLabel())}}const It=wt;class Nt extends e.Component{render(){const{label:e,showDivider:l,className:n,style:a}=this.props,r={[Ce("anchor-item")]:!0};return t().createElement("div",{className:Ee()(r,n),style:a},l&&t().createElement(Ne,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(Nt,"displayName","QmAnchorItem");const Tt=Nt;function Rt(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Ot extends e.Component{constructor(){super(...arguments),Rt(this,"currentState","ready"),Rt(this,"itemsTotal",void 0),Rt(this,"timer",void 0),Rt(this,"scrollEvent",void 0),Rt(this,"scrollRef",(0,e.createRef)()),Rt(this,"state",{activeKey:0}),Rt(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),Rt(this,"onTabClickHandle",(e=>{const{labelList:t=[]}=this.props,l=this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e];l&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),St()(l,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),Rt(this,"SCROLL_TO_ITEM",(e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)}))}get __is_conf(){var e;return!(null===(e=this.props.labelList)||void 0===e||!e.length)}componentDidMount(){this.scrollEvent=Et()(this.scrollRef.current,"scroll",(0,Q.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}createDistances(){var e;const{labelList:t=[]}=this.props;return(this.__is_conf?t.map((e=>document.getElementById(e.id))):Array.from((null===(e=this.scrollRef.current)||void 0===e?void 0:e.children)||[])).map((e=>((e,t)=>Math.abs(Be(e)-Be(t)))(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),l=this.createDistances();let n=-1;for(let e=0;e<l.length;e++){const a=l[e],r=l[e+1]||1e4;t>=a-1&&t<r&&(n=e)}return n}render(){const{activeKey:e}=this.state,{size:l,labelWidth:n,tabPosition:a,labelList:r=[],onTabClick:i,className:o,style:s}=this.props,c=l||this.context.size||"",d=Ce("anchor"),u={[d]:!0,[`${d}-left`]:"left"===a,[`${d}-top`]:"top"===a,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];t().Children.map(this.props.children,(e=>{var t;J(e)&&!ee(e)&&"QmAnchorItem"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&p.push(e)}));const h=this.__is_conf?r.map((e=>e.label)):p.map((e=>e.props.label)),m=this.__is_conf?r.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=h.length,t().createElement("div",{className:Ee()(u,o),style:s},t().createElement("div",{className:Ee()("anchor-nav"),style:{width:n?ce(n):""}},t().createElement(It,{activeKey:e,labels:h,onTabClick:(e,t)=>{this.onTabClickHandle(e),null==i||i({label:h[e],id:m[e]},t)}})),t().createElement("div",{ref:this.scrollRef,className:Ee()("anchor-container")},this.__is_conf?this.props.children:p))}}Rt(Ot,"Item",Tt),Rt(Ot,"propTypes",{size:(e,t,l)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")},labelWidth:(e,t,l)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return f("Anchor","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.");var n},labelList:r().arrayOf(r().shape({id:r().string,label:r().string}))}),Rt(Ot,"defaultProps",{tabPosition:"left"}),Rt(Ot,"contextType",i);const At=Ot,Pt=function(e){if(!t().isValidElement(e))return null;for(var l=arguments.length,n=new Array(l>1?l-1:0),a=1;a<l;a++)n[a-1]=arguments[a];return t().cloneElement(e,...n)};class Ft extends e.Component{render(){return t().createElement(R.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(Ft,"displayName","QmTabPane");const Ht=Ft;function kt(){return kt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},kt.apply(this,arguments)}function Lt(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class qt extends e.Component{render(){const{size:e,className:l,authConfig:n}=this.props,a=e||this.context.size||"",r=Ce("tabs"),i={[r]:!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a},o={...X()(this.props,["authConfig"]),size:a},s=[];if(t().Children.map(this.props.children,(e=>{var t;J(e)&&!ee(e)&&"QmTabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&s.push(e)})),n){const{fieldList:e=[]}=n||{};for(let t=0;t<s.length;t++){const l=s[t],n=e.find((e=>e.dataIndex===l.key)),{visible:a=1,disabled:r}=n||{};a?r&&(s[t]=Pt(l,{disabled:!0})):(s.splice(t,1),t--)}}return t().createElement(R.Tabs,kt({},o,{className:Ee()(i,l)}),s)}}Lt(qt,"TabPane",Ht),Lt(qt,"contextType",i),Lt(qt,"defaultProps",{tabBarGutter:10});const _t=qt;function $t(){return $t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},$t.apply(this,arguments)}function Dt(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Kt extends e.Component{constructor(){super(...arguments),Dt(this,"titleRef",t().createRef()),Dt(this,"$drawer",null),Dt(this,"opened",!1),Dt(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),Dt(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;var l,n;e?(this.opened=!0,(0,Q.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(null===(l=(n=this.props).onClosed)||void 0===l||l.call(n),this.setState({fullscreen:!1}))})),Dt(this,"toggleHandle",(()=>{this.$drawer=We(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{var e,t;null===(e=(t=this.props).onFullChange)||void 0===e||e.call(t,this.state.fullscreen)}))})),Dt(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),Dt(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:l,loading:n,destroyOnClose:a}=this.props,{fullscreen:r}=this.state;l&&l!==e.visible&&(!a&&this.opened||(0,Q.isUndefined)(n)&&this.setState({spinning:!0})),this.$drawer&&r!==t.fullscreen&&Ue(this.$drawer,r?{width:"100%"}:{width:ce(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{showFullScreen:l}=this.props;return t().createElement(t().Fragment,null,t().createElement("span",{ref:this.titleRef,className:Ee()("text")},this.props.title),l&&t().createElement("span",{className:Ee()("full-screen"),onClick:this.toggleHandle},t().createElement(e?Se.FullscreenExitOutlined:Se.FullscreenOutlined)))}render(){const{spinning:e,sloading:l}=this.state,{size:n,className:a,loading:r,maskClosable:i,onClose:o}=this.props,s=this.context.global,c=n||this.context.size||"",d=Ce("drawer"),u={[d]:!0,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c};return t().createElement(R.Drawer,$t({},X()(this.props,["size","showFullScreen","loading","maskClosable","onClosed"]),{maskClosable:i??(null==s?void 0:s.maskClosable)??!1,className:Ee()(u,a),title:this.renderTitle(),footer:null,onClose:o,afterVisibleChange:this.afterVisibleChange}),this.props.children,(r||l||e)&&t().createElement(pt,{spinning:!0,className:Ee()(`${d}-spin`)}))}}Dt(Kt,"contextType",i),Dt(Kt,"propTypes",{size:(e,t,l)=>{if(!b(e[t]||""))return f("Drawer","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")},spinning:r().bool}),Dt(Kt,"defaultProps",{width:"72%",showFullScreen:!0,destroyOnClose:!0,footer:null});const Vt=Kt;function Mt(){return Mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Mt.apply(this,arguments)}function jt(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const zt="10vh";var Ut;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small"}(Ut||(Ut={}));class Bt extends e.Component{constructor(){super(...arguments),jt(this,"$event",null),jt(this,"draggleRef",t().createRef()),jt(this,"opened",!1),jt(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),jt(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=Et()(document.body,"mousedown",je))})),jt(this,"removeMouseDownEvent",(()=>{var e;this.$event&&(null===(e=this.$event)||void 0===e||e.remove(),this.$event=null)})),jt(this,"onStart",((e,t)=>{const{clientWidth:l,clientHeight:n}=window.document.documentElement,a=this.draggleRef.current.getBoundingClientRect();a&&this.setState({bounds:{left:-a.left+t.x,right:l-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1}})})),jt(this,"toggleHandle",(e=>{const t=We(e.target,"ant-modal");if(!t)return;const l=t.querySelector(".ant-modal-body"),{height:n}=this.props,{fullscreen:a}=this.state;a?(Ue(t,{width:ce(this.props.width||"60%"),height:"auto",top:zt}),Ue(l,{height:n?ce(n):this.defaultHeight,maxHeight:"auto"===n?this.defaultHeight:""})):(Ue(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Ue(l,{height:`calc(100vh - ${Ut[this.$size]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{var e,t;null===(e=(t=this.props).onFullChange)||void 0===e||e.call(t,this.state.fullscreen)}))})),jt(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;null==e||e(),this.setState({fullscreen:!1})})),jt(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),jt(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - 10vh - 10vh - ${Ut[this.$size]}px)`}componentDidUpdate(e,t){const{visible:l,loading:n,stopMouseDownEvent:a,destroyOnClose:r}=this.props,{fullscreen:i}=this.state;if(l&&l!==e.visible){if(!r&&this.opened||(0,Q.isUndefined)(n)&&this.setState({spinning:!0}),a&&this.addMouseDownEvent(),!r&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,Q.isUndefined)(n)&&this.setState({spinning:!1})}),400)}l||this.removeMouseDownEvent(),i!==t.fullscreen&&(i?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:l}=this.state,{showFullScreen:n}=this.props;return t().createElement("div",{onMouseOver:()=>{l&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},t().createElement("span",{className:Ee()("text")},this.props.title),n&&t().createElement("span",{className:Ee()("full-screen"),onClick:this.toggleHandle},t().createElement(e?Se.FullscreenExitOutlined:Se.FullscreenOutlined)))}render(){const{spinning:e,sloading:l,fullscreen:n,disabled:a,bounds:r,position:i}=this.state,{height:o,className:s,loading:c,draggable:d,maskClosable:u,bodyStyle:p,onClose:h}=this.props,m=this.context.global,f=Ce("modal"),g={height:o?ce(o):this.defaultHeight,maxHeight:"auto"===o?this.defaultHeight:"",overflow:"auto"},b={[f]:!0,[`${f}--lg`]:"large"===this.$size,[`${f}--sm`]:"small"===this.$size};return t().createElement(R.Modal,Mt({},X()(this.props,["showFullScreen","loading","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{maskClosable:u??(null==m?void 0:m.maskClosable)??!1,className:Ee()(b,s),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},g,p),onCancel:h,afterClose:this.afterVisibleChange,modalRender:e=>t().createElement(Ke(),{disabled:!d||a||n,bounds:r,position:i,onStart:(e,t)=>this.onStart(e,t)},t().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(c||l||e)&&t().createElement(pt,{spinning:!0,className:Ee()(`${f}-spin`)}))}}jt(Bt,"contextType",i),jt(Bt,"propTypes",{size:(e,t,l)=>{if(!b(e[t]||""))return f("Modal","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")},spinning:r().bool}),jt(Bt,"defaultProps",{width:"60%",showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:zt}});const Wt=Bt,Gt=require("memoize-one");var Yt=n.n(Gt);const Xt=(0,e.createContext)(void 0),Qt=require("resize-observer-polyfill");var Zt=n.n(Qt);const Jt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},el=function(e,t){!Z&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(Zt())(Jt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},tl=function(e,t){var l;e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||null===(l=e.__ro__)||void 0===l||l.disconnect())},ll=80,nl="1",al="0",rl=400,il=["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"],ol={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let sl,cl,dl;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(sl||(sl={})),function(e){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"}(cl||(cl={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(dl||(dl={}));const ul={items:r().arrayOf(r().shape({type:r().string.isRequired,fieldName:r().string.isRequired})),initialValues:r().object,initialExtras:r().object,layout:r().oneOf(["horizontal","vertical"]),size:(e,t,l)=>{if(!b(e[t]||""))return f("Form","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")},cols:r().number,customClass:r().string,compactMode:r().bool,labelWidth:r().oneOfType([r().number,r().string]),labelAlign:r().oneOf(["left","right"]),labelWrap:r().bool,formType:r().oneOf(["default","search","onlyShow"]),disabled:r().bool,uniqueKey:r().string,defaultRows:r().number,searchButtonCols:r().number,scrollToFirstError:r().bool,authConfig:r().object,isAutoFocus:r().bool,isCollapse:r().bool,isFieldsDefine:r().bool,isSearchBtn:r().bool,isSubmitBtn:r().bool,fieldsChange:r().func,onValuesChange:r().func,onFieldsChange:r().func,onFinish:r().func,onFinishFailed:r().func,onReset:r().func,onCollapse:r().func},pl={layout:"horizontal",labelWidth:ll,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:te,onFieldsChange:te,onFinish:te,onFinishFailed:te,onReset:te,onCollapse:te,onFormItemsChange:te},hl=(e,t)=>{if(!e)return null;if(t===cl.week){const t=e.match(/^(\d{4})-(\d+)/);return t?s()().year(Number(t[1])).week(Number(t[2])):null}if(t===cl.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?s()().year(Number(t[1])).quarter(Number(t[2])):null}return s()(e,t)},ml=(e,t)=>e?s()(e).format(t):"",fl=e=>""===e||null==e,gl=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const l=t.split("|");let n="";for(let t=0,a=l.length;t<a;t++)n+=(e[l[t].trim()]??"")+(t===a-1?"":" | ");return n},bl=(e,t,l)=>{for(const n in l)if(Object.keys(t).includes(n)&&t[n]!==l[n])if(t[n].includes("|")){const a=t[n].split("|"),r=l[n].split("|");a.forEach(((t,l)=>e[t]=e[r[l]]))}else e[t[n]]=e[l[n]]},yl=(e,t,l)=>{for(const n in l)if(Object.keys(t).includes(n)&&t[n]!==l[n])if(t[n].includes("|")){const a=t[n].split("|"),r=l[n].split("|");a.forEach(((t,l)=>e[t]=e[r[l]]))}else e[t[n]]=e[l[n]]},vl=(e,t,l)=>e.map((e=>{const n={value:e[t],text:e[l]};return e.disabled&&(n.disabled=!0),e.isLeaf&&(n.isLeaf=!0),!(0,Q.isUndefined)(e.selectable)&&(n.selectable=e.selectable),Array.isArray(e.children)&&(n.children=vl(e.children,t,l)),n})),xl=(e,t)=>{for(const l of e){if(l.value===t)return l;if(Array.isArray(l.children)){const e=xl(l.children,t);if(e)return e}}return null},El=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[l]&&n.push(e),Array.isArray(e.children)&&n.push(...El(e.children,t,l+1))})),n},Cl=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),Sl=(e,t,l,n)=>{var a;const r={};return r.filters=(null===(a=e.filters)||void 0===a?void 0:a.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})))||[],r.table={columns:e.columns||[],rowKey:e.valueName},r.fieldsDefine={valueKey:e.valueKey||e.valueName},r.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(r.table.fetch={api:l(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(r.echoRequest={fetchApi:l(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(r.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(r.tree={fetch:{api:l(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{var t;const l={};return null===(t=e.treeSetting.relativeTable)||void 0===t||t.forEach((e=>l[e.tableField]=e.treeField)),l}}),e.emmediateSetting&&(r.columns=e.emmediateSetting.columns,r.request={fetchApi:l(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),r},wl=require("react-sortablejs");function Il(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Nl extends e.Component{get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}constructor(e){super(e),Il(this,"linkRef",t().createRef()),Il(this,"state",{visible:!1}),this.initLocalfields()}async getTableFieldsConfig(e){const t=this.context.global,l=null==t?void 0:t.getComponentConfigApi;if(l)try{const t=await l({key:e});if(200===t.code)return t.data}catch(e){}}async saveTableColumnsConfig(e,t){const l=this.context.global,n=null==l?void 0:l.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getTableFieldsConfig(this.formUniqueKey).then((e=>{if(!e)return this.setLocalFields(this.props.items);localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()})).catch((()=>{})),e?(0,Q.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:l}=t,n=e.find((e=>e.fieldName===l));return n?((0,Q.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,Q.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),l=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,Q.isEqual)(t,l)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveTableColumnsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;null==t||t([...e])}popup(){const{items:e}=this.props;return t().createElement(Xt.Consumer,null,(l=>{const n=l.$$form;return t().createElement("div",{className:Ee()("ant-dropdown-menu","fields-list")},t().createElement(wl.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const l=t.map((e=>e.fieldName)),a=e.map((e=>e.fieldName));(0,Q.isEqual)(l,a)||(n.setExpandHandle(!0),this.changeHandle(t),this.setLocalFields(t))}},e.map((l=>{var a;return t().createElement("li",{key:l.fieldName,className:"item",style:l.noAuth?{display:"none"}:void 0},t().createElement(R.Checkbox,{disabled:(null===(a=l.rules)||void 0===a?void 0:a.findIndex((e=>e.required)))>-1,checked:!l.hidden,onChange:t=>{const{checked:n}=t.target;l.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),t().createElement(Se.HolderOutlined,{className:"handle",title:p("qm.form.draggable")}),t().createElement("span",{className:"title"},n.getFormItemLabel(l.label||"")))}))))}))}render(){const{visible:e}=this.state,l=Ce("form-fields-filter");return t().createElement(Xt.Consumer,null,(n=>{const{$size:a}=n.$$form,r={[l]:!0,[`${l}--lg`]:"large"===a,[`${l}--sm`]:"small"===a};return t().createElement(R.Dropdown,{overlayClassName:Ee()(r),overlay:this.popup(),trigger:["click"],placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,visible:e,onVisibleChange:e=>{this.setState({visible:e})}},t().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},t().createElement(Se.UnorderedListOutlined,null)))}))}}Il(Nl,"contextType",i);const Tl=Nl,Rl=e=>{const{value:l,bordered:n}=e;return t().createElement(R.Input,{value:l,title:l,bordered:n,readOnly:!0})};Rl.displayName="FormItemView";const Ol=Rl;function Al(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const Pl=t().forwardRef(((e,l)=>{const{$$form:n}=t().useContext(Xt),{value:a,onChange:r,onValuesChange:i}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:h,disabled:m,onBlur:f=te,onEnter:g=te}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:C,toTrim:S,secretType:w}=o,I=w&&(h||m),N=e=>{null==r||r(e),i(e)},T=v?R.Input.Password:R.Input,O=I?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e=e.toString(),"finance"===t&&(e=Cl(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e}(a,w):a;return n.isOnlyShow?t().createElement(Ol,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(O),bordered:d}):t().createElement(T,{ref:l,value:O,placeholder:c,style:s,title:v?"":O,prefix:b,suffix:y,maxLength:x,bordered:d,allowClear:u,readOnly:h,disabled:m,onBlur:t=>{let l=t.target.value??"";if(S){const e=l.trim();l!==e&&(l=e,N(l))}(t=>{const{onBlur:l}=e;null==l||l(t)})(l),f(l)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),n.isFilterType&&n.SUBMIT_FORM()}},onChange:e=>{let t=e.target.value;(0,Q.isRegExp)(E)&&(t=E.test(t)?t:a??""),C&&(t=t.toUpperCase()),N(t)}})}));Pl.displayName="VInput";class Fl extends e.Component{constructor(){super(...arguments),Al(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(h)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Pl,{ref:e=>this[l]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(r,t)}}))),u&&t().createElement(R.Col,null,e.renderFormItemButton(r,u)),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}Al(Fl,"contextType",Xt);const Hl=Fl,kl=e=>{const{$$form:l}=t().useContext(Xt),{value:n=[],onChange:a,onValuesChange:r}=e,{options:i={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:h,suffix:m,maxLength:f}=i,g=e=>{const t=e.every((e=>!e))?[]:e;null==a||a(t),r(t,b(t))},b=e=>e.join(" - ");return l.isOnlyShow?t().createElement(Ol,{value:b(n),bordered:s}):t().createElement(R.Input.Group,null,t().createElement(R.Input,{value:n[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:o[0],prefix:h,suffix:m,maxLength:f,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([t,n[1]])}}),t().createElement(R.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t().createElement(R.Input,{value:n[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:o[1],prefix:h,suffix:m,maxLength:f,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class Ll extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,s),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(o)},required:e.getFormItemRequired(u)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(kl,{option:this.props.option,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],l=arguments.length>1?arguments[1]:void 0;p(t),e.setViewValue(r,l)}}))),c&&t().createElement(R.Col,{flex:ce(c.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...c}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(Ll,"contextType",Xt);const ql=Ll,_l=require("big.js");var $l=n.n(_l);function Dl(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const Kl=t().forwardRef(((e,l)=>{const{$$form:n}=t().useContext(Xt),{value:a,onChange:r,onValuesChange:i}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:h,onBlur:m=te,onEnter:f=te}=e.option,{step:g=1,min:b,max:y,precision:v,stringMode:x,textAlign:E="left",controls:C=!0,formatter:S,parser:w}=o,I=t().useRef(a),N=e=>{const t=fl(e)?"":(0,Q.isNumber)(e)?e.toFixed(v):new($l())(e).toFixed(v);return"function"==typeof S?S(t):t},T={[E]:!0,controls:C};return n.isOnlyShow?t().createElement(Ol,{value:N(a),bordered:d}):t().createElement(R.InputNumber,{ref:l,value:a,className:Ee()(T),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:C,precision:v,stringMode:x,formatter:S,parser:w,bordered:d,readOnly:u,disabled:h,onBlur:()=>{ae((()=>{(t=>{const{onBlur:l}=e;null==l||l(t)})(I.current),m(I.current)}))},onKeyUp:e=>{13===e.keyCode&&f(a)},onChange:e=>{const t=e??"";!x&&t.toString().replace(/^-|\./g,"").length>17||(e=>{I.current=e,null==r||r(e),i(e,N(e))})(t)}})}));Kl.displayName="VInputNumber";class Vl extends e.Component{constructor(){super(...arguments),Dl(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(h)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Kl,{ref:e=>this[l]=e,option:this.props.option,onValuesChange:(t,l)=>{m(t),e.setViewValue(r,l)}}))),u&&t().createElement(R.Col,null,e.renderFormItemButton(r,u)),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}Dl(Vl,"contextType",Xt);const Ml=Vl,jl=e=>{const{$$form:l}=t().useContext(Xt),{value:n=[],onChange:a,onValuesChange:r}=e,{options:i={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:h=1,min:m=0,max:f,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=i,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),C(e)},C=e=>{const t=e.every((e=>null===e))?[]:[...e];null==a||a(t),r(t,S(t))},S=e=>fl(e)?"":e.map((e=>fl(e)?"":Number(e).toFixed(y))),w={[g]:!0,controls:b};return l.isOnlyShow?t().createElement(Ol,{value:S(n),bordered:s}):t().createElement(R.Input.Group,null,t().createElement(R.InputNumber,{value:n[0],className:Ee()("site-input-left",w),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:o[0],step:h,min:m,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{C([e,n[1]])},onBlur:()=>{E(n)}}),t().createElement(R.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t().createElement(R.InputNumber,{value:n[1],className:Ee()("site-input-right",w),style:{width:"calc(50% - 5px)"},placeholder:o[1],step:h,min:m,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{C([n[0],e])},onBlur:()=>{E(n)}}))};class zl extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,s),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(o)},required:e.getFormItemRequired(u)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(jl,{option:this.props.option,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],l=arguments.length>1?arguments[1]:void 0;p(t),e.setViewValue(r,l)}}))),c&&t().createElement(R.Col,{flex:ce(c.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...c}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(zl,"contextType",Xt);const Ul=zl;let Bl;function Wl(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}!function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Bl||(Bl={}));const{Search:Gl}=R.Input;class Yl extends e.Component{constructor(e){var t;super(e),t=this,Wl(this,"searchHelper",void 0),Wl(this,"alias",void 0),Wl(this,"extras",void 0),Wl(this,"deriveParams",void 0),Wl(this,"valueKey",void 0),Wl(this,"_is_change",!1),Wl(this,"_record",void 0),Wl(this,"_prevValue",void 0),Wl(this,"state",{visible:!1,loading:!1}),Wl(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Wl(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t}=this.props.option;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const{fieldAliasMap:l,extraAliasMap:n,fieldsDefine:a}=this.searchHelper;if(l||g("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof l?l():l||{},this.extras="function"==typeof n?n():n||{},a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(t)||g("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Wl(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),Wl(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Wl(this,"getItemText",(async()=>{await this.props.waiting();const e=this.getItemValue();if(e===this._prevValue)return;this._prevValue=e;const{fetchApi:t,params:l={},formatter:n=(e=>e),dataKey:a,callback:r,fieldAliasMap:i,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof i?i():i||{},c="function"==typeof o?o():o||{},{value:d}=this.props;if(t&&!d&&e){this.setState({loading:!0});try{const i=await t(n({...l,key:e}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,Q.get)(i.data,a)??[];if(e[0]){const t=e[0];s&&bl(t,this.alias,s),c&&yl(t,this.extras,c),this._record=t,this.setFieldsValue(t),null==r||r([t])}}}catch(e){}this.setState({loading:!1})}})),Wl(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),Wl(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:l}=this.searchHelper,n=""!==e?e:void 0,a="function"==typeof l?l():l??[],r={[t]:n};return a.forEach((e=>r[e]=n)),r})),Wl(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:l={}}=this.searchHelper,{beforeFetch:n=le,formatter:a=(e=>e)}=t.fetch;return new Promise((async(r,i)=>{const o=(0,Q.merge)({},this.getLastedSearchHelper().table.fetch.params,{...l,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(o))return i();this.setState({loading:!0});const e=await t.fetch.api(o);if(ae((()=>this.setState({loading:!1}))),200===e.code)return r(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}i()}))})),Wl(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:l}=this.props.option;for(const n in this.alias){const a=gl(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===l&&t.setViewValue(l,a))}for(const l in this.extras){const n=gl(e,this.extras[l]);void 0!==n&&t.SET_FIELDS_EXTRA({[l]:n})}})),Wl(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],l=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,a=e.filter((e=>{var a;return null===(a=gl(e,t.alias[n]))||void 0===a?void 0:a.toString().toLowerCase().includes(l.toLowerCase())}));if(1===a.length)return t.closeSearchHelper(a[0]);t.openSearchHelper(l)})),Wl(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:l}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??le)(l.state.formData);null!=a&&a.then?a.then((()=>{this.todoOpen(e),null==t||t()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),null==t||t())})),Wl(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:l}=this.props.option;for(const n in this.alias)n!==l&&t.SET_FIELDS_VALUE({[n]:gl(e,this.alias[n])});for(const l in this.extras)t.SET_FIELDS_EXTRA({[l]:gl(e,this.extras[l])});this._record=e;const n=gl(e,this.alias[l]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{this.focus(),setTimeout((()=>null==a?void 0:a(e)),200)}))})),Wl(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,(()=>{this.focus()}))})),Wl(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const l in this.alias)l!==t&&e.SET_FIELDS_VALUE({[l]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),Wl(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,null==t||t(e,this._record)})),Wl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:l}=this.props;null==t||t(e),l(e)})),Wl(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;null==t||t(e)})),Wl(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}componentDidMount(){this.getItemText()}componentDidUpdate(){this.getItemText()}render(){const{$$form:e}=this.context,{visible:l,loading:n}=this.state,{value:a}=this.props,{type:r,options:i={},searchHelper:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:h,disabled:m}=this.props.option,{prefix:f,suffix:g,maxLength:b}=i,y={visible:l,title:p("qm.searchHelper.text"),width:o.width??"60%",loading:!1,bodyStyle:{paddingBottom:`${Bl[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},v={...this.getLastedSearchHelper(),size:e.$size,initialValue:Object.assign({},this.deriveParams,o.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Ol,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement(Gl,{ref:e=>this[`${r}_Ref`]=e,value:a,title:a,loading:n,placeholder:c,style:s,prefix:f,suffix:g,maxLength:b,bordered:d,allowClear:u,readOnly:h,disabled:m,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;var r;this.triggerBlur(t),this._is_change&&!l&&(t?n?null!=a&&null!==(r=a.fetch)&&void 0!==r&&r.api&&this.getSearchHelperTableData(t).then((e=>this.resetSearchHelperValue(e,t))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(t):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:t}=e.target;!l&&this.openSearchHelper(t)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):ae((()=>this.clearSearchHelperValue())))}}),t().createElement(Wt,y,t().createElement(Gs,v)))}}Wl(Yl,"contextType",Xt);class Xl extends e.Component{constructor(e,t){let{$$form:l}=t;super(e),Wl(this,"promiseRef",void 0),Wl(this,"searchRef",void 0),Wl(this,"state",{searchHelper:{}}),Wl(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Wl(this,"getHelperConfig",(e=>{var t,l;const{global:n}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==n||null===(t=n.searchHelper)||void 0===t||!t.getServerConfig||null==n||null===(l=n.searchHelper)||void 0===l||!l.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const l=await n.searchHelper.getServerConfig({searchHelperId:a});if(200===l.code){const t=Sl(Object.assign({},l.data,r),i,n.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(l.context)}render(){const{$$form:e}=this.context,{searchHelper:l}=this.state,{type:n,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:Ee()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(m)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Yl,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:l,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(i,t)}}))),p&&t().createElement(R.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(R.Col,{flex:ce(u.labelWidth||ll)},e.renderFormItemExtra({fieldName:i,...u}))))}}Wl(Xl,"contextType",Xt);const Ql=Xl;function Zl(){return Zl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Zl.apply(this,arguments)}function Jl(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const en=l=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,Jl(this,"startClick",void 0),Jl(this,"event1",null),Jl(this,"event2",null),Jl(this,"$el",null),Jl(this,"omitClassNames",[]),Jl(this,"state",{clickOutside:!1}),Jl(this,"mousedownHandler",(e=>{this.startClick=e})),Jl(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Jl(this,"documentHandler",((e,t)=>{var l,n;const a=e.target,r=null==t?void 0:t.target,i=!a||!r,o=(null===(l=this.$el)||void 0===l?void 0:l.contains(a))||(null===(n=this.$el)||void 0===n?void 0:n.contains(r)),s=this.$el===a,c=this.omitClassNames.map((e=>document.querySelector(e))),d=c.some((e=>null==e?void 0:e.contains(a)))||c.includes(r);let u;u=!(i||o||s||d),this.setState({clickOutside:u})})),Jl(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Jl(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=Et()(document,"mousedown",this.mousedownHandler),this.event2=Et()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){var e,t;null===(e=this.event1)||void 0===e||e.remove(),null===(t=this.event2)||void 0===t||t.remove()}render(){const{forwardedRef:e}=this.props,{clickOutside:n}=this.state;return t().createElement(l,Zl({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Jl(n,"displayName",`OutsideClick(${l.displayName||l.name})`),t().forwardRef(((e,l)=>t().createElement(n,Zl({},e,{forwardedRef:l}))))},tn=require("rc-trigger");var ln,nn,an=n.n(tn);function rn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}let on=en((nn=class extends e.Component{constructor(e){var l;super(e),l=this,rn(this,"searchHelper",void 0),rn(this,"alias",void 0),rn(this,"_records",[]),rn(this,"searchRef",t().createRef()),rn(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),rn(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),rn(this,"getLastedSearchHelper",(()=>{const e=Object.assign({},this.searchHelper,this.props.option.searchHelper);var t;return e.table&&!e.table.rowKey&&(e.table.rowKey=null===(t=this.alias)||void 0===t?void 0:t.valueKey),e})),rn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),rn(this,"setItemList",(e=>{this.setState({itemList:e})})),rn(this,"setRecords",(e=>{this._records=e})),rn(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),rn(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:l}=this.props.option;t.setViewValue(l,this.createViewText(e))})),rn(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:l}=this.searchHelper,n=(l??le)(t.state.formData);null!=n&&n.then?n.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),null==e||e())})),rn(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=l.alias;l.setRecords((0,Q.uniqBy)([...l._records.filter((e=>t.includes(e[n]))),...e],n));const a=l.recordsToDict();l.setItemList(a),l.triggerChange(a.map((e=>e.value)));const{closed:r}=l.searchHelper;l.setVisible(!1,(()=>{setTimeout((()=>null==r?void 0:r(l._records)),200)}))})),rn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:l}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),null==t||t(e),l(e,this.createViewText(e),this._records)})),this.initialHandle()}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:l=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,Q.isEqual)((0,Q.intersection)(l,n),n)||(0,Q.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){var e;if(await this.props.waiting(),!this.searchHelper)return;const{textKey:t,valueKey:l}=this.alias,{fetchApi:n,params:a={},formatter:r=(e=>e),dataKey:i,callback:o,fieldAliasMap:s}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},c="function"==typeof s?s():s||{},{value:d}=this.props;if(n&&!ie(d)){this.setState({loading:!0});try{const e=await n(r({...a,keys:d}));if(200===e.code){let n=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,i)??[];n.forEach((e=>{null!=c&&c.valueKey&&c.valueKey!==l&&(e[l]=e[c.valueKey]),null!=c&&c.textKey&&c.textKey!==t&&(e[t]=e[c.textKey])})),n=n.filter((e=>d.includes(e[l])));const a=n.map((e=>({value:e[l],text:e[t]})));this.setRecords(n),this.setItemList(a),this.setViewValue(d),null==o||o(n)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,l;const{$$form:n}=this.context,{visible:a,visible2:r,loading:i,itemList:o}=this.state,{value:s}=this.props,{fieldName:c,options:d={},searchHelper:u={},style:h={},placeholder:m=p("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:b,disabled:y}=this.props.option,{collapseTags:v,maxTagTextLength:x}=d,E={visible:a,title:p("qm.searchHelper.text"),width:u.width??"60%",loading:!1,bodyStyle:{paddingBottom:`${Bl[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C={...this.getLastedSearchHelper(),size:n.$size,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:s,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},S=o.filter((e=>null==s?void 0:s.includes(e.value))),w=t().createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),I=this.searchRef.current?this.searchRef.current.offsetWidth:300,N=Ce("form-multiple-search-helper"),{size:T}=n.context,O={[N]:!0,[`${N}--lg`]:"large"===T,[`${N}--sm`]:"small"===T};null===(e=(l=this.props).setOmitClassNames)||void 0===e||e.call(l,[`.${N}`]);const A=o.filter((e=>null==s?void 0:s.includes(e.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t().createElement(Ol,{value:A,bordered:f}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(an(),{popupVisible:!y&&r,popup:w,popupClassName:Ee()(O),popupStyle:{minWidth:I},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:ol,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(R.Select,{mode:"multiple",maxTagCount:v?"responsive":void 0,maxTagTextLength:x,open:!1,value:s,placeholder:m,loading:i,bordered:f,allowClear:g,disabled:y,style:{width:"100%",...h},title:A,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;var l,n;t.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(l=(n=this.props).setCurrentElement)||void 0===l||l.call(n,t),this.setState({visible2:!0}))},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},o.map((e=>t().createElement(R.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(R.Button,{className:"ant-input-search-button",disabled:y,icon:t().createElement(Se.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(Wt,E,t().createElement(Gs,C)))}},rn(nn,"contextType",Xt),ln=nn))||ln;class sn extends e.Component{constructor(e,t){let{$$form:l}=t;super(e),rn(this,"promiseRef",void 0),rn(this,"state",{searchHelper:{}}),rn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),rn(this,"getHelperConfig",(e=>{var t,l;const{global:n}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==n||null===(t=n.searchHelper)||void 0===t||!t.getServerConfig||null==n||null===(l=n.searchHelper)||void 0===l||!l.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const l=await n.searchHelper.getServerConfig({searchHelperId:a});if(200===l.code){const t=Sl(Object.assign({},l.data,r),i,n.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(l.context)}render(){const{$$form:e}=this.context,{searchHelper:l}=this.state,{type:n,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:Ee()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(m)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(on,{option:this.props.option,helperConfig:l,waiting:this.waiting,onValuesChange:(t,l,n)=>{f(t,n),e.setViewValue(i,l)}}))),p&&t().createElement(R.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(R.Col,{flex:ce(u.labelWidth||ll)},e.renderFormItemExtra({fieldName:i,...u}))))}}rn(sn,"contextType",Xt);const cn=sn;function dn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const{Search:un}=R.Input;class pn extends e.Component{constructor(e){super(e),dn(this,"searchHelper",void 0),dn(this,"alias",void 0),dn(this,"extras",void 0),dn(this,"valueKey",void 0),dn(this,"_record",void 0),dn(this,"_prevValue",void 0),dn(this,"state",{visible:!1,loading:!1}),dn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),dn(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t}=this.props.option;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const{fieldAliasMap:l,extraAliasMap:n,fieldsDefine:a}=this.searchHelper;if(l||g("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof l?l():l||{},this.extras="function"==typeof n?n():n||{},a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(t)||g("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),dn(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),dn(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),dn(this,"getItemText",(async()=>{await this.props.waiting();const e=this.getItemValue();if(e===this._prevValue)return;this._prevValue=e;const{fetchApi:t,params:l={},formatter:n=(e=>e),dataKey:a,fieldAliasMap:r,extraAliasMap:i}=this.searchHelper.echoRequest||{},o="function"==typeof r?r():r||{},s="function"==typeof i?i():i||{},{value:c}=this.props;if(t&&!c&&e){this.setState({loading:!0});try{const r=await t(n({...l,key:e}));if(200===r.code){const e=Array.isArray(r.data)?r.data:(0,Q.get)(r.data,a)??[];if(e[0]){const t=e[0];o&&bl(t,this.alias,o),s&&yl(t,this.extras,s),this._record=t,this.setFieldsValue(t)}}}catch(e){}this.setState({loading:!1})}})),dn(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:l}=this.props.option;for(const n in this.alias){const a=gl(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===l&&t.setViewValue(l,a)}for(const l in this.extras)t.SET_FIELDS_EXTRA({[l]:gl(e,this.extras[l])})})),dn(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:l}=this.searchHelper,n=(l??le)(t.state.formData);null!=n&&n.then?n.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),null==e||e())})),dn(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:l}=this.props.option;for(const n in this.alias)n!==l&&t.SET_FIELDS_VALUE({[n]:gl(e,this.alias[n])});for(const l in this.extras)t.SET_FIELDS_EXTRA({[l]:gl(e,this.extras[l])});this._record=e;const n=gl(e,this.alias[l]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==a?void 0:a(e)),200)}))})),dn(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const l in this.alias)l!==t&&e.SET_FIELDS_VALUE({[l]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),dn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:l}=this.props;null==t||t(e),l(e,this._record)})),dn(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;null==t||t(e)})),this.initialHandle()}componentDidMount(){this.getItemText()}componentDidUpdate(){this.getItemText()}render(){const{$$form:e}=this.context,{visible:l,loading:n}=this.state,{value:a=""}=this.props,{type:r,options:i={},searchHelper:o={},style:s={},placeholder:c=p("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:h,disabled:m}=this.props.option,{prefix:f,suffix:g,maxLength:b}=i,y={visible:l,title:p("qm.searchHelper.text"),width:o.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${Bl[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},v={...this.getLastedSearchHelper(),size:e.$size,initialValue:(0,Q.merge)({},o.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?t().createElement(Ol,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement(un,{ref:e=>this[`${r}_Ref`]=e,value:a,title:a,loading:n,placeholder:c,style:s,prefix:f,suffix:g,maxLength:b,bordered:d,allowClear:u,readOnly:h,disabled:m,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"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t().createElement(Wt,y,t().createElement(ec,v)))}}dn(pn,"contextType",Xt);class hn extends e.Component{constructor(e,t){let{$$form:l}=t;super(e),dn(this,"promiseRef",void 0),dn(this,"state",{searchHelper:{}}),dn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),dn(this,"getHelperConfig",(e=>{var t,l;const{global:n}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==n||null===(t=n.searchHelper)||void 0===t||!t.getServerConfig||null==n||null===(l=n.searchHelper)||void 0===l||!l.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const l=await n.searchHelper.getServerConfig({searchHelperId:a});if(200===l.code){const t=Sl(Object.assign({},l.data,r),i,n.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(l.context)}render(){const{$$form:e}=this.context,{searchHelper:l}=this.state,{type:n,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:Ee()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(m)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(pn,{option:this.props.option,helperConfig:l,waiting:this.waiting,onValuesChange:(t,l)=>{f(t,l),e.setViewValue(i,t)}}))),p&&t().createElement(R.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(R.Col,{flex:ce(u.labelWidth||ll)},e.renderFormItemExtra({fieldName:i,...u}))))}}dn(hn,"contextType",Xt);const mn=hn;var fn,gn;function bn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}let yn=en((gn=class extends e.Component{constructor(e){var l;super(e),l=this,bn(this,"searchHelper",void 0),bn(this,"alias",void 0),bn(this,"_records",[]),bn(this,"searchRef",t().createRef()),bn(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),bn(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),bn(this,"getLastedSearchHelper",(()=>{const e=Object.assign({},this.searchHelper,this.props.option.searchHelper);var t;return e.table&&!e.table.rowKey&&(e.table.rowKey=null===(t=this.alias)||void 0===t?void 0:t.valueKey),e})),bn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),bn(this,"setItemList",(e=>{this.setState({itemList:e})})),bn(this,"setRecords",(e=>{this._records=e})),bn(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),bn(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:l}=this.props.option;t.setViewValue(l,this.createViewText(e))})),bn(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:l}=this.searchHelper,n=(l??le)(t.state.formData);null!=n&&n.then?n.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),null==e||e())})),bn(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=l.alias;l.setRecords((0,Q.uniqBy)([...l._records.filter((e=>t.includes(e[n]))),...e],n));const a=l.recordsToDict();l.setItemList(a),l.triggerChange(a.map((e=>e.value)));const{closed:r}=l.searchHelper;l.setVisible(!1,(()=>{setTimeout((()=>null==r?void 0:r(l._records)),200)}))})),bn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:l}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),null==t||t(e),l(e,this.createViewText(e),this._records)})),this.initialHandle()}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:l=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,Q.isEqual)((0,Q.intersection)(l,n),n)||(0,Q.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){var e;if(await this.props.waiting(),!this.searchHelper)return;const{textKey:t,valueKey:l}=this.alias,{fetchApi:n,params:a={},formatter:r=(e=>e),dataKey:i,fieldAliasMap:o}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(n&&!ie(c)){this.setState({loading:!0});try{const e=await n(r({...a,keys:c}));if(200===e.code){let n=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,i)??[];n.forEach((e=>{null!=s&&s.valueKey&&s.valueKey!==l&&(e[l]=e[s.valueKey]),null!=s&&s.textKey&&s.textKey!==t&&(e[t]=e[s.textKey])})),n=n.filter((e=>c.includes(e[l])));const a=n.map((e=>({value:e[l],text:e[t]})));this.setRecords(n),this.setItemList(a),this.setViewValue(c)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,l;const{$$form:n}=this.context,{visible:a,visible2:r,loading:i,itemList:o}=this.state,{value:s}=this.props,{fieldName:c,options:d={},searchHelper:u={},style:h={},placeholder:m=p("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:b,disabled:y}=this.props.option,{collapseTags:v,maxTagTextLength:x}=d,E={visible:a,title:p("qm.searchHelper.text"),width:u.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${Bl[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C={...this.getLastedSearchHelper(),size:n.$size,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:s,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},S=o.filter((e=>null==s?void 0:s.includes(e.value))),w=t().createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),I=this.searchRef.current?this.searchRef.current.offsetWidth:300,N=Ce("form-multiple-tree-table-helper"),{size:T}=n.context,O={[N]:!0,[`${N}--lg`]:"large"===T,[`${N}--sm`]:"small"===T};null===(e=(l=this.props).setOmitClassNames)||void 0===e||e.call(l,[`.${N}`]);const A=o.filter((e=>null==s?void 0:s.includes(e.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t().createElement(Ol,{value:A,bordered:f}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(an(),{popupVisible:!y&&r,popup:w,popupClassName:Ee()(O),popupStyle:{minWidth:I},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:ol,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(R.Select,{mode:"multiple",maxTagCount:v?"responsive":void 0,maxTagTextLength:x,open:!1,value:s,placeholder:m,loading:i,bordered:f,allowClear:g,disabled:y,style:{width:"100%",...h},title:A,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;var l,n;t.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(l=(n=this.props).setCurrentElement)||void 0===l||l.call(n,t),this.setState({visible2:!0}))},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},o.map((e=>t().createElement(R.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(R.Button,{className:"ant-input-search-button",disabled:y,icon:t().createElement(Se.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(Wt,E,t().createElement(ec,C)))}},bn(gn,"contextType",Xt),fn=gn))||fn;class vn extends e.Component{constructor(e,t){let{$$form:l}=t;super(e),bn(this,"promiseRef",void 0),bn(this,"state",{searchHelper:{}}),bn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),bn(this,"getHelperConfig",(e=>{var t,l;const{global:n}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==n||null===(t=n.searchHelper)||void 0===t||!t.getServerConfig||null==n||null===(l=n.searchHelper)||void 0===l||!l.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const l=await n.searchHelper.getServerConfig({searchHelperId:a});if(200===l.code){const t=Sl(Object.assign({},l.data,r),i,n.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(l.context)}render(){const{$$form:e}=this.context,{searchHelper:l}=this.state,{type:n,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:Ee()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(m)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(yn,{option:this.props.option,helperConfig:l,waiting:this.waiting,onValuesChange:(t,l,n)=>{f(t,n),e.setViewValue(i,l)}}))),p&&t().createElement(R.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(R.Col,{flex:ce(u.labelWidth||ll)},e.renderFormItemExtra({fieldName:i,...u}))))}}bn(vn,"contextType",Xt);const xn=vn;function En(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const Cn=new Array(2).fill("");class Sn extends e.Component{constructor(e){var t;super(e),t=this,En(this,"searchHelper",void 0),En(this,"alias",void 0),En(this,"_is_change",!1),En(this,"_ceho_data",void 0),En(this,"_records",[]),En(this,"_is_clear",!1),En(this,"state",{visible:!1,loading:!1,itemList:[],textValue:Cn}),En(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),En(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),En(this,"setItemList",(e=>{this.setState({itemList:e})})),En(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),En(this,"setTextValue",(e=>{this.setState({textValue:e})})),En(this,"setRecords",(e=>{this._records=e})),En(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),En(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:l}=this.props;this._is_change=!1,null==t||t(e),l(e,this.createViewText(),this._records)})),En(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(Cn),this.triggerChange([])})),En(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:l}=this.alias,n=e.map((e=>({value:e[t],text:e[l]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==a?void 0:a(this._records)),200)}))})),En(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:l}=this.searchHelper,n=(l??le)(t.state.formData);null!=n&&n.then?n.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),null==e||e())})),En(this,"createFilters",(e=>{const{fieldName:t}=this.props.option;return{[t]:ie(e)?void 0:e}})),En(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:l={}}=this.searchHelper,{beforeFetch:n=le,formatter:a=(e=>e)}=t.fetch;return new Promise((async(r,i)=>{const o=(0,Q.merge)({},this.getLastedSearchHelper().table.fetch.params,{...l,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(o))return i();this.setState({loading:!0});const e=await t.fetch.api(o);if(ae((()=>this.setState({loading:!1}))),200===e.code)return r(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}i()}))})),En(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:l}=t.state,{textKey:n}=t.alias,a=e.filter((e=>{var t;const a=null===(t=e[n])||void 0===t?void 0:t.toString().toLowerCase();return l.some((e=>null==a?void 0:a.includes(e.toLowerCase())))}));if(2===a.length)return t.closeSearchHelper(a);t.openSearchHelper()})),En(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:l=[]}=this.props;(0,Q.isEqual)((0,Q.intersection)(t,l),l)||(0,Q.isEqual)(l,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,Q.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),l.length)){const e=Cn.map(((e,t)=>{var r;return(null===(r=n[a].find((e=>e.value===l[t])))||void 0===r?void 0:r.text)??""}));this.setTextValue(e)}}async getItemList(){if(await this.props.waiting(),!this.searchHelper)return;const{textKey:e,valueKey:t}=this.alias,{fetchApi:l,params:n={},formatter:a=(e=>e),dataKey:r,fieldAliasMap:i}=this.searchHelper.echoRequest||{},o="function"==typeof i?i():i||{},{value:s}=this.props;if(l&&!ie(s)){this.setState({loading:!0});try{const i=await l(a({...n,keys:s}));if(200===i.code){let l=Array.isArray(i.data)?i.data:(0,Q.get)(i.data,r)??[];l.forEach((l=>{null!=o&&o.valueKey&&o.valueKey!==t&&(l[t]=l[o.valueKey]),null!=o&&o.textKey&&o.textKey!==e&&(l[e]=l[o.textKey])})),l=l.filter((e=>s.includes(e[t]))).slice(0,2);const n=l.map((l=>({value:l[t],text:l[e]})));this.setRecords(l),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:l=[]}=this.props,{visible:n,loading:a,textValue:r}=this.state,{options:i={},searchHelper:o={},placeholder:s=p("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,readOnly:d,disabled:u}=this.props.option,{onlySelect:h=!0}=this.searchHelper||o,m={visible:n,title:p("qm.searchHelper.text"),width:o.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${Bl[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},f={...this.getLastedSearchHelper(),size:e.$size,initialValue:(0,Q.merge)({},o.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Ol,{value:r.join(" - "),bordered:c}):t().createElement(t().Fragment,null,t().createElement(R.Input.Group,null,t().createElement(R.Input,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],allowClear:!1,bordered:c,readOnly:d,disabled:u,onBlur:e=>{const{value:t}=e.target;var l,a;this._is_change&&!n&&(t?r.every((e=>!!e))&&null!==(l=this.searchHelper.table)&&void 0!==l&&null!==(a=l.fetch)&&void 0!==a&&a.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):r.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,r[1]]))}}),t().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:u,readOnly:!0}),t().createElement(R.Input.Search,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],loading:a,bordered:c,allowClear:!0,readOnly:d,disabled:u,onBlur:e=>{const{value:t}=e.target;var l,a;this._is_change&&!n&&(t?r.every((e=>!!e))&&null!==(l=this.searchHelper.table)&&void 0!==l&&null!==(a=l.fetch)&&void 0!==a&&a.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):r.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([r[0],t]))},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t().createElement(Wt,m,t().createElement(oc,f)))}}En(Sn,"contextType",Xt);class wn extends e.Component{constructor(e,t){let{$$form:l}=t;super(e),En(this,"promiseRef",void 0),En(this,"state",{searchHelper:{}}),En(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),En(this,"getHelperConfig",(e=>{var t,l;const{global:n}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==n||null===(t=n.searchHelper)||void 0===t||!t.getServerConfig||null==n||null===(l=n.searchHelper)||void 0===l||!l.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const l=await n.searchHelper.getServerConfig({searchHelperId:a});if(200===l.code){const t=Sl(Object.assign({},l.data,r),i,n.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(l.context)}render(){const{$$form:e}=this.context,{searchHelper:l}=this.state,{type:n,label:a,tooltip:r,fieldName:i,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:Ee()(i,c),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(h)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Sn,{option:this.props.option,helperConfig:l,waiting:this.waiting,onValuesChange:(t,l,n)=>{m(t,n),e.setViewValue(i,l)}}))),u&&t().createElement(R.Col,null,e.renderFormItemButton(i,u)),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:i,...d}))))}}En(wn,"contextType",Xt);const In=wn,Nn=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},disabled:s}=e.option,{falseValue:c=al,trueValue:d=nl}=i;return t().createElement(R.Checkbox,{checked:n===d,style:o,disabled:s||l.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{null==a||a(e),r(e,p(e===d?"am.form.trueText":"am.form.falseText"))})(t?d:c)}})};class Tn extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Nn,{option:this.props.option,onValuesChange:(t,l)=>{h(t),e.setViewValue(r,l)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(Tn,"contextType",Xt);const Rn=Tn;function On(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const An=e=>{const{$$form:l}=t().useContext(Xt),{value:n,items:a,onChange:r,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,h=ie(p)?a:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t().createElement(Ol,{value:m(n),bordered:c}):t().createElement(R.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{null==r||r(e),i(e,m(e))})(e)}},h.map((e=>t().createElement(R.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Pn extends e.Component{constructor(){super(...arguments),On(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,l;const n=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(l=this.props.option.request)||void 0===l?void 0:l.params;(0,Q.isEqual)(n,a)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:l={},dataKey:n,valueKey:a="value",textKey:r="text",callback:i}=e;if(t)try{const e=await t(l);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],l=t.map((e=>({value:e[a],text:e[r]})));this.setState({itemList:l},(()=>null==i?void 0:i(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:l}=this.state,{type:n,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:Ee()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(An,{option:this.props.option,items:l,onValuesChange:(t,l)=>{m(t),e.setViewValue(i,l)}}))),u&&t().createElement(R.Col,{flex:ce(u.labelWidth||ll)},e.renderFormItemExtra({fieldName:i,...u}))))}}On(Pn,"contextType",Xt);const Fn=Pn,Hn=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},allowClear:s=!0,readOnly:c,disabled:d}=e.option,{allowHalf:u,count:p=5,tooltips:h}=i;return t().createElement(R.Rate,{value:n,count:p,style:o,allowHalf:u,allowClear:s,tooltips:h,disabled:d||l.isOnlyShow,onChange:e=>{(e=>{var t;null==a||a(e),r(e,(t=e,h?h[Math.ceil(t)-1]:t.toString()))})(e)}})};class kn extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Hn,{option:this.props.option,onValuesChange:(t,l)=>{h(t),e.setViewValue(r,l)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(kn,"contextType",Xt);const Ln=kn;function qn(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const _n=e=>{const{$$form:l}=t().useContext(Xt),{value:n,items:a,onChange:r,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,h=ie(p)?a:p,m=e=>{var t;return(null===(t=h.find((t=>t.value===e)))||void 0===t?void 0:t.text)??""};return l.isOnlyShow?t().createElement(Ol,{value:m(n),bordered:c}):t().createElement(R.Radio.Group,{value:n,style:{width:"100%",...s},disabled:u||l.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{null==r||r(e),i(e,m(e))})(t)}},h.map((e=>t().createElement(R.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class $n extends e.Component{constructor(){super(...arguments),qn(this,"state",{itemList:[]}),qn(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:l={},dataKey:n,valueKey:a="value",textKey:r="text",callback:i}=e;if(t)try{const e=await t(l);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],l=t.map((e=>({value:e[a],text:e[r]})));this.setState({itemList:l},(()=>null==i?void 0:i(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,l;const n=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(l=this.props.option.request)||void 0===l?void 0:l.params;(0,Q.isEqual)(n,a)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:l}=this.state,{type:n,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:Ee()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(_n,{option:this.props.option,items:l,onValuesChange:(t,l)=>{m(t),e.setViewValue(i,l)}}))),u&&t().createElement(R.Col,{flex:ce(u.labelWidth||ll)},e.renderFormItemExtra({fieldName:i,...u}))))}}qn($n,"contextType",Xt);const Dn=$n,Kn=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},disabled:s}=e.option,{falseValue:c=al,trueValue:d=nl}=i;return t().createElement(R.Switch,{checked:n===d,style:o,disabled:s||l.isOnlyShow,checkedChildren:t().createElement(Se.CheckOutlined,null),unCheckedChildren:t().createElement(Se.CloseOutlined,null),onChange:e=>{(e=>{null==a||a(e),r(e,p(e===d?"am.form.trueText":"am.form.falseText"))})(e?d:c)}})};class Vn extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Kn,{option:this.props.option,onValuesChange:(t,l)=>{h(t),e.setViewValue(r,l)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(Vn,"contextType",Xt);const Mn=Vn,jn=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:h,onBlur:m=te,onEnter:f=te}=e.option,{showCount:g,maxLength:b,autoSize:y}=i,v=Object.assign({},{minRows:1,maxRows:3},y);return t().createElement(R.Input.TextArea,{value:n,placeholder:s,style:o,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:d,readOnly:u||l.isOnlyShow,disabled:h,onBlur:t=>{const{value:l}=t.target;(t=>{const{onBlur:l}=e;null==l||l(t)})(l),m(l)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;f(t)}},onChange:e=>{const{value:t}=e.target;(e=>{null==a||a(e),r(e)})(t)}})};class zn extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(jn,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,t)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(zn,"contextType",Xt);const Un=zn,Bn=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:c=p("qm.form.datePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:h,disabled:m}=e.option,{dateType:f="date",minDateTime:g,maxDateTime:b,shortCuts:y=!0}=i,v=t().createRef(),x=e=>{e&&"date"===f&&(e+=" 00:00:00"),null==a||a(e),r(e,E(e))},E=e=>fl(e)?"":["date","exactdate"].includes(f)?e.slice(0,10):e,C=e=>{let t=ml(s()().subtract(e,"day"),cl[f]);"date"===f&&(t=t.slice(0,10)),x(t),v.current.blur(),v.current.focus()};return l.isOnlyShow?t().createElement(Ol,{value:E(n),bordered:d}):t().createElement(q,{ref:v,style:{width:"100%",...o},picker:sl[f],bordered:d,showToday:!1,showTime:"datetime"===f,allowClear:u,disabled:m,inputReadOnly:h,disabledDate:e=>((e,t)=>{let[l,n]=t;return l&&n?e.isBefore(l,"day")||e.isAfter(n,"day"):l?e.isBefore(l,"day"):!!n&&e.isAfter(n,"day")})(e,[g,b]),renderExtraFooter:y?()=>t().createElement(t().Fragment,null,t().createElement(R.Tag,{color:"processing",onClick:()=>C(0)},p("qm.form.datePickers")[0]),t().createElement(R.Tag,{color:"processing",onClick:()=>C(1)},p("qm.form.datePickers")[1]),t().createElement(R.Tag,{color:"processing",onClick:()=>C(7)},p("qm.form.datePickers")[2]),t().createElement(R.Tag,{color:"processing",onClick:()=>C(30)},p("qm.form.datePickers")[3])):void 0,value:hl(n,cl[f]),onChange:(e,t)=>{x(t)}})};class Wn extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Bn,{option:this.props.option,onValuesChange:(t,l)=>{h(t),e.setViewValue(r,l)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(Wn,"contextType",Xt);const Gn=Wn,Yn=e=>[s()().subtract(e,"day"),s()()],Xn=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.daterangePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:h}=e.option,{dateType:m="date",disableds:f=[!1,!1],minDateTime:g,maxDateTime:b,shortCuts:y=!0}=i,v={[p("qm.form.dateRangePickers")[0]]:Yn(7),[p("qm.form.dateRangePickers")[1]]:Yn(30),[p("qm.form.dateRangePickers")[2]]:Yn(90),[p("qm.form.dateRangePickers")[3]]:Yn(180)},x=e=>fl(e)?"":e.map((e=>["date","exactdate"].includes(m)?null==e?void 0:e.slice(0,10):e)).join(" - ");return l.isOnlyShow?t().createElement(Ol,{value:x(n),bordered:c}):t().createElement(q.RangePicker,{style:{width:"100%",...o},picker:sl[m],bordered:c,showTime:"datetime"===m,allowClear:d,disabled:h?[!0,!0]:f,inputReadOnly:u,disabledDate:e=>((e,t)=>{let[l,n]=t;return l&&n?e.isBefore(l,"day")||e.isAfter(n,"day"):l?e.isBefore(l,"day"):!!n&&e.isAfter(n,"day")})(e,[g,b]),ranges:y?v:void 0,value:ie(n)?null:[hl(null==n?void 0:n[0],cl[m]),hl(null==n?void 0:n[1],cl[m])],onChange:(e,t)=>{(e=>{"date"===m&&(e=e.map(((e,t)=>e?0===t?e+" 00:00:00":e+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),null==a||a(e),r(e,x(e))})(t)}})};class Qn extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Xn,{option:this.props.option,onValuesChange:(t,l)=>{h(t),e.setViewValue(r,l)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(Qn,"contextType",Xt);const Zn=Qn,Jn=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.timePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:h}=e.option,{timeType:m="hour-minute-second",hourStep:f=1,minuteStep:g=1,secondStep:b=1}=i;return l.isOnlyShow?t().createElement(Ol,{value:n,bordered:c}):t().createElement(K,{style:{width:"100%",...o},bordered:c,showNow:!0,hourStep:f,minuteStep:g,secondStep:b,allowClear:d,disabled:h,inputReadOnly:u,format:dl[m],value:hl(n,dl[m]),onChange:(e,t)=>{(e=>{const t=ml(e,dl[m]);null==a||a(t),r(t)})(e)}})};class ea extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Jn,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,t)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(ea,"contextType",Xt);const ta=ea,la=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.timerangePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:h}=e.option,{timeType:m="hour-minute-second",disableds:f=[!1,!1],hourStep:g=1,minuteStep:b=1,secondStep:y=1}=i,v=e=>fl(e)?"":e.join(" - ");return l.isOnlyShow?t().createElement(Ol,{value:v(n),bordered:c}):t().createElement(K.RangePicker,{style:{width:"100%",...o},bordered:c,showNow:!1,hourStep:g,minuteStep:b,secondStep:y,allowClear:d,disabled:h?[!0,!0]:f,inputReadOnly:u,format:dl[m],value:ie(n)?null:[hl(null==n?void 0:n[0],dl[m]),hl(null==n?void 0:n[1],dl[m])],onChange:(e,t)=>{(e=>{const t=[ml(null==e?void 0:e[0],dl[m]),ml(null==e?void 0:e[1],dl[m])];null==a||a(t),r(t,v(t))})(e)}})};class na extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(la,{option:this.props.option,onValuesChange:(t,l)=>{h(t),e.setViewValue(r,l)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(na,"contextType",Xt);const aa=na,ra={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 ia,oa=null;function sa(e){return e||null===oa?("object"==typeof Intl&&Intl.Collator?(ia=new Intl.Collator(["zh-Hans-CN","zh-CN"]),oa=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):oa=!1,oa):oa}function ca(e){const t=ra.UNIHANS,l=ra.PINYINS,n=ra.EXCEPTIONS,a={source:e};if(e in n)return a.type=2,a.target=n[e],a;let r,i=-1;if(e.charCodeAt(0)<256)return a.type=1,a.target=e,a;if(r=ia.compare(e,"阿"),r<0)return a.type=3,a.target=e,a;if(0===r)a.type=2,i=0;else{if(r=ia.compare(e,"鿿"),r>0)return a.type=3,a.target=e,a;0===r&&(a.type=2,i=t.length-1)}if(a.type=2,i<0){let l=0,n=t.length-1;for(;l<=n;){i=~~((l+n)/2);const a=t[i];if(r=ia.compare(e,a),0===r)break;r>0?l=i+1:n=i-1}}return r<0&&i--,a.target=l[i],a.target||(a.type=3,a.target=a.source),a}function da(e){return"string"==typeof e&&sa()?e.split("").map((e=>ca(e))):e}const ua={isSupported:sa,parse:da,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(ra)})))},genToken:ca,convertToPinyin:(e,t,l)=>da(e).map((e=>t&&2===e.type?e.target.toLowerCase():e.target)).join(l||"")},pa={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}};ua.isSupported()&&pa.shouldPatch(ua.genToken)&&ua.patchDict(pa);const ha=ua;function ma(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function fa(){return fa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},fa.apply(this,arguments)}const{Option:ga}=R.Select,ba=e=>{const{$$form:l}=t().useContext(Xt),{value:n,items:a,multiple:r,loading:i,onChange:o,onValuesChange:s}=e,{options:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,readOnly:f,disabled:g}=e.option,{itemList:b=[],filterable:y=!0,listHeight:v=rl,collapseTags:x,maxTagTextLength:E,openPyt:C=!0}=c,S=ie(b)?a:b,w=e=>{var t;return r?S.filter((t=>null==e?void 0:e.includes(t.value))).map((e=>e.text)).join(","):(null===(t=S.find((t=>t.value===e)))||void 0===t?void 0:t.text)||""};return l.isOnlyShow?t().createElement(Ol,{value:w(n),bordered:h}):t().createElement(R.Select,fa({value:n,mode:r?"multiple":void 0,placeholder:u,style:d,loading:i,bordered:h,allowClear:m,disabled:g,showSearch:y,listHeight:v,maxTagCount:x?"responsive":void 0,maxTagTextLength:E},r?{title:w(n)}:null,{filterOption:(e,t)=>{var l;const n=(null==t||null===(l=t.children)||void 0===l?void 0:l.toString())||"",a=ha.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${n}|${a}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,w(e),S)})(e)}}),S.map((e=>t().createElement(ga,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ya extends e.Component{constructor(){super(...arguments),ma(this,"state",{itemList:[],loading:!1}),ma(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:l={},dataKey:n,valueKey:a="value",textKey:r="text",callback:i}=e;if(t){this.setState({loading:!0});try{const e=await t(l);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],l=t.map((e=>({value:e[a],text:e[r]})));this.setState({itemList:l},(()=>null==i?void 0:i(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,l;const n=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(l=this.props.option.request)||void 0===l?void 0:l.params;(0,Q.isEqual)(n,a)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:l,loading:n}=this.state,{type:a,label:r,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:Ee()(o,u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(f)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t().createElement(ba,{option:this.props.option,items:l,loading:n,multiple:this.props.multiple,onValuesChange:(t,l,n)=>{g(t,l,n),e.setViewValue(o,l)}}))),h&&t().createElement(R.Col,null,e.renderFormItemButton(o,h)),p&&t().createElement(R.Col,{flex:ce(p.labelWidth||ll)},e.renderFormItemExtra({fieldName:o,...p}))))}}ma(ya,"contextType",Xt);const va=ya;function xa(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Ea extends e.Component{constructor(e){super(e),xa(this,"searchHelper",void 0),xa(this,"alias",void 0),xa(this,"extras",void 0),xa(this,"valueKey",void 0),xa(this,"prevValue",""),xa(this,"_record",void 0),xa(this,"_prevValue",void 0),xa(this,"searchRef",t().createRef()),xa(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0}),xa(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t,options:l,searchHelper:n}=this.props.option;this.searchHelper=Object.assign({},e,l,n);const{fieldAliasMap:a,extraAliasMap:r,fieldsDefine:i}=this.searchHelper;if(a||g("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof a?a():a||{},this.extras="function"==typeof r?r():r||{},i){const e=["valueKey","displayKey","extraKey"];for(const t in i)e.includes(t)&&(this[t]=i[t])}Object.keys(this.alias).includes(t)||g("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),xa(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),xa(this,"getLatestRequest",(()=>{var e;const{request:t,searchHelper:l}=this.props.option;return Object.assign({},null===(e=this.searchHelper)||void 0===e?void 0:e.request,t,null==l?void 0:l.request)})),xa(this,"getItemText",(async()=>{await this.props.waiting();const e=this.getItemValue();if(e===this._prevValue)return;this._prevValue=e;const{fetchApi:t,params:l={},formatter:n=(e=>e),dataKey:a,fieldAliasMap:r,extraAliasMap:i}=this.searchHelper.echoRequest||{},o="function"==typeof r?r():r||{},s="function"==typeof i?i():i||{},{value:c}=this.props;if(t&&!c&&e)try{const r=await t(n({...l,key:e}));if(200===r.code){const e=Array.isArray(r.data)?r.data:(0,Q.get)(r.data,a)??[];if(e[0]){const t=e[0];o&&bl(t,this.alias,o),s&&yl(t,this.extras,s),this._record=t,this.setFieldsValue(t)}}}catch(e){}})),xa(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:l}=this.props.option;for(const n in this.alias){const a=gl(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===l&&t.setViewValue(l,a)}for(const l in this.extras)t.SET_FIELDS_EXTRA({[l]:gl(e,this.extras[l])});this._record=e,this.prevValue=gl(e,this.alias[l])??""})),xa(this,"fetchHandle",(0,Q.debounce)(this.getItemList,200)),xa(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),xa(this,"triggerChange",((e,t)=>{const{onChange:l,onValuesChange:n}=this.props;null==l||l(e),t&&n(e,this._record)})),xa(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;null==t||t(e)})),xa(this,"clickHandle",((e,t)=>{const{$$form:l}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&l.SET_FIELDS_VALUE({[t]:gl(e,this.alias[t])});for(const t in this.extras)l.SET_FIELDS_EXTRA({[t]:gl(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=gl(e,this.alias[n]);this.prevValue=a??"",this.triggerChange(a,!0),t&&t()})),this.initialHandle()}componentDidMount(){this.getItemText()}componentDidUpdate(e){var t,l,n,a,r,i;const o=(null===(t=e.option.searchHelper)||void 0===t||null===(l=t.request)||void 0===l?void 0:l.params)||(null===(n=e.option.request)||void 0===n?void 0:n.params),s=(null===(a=this.props.option.searchHelper)||void 0===a||null===(r=a.request)||void 0===r?void 0:r.params)||(null===(i=this.props.option.request)||void 0===i?void 0:i.params);(0,Q.isEqual)(o,s)||this.getItemList(),this.getItemText()}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:l,params:n={},formatter:a=(e=>e),dataKey:r}=this.getLatestRequest();if(l){this.setState({loading:!0});try{const i=await l(a({...n,[t]:e}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,Q.get)(i.data,r)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){var e;const{$$form:l}=this.context,{visible:n,loading:a,itemList:r}=this.state,{value:o}=this.props,{options:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{hideHeader:g,onlySelect:b=!0,listHeight:y=rl}=s,v=(null===(e=this.searchHelper)||void 0===e?void 0:e.columns)||[],x=Ce("form-immediate"),E=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,C=t().createElement(R.Spin,{spinning:a},r.length?t().createElement("table",{cellSpacing:0,cellPadding:0,className:Ee()("table")},!g&&t().createElement("thead",null,t().createElement("tr",null,v.filter((e=>!e.hidden)).map((e=>t().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t().createElement("tbody",null,r.map(((e,l)=>t().createElement("tr",{key:l,className:this.state.activeIndex===l?"active":"",onMouseEnter:()=>{this.setState({activeIndex:l})},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},v.filter((e=>!e.hidden)).map((l=>t().createElement("td",{key:l.dataIndex},(0,Q.get)(e,l.dataIndex))))))))):t().createElement(dt,null));return t().createElement(i.Consumer,null,(e=>{const a={[x]:!0,[`${x}--lg`]:"large"===(null==e?void 0:e.size),[`${x}--sm`]:"small"===(null==e?void 0:e.size)};return l.isOnlyShow?t().createElement(Ol,{value:o,bordered:u}):t().createElement(an(),{action:f?[]:["click"],popupVisible:!f&&n,popup:C,popupClassName:Ee()(a),popupStyle:{minWidth:E,maxHeight:y},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:ol,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(R.Input,{ref:this.searchRef,placeholder:d,allowClear:h,bordered:u,readOnly:m,disabled:f,style:{width:"100%",...c},value:o,title:o,onFocus:()=>{!r.length&&this.fetchHandle(o)},onBlur:e=>{const{value:t}=e.target;b&&t!==this.prevValue&&this.triggerChange(this.prevValue,!1),this.triggerBlur(t)},onKeyUp:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(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 l=40===e.keyCode?++t%r.length:(--t+r.length)%r.length;this.setState({activeIndex:l})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),t?(this.handleVisibleChange(!0),this.triggerChange(t,!b)):this.clickHandle(null)}}))}))}}xa(Ea,"contextType",Xt);class Ca extends e.Component{constructor(e,t){let{$$form:l}=t;super(e),xa(this,"promiseRef",void 0),xa(this,"state",{searchHelper:{}}),xa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),xa(this,"getHelperConfig",(e=>{var t,l;const{global:n}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==n||null===(t=n.searchHelper)||void 0===t||!t.getServerConfig||null==n||null===(l=n.searchHelper)||void 0===l||!l.createFetchApi)return g("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const l=await n.searchHelper.getServerConfig({searchHelperId:a});if(200===l.code){const t=Sl(Object.assign({},l.data,r),i,n.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(l.context)}render(){const{$$form:e}=this.context,{searchHelper:l}=this.state,{type:n,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(a),className:Ee()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(m)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ea,{option:this.props.option,helperConfig:l,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",l=arguments.length>1?arguments[1]:void 0;f(t,l),e.setViewValue(i,t)}}))),p&&t().createElement(R.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(R.Col,{flex:ce(u.labelWidth||ll)},e.renderFormItemExtra({fieldName:i,...u}))))}}xa(Ca,"contextType",Xt);const Sa=Ca;class wa extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,fieldName:a,className:r,style:i={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=te}=o,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===a))??[],l=c??t.length-1;t.slice(l+1).forEach((t=>{const l=d.find((e=>e.fieldName===t.fieldName));if(!l)return;const n=l.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${n}${a}`})}))}return t().createElement(R.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},t().createElement(Ne,{id:a,label:n,className:r,extra:p.map((e=>e.text)).join(" | "),style:{...i},collapse:s[a],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[a]:t})}))),u(t)}}))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(wa,"contextType",Xt);const Ia=wa;function Na(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function Ta(){return Ta=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Ta.apply(this,arguments)}const Ra=(e,t,l,n)=>e.map((e=>e[l]===t?{...e,children:n}:e.children?{...e,children:Ra(e.children,t,l,n)}:e)),Oa=e=>{const{$$form:l}=t().useContext(Xt),{value:n,items:a,multiple:r,loading:i,onChange:o,onValuesChange:s}=e,{options:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,asyncLoad:f,readOnly:g,disabled:b}=e.option,{itemList:y,filterable:v=!0,listHeight:x=rl,checkStrictly:E,checkStrategy:C="SHOW_CHILD",collapseTags:S,openPyt:w=!0}=c,[I,N]=t().useState(ie(y)?a:y);$e((()=>{N(ie(y)?a:y)}),[y,a]);const T=e=>{var t;return(null===(t=xl(I,e))||void 0===t?void 0:t.text)||""},O=e=>r?e.map((e=>T(e))).filter((e=>!!e)).join(","):T(e);return l.isOnlyShow?t().createElement(Ol,{value:O(n),bordered:h}):t().createElement(R.TreeSelect,Ta({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:r,treeCheckable:r,treeCheckStrictly:E,showCheckedStrategy:R.TreeSelect[C],placeholder:u,listHeight:x,style:d,loading:i,bordered:h,allowClear:m,disabled:b,treeDefaultExpandAll:!f,showSearch:v,maxTagCount:S?"responsive":void 0,loadData:f?async e=>{let{key:t,children:l}=e;if(!f||l)return;const{fetchApi:n,params:a,dataKey:r,textKey:i="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=f;if(n)try{const e=await n(c({...a,[o]:t}));if(200===e.code){const l=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=Ra(I,t,o,vl(l,o,i));N(n),null==s||s(l)}}catch(e){}}:void 0,treeData:I},r?{title:O(n)}:null,{filterTreeNode:(e,t)=>{var l;const n=(null==t||null===(l=t.text)||void 0===l?void 0:l.toString())||"",a=ha.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${n}|${a}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,O(e),I)})(e)}}))};class Aa extends e.Component{constructor(){super(...arguments),Na(this,"state",{itemList:[],loading:!1}),Na(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:l={},dataKey:n,valueKey:a="value",textKey:r="text",callback:i}=e;if(t){this.setState({loading:!0});try{const e=await t(l);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],l=vl(t,a,r);this.setState({itemList:l},(()=>null==i?void 0:i(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,l;const n=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(l=this.props.option.request)||void 0===l?void 0:l.params;(0,Q.isEqual)(n,a)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:l,loading:n}=this.state,{type:a,label:r,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:Ee()(o,u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(m)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(r)}},t().createElement(Oa,{option:this.props.option,items:l,loading:n,multiple:this.props.multiple,onValuesChange:(t,l,n)=>{f(t,l,n),e.setViewValue(o,l)}}))),p&&t().createElement(R.Col,{flex:ce(p.labelWidth||ll)},e.renderFormItemExtra({fieldName:o,...p}))))}}Na(Aa,"contextType",Xt);const Pa=Aa;function Fa(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function Ha(){return Ha=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Ha.apply(this,arguments)}const ka=e=>{const{$$form:l}=t().useContext(Xt),{value:n,multiple:a,items:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:h}=e.option,{changeOnSelect:m,checkStrictly:f,checkStrategy:g="SHOW_PARENT",filterable:b=!0,openPyt:y=!0}=i,{itemList:v=[]}=i,x=ie(v)?r:v,E=e=>ie(e)?"":a?e.map((e=>El(x,e).map((e=>e.text)).join("/"))).join(","):El(x,e).map((e=>e.text)).join("/");return l.isOnlyShow?t().createElement(Ol,{value:E(n),bordered:c}):t().createElement(R.Cascader,Ha({value:(e=>ie(e)?[]:a?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:x,multiple:a,maxTagCount:"responsive",changeOnSelect:m||f,showCheckedStrategy:R.Cascader[g],placeholder:s,style:o,bordered:c,allowClear:d,disabled:h,showSearch:b&&{filter:(e,t)=>t.some((t=>{var l;const n=(null==t||null===(l=t.text)||void 0===l?void 0:l.toString())||"",a=ha.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(y?`${n}|${a}`:n).toLowerCase().indexOf(e.toLowerCase())>=0}))}},a?{title:E(n)}:null,{onChange:t=>{(t=>{const{onChange:l,onValuesChange:n}=e;null==l||l(t),n(t,E(t),x)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class La extends e.Component{constructor(){super(...arguments),Fa(this,"state",{itemList:[],loading:!1}),Fa(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:l={},dataKey:n,valueKey:a="value",textKey:r="text",callback:i}=e;if(t){this.setState({loading:!0});try{const e=await t(l);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],l=vl(t,a,r);this.setState({itemList:l},(()=>null==i?void 0:i(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,l;const n=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(l=this.props.option.request)||void 0===l?void 0:l.params;(0,Q.isEqual)(n,a)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:l}=this.props,{itemList:n}=this.state,{type:a,label:r,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(r),className:Ee()(o,u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(m)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(r)}},t().createElement(ka,{option:this.props.option,multiple:l,items:n,onValuesChange:(t,l,n)=>{f(t,l,n),e.setViewValue(o,l)}}))),p&&t().createElement(R.Col,{flex:ce(p.labelWidth||ll)},e.renderFormItemExtra({fieldName:o,...p}))))}}Fa(La,"contextType",Xt);const qa=La,_a=require("china-area-data");var $a=n.n(_a);function Da(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const Ka=["110000","120000","310000","500000"],Va=["810000","820000"],Ma=[{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"}],ja=[{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"}],za=e=>ha.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Ua=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(l>2||!e[t])return;const n="86"===t?Object.keys(e[t]).filter((e=>![...Ka,...Va].includes(e))):Object.keys(e[t]);return n.map((n=>({l:za(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:Ua(e,n,l+1)})))},Ba=(e,t)=>t.map((t=>({l:za(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Wa extends e.Component{constructor(e){super(e),Da(this,"searchRef",t().createRef()),Da(this,"scrollRef",t().createRef()),Da(this,"zxsAndGa",void 0),Da(this,"provinces",void 0),Da(this,"allCities",void 0),Da(this,"letterCities",void 0),Da(this,"state",{visible:!1,select_type:"0",active_key:""}),Da(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Da(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:l}=this.props;null==t||t(e),l(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(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),St()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){var t;return(null===(t=this.allCities.find((t=>t.c===e)))||void 0===t?void 0:t.n)||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Ba($a(),Ka)},{l:"Z2",n:"港澳",c:"",p:"",children:Ba($a(),Va)}]}createProvince(){return(Ua($a(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return ja.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Ka,...Va].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t().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}))}},t().createElement(R.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),t().createElement(R.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:l}=this.state;return("0"===l?Ma:ja).map((l=>t().createElement("li",{key:l.value,className:Ee()({tag:!0,actived:l.value===e}),onClick:()=>this.scrollHandle(l.value.toString())},l.text)))}renderSelect(){const{value:e}=this.props;return t().createElement(R.Select,{size:"small",placeholder:p("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>{var l;return((null==t||null===(l=t.children)||void 0===l?void 0:l.toString())||"").toLowerCase().indexOf(e.toLowerCase())>=0},value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t().createElement(R.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:l}=this.state;return("0"===l?this.provinces:this.letterCities).map(((l,n)=>{var a;return t().createElement("div",{key:n},t().createElement("dt",{ref:e=>this[`${l.l}Ref`]=e},l.n,":"),t().createElement("dd",null,null===(a=l.children)||void 0===a?void 0:a.map((l=>t().createElement("li",{key:l.c,className:Ee()({actived:l.c===e}),onClick:()=>this.clickHadnle(l.c)},l.n)))))}))}render(){const{$$form:e}=this.context,{visible:l}=this.state,{value:n}=this.props,{options:a={},style:r={},placeholder:o=p("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,h=Ce("form-city-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,f=this.createTextValue(n),g=t().createElement("div",{className:"container",style:{...r}},t().createElement("div",{className:"city-drop"},t().createElement("div",{className:"city-drop-toper"},t().createElement("div",{className:"city-drop-toper__type"},this.renderType()),t().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t().createElement("div",{className:"city-drop-letter"},this.renderLetter()),t().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t().createElement("dl",null,this.renderCity(n)))));return t().createElement(i.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===(null==n?void 0:n.size),[`${h}--sm`]:"small"===(null==n?void 0:n.size)};return e.isOnlyShow?t().createElement(Ol,{value:f,bordered:s}):t().createElement(an(),{action:u?[]:["click"],popupVisible:!u&&l,popup:g,popupClassName:Ee()(a),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:ol,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(R.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:{width:"100%",...r},value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}Da(Wa,"contextType",Xt);class Ga extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Wa,{option:this.props.option,onValuesChange:(t,l)=>{h(t),e.setViewValue(r,l)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}Da(Ga,"contextType",Xt);const Ya=Ga;function Xa(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const Qa=(e,t)=>{if(e[t])return Object.keys(e[t]).map((l=>({text:e[t][l],value:l,children:Qa(e,l)})))};class Za extends e.Component{constructor(e){super(e),Xa(this,"searchRef",t().createRef()),Xa(this,"prevText",void 0),Xa(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Xa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:l}=this.props;null==t||t(e),l(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const l=Qa($a(),"86")||[];this.state={results:l,visible:!1,values:[],tabs:[l.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:l}=this.props;t!==l&&this.state.values.join(",")!==(l??"")&&this.initial()}get isFetch(){var e;return!(null===(e=this.props.option.request)||void 0===e||!e.fetchApi)}get leave(){return this.isFetch?4:3}setInputReadonly(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>{var l,n;return null===(l=this.state.tabs[t])||void 0===l||null===(n=l.find((t=>t.value===e)))||void 0===n?void 0:n.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 l=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=xl(e,t[n]);if(a&&ie(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(null==a?void 0:a.children)&&(l[n+1]=null==a?void 0:a.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:l})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:l,formatter:n=(e=>e),dataKey:a,valueKey:r="value",textKey:i="text"}=t;if(l)try{const t=await l(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[i],value:e[r]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,l=this.state.tabs.map(((l,n)=>{var a;const r=(null===(a=l.find((t=>t.value===e[n])))||void 0===a?void 0:a.text)||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return t().createElement(R.Tabs.TabPane,{key:n.toString(),tab:r},t().createElement("div",{className:"region-box"},l.map((l=>t().createElement("span",{key:l.value,className:Ee()({"region-box__item":!0,actived:e.includes(l.value.toString())}),title:l.text,onClick:()=>{let{values:e}=this.state;e[n]=l.value.toString(),e=e.slice(0,n+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.leave-1:this.leave;if(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},l.text)))))}));return l.length?t().createElement(R.Tabs,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},l):t().createElement(dt,null)}render(){const{$$form:e}=this.context,{visible:l}=this.state,{value:n}=this.props,{options:a={},style:r={},placeholder:o=p("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,h=Ce("form-region-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,f=t().createElement("div",{className:"container"},this.renderTabs());let g=this.prevText;if(!l){const e=this.createTextValue(n);(""===e||e.split("/").every((e=>""!==e)))&&(g=e,this.prevText=g)}return t().createElement(i.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===(null==n?void 0:n.size),[`${h}--sm`]:"small"===(null==n?void 0:n.size)};return e.isOnlyShow?t().createElement(Ol,{value:g,bordered:s}):t().createElement(an(),{action:u?[]:["click"],popupVisible:!u&&l,popup:f,popupClassName:Ee()(a),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:ol,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(R.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:{width:"100%",...r},readOnly:d,disabled:u,value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&ae((()=>this.initial()))}}))}))}}Xa(Za,"contextType",Xt);class Ja extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Za,{option:this.props.option,onValuesChange:(t,l)=>{h(t),e.setViewValue(r,l)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}Xa(Ja,"contextType",Xt);const er=Ja,tr=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},upload:o={},style:s={},disabled:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:p,fileSize:h,onRemove:m}=i,{action:f,headers:g,params:b,withCredentials:y=!1,dataKey:v="",fieldAliasMap:x,button:E}=o,C="function"==typeof x?x():x||{};return t().createElement(jr,{name:"file",action:f,multiple:d,headers:g,data:b,withCredentials:y,maxCount:u,fileTypes:p,fileSize:h,disabled:c||l.isOnlyShow,button:E,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(Se.DownloadOutlined,null)},fileList:n,onChange:e=>{let{file:t,fileList:l}=e;(e=>{const t=e.map((e=>{var t,l;const n={};for(const t in C){var a,r;n[t]=e[t]||(null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r?void 0:r[C[t]])||""}return{uid:e.uid,name:e.name,...n,url:e.url||(v?(0,Q.get)(null===(l=e.response)||void 0===l?void 0:l.data,v):null===(t=e.response)||void 0===t?void 0:t.data)||"",status:e.status}}));null==a||a(t),t.every((e=>"done"===e.status&&e.url))&&r(t)})(l)},onRemove:m})};class lr extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(tr,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,"")}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(lr,"contextType",Xt);const nr=lr,ar=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},upload:o={},style:s={},disabled:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:p,quality:h,openCropper:m,fileTypes:f,fileSize:g,onRemove:b}=i,{action:y,headers:v,params:x,withCredentials:E=!1,dataKey:C="",fieldAliasMap:S}=o,w="function"==typeof S?S():S||{};return t().createElement(Xr,{name:"file",action:y,multiple:d,headers:v,data:x,withCredentials:E,maxCount:u,fixedSize:p,quality:h,openCropper:m,fileTypes:f,fileSize:g,disabled:c||l.isOnlyShow,fileList:n,onChange:e=>{let{file:t,fileList:l}=e;(e=>{const t=e.map((e=>{var t,l;const n={};for(const t in w){var a,r;n[t]=e[t]||(null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r?void 0:r[w[t]])||""}return{uid:e.uid,name:e.name,...n,url:e.url||(C?(0,Q.get)(null===(l=e.response)||void 0===l?void 0:l.data,C):null===(t=e.response)||void 0===t?void 0:t.data)||"",status:e.status}}));null==a||a(t),t.every((e=>"done"===e.status&&e.url))&&r(t)})(l)},onRemove:b})};class rr extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ar,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,"")}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(rr,"contextType",Xt);const ir=rr,or=e=>{const{$$form:l}=t().useContext(Xt),{value:n,onChange:a,onValuesChange:r}=e,{options:i={},upload:o,style:s={},placeholder:c=p("qm.form.inputPlaceholder"),readOnly:d,disabled:u}=e.option,{tinymce:h,thresholdSize:m}=i;return t().createElement(kr,{value:n,tinymce:h,upload:o,thresholdSize:m,style:{width:"100%",...s},disabled:d||u||l.isOnlyShow,onChange:e=>{(e=>{null==a||a(e),r(e)})(e)}})};class sr extends e.Component{render(){const{$$form:e}=this.context,{type:l,label:n,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=te}=this.props.option;return t().createElement(R.Form.Item,{label:e.renderFormLabel(n),className:Ee()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},t().createElement(R.Row,{wrap:!1,gutter:4},t().createElement(R.Col,{flex:"auto"},t().createElement(R.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(or,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,t)}}))),d&&t().createElement(R.Col,{flex:ce(d.labelWidth||ll)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,l){t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l}(sr,"contextType",Xt);const cr=sr;function dr(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class ur extends e.Component{constructor(e){super(e),dr(this,"provide",{$$form:this,echo_data:{}}),dr(this,"_initialValues",void 0),dr(this,"_initialOthers",void 0),dr(this,"_initialExtras",void 0),dr(this,"_fieldAuth",{}),dr(this,"wrapperRef",t().createRef()),dr(this,"formRef",t().createRef()),dr(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!1}),dr(this,"resizeObserveHandler",(()=>{var e;const t=null===(e=this.wrapperRef.current)||void 0===e?void 0:e.offsetWidth;if(void 0===t||0===t||this.props.cols>0)return;let l=Math.floor(t/300);l=24%l==0?l:l-1,l=l<1?1:l,l=l>8?8:l,l!==this.state.flexCols&&this.setState({flexCols:l})})),dr(this,"resizeListenerHandle",(0,Q.debounce)(this.resizeObserveHandler,10)),dr(this,"getFormItems",Yt()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),dr(this,"getFlattenItems",Yt()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,Q.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),dr(this,"valuesChangeHandle",((e,t)=>{var l,n;null===(l=(n=this.props).onValuesChange)||void 0===l||l.call(n,e,this._initialValues)})),dr(this,"fieldsChangeHandle",((e,t)=>{var l,n;null===(l=(n=this.props).onFieldsChange)||void 0===l||l.call(n,e,t)})),dr(this,"finishHandle",(e=>{var t,l;null===(t=(l=this.props).onFinish)||void 0===t||t.call(l,Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),dr(this,"finishFailedHandle",(e=>{var t,l;let{values:n,errorFields:a}=e;null===(t=(l=this.props).onFinishFailed)||void 0===t||t.call(l,a)})),dr(this,"openValidateInfo",(e=>{const l=t().createElement("ul",null,e.map((e=>{const{label:l}=this.formItems.find((t=>t.fieldName===e.name[0]));return t().createElement("li",{key:e.name[0],style:{color:"#f5222d"}},"[",("string"==typeof l?`${l}: `:"")+e.errors.join(","),"]")})));R.notification.error({message:p("qm.form.validatePrompt"),description:l,duration:10})})),dr(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&St()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!(null==e||!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(){el(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){tl(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&g("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),l={};for(const n in e)t.includes(n)||(l[n]=e[n]);return Object.assign({},l)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,Q.isPlainObject)(e.extra))).forEach((l=>{t[l.fieldName]=e[l.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,Q.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:l,options:n}=e;return t=t??void 0,il.includes(l)&&(t=t??[]),"CHECKBOX"!==l&&"SWITCH"!==l||(t=t??(null==n?void 0:n.falseValue)??al),t}createFormValue(e){const t={};return this.flattenItems.forEach((l=>{t[l.fieldName]=this.getInitialValue(l,e[l.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t!==this.getViewValue(e)&&this.setState((l=>({viewData:Object.assign({},l.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){this.setState({collapse:e},(()=>{var e,t;null===(e=(t=this.props).onCollapse)||void 0===e||e.call(t,this.state.collapse)}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:l}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!l||setTimeout((()=>this.CREATE_FOCUS(l)))}getFormItemLabel(e){var t,l;if("string"==typeof e)return e;const{fieldName:n,options:a={}}=e,{itemList:r=[]}=a;if(!r.length)return g("Form",`fieldName 为 ${n} 的表单项的 \`itemList\` 配置有误`),"";const i=(null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([n])[n])??this._initialValues[n]??r[0].value;return(null===(l=r.find((e=>e.value===i)))||void 0===l?void 0:l.text)||""}getBlockDerivedItems(){const e=[];for(let t=0,l=this.dividers.length;t<l;t++){const l=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(l,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:l}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){var a;const t=n[e],r=this.dividers.find((e=>e.fieldName===t[0].fieldName)),i=(null==r||null===(a=r.collapse)||void 0===a?void 0:a.showLimit)??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===l&&e>i)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const l=e[t];if(fl(l)&&(e[t]=""),Array.isArray(l)&&l.forEach(((l,n)=>{fl(l)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(l)){const[n,a]=t.split("|");e[n]=l[0]??"",e[a]=l[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=X()(e,["fetch"]);if(e.fetch){const{api:l,params:n,dataKey:a}=e.fetch;try{const e=await l(n);200===e.code&&(t=(a?(0,Q.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){var l,n;const e=this.props.items.map((e=>{const{fieldName:l}=e,n=t.fieldList.find((e=>e.dataIndex===l));if(n){const{visible:t=1,disabled:a,secretName:r}=n;t||(e.noAuth=!0),a&&(e.disabled=!0),r&&(e.options?e.options.secretType=r:e.options={secretType:r}),this.setFieldAuth(l,{visible:t,disabled:a,secretName:r})}return e}));null===(l=(n=this.props).fieldsChange)||void 0===l||l.call(n,e)}}INPUT(e){return t().createElement(Hl,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(ql,{option:e})}INPUT_NUMBER(e){return t().createElement(Ml,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(Ul,{option:e})}SEARCH_HELPER(e){return t().createElement(Ql,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t().createElement(cn,{option:e})}TREE_TABLE_HELPER(e){return t().createElement(mn,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t().createElement(xn,{option:e})}RANGE_SEARCH_HELPER(e){return t().createElement(In,{option:e})}CHECKBOX(e){return t().createElement(Rn,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(Fn,{option:e})}RATE(e){return t().createElement(Ln,{option:e})}RADIO(e){return t().createElement(Dn,{option:e})}SWITCH(e){return t().createElement(Mn,{option:e})}TEXT_AREA(e){return t().createElement(Un,{option:e})}DATE(e){return t().createElement(Gn,{option:e})}RANGE_DATE(e){return t().createElement(Zn,{option:e})}TIME(e){return t().createElement(ta,{option:e})}RANGE_TIME(e){return t().createElement(aa,{option:e})}SELECT(e){return t().createElement(va,{option:e})}MULTIPLE_SELECT(e){return t().createElement(va,{option:e,multiple:!0})}IMMEDIATE(e){return t().createElement(Sa,{option:e})}DIVIDER(e){return t().createElement(Ia,{option:e})}TREE_SELECT(e){return t().createElement(Pa,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(Pa,{option:e,multiple:!0})}CASCADER(e){return t().createElement(qa,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(qa,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(Ya,{option:e})}REGION_SELECT(e){return t().createElement(er,{option:e})}UPLOAD_FILE(e){return t().createElement(nr,{option:e})}UPLOAD_IMG(e){return t().createElement(ir,{option:e})}TINYMCE(e){return t().createElement(cr,{option:e})}renderFormLabel(e){if(!(0,Q.isPlainObject)(e))return e;const{type:l,fieldName:n,options:a={},placeholder:r,disabled:i,onChange:o=te}=e,{itemList:s=[]}=a;return t().createElement(R.Form.Item,{name:n,noStyle:!0},"SELECT"===l&&t().createElement(R.Select,{placeholder:r,disabled:i,style:{width:"calc(100% - 10px)"},onChange:e=>o(e,s.find((t=>t.value===e)).text)},s.map((e=>t().createElement(R.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text)))))}renderFormItemExtra(e){const{fieldName:l,isTooltip:n,style:a={},render:r}=e,{extra:i}=this.state;if(n)return t().createElement(R.Tooltip,{className:"extra-tooltip",title:i[l]},t().createElement(Se.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===l));return t().createElement("div",{className:"extra-text",title:r?"":i[l],style:a},t().createElement("span",{className:"extra-overflow-cut"},r?r(o,this):i[l]))}renderFormItemButton(e,t){const l=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(l):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:l,fieldName:n,invisible:a,className:r,labelWidth:i=this.props.labelWidth,rules:o=[],style:s={},render:c}=e;return ie(this.state.formData)?null:t().createElement(R.Form.Item,{label:l,name:n,rules:o,hidden:a,className:Ee()(n,r),style:{width:"100%",...s},labelCol:{flex:ce(i)}},null==c?void 0:c(e,this))}createFormItem(e){return(0,Q.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(g("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:l,defaultRows:n,isFieldsDefine:a}=this.props,r=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:l=0}=e;for(let e=0;e<t;e++)r.push({});r.push(e);for(let e=0;e<l;e++)r.push({})}));const i=24/e,o=[],s=r.reduce(((e,t)=>{const{selfCol:l=1}=t,n=e+l;return o.push(n),n}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,d=[],u=r.map(((l,n)=>{let{selfCol:a=1}=l;const{type:r,fieldName:s}=l;a=a>=24||"DIVIDER"===r||"TINYMCE"===r?e:a;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(l);return u&&d.push(o[n]),t().createElement(R.Col,{key:s??n,span:a*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},r?this.createFormItem(se(l)):null)}));return a&&"default"===l&&u.push(t().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:l,collapse:n}=this.state,{searchButtonCols:a,isSearchBtn:r,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const o=24/l,s=a||1,c=l-e%l-s;return r?t().createElement(R.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t().createElement(R.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,icon:t().createElement(Se.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),t().createElement(he,{size:this.$size,icon:t().createElement(Se.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),i?this.createFieldsDefine():null,this.showFilterCollapse&&t().createElement("a",{onClick:()=>this.setExpandHandle(!n)},n?t().createElement(Se.UpOutlined,null):t().createElement(Se.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:l,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const a=24/e;return n&&"default"===l?t().createElement(R.Row,{gutter:0},t().createElement(R.Col,{key:"-",span:a},t().createElement(R.Form.Item,null,t().createElement(R.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),t().createElement(he,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:l,fieldsChange:n}=this.props;return t().createElement(Tl,{uniqueKey:e,items:l,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[l,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>{var t;return null===(t=this[`${e.fieldName}_Ref`])||void 0===t?void 0:t.searchRef._is_change})).map((e=>({name:[e.fieldName],errors:[p("qm.form.searchHelperTips")],warnings:[]})));l||a.length?t((l||[]).concat(a)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){var e,t;let l=[];const n=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName));n.length&&(l=this.flattenItems.map((e=>e.fieldName)).filter((e=>!n.includes(e)))),this.formRef.current.resetFields(l.length?l:void 0),this.setState((e=>{const t=Object.keys(e.other),l=Object.keys(this._initialOthers),n=t.filter((e=>!l.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),null===(e=(t=this.props).onReset)||void 0===e||e.call(t)}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){g("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,l){const{items:n,fieldsChange:a}=this.props,r=n.find((t=>t.fieldName===e));if(!r)return g("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,Q.isPlainObject)(t))return g("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(r.noAuth)return g("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const l in t)l&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===l||(0,Q.set)(r,l,t[l]));l&&(a?a([...n]):g("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:l,layout:n,disabled:a,labelWidth:r,labelAlign:i,labelWrap:o,customClass:s}=this.props,c=Ce("form"),d={required:"${label}"+p("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return t().createElement("div",{ref:this.wrapperRef,className:Ee()(u,e),style:l},t().createElement(R.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:i,labelWrap:o,colon:!1,disabled:a,labelCol:{flex:this.verticalLayout?"initial":ce(r)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t().createElement(Xt.Provider,{value:this.provide},t().createElement(R.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}dr(ur,"contextType",i),dr(ur,"propTypes",ul),dr(ur,"defaultProps",pl);const pr=ur,hr={onActivate:l.func,onAddUndo:l.func,onBeforeAddUndo:l.func,onBeforeExecCommand:l.func,onBeforeGetContent:l.func,onBeforeRenderUI:l.func,onBeforeSetContent:l.func,onBeforePaste:l.func,onBlur:l.func,onChange:l.func,onClearUndos:l.func,onClick:l.func,onContextMenu:l.func,onCommentChange:l.func,onCopy:l.func,onCut:l.func,onDblclick:l.func,onDeactivate:l.func,onDirty:l.func,onDrag:l.func,onDragDrop:l.func,onDragEnd:l.func,onDragGesture:l.func,onDragOver:l.func,onDrop:l.func,onExecCommand:l.func,onFocus:l.func,onFocusIn:l.func,onFocusOut:l.func,onGetContent:l.func,onHide:l.func,onInit:l.func,onKeyDown:l.func,onKeyPress:l.func,onKeyUp:l.func,onLoadContent:l.func,onMouseDown:l.func,onMouseEnter:l.func,onMouseLeave:l.func,onMouseMove:l.func,onMouseOut:l.func,onMouseOver:l.func,onMouseUp:l.func,onNodeChange:l.func,onObjectResizeStart:l.func,onObjectResized:l.func,onObjectSelected:l.func,onPaste:l.func,onPostProcess:l.func,onPostRender:l.func,onPreProcess:l.func,onProgressState:l.func,onRedo:l.func,onRemove:l.func,onReset:l.func,onSaveContent:l.func,onSelectionChange:l.func,onSetAttrib:l.func,onSetContent:l.func,onShow:l.func,onSubmit:l.func,onUndo:l.func,onVisualAid:l.func,onSkinLoadError:l.func,onThemeLoadError:l.func,onModelLoadError:l.func,onPluginLoadError:l.func,onIconsLoadError:l.func,onLanguageLoadError:l.func},mr={apiKey:l.string,id:l.string,inline:l.bool,init:l.object,initialValue:l.string,onEditorChange:l.func,value:l.string,tagName:l.string,cloudChannel:l.string,plugins:l.oneOfType([l.string,l.array]),toolbar:l.oneOfType([l.string,l.array]),disabled:l.bool,textareaName:l.string,tinymceScriptSrc:l.string,rollback:l.oneOfType([l.number,l.oneOf([!1])]),scriptLoading:l.shape({async:l.bool,defer:l.bool,delay:l.number}),...hr},fr=e=>"function"==typeof e,gr=e=>e in hr,br=e=>e.substr(2),yr=(e,t,l,n,a)=>((t,l,n,a,r,i,o)=>{const s=Object.keys(r).filter(gr),c=Object.keys(i).filter(gr),d=s.filter((e=>void 0===i[e])),u=c.filter((e=>void 0===r[e]));d.forEach((e=>{const t=br(e),l=o[t];n(t,l),delete o[t]})),u.forEach((n=>{const a=((t,l)=>n=>{var a;return null===(a=t(l))||void 0===a?void 0:a(n,e)})(t,n),r=br(n);o[r]=a,l(r,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,l,n);let vr=0;const xr=e=>{const t=Date.now(),l=Math.floor(1e9*Math.random());return vr++,e+"_"+l+vr+String(t)},Er=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Cr=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Sr=(e,t)=>Cr(e).concat(Cr(t)),wr=e=>{if(!("isConnected"in Node.prototype)){let t=e,l=e.parentNode;for(;null!=l;)t=l,l=t.parentNode;return t===e.ownerDocument}return e.isConnected},Ir=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Nr=()=>({listeners:[],scriptId:xr("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Tr=(()=>{let e=Nr();return{load:(t,l,n,a,r,i)=>{const o=()=>((t,l,n,a,r,i)=>{const o=l.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=n,o.async=a,o.defer=r;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),l.head&&l.head.appendChild(o)})(e.scriptId,t,l,n,a);e.scriptLoaded?i():(e.listeners.push(i),e.scriptLoading||(e.scriptLoading=!0,r>0?setTimeout(o,r):o()))},reinitialize:()=>{e=Nr()}}})(),Rr=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Or(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Ar extends e.Component{constructor(t){var l,n;super(t),l=this,Or(this,"editor",void 0),Or(this,"id",void 0),Or(this,"elementRef",void 0),Or(this,"inline",void 0),Or(this,"currentContent",void 0),Or(this,"boundHandlers",void 0),Or(this,"rollbackTimer",void 0),Or(this,"valueCursor",void 0),Or(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})),Or(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){}})),Or(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Or(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))}})),Or(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Or(this,"initialise",(function(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const a=l.elementRef.current;if(!a)return;if(!wr(a)){if(0===n)setTimeout((()=>l.initialise(1)),1);else{if(!(n<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>l.initialise(n+1)),100)}return}const r=Rr(l.view);if(!r)throw new Error("tinymce should have been loaded into global scope");const i={...l.props.init,selector:void 0,target:a,readonly:l.props.disabled,inline:l.inline,plugins:Sr(null===(e=l.props.init)||void 0===e?void 0:e.plugins,l.props.plugins),toolbar:l.props.toolbar??(null===(t=l.props.init)||void 0===t?void 0:t.toolbar),setup:e=>{l.editor=e,l.bindHandlers({}),l.inline&&!Er(a)&&e.once("PostRender",(t=>{e.setContent(l.getInitialValue(),{no_events:!0})})),l.props.init&&fr(l.props.init.setup)&&l.props.init.setup(e)},init_instance_callback:e=>{const t=l.getInitialValue();l.currentContent=l.currentContent??e.getContent(),l.currentContent!==t&&(l.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=l.props.disabled??!1;Ir(l.editor,n?"readonly":"design"),l.props.init&&fr(l.props.init.init_instance_callback)&&l.props.init.init_instance_callback(e)}};l.inline||(a.style.visibility=""),Er(a)&&(a.value=l.getInitialValue()),r.init(i)})),this.id=this.props.id||xr("tiny-react"),this.elementRef=e.createRef(),this.inline=this.props.inline??(null===(n=this.props.init)||void 0===n?void 0:n.inline)??!1,this.boundHandlers={}}get view(){var e;return(null===(e=this.elementRef.current)||void 0===e?void 0:e.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 l=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,l])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Ir(this.editor,e?"readonly":"design")}}}componentDidMount(){if(null!==Rr(this.view))this.initialise();else if(this.elementRef.current&&this.elementRef.current.ownerDocument){var e,t,l;Tr.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),(null===(e=this.props.scriptLoading)||void 0===e?void 0:e.async)??!1,(null===(t=this.props.scriptLoading)||void 0===t?void 0:t.defer)??!1,(null===(l=this.props.scriptLoading)||void 0===l?void 0:l.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(){var e,t,l;return(null===(e=Rr(this.view))||void 0===e||null===(t=e.Env)||void 0===t||null===(l=t.browser)||void 0===l?void 0:l.isIE())?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){yr(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,l=t(e),n=t(this.props);!l&&n?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):l&&!n&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}function Pr(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var Fr;Or(Ar,"propTypes",mr),Or(Ar,"defaultProps",{cloudChannel:"6"}),function(e){e["zh-cn"]="zh_CN",e.en="en"}(Fr||(Fr={}));class Hr extends e.Component{constructor(){super(...arguments),Pr(this,"defaultOption",{height:400,plugins:"preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap emoticons",menubar:"file edit view insert format tools table help",toolbar:"undo redo | bold italic underline strikethrough | fontfamily fontsize blocks | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media template link anchor codesample | ltr rtl"})}render(){var e;const{size:l,className:n,style:a,tinymce:r={},upload:i={},thresholdSize:o=.5,tinymceScriptSrc:s,disabled:c,value:d,onChange:u=te}=this.props,h=this.context.global,m=this.context.locale,f=l||this.context.size||"",g=Ce("tinymce"),b={[g]:!0,[`${g}--lg`]:"large"===f,[`${g}--sm`]:"small"===f},y={init:{height:r.height||this.defaultOption.height,plugins:r.plugins||this.defaultOption.plugins,toolbar:r.toolbar||this.defaultOption.toolbar,menubar:r.menubar||this.defaultOption.menubar,language:Fr[m],skin:"tinymce-5",...X()(r,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,l)=>{const{action:n,headers:a,withCredentials:r,dataKey:s}=i,c=`data:image/jpeg;base64,${e.base64()}`,d=new FormData;d.append("file",e.blob(),e.filename());const u=e.blob().size;if(n&&u/1024/1024>o)try{const{data:e}=await mt().post(n,d,{headers:a,withCredentials:r});200===e.code&&t(s?(0,Q.get)(e.data,s):e.data)}catch(e){R.message.error(p("qm.uploadCropper.uploadError"))}else t(c)}))},value:d,disabled:c,tinymceScriptSrc:s||(null==h||null===(e=h.tinymce)||void 0===e?void 0:e.scriptSrc)||void 0,onEditorChange:(e,t)=>{u(t.getContent())}};return t().createElement("div",{className:Ee()(b,n),style:a},t().createElement(Ar,y))}}Pr(Hr,"contextType",i),Pr(Hr,"propTypes",{size:(e,t,l)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")}});const kr=Hr,Lr=require("cropperjs");var qr=n.n(Lr);function _r(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class $r extends e.Component{constructor(){super(...arguments),_r(this,"imgRef",t().createRef()),_r(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:l,alt:n,imgStyle:a,...r}=this.props,i={};for(const e in r)void 0!==this.props[e]&&(i[e]=this.props[e]);this.cropper=new(qr())(this.imgRef.current,i)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:l,src:n,alt:a,imgStyle:r}=this.props,i={[Ce("cropper")]:!0};return t().createElement("div",{className:Ee()(i,e),style:l},t().createElement("img",{ref:this.imgRef,src:n,alt:a,style:{maxWidth:"100%",...r}}))}}_r($r,"defaultProps",{src:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0});const Dr=$r;function Kr(){return Kr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Kr.apply(this,arguments)}function Vr(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Mr extends e.Component{constructor(){super(...arguments),Vr(this,"beforeUpload",((e,t)=>new Promise((async(l,n)=>{const{fileTypes:a=[],fileSize:r,beforeUpload:i}=this.props,o=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!r||e.size/1024/1024<r,c=o&&s;if(o||R.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),s||R.message.warning(p("qm.upload.sizeLimit",{size:r})),!c)return c||R.Upload.LIST_IGNORE;if(i){const a=i(e,t);if(!0===a)return l(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{l(await a)}catch(e){n(e)}}l(e)}))))}async downloadFile(e,t){const l=await mt()({url:e,responseType:"blob"}),n=l.data,a=l.headers["content-disposition"],r=t||(a?a.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));ft(n,r)}render(){const{button:e,disabled:l,onChange:n}=this.props,a=Ce("upload-file");return t().createElement(R.Upload,Kr({className:a},X()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,onChange:e=>{null==n||n(e)},onPreview:async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){R.message.error(p("qm.download.error"))}},onDownload:async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){R.message.error(p("qm.download.error"))}}}),this.props.children?this.props.children:t().createElement(R.Button,{icon:(null==e?void 0:e.icon)||t().createElement(Se.UploadOutlined,null),disabled:l},(null==e?void 0:e.text)||p("qm.upload.text")))}}Vr(Mr,"defaultProps",{name:"file",multiple:!0,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(Se.DownloadOutlined,null)}});const jr=Mr;function zr(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Ur extends e.Component{constructor(){super(...arguments),zr(this,"cropperRef",t().createRef()),zr(this,"beforeUploadRef",void 0),zr(this,"fileRef",void 0),zr(this,"resolveRef",void 0),zr(this,"rejectRef",void 0),zr(this,"state",{src:""}),zr(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:l,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let a=new File([e],l,{type:t});a.uid=n;const{fileTypes:r=[],fileSize:i}=this.props;if(r.length&&!r.includes(a.name.slice(a.name.lastIndexOf(".")+1).toLowerCase()))return R.message.warning(p("qm.upload.tooltip",{type:r.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(a);const o=this.beforeUploadRef(a,[a]);if("boolean"==typeof o||o){if(!0===o)return this.resolveRef(a);if(!1===o)return this.rejectRef("not upload");if(o&&"function"==typeof o.then)try{const e=await o,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),this.resolveRef(a)}catch(e){this.rejectRef(e)}}else g("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await ne(100),this.onClose()})),zr(this,"onOk",(()=>{this.confirmHandle()})),zr(this,"onClose",(()=>{this.rejectRef(),this.setSrc("")}))}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:l}=this.props,n=Array.isArray(e)?e[0]:e;if(!n)return null;const{beforeUpload:a,...r}=n.props;return this.beforeUploadRef=a,t().createElement(n.type,{...r,beforeUpload:(e,t)=>new Promise((async(n,a)=>{if(l&&!await l(e,t))return void a();this.fileRef=e,this.resolveRef=n,this.rejectRef=a;const r=new FileReader;r.onload=()=>{this.setSrc(r.result),r.onload=null},r.readAsDataURL(e)}))})}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return t().createElement("div",{className:"cropper-preview"},t().createElement("div",{className:"cropper-area"},t().createElement("div",{className:"img-cropper"},t().createElement(Dr,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),t().createElement("div",{className:"actions"},t().createElement(R.Space,{size:"small"},t().createElement(R.Button,{type:"primary",size:"middle",icon:t().createElement(Se.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},p("qm.uploadCropper.zoomIn")),t().createElement(R.Button,{type:"primary",size:"middle",icon:t().createElement(Se.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},p("qm.uploadCropper.zoomOut")),t().createElement(R.Button,{type:"primary",size:"middle",icon:t().createElement(Se.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},p("qm.uploadCropper.rotatePlus")),t().createElement(R.Button,{type:"primary",size:"middle",icon:t().createElement(Se.RotateLeftOutlined,null),onClick:()=>this.rotateHandle(-90)},p("qm.uploadCropper.rotateSubtract"))))),t().createElement("div",{className:"preview-area"},t().createElement("div",{className:"preview",style:this.previewSize})))}render(){const{src:e}=this.state,l=Ce("cropper-preview");return t().createElement(t().Fragment,null,this.renderUpload(),e&&t().createElement(R.Modal,{visible:!0,wrapClassName:Ee()(l),title:p("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}zr(Ur,"contextType",i);const Br=Ur;function Wr(){return Wr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Wr.apply(this,arguments)}function Gr(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Yr extends e.Component{constructor(){super(...arguments),Gr(this,"state",{previewVisible:!1,previewImage:"",previewTitle:""}),Gr(this,"beforeUpload",((e,t)=>new Promise((async(t,l)=>{const{fileTypes:n=[],fileSize:a}=this.props,r=!n.length||n.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),i=!a||e.size/1024/1024<a,o=r&&i;if(r||R.message.warning(p("qm.upload.tooltip",{type:n.join(",")})),i||R.message.warning(p("qm.upload.sizeLimit",{size:a})),!o)return o||R.Upload.LIST_IGNORE;t(e)})))),Gr(this,"handlePreview",(async e=>{e.url||e.preview||(e.preview=await(e=>new Promise(((t,l)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>t(n.result),n.onerror=e=>l(e)})))(e.originFileObj)),this.setState({previewImage:e.url||e.preview,previewVisible:!0,previewTitle:e.name||e.url.substring(e.url.lastIndexOf("/")+1)})}))}get showUploadButton(){var e;const t=(null===(e=this.props.fileList)||void 0===e?void 0:e.length)??0;return!this.props.maxCount||t<this.props.maxCount}render(){const{previewVisible:e,previewImage:l,previewTitle:n}=this.state,{fileList:a,fixedSize:r,quality:i,fileTypes:o,fileSize:s,openCropper:c,beforeCrop:d}=this.props,u=Ce("upload-img"),h=t().createElement("div",null,t().createElement(Se.PlusOutlined,null),t().createElement("div",{style:{marginTop:8}},p("qm.uploadCropper.dragableText"))),m=t().createElement(R.Upload,Wr({className:u},X()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,onPreview:this.handlePreview}),this.showUploadButton?h:null);return t().createElement(t().Fragment,null,c?t().createElement(Br,{fixedSize:r,quality:i,fileTypes:o,fileSize:s,beforeCrop:d},m):m,t().createElement("div",{style:{display:"none"}},t().createElement(R.Image.PreviewGroup,{preview:{visible:e,onVisibleChange:e=>{this.setState({previewVisible:e})}}},null==a?void 0:a.map((e=>t().createElement(R.Image,{key:e.uid,src:e.url,alt:""}))))))}}Gr(Yr,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const Xr=Yr;function Qr(t){const[l,n]=e.useState({width:0,height:0});return e.useEffect((()=>{const e=t.current,l=e=>{const{inlineSize:t,blockSize:l}=e.contentBoxSize[0];n({width:t,height:l})};return e&&el(e,l),()=>{e&&tl(e,l)}}),[t]),l}const Zr=(e,t,l)=>{let n;for(let a=0;a<e.length;a++){const r=e[a];if(r.children)if(r.children.some((e=>e[l]===t)))n=r[l];else{const e=Zr(r.children,t,l);e&&(n=e)}}return n},Jr=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Jr(e.children,t),t(e)||e.children&&e.children.length))),ei=(e,t)=>{const l=[];return e.forEach((e=>{e.children&&l.push(...ei(e.children,t)),t(e)&&l.push(e)})),l},ti=(e,t)=>{let l=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(l=ti(e[n].children,t)),l)return l;if(t(e[n]))return e[n]}return l},li=(e,t,l,n)=>e.map((e=>e[l]===t?{...e,children:n}:e.children?{...e,children:li(e.children,t,l,n)}:e)),ni=(e,t)=>{const l=[];return e.forEach((e=>{e.children&&l.push(...ni(e.children,t)),Array.isArray(e.children)&&e.children.length&&l.push(e[t])})),l},ai=(e,t,l)=>{for(let n=0;n<e.length;n++){if(e[n][l]===t)return[t];if(Array.isArray(e[n].children)){const a=ai(e[n].children,t,l);if(a)return[e[n][l],a].flat()}}},ri=(e,t)=>{var l;const n=(null===(l=e.children)||void 0===l?void 0:l.map((e=>e[t])))||[];return Array.isArray(e.children)&&e.children.forEach((e=>n.push(...ri(e,t)))),n},ii=t().forwardRef(((e,l)=>{const{filterable:n=!0,multiple:a,draggable:r,dataSource:o,fetch:s,asyncLoad:c,checkStrictly:d,checkStrategy:u="SHOW_CHILD",placeholder:h=p("qm.form.inputPlaceholder"),fieldsDefine:m,value:f,height:g,defaultSelectedKeys:b=[],defaultExpandAll:y=!0,showSearchBar:v=!0,showCollapse:x=!0,onSelectChange:E,onCheckChange:C,onDragChange:S}=e,{size:w}=t().useContext(i),I=t().useMemo((()=>e.size??w??""),[e.size,w]),N=(null==m?void 0:m.valueKey)||"value",T=(null==m?void 0:m.textKey)||"text",O=(null==m||m.children,t().useRef(null)),A=Qr(O),[P,F]=t().useState(g),[H,k]=t().useState(!1),L=(0,Q.debounce)((()=>{F(O.current.offsetHeight-G.current.offsetHeight-10)}),5);$e((()=>{g||L()}),[A.height]);const[q,_]=t().useState([]),[$,D]=t().useState({}),[K,V]=t().useState([]),[M,j]=t().useState([]),[z,U]=t().useState(""),[B,W]=t().useState(y),G=t().useRef(null),Y=t().useRef([]),X=t().useRef([]);t().useEffect((()=>{Array.isArray(o)&&(Z(o),V(J(o)),D({}))}),[o]),t().useEffect((()=>{le()}),[]),$e((()=>{le()}),[null==s?void 0:s.params]),$e((()=>{j(te())}),[$]),t().useImperativeHandle(l,(()=>({INSERT_RECORD:(e,t)=>{const l=ti(q,(t=>e===t[N]));l&&(Array.isArray(l.children)?l.children.push(t):l.children=[t],Z([...q]))},REMOVE_RECORD:e=>{const t=Zr(q,e,N);if(void 0===t&&q.find((t=>t[N]===e)))Z(q.filter((t=>t[N]!==e)));else{var l;const n=ti(q,(e=>t===e[N]));if(!n)return;const a=null===(l=n.children)||void 0===l?void 0:l.findIndex((t=>e===t[N]));a>=0&&(n.children.splice(a,1),Z([...q]))}},UPDATE_RECORD:(e,t)=>{const l=ti(q,(t=>e===t[N]));l&&((0,Q.merge)(l,t),Z([...q]))}})));const Z=e=>{_(e),Y.current=e,X.current=ni(e,N)},J=e=>{if(a)return b;const t=ei(e,(e=>b.includes(e[T])));return 1===t.length?[t[0][N]]:[]},ee=e=>{var t;return(null===(t=ai(q,e,N))||void 0===t?void 0:t.slice(0,-1))||[]},te=()=>{if(y)return X.current;const e=[];return K.forEach((t=>{if(a){if("SHOW_ALL"===u&&!X.current.includes(t)&&e.push(...ee(t)),"SHOW_CHILD"===u&&e.push(...ee(t)),"SHOW_PARENT"===u){const l=xl(q,t);if(l){const n=ee(t),a=ri(l,N);e.push(...n,...[t,...a].filter((e=>X.current.includes(e))))}}}else e.push(...ee(t))})),[...new Set(e)]},le=async()=>{if(!s)return;const{api:e,params:t,dataKey:l,callback:n}=s;try{k(!0);const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,Q.get)(a.data,l)??[];Z(e),V(J(e)),D({}),null==n||n(e)}}catch(e){}k(!1)},ne=e=>`${e}|${ha.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ae=Ce("search-tree"),re={[ae]:!0,[`${ae}--lg`]:"large"===I,[`${ae}--sm`]:"small"===I};return t().createElement("div",{ref:O,className:Ee()(re)},t().createElement("div",{ref:G,className:"topper"},v&&t().createElement(R.Input.Search,{value:z,size:I,placeholder:h,allowClear:!0,onChange:e=>(e=>{if(!n)return;const t=Jr(Y.current,(t=>{if(!e)return!0;const l=t[T]||"";return-1!==ne(l).indexOf(e)}));U(e),_(t),y||e?j(ni(t,N)):D({})})(e.target.value)}),x&&t().createElement("a",{className:"trigger",onClick:()=>{W(!B),j(B?[]:X.current)}},B?t().createElement(Se.UpOutlined,null):t().createElement(Se.DownOutlined,null)," ",p(B?"qm.form.collect":"qm.form.spread"))),t().createElement(pt,{spinning:H},t().createElement(R.Tree,{fieldNames:{title:T,key:N,children:"children"},multiple:a,draggable:r,blockNode:r,checkable:a,selectable:!a,height:P,disabled:e.disabled,checkStrictly:d,selectedKeys:f??K,checkedKeys:f??K,expandedKeys:M,treeData:q,loadData:c?async e=>{let{key:t,children:l}=e;if(!s||l)return;const{api:n,params:a,dataKey:r,formatter:i=(e=>e)}=s;try{const e=await n(i({...a,[N]:t}));if(200===e.code){const l=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=li(Y.current,t,N,l);Z(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!z)return!1;const t=e[T]||"";return-1!==ne(t).indexOf(z)},onDragEnter:e=>{j(e.expandedKeys)},onDrop:e=>{const t=e.node.key,l=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),r=(e,t,l)=>{for(let n=0;n<e.length;n++){if(e[n][N]===t)return l(e[n],n,e);e[n].children&&r(e[n].children,t,l)}},i=[...q];let o;if(r(i,l,((e,t,l)=>{l.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)r(i,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,l=[];r(i,t,((t,n,a)=>{l=a,e=n})),-1===a?l.splice(e,0,o):l.splice(e+1,0,o)}else r(i,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));Z(i)},onDragEnd:e=>{null==S||S(e,q)},onExpand:e=>{j(e)},onSelect:e=>{V(e);const t=ei(Y.current,(t=>e.includes((0,Q.get)(t,N))));null==E||E(a?t:t[0])},onCheck:e=>{d&&(e=e.checked),V(e),"SHOW_CHILD"===u&&(e=e.filter((e=>!X.current.includes(e)))),"SHOW_PARENT"===u&&(e=e.filter(((e,t,l)=>!l.includes(Zr(q,e,N)))));const t=ei(Y.current,(t=>e.includes((0,Q.get)(t,N))));null==C||C(a?t:t[0])}})))}));ii.displayName="QmSearchTree";const oi=ii,si=(0,e.createContext)(void 0),ci={dataIndex:r().string.isRequired,title:r().string.isRequired,description:r().string,colSpan:r().number,width:r().number,minWidth:r().number,fixed:r().oneOf(["left","right"]),align:r().oneOf(["left","center","right"]),theadAlign:r().oneOf(["left","center","right"]),printFixed:r().bool,hidden:r().bool,noAuth:r().bool,noFixed:r().bool,ellipsis:r().bool,className:r().string,theadClassName:r().string,children:r().array,sorter:r().oneOfType([r().bool,r().func]),filter:r().shape({type:r().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:r().arrayOf(r().shape({text:r().string,value:r().oneOfType([r().string,r().number])})),style:r().object}),precision:r().number,formatType:r().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:r().bool,canCopy:r().bool,editRender:r().func,dictItems:r().arrayOf(r().shape({text:r().string,value:r().oneOfType([r().string,r().number])})),summation:r().shape({sumBySelection:r().bool,displayWhenNotSelect:r().bool,dataKey:r().string,unit:r().string,render:r().func}),groupSummary:r().shape({dataKey:r().string,unit:r().string,render:r().func}),headRender:r().func,render:r().func},di=(r().arrayOf(r().shape(ci)).isRequired,r().func,r().array,r().oneOfType([r().string,r().func]).isRequired,r().bool,r().bool,r().shape({api:r().func.isRequired,params:r().object.isRequired,formatter:r().func,beforeFetch:r().func,afterFetch:r().func,stopToFirst:r().bool,dataKey:r().string,callback:r().func}),r().bool,r().bool,r().string,r().string,r().bool,r().bool,r().oneOfType([r().object,r().func]),r().oneOfType([r().object,r().func]),r().array,r().func,r().bool,r().bool,r().shape({type:r().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:r().array,selectedRowKeys:r().array,hideSelectAll:r().bool,checkStrictly:r().bool,filterable:r().bool,selectByClickRow:r().bool,selectFirstRowOnChange:r().bool,clearableAfterFetched:r().bool,selectAllOnCurrentPage:r().bool,fetchSelectedRows:r().shape({api:r().func.isRequired,params:r().object,dataKey:r().string}),fetchAllRowKeys:r().shape({api:r().func.isRequired,params:r().object,dataKey:r().string}),disabled:r().func,onChange:r().func,onSelect:r().func,onSelectAll:r().func}),r().shape({currentRowKey:r().oneOfType([r().number,r().string]),disabled:r().func,onChange:r().func}),r().shape({virtual:r().bool}),r().shape({defaultExpandAllRows:r().bool,defaultExpandedRowKeys:r().array,expandedRowKeys:r().array,hideExpandAll:r().bool,rowExpandable:r().func,expandedRowClassName:r().string,expandedRowRender:r().func,onExpand:r().func,onChange:r().func}),r().shape({groupItems:r().arrayOf(r().shape({dataIndex:r().string.isRequired,titleIndex:r().string,color:r().string,backgroundColor:r().string})),fetch:r().shape({api:r().func.isRequired,params:r().object,dataKey:r().string}),onChange:r().func}),r().func,r().bool,r().bool,r().bool,r().bool,r().shape({current:r().number,pageSize:r().number,pageSizeOptions:r().array,showSizeChanger:r().bool,showQuickJumper:r().bool}),r().shape({fileName:r().string,fetch:r().shape({api:r().func.isRequired,params:r().object}),beforeExport:r().func,cellStyle:r().bool,hideIcon:r().bool}),r().shape({showLogo:r().bool}),r().shape({fetch:r().shape({api:r().func.isRequired,params:r().object,dataKey:r().string}),fieldList:r().arrayOf(r().object)}),r().shape({position:r().oneOf(["top","bottom"]),hideAlert:r().bool,hideClearButton:r().bool}),r().oneOf(["left","right"]),r().func,r().func,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().func,r().func,r().func,r().func,r().func,r().func,r().func,r().func,r().func,10),ui="1",pi="0",hi="YYYY-MM-DD",mi="YYYY-MM-DD HH:mm:ss",fi="YYYYMMDDHHmmss",gi={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 bi;!function(e){e.left="flex-start",e.right="flex-end"}(bi||(bi={}));let yi=[];const vi={getFocusInstance:function(){return yi[0]??null},getInstance:function(e){return yi.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==yi.findIndex((e=>e===t))&&(this.deregister(e),yi=[t,...yi])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),yi=[{id:e,vm:t},...yi])},deregister:function(e){e&&(yi=yi.filter((t=>t.id!==e)))}},xi=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],Ei={operations:function(e){const t=e.split(" "),l=[];let n=0;l[n]=[];for(let e=0;e<t.length;e++)xi.includes(t[e])?(l[n]=l[n].join(" "),n++,l[n]=[]):l[n].push(t[e]);return l[n]=l[n].join(" "),l},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let l=0,n=(e=Array.isArray(e)?e:[e]).length;l<n;l++)t+="number"==typeof e[l]?e[l]:"'"+e[l]+"'",l<n-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,l){return e.split(t).join(l)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},Ci=["==","<",">","<=",">=","!=","like","likes","in","nin"],Si=function(e,t){let l="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?l+=" "+e[t]+" ":l+=e[t];const n=l.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)Ci.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),Ci.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},wi=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Ii=["string","number","boolean","symbol"],Ni=e=>Ii.includes(typeof e),Ti=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Ri=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(wi,"\\$1"),"i"),Oi=(e,t,l)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Ri(l));break;case"likes":n=l.split(/,|,/).some((t=>null!==e.toString().match(Ri(t))));break;case"in":Ni(l)&&(l=[l]),Array.isArray(l)&&(n=Array.isArray(e)?l.every((t=>e.includes(t))):l.includes(e));break;case"nin":Ni(l)&&(l=[l]),Array.isArray(l)&&(n=!(Array.isArray(e)?l.some((t=>e.includes(t))):l.includes(e)));break;case"!=":case"<>":n=(Ti(e)?e.slice(0,10):e)!=l;break;case"<":n=(Ti(e)?e.slice(0,10):e)<l;break;case"<=":n=(Ti(e)?e.slice(0,10):e)<=l;break;case">":n=(Ti(e)?e.slice(0,10):e)>l;break;case">=":n=(Ti(e)?e.slice(0,10):e)>=l;break;default:n=(Ti(e)?e.slice(0,10):e)==l}return n};window.__query__=function(){return Oi(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const Ai=Ei.stringify,Pi=Ei.array_format,Fi=function(e){let t=0;const l=e.length;for(let n=0;n<l;n++){const l=e.charAt(n);"("===l&&t++,")"===l&&t--}return 0===t},Hi=(e,t,l)=>{let n=[];if(t=Ei.replace_symbols(t),l){const l=new Function("record",`return ${Si(t,"record")};`);n=so(e,(e=>l(e)))}else{const l=new Function("array","i",`return ${Si(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)l(e,t)&&n.push(e[t])}return n},ki=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...ki(e.children)):t.push(e)})),t},Li=e=>{const t=[];return e.forEach((e=>{let l=e;e.children&&(l={...e},l.children=Li(e.children)),e.hidden||e.noAuth||t.push(l)})),t},qi=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...qi(e.children))})),t},_i=(e,t)=>e.map((e=>(e.children&&(e.children=_i(e.children,t)),null==t||t(e),e))),$i=(e,t)=>{for(const l of e){if(l.dataIndex===t)return l;if(l.children){const e=$i(l.children,t);if(e)return e}}return null},Di=e=>{const t=e.children;return t?t[0].children?Di(t[0]):t[0]:e},Ki=e=>{const t=e.children;return t?t[t.length-1].children?Ki(t[t.length-1]):t[t.length-1]:e},Vi=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Mi=(e,t)=>{for(const l of e){if(l.rowKey===t)return l;if(l.children){const e=Mi(l.children,t);if(e)return e}}return null},ji=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...ji(e.children))})),t},zi=e=>{let t=1;const l=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,l(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,l(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return qi(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},Ui=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(l.top+=e.offsetTop,l.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(l.top-=n.scrollTop,l.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Ui(e.offsetParent,t,l)}return l},Bi=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Wi=(e,t)=>(0,Q.transform)(e,((e,l,n)=>{(0,Q.isEqual)(l,t[n])||(e[n]=(0,Q.isPlainObject)(l)&&(0,Q.isPlainObject)(t[n])?Wi(l,t[n]):l)})),Gi=(e,t)=>(0,Q.intersection)(e,t).length===t.length,Yi=(e,t)=>(0,Q.get)(e,t)??"",Xi=(e,t,l,n)=>{n>=0&&null!=l&&(l=Number(l).toFixed(n)),(0,Q.set)(e,t,l??"")},Qi=(e,t)=>{if(!t.includes("|"))return Yi(e,t);const l=[];return t.split("|").forEach((t=>{t&&l.push(Yi(e,t))})),l.join(" | ")},Zi=e=>{const t=(e=e.toString()).split("."),l="-"===t[0].charAt(0)?"-":"";let n=l?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${l}${a}${t[1]?`.${t[1]}`:""}`},Ji=(e,t)=>e?s()(e,t):null,eo=(e,t)=>e?s()(e).format(t):"",to=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=(new Date).getTime();const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const l=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?l:3&l|8).toString(16)}));return e+l},lo=e=>{const t=[];if(J(e)){const{children:l}=e.props;Array.isArray(l)?l.forEach((e=>t.push(...lo(e)))):l&&t.push(...lo(l))}else t.push(e);return t},no=e=>e.filter((e=>!e._group)),ao=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l="";if(Array.isArray(e)){let n=0;for(let a=0,r=e.length;a<r;a++){const r=e[a];if(!r.fieldName)continue;const i=Array.isArray(r.condition)?Pi(r.condition):Ai(r.condition,"^");l+=`${r.bracketLeft} ${t?`${r.fieldName}|${r.fieldType}`:r.fieldName} ${r.expression} ${i} ${r.bracketRight} ${r.logic} `,n=r.logic.length}l=l.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,r]=n.includes("|")?n.split("|"):[n,""],i=e[n];for(const e in i)l+=`${t?`${a}|${r}`:a} ${e} ${Array.isArray(i[e])?Pi(i[e]):Ai(i[e],"^")} and `}l=l.slice(0,-1*n)}return l.replace(/\s+/g," ").trim()},ro=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const l=e=>{const l=[];return t.forEach((t=>l.push(Yi(e,t)))),l},n={};return e.forEach((e=>{const t=JSON.stringify(l(e));n[t]=n[t]||[],n[t].push(e)})),Object.keys(n).map((e=>n[e]))},io=(e,t)=>{for(let l=0;l<e.length;l++){if(e[l].rowKey===t)return[t];if(Array.isArray(e[l].children)){const n=io(e[l].children,t);if(n)return[e[l].rowKey,n].flat()}}},oo=(e,t)=>{for(const l of e){if(Array.isArray(l.children)){const e=oo(l.children,t);if(e)return e}if(t(l))return l}return null},so=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&so(e.children,t),t(e)||e.children&&e.children.length)));function co(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const uo=class{constructor(){co(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),co(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),co(this,"removeFromRequired",(e=>{const t=this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.required.splice(t,1)})),co(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),co(this,"removeFromValidate",(e=>{const t=this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.validate.splice(t,1)})),co(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),co(this,"removeFromEdited",(e=>{const t=this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.edited.splice(t,1)})),co(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),co(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),co(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),co(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),co(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),co(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),co(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),co(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},po={defaultColumnWidth:80,selectionColumnWidth:50,rowHeightMaps:{large:42,middle:34,small:26},sortDirections:["ascend","descend"],pagination:{current:1,pageSize:20,pageSizeOptions:[10,20,30,40,50],showSizeChanger:!0,showQuickJumper:!0},groupSummary:{total:{text:"记录数",value:"*"},recordTotalIndex:"nRecordsCount",summaryFieldName:"tsummary",groupbyFieldName:"tgroupby"},highSearch:{showSQL:!1},treeTable:{textIndent:17},dataKey:"records",summationKey:"summation",totalKey:"total",virtualScrollY:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};let ho;const mo=()=>{var e;if(Z)return 0;if(void 0!==ho)return ho;const t=document.createElement("div");t.className="qm-scrollbar__wrap",t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const l=t.offsetWidth;t.style.overflow="scroll";const n=document.createElement("div");n.style.width="100%",t.appendChild(n);const a=n.offsetWidth;return null===(e=t.parentNode)||void 0===e||e.removeChild(t),ho=l-a,ho},fo=e=>e.map((e=>(e.children&&(e.children.forEach((t=>{t.parentDataIndex=e.dataIndex,e.fixed?t.fixed=e.fixed:delete t.fixed})),e.children=fo(e.children)),e))),go=(e,l)=>{const{fetch:n,columns:a,height:r,minHeight:i,maxHeight:o,border:s=!0,rowSelection:c,summation:d,expandable:u,webPagination:h,scrollPagination:m,dragMergeCell:f,showSuperSearch:g,showFastSearch:b,showGroupSummary:y,showTableImport:v,showClipboard:x,showSelectCollection:E,footRender:C}=e,{tableRef:S,tableFullData:w,tableData:I,sorter:N,filters:T,superFilters:R,pagination:O}=l,{selectionRows:A,summaries:P}=S.current,F=t().useMemo((()=>!(null==n||!n.api)),[null==n?void 0:n.api]),H=t().useMemo((()=>!F&&!!h),[F,h]),k=t().useMemo((()=>F&&!!m),[F,m]),L=t().useMemo((()=>(F||H)&&!k),[F,H,k]),q=t().useMemo((()=>!!(r||i||o)),[r,i,o]),_=t().useMemo((()=>(e=>{const t=fo(e),l=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:po.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:po.selectionColumnWidth,fixed:"left",type:t}})(c),n=null!=(a=u)&&a.expandedRowRender?{dataIndex:po.expandableColumn,title:"",width:po.selectionColumnWidth,fixed:"left",type:"expand"}:null;var a;return l&&t.unshift(l),n&&t.unshift(n),Li(t)})(a)),[a]),$=t().useMemo((()=>ki(_)),[_]),D=t().useMemo((()=>$.filter((e=>"function"==typeof e.editRender))),[$]),K=t().useMemo((()=>$.filter((e=>!!e.summation))),[$]),V=t().useMemo((()=>$.filter((e=>"left"===e.fixed))),[$]),M=t().useMemo((()=>$.filter((e=>"right"===e.fixed))),[$]),j=t().useMemo((()=>{const e=$.filter((e=>![po.expandableColumn,po.selectionColumn,po.operationColumn].includes(e.dataIndex)));return e.length?e[0].dataIndex:""}),[$]),z=t().useMemo((()=>K.length>0),[K]),U=t().useMemo((()=>!!C||z),[C,z]),B=t().useMemo((()=>zi(_).length>1),[_]),W=t().useMemo((()=>s||B),[s,B]),G=t().useMemo((()=>$.some((e=>e.sorter))),[$]),Y=t().useMemo((()=>$.some((e=>e.filter))),[$]),X=t().useMemo((()=>K.some((e=>!!e.summation.dataKey))),[K]),Q=t().useMemo((()=>!F&&!!v),[F,v]),Z=t().useMemo((()=>!!x&&D.length>0),[x,D]),J=t().useMemo((()=>!!E&&"checkbox"===(null==c?void 0:c.type)),[E,c]),ee=t().useMemo((()=>!!g&&Y),[g,Y]),te=t().useMemo((()=>!F&&!!b&&Y),[F,b,Y]),le=t().useMemo((()=>!!y&&$.some((e=>!!e.groupSummary))),[$]),ne=t().useMemo((()=>{var e;return!(null==d||null===(e=d.groupItems)||void 0===e||!e.length)}),[d]),ae=t().useMemo((()=>!!f&&!F&&!h),[f,F,h]),re=t().useMemo((()=>w.some((e=>Array.isArray(e.children)&&e.children.length))),[w]),ie=t().useMemo((()=>!I.length),[I]),oe=t().useMemo((()=>(()=>{const e={};return K.forEach((t=>{const{dataIndex:l,precision:n,summation:a}=t,{sumBySelection:r,displayWhenNotSelect:i,unit:o}=a,s=ne?no(S.current.tableFullData):S.current.tableFullData,c=!A.length&&!!i;let d=(!r||c?s:A).reduce(((e,t)=>{if(null!=t&&t[po.summaryIgnore])return e;const n=Number(Yi(t,l));return Number.isNaN(n)?e:new($l())(e).plus(n).toNumber()}),0);!Object.keys(P).includes(l)||r&&!c||(d=Number(Yi(P,l))),Xi(e,l,d);let u=n>=0?d.toFixed(n):d;u=Zi(u),Xi(e,`${l}_text`,o?`${u} ${o}`:u)})),[e]})()),[w,A,P]),se=t().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(K)),[K]),ce=t().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((l=>{null!==e[l]&&t.push(`${l}|${e[l]}`)})),t.join(",")})(N),t=((e,t)=>{const l=[];if(Object.keys(e).length)for(const t in e){const[n,a]=po.showFilterType?t.split("|"):[t,""],r=e[t];Object.keys(r).forEach((e=>{l.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:r[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{l.push({type:po.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),l.length&&(l[l.length-1].logic=""),l})(T,R);return{...e?{[po.sorterFieldName]:e}:null,...t.length?{[po.filterFieldName]:t}:null,...se?{[po.groupSummary.summaryFieldName]:se,usedJH:1}:null,...(null==n?void 0:n.params)??null,[po.currentPageName]:O.current,[po.pageSizeName]:O.pageSize}}),[null==n?void 0:n.params,O.current,O.pageSize,N,T,R,se]);return{isFetch:F,isWebPagination:H,isScrollPagination:k,showPagination:L,shouldUpdateHeight:q,tableColumns:_,flattenColumns:$,editableColumns:D,summationColumns:K,leftFixedColumns:V,rightFixedColumns:M,firstDataIndex:j,showSummary:z,showFooter:U,isHeadGroup:B,bordered:W,isHeadSorter:G,isHeadFilter:Y,isServiceSummation:X,isSelectCollection:J,isTableImport:Q,isTableClipboard:Z,isSuperSearch:ee,isFastSearch:te,isGroupSummary:le,isGroupSubtotal:ne,isDragMergeCell:ae,isTreeTable:re,isTableEmpty:ie,summationRows:oe,fetchParams:ce}},bo=(l,n)=>{const{rowKey:a,dataSource:r,summation:i,fetch:o,rowSelection:s,expandable:c,treeConfig:d,authConfig:u,ignorePageIndex:p,columnsChange:h,onScrollEnd:m,onDataChange:f,onDataLoad:b,onChange:y}=l,{getRowKey:v,tableRef:x,tableElementRef:E,tableBodyRef:C,$size:S,tableColumns:w,tableFullData:I,pagination:N,layout:T,filters:R,sorter:O,superFilters:A,fetchParams:P,selectionKeys:F,rowExpandedKeys:H,highlightKey:k,summationColumns:L,shouldUpdateHeight:q,isFetch:_,isTreeTable:$,isWebPagination:D,isScrollPagination:K,isServiceSummation:V,isGroupSubtotal:M,doLayout:j,setTableData:z,setTableFullData:U,setTableOriginData:B,setAllTableData:W,setDeriveRowKeys:G,setPagination:Y,setSpinning:Z,setSorter:J,setFilters:ee,setSuperFilters:te,setSelectionKeys:ne,setRowExpandedKeys:ae,setHighlightKey:re,setSelectionRows:oe,setScrollYLoad:se,setScrollYStore:ce,setFieldAuth:de,setResizeState:ue,setSummaries:pe,setPermission:he,setRecordsMap:me,resetTableScroll:fe,clearElementStore:ge,clearRecordsMap:be}=n,{store:ye}=x.current,ve=Qr(E),xe=t().useRef({...P}),Ee=t().useRef({list:[],maps:new Map});$e((()=>{j()}),[w,S,T.tableAutoHeight]),$e((()=>{Ce()}),[ve]),$e((()=>{tt(),lt(),nt(),_||(D&&Be(),Ke(r))}),[r,null==o?void 0:o.params]),$e((()=>{const e=qe(P,xe.current);e||_&&(null==s?void 0:s.clearableAfterFetched)&&at(),e||!(P[po.currentPageName]>1)||null!=o&&o.stopToFirst?_&&De():Be(),xe.current=P}),[P]),$e((()=>{D&&Qe(),K||fe(),He()}),[N.current,N.pageSize]),$e((()=>{_||Se(I.length),j()}),[I]),$e((()=>{$&&null!=d&&d.virtual&&(We(),Qe())}),[H]);const Ce=()=>{const{scrollYLoad:e,resizeState:t}=x.current,{height:l}=t,{width:n,height:a}=ve,r=a!==l;j(),r&&q&&e&&Qe(),ue(Object.assign({},t,{width:n,height:a}))},Se=e=>{e!==N.total&&Y((t=>Object.assign({},t,{total:e})))},we=(0,Q.debounce)((e=>{je(),null==m||m(e)})),Ie=e=>M?Ne(Te(e,0)):e,Ne=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ne(e.children)),delete e.children,t.push(e)})),t},Te=(e,t)=>{var l;const n=null===(l=i.groupItems)||void 0===l?void 0:l[t];return n?ro(e,[n.dataIndex]).map((e=>{const l={children:Te(e,t+1),_group:n.dataIndex};return"function"!=typeof a&&Xi(l,a.toString(),to()),n.titleIndex&&Xi(l,n.titleIndex,Yi(e[0],n.titleIndex)),Xi(l,n.dataIndex,Yi(e[0],n.dataIndex)),L.forEach((e=>{var t;const{dataIndex:n}=e,a=null===(t=l.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[po.summaryIgnore])return e;const l=Number(Yi(t,n));return Number.isNaN(l)?e:e+l}),0);Xi(l,n,a)})),l})):(e.forEach(((t,l)=>{t._rowSpan=0===l?e.length:0,t._colSpan=1})),e)},Re=e=>{const{selectionRows:t,allTableData:l,recordsMap:n}=x.current;if(_)return[...t.filter((t=>e.includes(v(t,t.index)))),...l.filter((l=>{const n=v(l,l.index);return e.includes(n)&&-1===t.findIndex((e=>v(e,e.index)===n))}))];const a=[];for(let t=0,l=e.length;t<l;t++){const l=e[t];n.has(l)&&a.push(n.get(l))}return a},Oe=e=>{const{type:t,checkStrictly:l=!0}=s||{},n=Array.isArray(e)?e:F;let a=[];return x.current.treeTable&&!l&&n.forEach((e=>{a.push(...((e,t)=>{var l;const{deriveRowKeys:n}=x.current,a=Mi(n,e);let r=[];if(!a)return r;const i=Pe((null==a?void 0:a.children)||[]),o=(null===(l=io(n,e))||void 0===l?void 0:l.slice(0,-1).reverse())||[];return r=[...new Set([...t,...i])],o.forEach((e=>{var t;const l=Mi(n,e),a=Gi(r,(null==l||null===(t=l.children)||void 0===t?void 0:t.map((e=>e.rowKey)))||[]);r=a?[...r,e]:r.filter((t=>t!==e))})),r})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},Ae=e=>{const{allRowKeys:t,deriveRowKeys:l,flattenRowKeys:n}=x.current,{defaultExpandAllRows:a,expandedRowRender:r}=c||{},i=Array.isArray(e)?e:H;if(x.current.treeTable){r&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...F];k&&e.unshift(k);let o=[];return e.forEach((e=>{const t=io(l,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=a?t:[...new Set([...i,...o])],o.filter((e=>!n.includes(e)))}return c?a?t.slice(0):[...i]:[]},Pe=e=>{const t=[];for(let l=0;l<e.length;l++)Array.isArray(e[l].children)&&t.push(...Pe(e[l].children)),t.push(e[l].rowKey);return t},Fe=(e,t)=>{const l=[];return e.forEach((e=>{e.children&&l.push(...Fe(e.children,t)),e.rowKey===t&&e.parentRowKey&&l.push(e.parentRowKey)})),l.length&&l.push(...Fe(e,l[l.length-1])),l},He=(0,Q.debounce)((()=>{Me(),null==y||y(N,Le(R),ke(O),A,{currentDataSource:Ye()})})),ke=e=>{const t={};for(const l in e)null!==e[l]&&(t[l]=e[l]);return t},Le=e=>{const t={};for(const l in e){if(!l.includes("|"))continue;const[n,a]=l.split("|");t[po.showFilterType?`${n}|${a}`:n]=e[l]}return t},qe=(e,t)=>{const l=Object.keys(Wi(e,t));return 1===l.length&&(l.includes(po.currentPageName)||l.includes(po.pageSizeName))},_e=async()=>{var e;if(!o)return;const{formatter:t=(e=>e),beforeFetch:l=le,afterFetch:n,callback:a}=o;if(!l(P))return;const r=K&&P[po.currentPageName]>xe.current[po.currentPageName]&&qe(P,xe.current),s=!(null==i||null===(e=i.fetch)||void 0===e||!e.api);Z(!0);try{const[e,l]=s?await Promise.all([o.api(t(P)),i.fetch.api(t(P))]):[await o.api(t(P))];if(s?200===e.code&&200===l.code:200===e.code){const t=o.dataKey??po.dataKey;let i=(0,Q.get)(e.data,t)??[];i="function"==typeof n?await n(i):i;const s=(0,Q.get)(e.data,t.replace(/[^.]+$/,po.totalKey))||i.length||0;Ke(r?x.current.tableFullData.concat(i):i),Se(s),Ve((null==l?void 0:l.data)||e.data),null==a||a(e.data)}}catch(e){}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(o)&&(o.stopToFirst=!1),Z(!1)},De=function(t,l){const n=e.useRef();return e.useEffect((()=>()=>clearTimeout(n.current)),[]),()=>{clearTimeout(n.current),n.current=setTimeout(t,undefined)}}(_e),Ke=e=>{const t=e=>e.map(((e,l)=>(Array.isArray(e.children)&&e.children.length&&(e.children=t(e.children)),e.index=l,p||(e.pageIndex=(e=>{const{current:t,pageSize:l}=N;return!_||K?e:(t-1)*l+e})(l)),e))),l=Ie(t(e));Ze(l),Je(l),et(),ne(Oe()),ae(Ae()),oe(Re(F)),Me(),null==b||b(l)},Ve=e=>{var t;if(!V)return;const l=(null==i||null===(t=i.fetch)||void 0===t?void 0:t.dataKey)??po.summationKey,n=(l?(0,Q.get)(e,l):e)??{},a={};L.filter((e=>!!e.summation.dataKey)).forEach((e=>{Xi(a,e.dataIndex,Number(Yi(n,e.summation.dataKey)))})),pe(a)},Me=()=>{const{type:e,selectFirstRowOnChange:t}=s||{};if("radio"===e&&t){const e=Ye();if(e.length){const t=v(e[0],e[0].index);ne([t])}else ne([])}},je=()=>{if(!K)return;const e=Ue();N.current>=e||ze({...N,current:N.current+1})},ze=e=>{let{current:t,pageSize:l}=e;Y((e=>Object.assign({},e,{current:t,pageSize:l})))},Ue=()=>{const{pageSize:e,total:t}=N;return Math.ceil(t/e)},Be=()=>{ze(Object.assign({},N,{current:1}))},We=()=>{if(!x.current.treeTable||null==d||!d.virtual)return;const e=Ge(x.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=x.current,{rowExpandable:l}=c||{},n=[];return"function"==typeof l&&e.forEach(((e,a)=>!l(e)&&n.push(t[a]))),n.length?H.filter((e=>!n.includes(e))):H})());Ee.current.list=e,Ee.current.maps.clear(),e.forEach(((e,t)=>Ee.current.maps.set(e.rowKey,t)))},Ge=(e,t)=>{const l=[];return e.forEach((e=>{e.children&&l.push(...Ge(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&l.push({rowKey:e.rowKey,level:e.level})})),l},Ye=()=>D?(()=>{const{current:e,pageSize:t}=N;return x.current.tableFullData.slice((e-1)*t,e*t)})():x.current.tableFullData,Xe=e=>{const{scrollYLoad:t,scrollYStore:l}=x.current;z(t?e.slice(l.startIndex,l.endIndex):e)},Qe=()=>{let e=Ye();x.current.treeTable&&null!=d&&d.virtual&&(e=(e=>{const{allTableData:t,allRowKeys:l}=x.current,{list:n,maps:a}=Ee.current,r=[];for(let e=0,i=l.length;e<i;e++){const i=l[e];a.has(i)&&(t[e]._level=n[a.get(i)].level,r.push(t[e]))}return r})()),se(e.length>po.virtualScrollY),(e=>{const{elementStore:t,scrollYStore:l,scrollYLoad:n}=x.current,{startIndex:a,rowHeight:r}=l;let i="",o="";n&&(i=`translateY(${Math.max(0,a*r)+"px"})`,o=e.length*r+"px"),t.$tableBody.style.transform=i,t.$tableYspace.style.height=o})(e),Xe(e)},Ze=e=>{U(e),W(e),G(e),We(),Qe()},Je=e=>{B(e)},et=()=>{const{allTableData:e}=x.current;be(),e.forEach((e=>me(v(e,e.index),e)))},tt=()=>{J({})},lt=()=>{ee({})},nt=()=>{te([])},at=()=>{ne([])};return{initialTable:()=>{(async()=>{if(!u)return;let e=X()(u,["fetch"]);if(u.fetch){const{api:t,params:l,dataKey:n}=u.fetch;try{const a=await t(l);200===a.code&&(e=(n?(0,Q.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(e).length){const{isExport:t=1,isImport:l=1,isPrint:n=1}=e;he((e=>Object.assign({},e,{export:!!t,import:!!l,print:!!n})))}if(Array.isArray(e.fieldList)){const{originColumns:t}=x.current,n=_i(l.columns,(l=>{const{dataIndex:n}=l,a=e.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:e=1,disabled:r,secretName:i}=a,o=$i(t,n);de(n,{visible:e,disabled:r,secretName:i}),e||(l.noAuth=!0,o.noAuth=!0),i&&(l.formatType=`secret-${i}`,o.formatType=`secret-${i}`)}}));null==h||h(n)}})(),k&&C.current.setClickedValues([k,""]),"radio"===(null==s?void 0:s.type)&&F.length&&C.current.setClickedValues([F[0],""]),_?_e():Ke(r)},createTableFullData:Ze,getTableData:_e,handleTableData:Xe,createTableData:Ke,createGroupData:Ie,createSelectionKeys:Oe,createSelectionRows:Re,createRowExpandedKeys:Ae,findParentRowKeys:Fe,getAllChildRowKeys:Pe,doFieldValidate:(e,t,l,n)=>{if(!Array.isArray(e))return g("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(ye.removeFromRequired({x:l,y:n}),ye.removeFromValidate({x:l,y:n}),e.forEach((e=>{var a;e.required&&ie(t)&&ye.addToRequired({x:l,y:n,text:e.message}),"function"!=typeof e.validator||null!==(a=e.validator)&&void 0!==a&&a.call(e,t)||ye.addToValidate({x:l,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:l,updated:n,removed:a}=ye.state,r=(0,Q.intersection)(l,a),i=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:i(e),validate:i(t),inserted:l.filter((e=>!r.includes(e))),updated:n.filter((e=>![...(0,Q.intersection)(n,l),...(0,Q.intersection)(n,a)].includes(e))),removed:a.filter((e=>!r.includes(e)))}},dataChange:()=>{null==f||f(x.current.tableFullData)},tableChange:He,toLastPage:()=>{const e=Ue();N.current!==e&&ze(Object.assign({},N,{current:e}))},toFirstPage:Be,getPageCount:Ue,pagerChangeHandle:ze,triggerScrollYEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=x.current,{startIndex:l,endIndex:n,offsetSize:a,visibleSize:r,rowHeight:i}=t,o=Math.floor(e/i),s=Math.max(0,o-1-a),c=o+r+a;(o<=l||o>=n-r-1)&&(l===s&&n===c||(ce(Object.assign({},t,{startIndex:s,endIndex:c})),Qe()))}(e)},scrollBottomDebouncer:we,clearTableSorter:tt,clearTableFilter:lt,clearSuperFilters:nt,clearRowSelection:at,clearRowHighlight:()=>{re("")},clearTableLog:()=>{ye.clearAllLog()},destroy:()=>{ge(),ye.destroy(),vi.deregister(x.current.uid)}}},yo=(e,l)=>{const{height:n,minHeight:a,maxHeight:r,resizable:i,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,$size:u,tableColumns:p,flattenColumns:h,leftFixedColumns:m,layout:f,scrollY:g,tableData:b,showFooter:y,showPagination:v,isWebPagination:x,isFullScreen:E,setLayout:C,setScrollX:S,setScrollY:w,setElementStore:I,setScrollYStore:N,setShouldToTop:T}=l,R=t().useRef(g),O=t().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=f,l={};return a&&Object.assign(l,{minHeight:`${Bi(a)}px`}),r&&Object.assign(l,{maxHeight:`${Bi(r)}px`}),E?{...l,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...l,height:"auto"!==n?`${Bi(n)}px`:`${t}px`}:l}),[n,r,a,E,f]),A=(e,t)=>{const{elementStore:l,scrollYStore:n,allTableData:a}=d.current,r=l.$tableBody.parentNode;if(void 0!==t&&t>=0)r.scrollTop=t*n.rowHeight;else{const t=(x?ji(b):a).findIndex((t=>e===c(t,t.index)));r.scrollTop=(t<0?0:t)*n.rowHeight}};return{createElementStore:e=>{Object.keys(e).forEach((t=>{I(t,e[t])}))},tableStyles:O,getSpan:(e,t,l,n,a)=>{let r=1,i=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:l,columnIndex:n,tableData:a});Array.isArray(o)?(r=o[0],i=o[1]):(0,Q.isPlainObject)(o)&&(r=o.rowSpan,i=o.colSpan)}const{mergeCells:o}=d.current;if(o.length>0){const e=o.find((e=>e.row===l&&e.col===n));e&&(r=e.rowSpan,i=e.colSpan)}return{rowSpan:r,colSpan:i}},getStickyLeft:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Di($i(p,e)).dataIndex);let t=0;for(let l=0;l<h.length;l++){const n=h[l];if(n.dataIndex===e)break;t+=Bi(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Ki($i(p,e)).dataIndex);let t=0;for(let l=h.length-1;l>=0;l--){const n=h[l];if(n.dataIndex===e)break;t+=Bi(n.width||n.renderWidth||0)}return t},scrollXToColumn:(e,t)=>{const{elementStore:l}=d.current,n=void 0===t?h.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=m.map((e=>e.width||e.renderWidth||po.defaultColumnWidth)).reduce(((e,t)=>e+t),0);l.$tableBody.parentNode.scrollLeft=l.$tableBody.querySelectorAll("tbody > tr > td")[n].offsetLeft-a},scrollYToRecord:A,rowInViewport:e=>{const{elementStore:t,scrollYStore:l}=d.current,{viewportHeight:n,gutterWidth:a}=f,r=e*l.rowHeight,i=t.$tableBody.parentNode;return!(r<i.scrollTop||r+l.rowHeight>i.scrollTop+(scrollX?n-a:n))},calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=d.current,l=t.winHeight-e.$table.getBoundingClientRect().top-(v?Bl["small"!==u?"middle":u]+di:0)-di;C((e=>Object.assign({},e,{tableAutoHeight:l})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&A("",0),T(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollYLoad:t,resizeState:l}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=o?e.$header.offsetHeight:f.headerHeight,r=y?e.$footer.offsetHeight:f.footerHeight,i=n-a-r,s=e.$tableBody.offsetHeight,c=t||s>i;let p=0;if(E){const t=e.$toper?e.$toper.offsetHeight+di:0,n=e.$pager?e.$pager.offsetHeight+di:0;p=l.winHeight-t-n-20}i!==f.viewportHeight&&(e=>{const{scrollYStore:t,isIE:l}=d.current,{startIndex:n,endIndex:a}=t,r=po.rowHeightMaps[u],i=Math.max(8,Math.ceil(e/r)+2),o=l?5:0;N(Object.assign({},t,{visibleSize:i,offsetSize:o,endIndex:Math.max(n+i+o,a),rowHeight:r}))})(i),R.current=c,w(c),C((e=>Object.assign({},e,{headerHeight:a,footerHeight:r,viewportHeight:i,tableBodyHeight:s,tableFullHeight:p})))})(),(()=>{const{elementStore:e}=d.current,t=e.$table.clientWidth,l=R.current?f.gutterWidth:0,{defaultColumnWidth:n}=po,a=h.filter((e=>"number"!=typeof e.width));let r=0;if(h.forEach((e=>{"number"==typeof e.width&&(e.renderWidth=void 0)})),a.length>0){if(h.forEach((e=>{r+=e.width||e.minWidth||n})),r<=t-l){S(!1);const e=t-l-r;if(1===a.length&&i)a[0].renderWidth=(a[0].minWidth||n)+e;else{const t=e/a.reduce(((e,t)=>e+(t.minWidth||n)),0);let l=0;a.forEach(((e,a)=>{if(0===a)return;const r=Math.floor((e.minWidth||n)*t);l+=r,e.renderWidth=(e.minWidth||n)+r})),i&&(a[0].renderWidth=(a[0].minWidth||n)+e-l)}}else S(!0),a.forEach((e=>{e.renderWidth=e.minWidth||n}));C((e=>Object.assign({},e,{tableBodyWidth:Math.max(r,t)})))}else h.forEach((e=>{e.renderWidth=e.width||e.minWidth||n,r+=e.renderWidth})),S(r>t),C((e=>Object.assign({},e,{tableBodyWidth:r})));C((e=>Object.assign({},e,{tableWidth:t})))})()}}};function vo(){const[,t]=e.useReducer((e=>e+1),0);return t}const xo=e=>{const{total:l}=e,{tableRef:n,tableProps:a,selectionKeys:r,isHeadSorter:i,isHeadFilter:o,isTreeTable:s,clearTableSorter:c,clearTableFilter:d,clearSuperFilters:u,clearRowSelection:h,clearRowHighlight:m}=t().useContext(si),{infoBarConfig:f,rowSelection:g,rowHighlight:b}=a,{allTableData:y}=n.current,{hideAlert:v,hideClearButton:x}=f||{},E=t().useMemo((()=>!v),[v]),C=t().useMemo((()=>!x&&!!(i||o||g||b)),[x,i,o,g,b]),S={[`${Ce("table")}__alert`]:!0};return E?t().createElement("div",{className:Ee()(S)},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.InfoCircleFilled,null)),t().createElement("span",null,p("qm.table.alert.total",{total:s?y.length:l}),g?`,${p("qm.table.alert.selected",{total:r.length})}`:""),C&&t().createElement("em",{onClick:()=>{c(),d(),u(),h(),m()}},p("qm.table.alert.clear"))):null},Eo=t().forwardRef(((e,l)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:r}=t().useContext(si),i=()=>{r(!n)};t().useImperativeHandle(l,(()=>({clickHandle:i})));const o=Ce("table");return a?t().createElement("span",{className:`${o}-full-screen`,title:p(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},n?t().createElement(Se.FullscreenExitOutlined,null):t().createElement(Se.FullscreenOutlined,null))):null}));Eo.displayName="FullScreen";const Co=Eo,So=t().forwardRef(((e,l)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(si),r=()=>{a()};t().useImperativeHandle(l,(()=>({clickHandle:r})));const i=Ce("table");return n?t().createElement("span",{className:`${i}-reload`,title:p("qm.table.refresh.text"),onClick:()=>r()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.ReloadOutlined,null))):null}));So.displayName="Reload";const wo=So,Io=t().forwardRef(((e,l)=>{var n,a;const{tableColumns:r,open:o=!0}=e,{global:s}=t().useContext(i),{tableRef:c,tableBodyRef:d,tableProps:u,flattenColumns:h,summationRows:m,showSummary:f,getSpan:g}=t().useContext(si),{tablePrint:b,showHeader:y}=u,v=(null==s||null===(n=s.print)||void 0===n?void 0:n.leftLogo)??"",x=(null==s||null===(a=s.print)||void 0===a?void 0:a.rightLogo)??"",E=!(!v&&!x),C=t().useMemo((()=>se(Vi(r,[po.expandableColumn,po.selectionColumn,po.operationColumn]))),[r]),S=t().useMemo((()=>se(Vi(h,[po.expandableColumn,po.selectionColumn,po.operationColumn]))),[h]),w=t().useMemo((()=>se(r.filter((e=>e.printFixed)))),[r]),I=(e,t)=>{const l=Object.assign({},$i(t,e.parentDataIndex));return l.children=[e],l.level&&l.level>1?I(l,t):l},N=(e,t)=>(0,Q.map)((0,Q.groupBy)((0,Q.flatten)(e),t),(0,Q.spread)((function(){for(var e=arguments.length,l=new Array(e),n=0;n<e;n++)l[n]=arguments[n];return(0,Q.mergeWith)(...l,((e,l)=>{if(Array.isArray(e))return N(e.concat(l),t)}))}))),T=()=>{const{allTableData:e}=c.current,t=(e=>{const t=[];let l=[],n=0,a=0;for(;a<e.length;){const r=e[a];n+=r.width||r.renderWidth||r.minWidth||po.defaultColumnWidth,n<=po.printWidth?(l.push(r),a===e.length-1&&t.push(l),a++):a>0?(e.splice(0,a),w.length&&e.unshift(...w),t.push(l),l=[],n=0,a=0):(r.width=po.printWidth,l.push(r),t.push(l),a++)}return t})([...S]),l=((e,t)=>{const l=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(I(e,t))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const l=e.filter((e=>e.dataIndex===t));return l.length<=1?l[0]:N(l,"dataIndex")[0]})))(n),l.push(zi(n))})),l})(t,C);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=R(l[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},R=(e,t,l)=>{const{showLogo:n=!0}=b;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((e=>{let{width:t,minWidth:l,renderWidth:n}=e;return`<col style="width:${t||n||l||po.defaultColumnWidth}px">`})).join("")}</colgroup>`,y&&(a+=["<thead>",n&&E?`<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">',v?`<img src="${v}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',x?`<img src="${x}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:l}=e;return 0===l?null:`<th colspan="${l}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),l.length&&(a+=`<tbody>${l.map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:r}=g(e,t,e.index,n,l);return a&&r?`<td rowspan="${a}" colspan="${r}">${((e,t,l,n)=>d.current.renderCellTitle(l,e,t,n))(e,e.index,t,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&m.length&&(a+=["<tfoot>",m.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:r}=t,i=null!=r&&r.render?r.render(l):Yi(e,`${a}_text`);return`<td>${0===n&&""===i?p("qm.table.config.summaryText"):i}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},O=()=>{var e;null===(e=((e,t)=>{const{filename:l,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},r=`${l}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});ft(e,r)}})(0,T()))||void 0===e||e.then((e=>{let{content:t,blob:l}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),c.current.isIE?(n.contentDocument.write(t),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(l))}))};t().useImperativeHandle(l,(()=>({clickHandle:O})));const A=Ce("table");return o?t().createElement("span",{className:`${A}-print`,title:p("qm.table.print.text"),onClick:()=>O()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.PrinterOutlined,null))):null}));Io.displayName="TablePrint";const No=Io,To=require("exceljs");var Ro=n.n(To);const Oo="606060",Ao="thin",Po="d4d4d4",Fo=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Ho=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},ko=()=>({top:{style:Ao,color:{argb:Po}},left:{style:Ao,color:{argb:Po}},bottom:{style:Ao,color:{argb:Po}},right:{style:Ao,color:{argb:Po}}}),Lo=e=>{const{children:t}=e;return t&&t.length?Lo(t[0]):e},qo=e=>{const{precision:t,formatType:l}=e,n=t>=0?t?`0.${new Array(t).fill("0").join("")}`:"0":"";return n?{numFmt:n}:"percent"===l?{numFmt:t>=0?`${n}%`:"0%"}:"finance"===l?{numFmt:t>=0?`#,##${n}`:"#,##0"}:null},_o=()=>{const{tableRef:e,tableProps:l,getSpan:n,showSummary:a,isHeadGroup:r}=t().useContext(si),{spanMethod:i,showHeader:o}=l,s=(e,t)=>{var l;return(null===(l=e.find((e=>e.text==t)))||void 0===l?void 0:l.value)??""};return{exportXLSX:async(t,l,s,c)=>{const{columns:d,footSummation:u}=t,{scrollYStore:{rowHeight:h}}=e.current,m=ki(d),f=zi(d),g=[],b=[],y=[],v=[];let x=0;const E={};m.forEach((e=>{const{dataIndex:t,title:l,width:n,minWidth:a,renderWidth:r}=e;E[t]=l,y.push({key:t,width:(n||r||a||po.defaultColumnWidth)/8})})),o&&(r?f.forEach(((e,t)=>{const l={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,r=Lo(e),i=m.findIndex((e=>{let{dataIndex:t}=e;return t===r.dataIndex}));l[r.dataIndex]=e.title,0!==n&&(n>1||a>1)&&v.push({s:{r:t,c:i},e:{r:t+a-1,c:i+n-1}})})),g.push(l)})):(m.forEach(((e,t)=>{const{colSpan:l,rowSpan:n}=e;(l>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+l-1}})})),g.push(E)),x+=g.length);const C=l.map(((e,t)=>{const a={};return m.forEach(((r,o)=>{if("function"==typeof i){const{rowSpan:a,colSpan:i}=n(e,r,t,o,l);(i>1||a>1)&&v.push({s:{r:t+x,c:o},e:{r:t+x+a-1,c:o+i-1}})}const s=["percent","finance"].includes(r.formatType);a[r.dataIndex]=s?Yi(e,r.dataIndex):c(e,t,r,o)})),a}));x+=C.length,a&&u&&s(m,l).forEach(((e,t)=>{const n={};m.forEach(((t,a)=>{const{dataIndex:r,summation:i}=t,o=null!=i&&i.render?i.render(l):Yi(e,r);n[r]=0===a&&""===o?p("qm.table.config.summaryText"):J(o)?lo(o).join(""):o})),b.push(n)}));const{sheetName:S,useStyle:w}=t,I=new(Ro().Workbook),N=I.addWorksheet(S);N.columns=y,o&&N.addRows(g).forEach((e=>{w&&Fo(e,h),e.eachCell((e=>{const t=N.getColumn(e.col),l=$i(d,t.key),{align:n}=l;Ho(e,n),w&&Object.assign(e,{font:{bold:!0,color:{argb:Oo}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:ko()})}))})),N.addRows(C).forEach((e=>{w&&Fo(e,h),e.eachCell((e=>{const t=N.getColumn(e.col),l=$i(d,t.key),{align:n}=l;Ho(e,n),Object.assign(e,qo(l)),w&&Object.assign(e,{font:{color:{argb:Oo}},border:ko()})}))})),a&&u&&N.addRows(b).forEach((e=>{w&&Fo(e,h),e.eachCell((e=>{const t=N.getColumn(e.col),l=$i(d,t.key),{align:n}=l;Ho(e,n),Object.assign(e,qo(l)),w&&Object.assign(e,{font:{color:{argb:Oo}},border:ko()})}))})),v.forEach((e=>{let{s:t,e:l}=e;N.mergeCells(t.r+1,t.c+1,l.r+1,l.c+1)}));const T=await I.xlsx.writeBuffer();return new Blob([T],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const l=e=>{let t=e;const l=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(l||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,r,i="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)r=a.cells[n],i=i+(n?",":"")+l(r.textContent.trim());i+="\r\n"}return i})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,l)=>{t=t||"",l=l||512;const n=window.atob(e),a=[];let r;for(r=0;r<n.length;r+=l){const e=n.slice(r,r+l),t=new Array(e.length);let i;for(i=0;i<e.length;i+=1)t[i]=e.charCodeAt(i);const o=new window.Uint8Array(t);a.push(o)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:l,file:n}=e,a=ki(l),r=new FileReader;r.onerror=()=>{R.message.error(p("qm.table.import.error"))},r.onload=e=>{const l=a.map((e=>e.title)),n=new(Ro().Workbook),r=e.target;r?n.xlsx.load(r.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),r=e.findIndex((e=>e&&e.length>0)),i=e[r],o=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(l,i);if(o){const n=e.slice(r+1).map((e=>{const t={};e.forEach(((e,l)=>{let n=e;(0,Q.isPlainObject)(n)&&(n=e.text),(0,Q.isDate)(n)&&(n=eo(e,mi)),t[i[l]]=n}));const n={};return l.forEach(((e,l)=>{const{dataIndex:r,dictItems:i}=a[l];var o;Array.isArray(i)&&(null!==(o=t[e])&&void 0!==o&&o.includes(",")?t[e]=t[e].split(",").map((e=>s(i,e))).filter((e=>""!==e)):t[e]=s(i,t[e])),Xi(n,r,t[e])})),n}));null==t||t(n)}else R.message.error(p("qm.table.import.error"))}else R.message.error(p("qm.table.import.error"))})):R.message.error(p("qm.table.import.error"))},r.readAsArrayBuffer(n)}}},$o=e=>{const{fileType:l,onChange:n}=e;let a,r;const i=Ce("table"),o=e=>{const t=e.name,l=t.lastIndexOf("."),n=t.substring(l+1,t.length);return{filename:t.substring(0,l),type:n}};return t().createElement(he,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),r=document.createElement("input"),a.className=`${i}--file-form`,r.name="file",r.type="file",a.appendChild(r),document.body.appendChild(a)),new Promise(((e,l)=>{const n=!t.type;r.multiple=!!t.multiple,r.accept=n?"":`.${t.type}`,r.onchange=i=>{const{files:s}=i.target,c=s[0];let d="";if(!n)for(let e=0;e<s.length;e++){const{type:l}=o(s[e]);if(t.type!==l){d=l;break}}d?(R.message.warning(p("qm.upload.notType",{type:d})),l()):e(c),document.body.removeChild(a),a=null,r=null},a.reset(),r.click()}))})({type:l});null==n||n(e.name,e)}catch(e){}})()},p("qm.upload.text"))},Do=e=>{const{columns:l,onClose:n}=e,{tableRef:a,tableProps:r,createTableData:i,dataChange:o}=t().useContext(si),{beforeTableImport:s}=r,{importXLSX:c}=_o(),d=t().useRef(null),[u,h]=t().useState(!1),[m,f]=t().useState(!0),g=e=>e.filter((e=>![po.expandableColumn,po.selectionColumn,"index","pageIndex",po.operationColumn].includes(e.dataIndex))),[b,y]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName",render:(e,l)=>{const{fileName:n}=l.GET_FIELDS_VALUE(["fileName"]);return t().createElement(t().Fragment,null,n?t().createElement("span",null,n):t().createElement($o,{fileType:l.state.formData.fileType,onChange:(e,t)=>{l.SET_FIELDS_VALUE({fileName:e,file:t}),t&&f(!1)}}))}},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:p("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:p("qm.table.import.fillText"),value:"fill"},{text:p("qm.table.import.addText"),value:"add"},{text:p("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{b.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,y([...b])}},{type:"INPUT_NUMBER",label:p("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:a.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),v=Ce("table");return t().createElement("div",{className:`${v}-import__setting`},t().createElement(pr,{ref:d,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:b,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:u,disabled:m,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||(h(!0),c({columns:g(l),file:t.file},(async e=>{const{tableFullData:l,store:r}=a.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=await s(e)}catch(e){}if("fill"===t.importType&&i(e),"add"===t.importType&&i([...l,...e]),"insert"===t.importType){const{tableFullData:l}=a.current,n=t.posIndex,r=l.slice(0,n).concat(e).concat(l.slice(n));i(r)}e.forEach((e=>{r.addToInserted(e)})),o(),R.message.success(p("qm.table.import.success",{total:e.length})),h(!1),n()})))})()},p("qm.table.import.text"))))},Ko=t().forwardRef(((e,l)=>{const{tableColumns:n,open:a=!0}=e,[r,i]=t().useState(!1),o=()=>{i(!0)};t().useImperativeHandle(l,(()=>({clickHandle:o})));const s={[`${Ce("table")}-import`]:!0},c={visible:r,title:p("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Ee()(s),title:p("qm.table.import.textNoSpace"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.ImportOutlined,null))),t().createElement(Wt,c,t().createElement(Do,{columns:n,onClose:()=>i(!1)})))}));Ko.displayName="TableImport";const Vo=Ko,Mo=e=>{const{columns:l,onChange:n}=e,{$size:a}=t().useContext(si),r=t().useRef([]),[i,o]=t().useState(!1),[s,c]=t().useState(l);$e((()=>{u()}),[s]),t().useEffect((()=>{d()}),[l]);const d=()=>{const e=[];l.forEach(((t,n)=>{const a=t.colSpan;a>1&&l.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(l.slice(n,n+a))})),r.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:l,dataIndex:n}=t;if(0===l)return;if(1===l)return e.push(t);const a=r.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...r[a].map(((e,l)=>{let{dataIndex:n}=e;const a=s.find((e=>e.dataIndex===n));return l>0&&void 0!==t.hidden&&(a.hidden=t.hidden),a})))})),null==n||n(e)},h=Ce("table"),m={[`${h}__popper`]:!0,"column-filter__popper":!0,[`${h}--lg`]:"large"===a,[`${h}--sm`]:"small"===a},f=[`${h}-column-filter`,{selected:i}];return t().createElement(an(),{action:["click"],popupVisible:i,popup:t().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"main"},t().createElement(wl.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),l=s.map((e=>e.dataIndex));(0,Q.isEqual)(t,l)||c(e)}},s.map((e=>((e,l)=>{const{colSpan:n}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=["svgicon","handle","main-handle"];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(R.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:l}=t.target;e.hidden=!l,c([...s])}}),t().createElement("i",{className:Ee()(a),title:p("qm.table.columnFilter.draggable")},t().createElement(Se.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title))})(e)))))),popupClassName:Ee()(m),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{o(e)},builtinPlacements:gi,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Ee()(f),title:p("qm.table.columnFilter.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.SettingOutlined,null)),t().createElement("span",null,p("qm.table.columnFilter.text"))))},jo=e=>{const{defaultValue:l,onClose:n,onOk:a}=e,{tableProps:r,pagination:i,showSummary:o}=t().useContext(si),{rowSelection:c}=r,d=t().useRef(null),[u,h]=t().useState(!1),m=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(fi)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:"all","startIndex|endIndex":[1,i.total],footSummation:o?1:0,useStyle:0},l,{columns:se(l.columns||[])})),[]),[f,g]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:p("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:p("qm.table.export.all"),value:"all"},{text:p("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==(null==c?void 0:c.type)},{text:p("qm.table.export.custom"),value:"custom"}]},onChange:e=>{f.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,g([...f])}},options:{min:1},disabled:!0},{type:"INPUT",label:p("qm.table.columnFilter.text"),fieldName:"columns",render:(e,l)=>t().createElement(Mo,{columns:l.state.formData.columns,onChange:e=>{l.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:p("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!o,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:p("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),b=Ce("table");return t().createElement("div",{className:`${b}-export__setting`},t().createElement(pr,{ref:d,initialValues:m,items:f,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:u,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);a(t),await ne(1e3),h(!1),n()}})()},p("qm.table.export.text"))))},zo=t().forwardRef(((e,l)=>{const{tableColumns:n,open:a=!0}=e,{global:r}=t().useContext(i),{tableRef:o,tableBodyRef:c,tableProps:d,flattenColumns:u,pagination:h,fetchParams:m,isFetch:f,isGroupSubtotal:g,showSummary:b,getSpan:y}=t().useContext(si),{exportExcel:v,fetch:x,showHeader:E}=d,[C,S]=t().useState(!1),[w,I]=t().useState(!1),N=t().useMemo((()=>{var e;return!(null==v||null===(e=v.fetch)||void 0===e||!e.api)}),[v]),T=t().useMemo((()=>!h.total||w),[h.total,w]),O=t().useMemo((()=>Vi(n,[po.expandableColumn,po.selectionColumn,po.operationColumn])),[n]),A=t().useMemo((()=>Vi(u,[po.expandableColumn,po.selectionColumn,po.operationColumn])),[u]),P=(e,t)=>{const l={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(g?no(t):t).reduce(((e,t)=>{if(null!=t&&t[po.summaryIgnore])return e;const l=Number(Yi(t,n));return Number.isNaN(l)?e:e+l}),0);Xi(l,n,a)})),[l]},F=(e,t,l,n)=>{const{precision:a,formatType:r}=l;let i=c.current.renderCellTitle(l,e,t,n);return a>=0&&!r&&""!==i&&(i=Number(i)),i},{exportXLSX:H,exportCSV:k}=_o(),L=async e=>{const{api:t,dataKey:l}=x;let n=[];try{I(!0);const a=await t({...m,[po.currentPageName]:1,[po.pageSizeName]:e??h.total});200===a.code&&(n=(Array.isArray(a.data)?a.data:(0,Q.get)(a.data,l)??[]).map(((e,t)=>{const l={...e,index:t,pageIndex:t};return A.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&Xi(l,n,Yi(l,n))})),l})))}catch(e){}return I(!1),n},q=e=>{var t;const l=null==r||null===(t=r.table)||void 0===t?void 0:t.recordExportLog;try{null==l||l({fileName:e})}catch(e){}},_=(null==v?void 0:v.fileName)??`${s()().format(fi)}.xlsx`,$=_.slice(_.lastIndexOf(".")+1).toLowerCase(),D=()=>{if(T)return R.message.warning(p("qm.table.export.warnText"));N?(async e=>{I(!0);try{const{api:t,params:l}=v.fetch,n=await t({columns:A.map((e=>{const{title:t,dataIndex:l,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:l,type:a,hidden:n}})),...m,...l,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[po.currentPageName]:void 0,[po.pageSizeName]:void 0});n.data&&(ft(n.data,e),q(e))}catch(e){}I(!1)})(_):S(!0)};t().useImperativeHandle(l,(()=>({clickHandle:D})));const K={[`${Ce("table")}-export`]:!0},V={visible:C,title:p("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},M={fileName:_.slice(0,_.lastIndexOf(".")),fileType:$,columns:O,useStyle:null!=v&&v.cellStyle?1:0};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Ee()(K),title:p("qm.table.export.textNoSpace"),onClick:()=>D()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.DownloadOutlined,null))),t().createElement(Wt,V,t().createElement(jo,{defaultValue:M,onClose:()=>S(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:l,exportType:n,startIndex:a=1,endIndex:r}=e,{allTableData:i,selectionRows:s}=o.current;let c=[];if(f?("all"===n&&(c=await L()),"custom"===n&&(c=await L(r),c=c.slice(a-1))):("all"===n&&(c=i.slice(0)),"custom"===n&&(c=i.slice(a-1,r||void 0))),"selected"===n&&(c=s.slice(0)),"function"==typeof(null==v?void 0:v.beforeExport))try{c=null==v?void 0:v.beforeExport(c)}catch(e){}if("xlsx"===l){const l=await H(e,c,P,F);ft(l,`${t}.xlsx`),q(`${t}.xlsx`)}if("csv"===l){const l=k(e,((e,t)=>{const{columns:l,footSummation:n}=e,a=zi(l),r=ki(l);let i='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${r.map((e=>{let{width:t,minWidth:l,renderWidth:n}=e;return`<col style="width:${t||n||l||po.defaultColumnWidth}px">`})).join("")}</colgroup>`,E&&(i+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:l}=e;return 0===l?null:`<th colspan="${l}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(i+=`<tbody>${t.map((e=>`<tr>${r.map(((l,n)=>{const{rowSpan:a,colSpan:r}=y(e,l,e.index,n,t);return a&&r?`<td rowspan="${a}" colspan="${r}">${F(e,e.index,l,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),b&&n&&(i+=["<tfoot>",P(r,t).map((e=>`<tr>${r.map(((l,n)=>{const{dataIndex:a,summation:r}=l,i=null!=r&&r.render?r.render(t):Yi(e,a);return`<td>${0===n&&""===i?p("qm.table.config.summaryText"):J(i)?lo(i).join(""):i}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i})(e,c));ft(l,`${t}.csv`),q(`${t}.csv`)}})(Object.assign({},e,{columns:Li(e.columns)}))}})))}));zo.displayName="TableExport";const Uo=zo,Bo=e=>{const{columns:l,onClose:n}=e,{tableRef:a,tableBodyRef:r,tableProps:i,dataChange:o}=t().useContext(si),{beforeClipboard:s}=i,c=t().useRef(null),[d,u]=t().useState([{type:"INPUT_NUMBER",label:p("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:p("qm.table.clipboard.colIndex"),fieldName:"dataIndex",options:{itemList:l.map(((e,t)=>({value:t,text:e.title})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:p("qm.table.clipboard.content"),fieldName:"content",placeholder:p("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[h,m]=t().useState(!1),f=Ce("table");return t().createElement("div",{className:`${f}-clipboard__setting`},t().createElement("h3",{className:"info"},p("qm.table.clipboard.supportText")),t().createElement(pr,{ref:c,initialValues:{},initialExtras:{rowIndex:"行",dataIndex:"列"},items:d,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:h,onClick:()=>(async()=>{var e;const[t,i]=await c.current.GET_FORM_DATA();if(t)return;const{tableFullData:d,store:u}=a.current;m(!0);const h=i.content.trim().replace(/(\r|\n)$/,"");let f=h.replace(/"[^"]+"/g,"^");((null===(e=h.match(/"[^"]+"/g))||void 0===e?void 0:e.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,t)=>l[i.dataIndex+t].dataIndex)))}catch(t){}g.forEach(((e,t)=>{e.forEach(((e,n)=>{const r=d[i.rowIndex-1+t],o=l[i.dataIndex+n];if(r&&o){let t=!1;if(o.editRender){var s,c;const e=o.editRender(r,o);t=!(e.disabled||(null===(s=e.extra)||void 0===s?void 0:s.disabled)||null!==(c=a.current.fieldAuth[o.dataIndex])&&void 0!==c&&c.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&(Xi(r,o.dataIndex,e),u.addToUpdated(r))}}))})),r.current.forceUpdate(),o(),R.message.success(p("qm.table.clipboard.success",{total:g.length})),m(!1),n()})()},p("qm.table.clipboard.text"))))},Wo=t().forwardRef(((e,l)=>{const{flattenColumns:n,open:a=!0}=e,[r,i]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![po.expandableColumn,po.selectionColumn,"index","pageIndex",po.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{i(!0)};t().useImperativeHandle(l,(()=>({clickHandle:s})));const c={[`${Ce("table")}-clipboard`]:!0},d={visible:r,title:p("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Ee()(c),title:p("qm.table.clipboard.textNoSpace"),onClick:()=>s()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.CopyOutlined,null))),t().createElement(Wt,d,t().createElement(Bo,{columns:o,onClose:()=>i(!1)})))}));Wo.displayName="TableClipboard";const Go=Wo,Yo=e=>{const{columns:l,onClose:n}=e,{tableProps:a,tableRef:r,$size:i,selectionKeys:o,setSelectionKeys:s}=t().useContext(si),{rowKey:c}=a,d=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=d(e.children)),t})),[u,h]=t().useState([{title:p("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...d(l.filter((e=>![po.expandableColumn,po.selectionColumn,"index","pageIndex",po.operationColumn].includes(e.dataIndex))))]),[m]=t().useState(r.current.selectionRows.map((e=>({...e,children:void 0}))));return t().createElement(t().Fragment,null,t().createElement(zs,{size:i,columns:u,dataSource:m,rowKey:c,minHeight:338,rowSelection:{type:"checkbox",selectedRowKeys:o,onChange:e=>s(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>h(e)}),t().createElement("div",{style:{height:10}}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n()},p("qm.table.selectCollection.closeButton"))))},Xo=t().forwardRef(((e,l)=>{const{columns:n,open:a=!0}=e,{tableProps:r,getRowKey:i,isFetch:o,isTableEmpty:s,setSelectionKeys:c,setSelectionRows:d}=t().useContext(si),{rowSelection:u}=r,[h,m]=t().useState(!1),f=t().useRef(!1);$e((()=>{!f.current&&g()}),[s]);const g=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=u;if(o&&e)try{const l=await e.api(e.params);if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,e.dataKey)??[];n=n.filter((e=>!t(e))),d(n),c(n.map(((e,t)=>i(e,t)))),f.current=!0}}catch(e){}},b=()=>{m(!0)};t().useImperativeHandle(l,(()=>({clickHandle:b})));const y=Ce("table"),v={visible:h,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>m(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:`${y}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>b()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.CheckSquareOutlined,null))),t().createElement(Wt,v,t().createElement(Yo,{columns:n,onClose:()=>m(!1)})))}));Xo.displayName="SelectCollection";const Qo=Xo,Zo=require("localforage");var Jo=n.n(Zo);const es=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),ts=e=>{const{onClose:l}=e,{global:n}=t().useContext(i),{tableProps:a,tableRef:r,getRowKey:o,$size:s,flattenColumns:c,pagination:d,setPagination:u,scrollYToRecord:h,setHighlightKey:m,setShouldToTop:f,isTreeTable:b,isWebPagination:y}=t().useContext(si),{uniqueKey:v}=a,x=t().useRef(null),E=t().useRef(null),C=t().useRef([]),S=t().useRef(""),w=t().useRef(-1),I=t().useRef("stop");$e((()=>{const{current:e,pageSize:t}=d,l=r.current.tableFullData.slice((e-1)*t,e*t),n=ji(l).findIndex((e=>o(e,e.index)===S.current));h("",n)}),[d.current]);const N=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},T=e=>e.filter((e=>null==e?void 0:e.dataIndex)).map((e=>({type:N(e.filter.type),fieldName:e.dataIndex,label:e.title,tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await x.current.GET_FORM_DATA(),[l,n]=await E.current.GET_FORM_DATA(),a=(0,Q.omitBy)(Object.assign({},t,n),ie);F(a)}}))),O={case:0,fullchar:0},A=t().useMemo((()=>c.filter((e=>![po.expandableColumn,po.selectionColumn,"index","pageIndex",po.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[P,F]=t().useState({}),[H,k]=t().useState(O),[L]=t().useState(T([A[0]])),[q]=t().useState(T(A.slice(1))),[_,$]=t().useState(0),D=t().useMemo((()=>!Object.keys(P).length),[P]);$e((()=>{I.current="ready"}),[P,H]);const K=e=>{k(Object.assign({},H,e))},V=(e,t,l)=>new Promise(((n,a)=>{R.Modal.confirm({title:p("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{l(),n()}})})),M=async e=>{if(!Object.keys(P).length)return R.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.queryCondition")});if("ready"===I.current&&(I.current="stop",C.current=(e=>{const{allTableData:t}=r.current,l=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];let r=!0;for(const t in e){const{type:l}=A.find((e=>e.dataIndex===t)).filter;let n=Yi(a,t),i=!0;if("text"===l||"textarea"===l?i=new RegExp(H.fullchar?`^${e[t]}$`:e[t],H.case?"":"i").test(n):(n=es(n)?n.slice(0,10):n,i=n==e[t]),!i){r=!1;break}}r&&l.push(a)}return l})(P),$(C.current.length)),!C.current.length)return m(""),R.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>C.current.length-1&&await V(p("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=C.current.length-1))),"prev"===e&&(w.current=w.current<0?C.current.length-1:w.current-1,w.current<0&&await V(p("qm.table.fastSearch.toStart"),(()=>w.current=C.current.length-1),(()=>w.current=0)));const t=C.current[w.current],l=o(t,t.index);let n=t.index;if(b&&y){const e=io(r.current.deriveRowKeys,l)[0];n=r.current.tableFullData.findIndex((t=>o(t,t.index)===e))}((e,t)=>{if(S.current=e,y){const{pageSize:e}=d,l=Math.ceil((t+1)/e);f(!1),u(Object.assign({},d,{current:l}))}else h(e)})(l,n),m(l)},j=()=>{x.current.RESET_FORM(),E.current.RESET_FORM()},z=t().useMemo((()=>v?`fastSearch_${v}`:""),[v]),[U,B]=t().useState([]),[W,G]=t().useState(""),[Y,Z]=t().useState("");$e((()=>{if(Y){const{filters:e,config:t}=U.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(X()(e,q.map((e=>e.fieldName)))),E.current.SET_FIELDS_VALUE(X()(e,L.map((e=>e.fieldName)))),F(e),k(t)}else j(),F({}),k(O)}),[Y]),t().useEffect((()=>{J()}),[]);const J=async()=>{if(!z)return;let e=await Jo().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await Jo().setItem(z,e)),Array.isArray(e)&&e.length&&(B(e),Z(e[0].value))},ee=async e=>{const t=null==n?void 0:n.getComponentConfigApi;if(t)try{const l=await t({key:e});if(200===l.code)return l.data}catch(e){}},te=async(e,t)=>{const l=null==n?void 0:n.saveComponentConfigApi;if(l)try{await l({[e]:t})}catch(e){}},le=Ce("table");return t().createElement("div",{className:`${le}-fast-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"top"},t().createElement("div",{className:"container"},t().createElement(_t,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t().createElement("span",null,p("qm.table.alert.total",{total:_}))},t().createElement(_t.TabPane,{tab:p("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t().createElement(pr,{ref:x,items:L,cols:1,labelWidth:110})),t().createElement(_t.TabPane,{tab:p("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t().createElement(pr,{ref:E,items:q,cols:1,labelWidth:110})))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(R.Input,{size:s,value:W,placeholder:p("qm.table.highSearch.configText"),disabled:D,onChange:e=>{const{value:t}=e.target;G(t)}}),t().createElement(he,{type:"primary",disabled:!W||D,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=to(),t=[...U,{text:W,value:e,list:{filters:P,config:H}}];B(t),Z(e),G(""),await Jo().setItem(z,t),await te(z,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${po.rowHeightMaps[s]}px`}},t().createElement("span",null,p("qm.table.fastSearch.savedSetting"))),t().createElement("ul",null,U.map((e=>t().createElement("li",{key:e.value,className:Ee()({selected:e.value===Y}),title:e.text,onClick:()=>(e=>{Z(e!==Y?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=U.filter((t=>t.value!==e));B(t),e===Y&&Z(""),await Jo().setItem(z,t),await te(z,t)})(e.value)}},t().createElement(Se.CloseCircleOutlined,null))))),!U.length&&t().createElement("div",{style:{padding:di}},t().createElement(dt,null)))))),t().createElement("div",{className:"bottom"},t().createElement("div",null,t().createElement(R.Checkbox,{checked:!!H.case,onChange:e=>K({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t().createElement(R.Checkbox,{checked:!!H.fullchar,onChange:e=>K({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t().createElement("div",null,t().createElement(he,{onClick:()=>j()},p("qm.table.fastSearch.clear"))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Bl[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>l(),style:{marginRight:8}},p("qm.table.fastSearch.closeButton")),t().createElement(he,{type:"primary",style:{marginRight:8},onClick:()=>M("prev")},p("qm.table.fastSearch.queryPrev")),t().createElement(he,{type:"primary",onClick:()=>M("next")},p("qm.table.fastSearch.queryNext"))))},ls=t().forwardRef(((e,l)=>{const{open:n=!0}=e,{$size:a}=t().useContext(si),[r,i]=t().useState(!1),o=()=>{i(!0)};t().useImperativeHandle(l,(()=>({clickHandle:o})));const s=Ce("table"),c={visible:r,title:p("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Bl[a]+20}px`},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${s}-super-search`,title:p("qm.table.fastSearch.text"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.MonitorOutlined,null))),t().createElement(Wt,c,t().createElement(ts,{onClose:()=>i(!1)})))}));ls.displayName="FastSearch";const ns=ls,as=e=>{const{columns:l,group:n,summary:a}=e,{tableRef:r,tableProps:i,$size:o,pagination:c,fetchParams:d,isFetch:u}=t().useContext(si),{fetch:h}=i,m=e=>{const t=l.find((t=>t.dataIndex===e));return{title:t.title,precision:t.precision,dictItems:t.dictItems??[]}},f=n.map((e=>({dataIndex:e.group,...m(e.group)}))),g=a.map((e=>e.summary===po.groupSummary.total.value?{dataIndex:e.summary,title:po.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...m(e.summary),formula:e.formula})),b=t().useMemo((()=>Object.assign({},d,{[po.sorterFieldName]:void 0,[po.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[po.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[po.currentPageName]:1})),[d,n,a]),[y,v]=t().useState(((e,t)=>[{title:p("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{var t;const n=null===(t=l.find((t=>t.dataIndex===e.dataIndex)))||void 0===t?void 0:t.groupSummary;let a=n?{summation:n}:null;return e.dataIndex===po.groupSummary.total.value&&(a={dataIndex:po.groupSummary.recordTotalIndex,summation:{render:()=>c.total}}),{...e,..."count"===e.formula||"sum"===e.formula?a:null}}))])(f,g)),[x]=t().useState(u?[]:(e=>{const t=ro(e,n.map((e=>e.group))),l=[];return t.forEach((e=>{const t={};y.forEach((l=>{const{dataIndex:n}=l;"index"!==n&&Xi(t,n,Yi(e[0],n))})),a.forEach((l=>{const n=l.summary!==po.groupSummary.total.value?l.summary:po.groupSummary.recordTotalIndex,a=l.formula;"count"===a&&Xi(t,n,e.length),"sum"===a&&Xi(t,n,(0,Q.sumBy)(e,n)),"max"===a&&Xi(t,n,(0,Q.maxBy)(e,n)[n]),"min"===a&&Xi(t,n,(0,Q.minBy)(e,n)[n]),"avg"===a&&Xi(t,n,((0,Q.sumBy)(e,n)/e.length).toFixed(2))})),l.push(t)})),l})(r.current.tableFullData)),E={size:o,height:400,...u?{fetch:{api:h.api,params:b,dataKey:null==h?void 0:h.dataKey}}:{dataSource:x},columns:y,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${s()().format("YYYYMMDDHHmmss")}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>v(e)};return t().createElement(zs,E)},rs=e=>{const{onClose:l}=e,{global:n}=t().useContext(i),{tableProps:a,$size:r,flattenColumns:o}=t().useContext(si),{uniqueKey:s}=a,c=t().useRef(null),d=t().useRef(null),[u,h]=t().useState(!1),[m,f]=t().useState([]),[b,y]=t().useState(""),[v,x]=t().useState("");$e((()=>{if(v){const{group:e,summary:t}=m.find((e=>e.value===v)).list;T(e),F(t)}else{const e=q();T((null==e?void 0:e.group)||[]),F((null==e?void 0:e.summary)||[])}}),[v]),t().useEffect((()=>{_()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),C=t().useMemo((()=>o.filter((e=>![po.expandableColumn,po.selectionColumn,"index","pageIndex",po.operationColumn].includes(e.dataIndex)))),[o]),S=C.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[po.groupSummary.total,...C.filter((e=>!!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex})))],I=[{text:p("qm.table.groupSummary.sumText"),value:"sum"},{text:p("qm.table.groupSummary.maxText"),value:"max"},{text:p("qm.table.groupSummary.minText"),value:"min"},{text:p("qm.table.groupSummary.avgText"),value:"avg"},{text:p("qm.table.groupSummary.countText"),value:"count"}],[N,T]=t().useState([]),[O,A]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,l)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{c.current.REMOVE_RECORDS(l)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:p("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:S.map((e=>({...e,disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[P,F]=t().useState([]),[H,k]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,l)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(l)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:p("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:w.map((e=>({...e,disabled:P.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:p("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===po.groupSummary.total.value?I.slice(I.length-1):I})}]),L=t().useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=P.length&&P.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,P]),q=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},_=async()=>{if(!E)return;const e=q();if(e){const{group:t,summary:l}=e;T(t),F(l)}let t=await Jo().getItem(E);t||(t=await $(E),Array.isArray(t)&&await Jo().setItem(E,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},$=async e=>{const t=null==n?void 0:n.getComponentConfigApi;if(t)try{const l=await t({key:e});if(200===l.code)return l.data}catch(e){}},D=async(e,t)=>{const l=null==n?void 0:n.saveComponentConfigApi;if(l)try{await l({[e]:t})}catch(e){}},K=Ce("table"),V={visible:u,title:p("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>h(!1)};return t().createElement("div",{className:`${K}-group-summary__setting`},t().createElement("div",{className:"main"},t().createElement("div",{style:{width:"30%"}},t().createElement(zs,{ref:c,size:r,columns:O,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>A(e),onDataChange:e=>{T(e)}},t().createElement(he,{type:"primary",icon:t().createElement(Se.PlusOutlined,null),onClick:()=>{c.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"container line"},t().createElement(zs,{ref:d,size:r,columns:H,dataSource:P,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{F(e)}},t().createElement(he,{type:"primary",icon:t().createElement(Se.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(R.Input,{size:r,value:b,placeholder:p("qm.table.groupSummary.configText"),disabled:L,onChange:e=>{const{value:t}=e.target;y(t)}}),t().createElement(he,{type:"primary",disabled:!b||L,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=to(),t=[...m,{text:b,value:e,list:{group:N.filter((e=>!!e.group)),summary:P.filter((e=>!!e.summary))}}];f(t),x(e),y(""),await Jo().setItem(E,t),await D(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${po.rowHeightMaps[r]}px`}},t().createElement("span",null,p("qm.table.groupSummary.savedSetting"))),t().createElement("ul",null,m.map((e=>t().createElement("li",{key:e.value,className:Ee()({selected:e.value===v}),title:e.text,onClick:()=>(e=>{x(e!==v?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=m.filter((t=>t.value!==e));f(t),e===v&&x(""),await Jo().setItem(E,t),await D(E,t)})(e.value)}},t().createElement(Se.CloseCircleOutlined,null))))),!m.length&&t().createElement("div",{style:{padding:di}},t().createElement(dt,null)))))),t().createElement(Wt,V,t().createElement(as,{columns:C,group:N,summary:P})),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>l(),style:{marginRight:8}},p("qm.table.groupSummary.closeButton")),t().createElement(he,{type:"primary",disabled:L,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:N.filter((e=>!!e.group)),summary:P.filter((e=>!!e.summary))})),void h(!0))},p("qm.table.groupSummary.confirmButton"))))},is=t().forwardRef(((e,l)=>{const{open:n=!0}=e,[a,r]=t().useState(!1),i=()=>{r(!0)};t().useImperativeHandle(l,(()=>({clickHandle:i})));const o=Ce("table"),s={visible:a,title:p("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>r(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-group-summary`,title:p("qm.table.groupSummary.text"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.PieChartOutlined,null))),t().createElement(Wt,s,t().createElement(rs,{onClose:()=>r(!1)})))}));is.displayName="GroupSummary";const os=is,ss=e=>{const{onClose:l}=e,{global:n}=t().useContext(i),{tableProps:a,$size:r,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(si),{uniqueKey:d}=a,u=t().useRef(null),[h,m]=t().useState([]),[f,b]=t().useState([]),[y,v]=t().useState(""),[x,E]=t().useState("");$e((()=>{m(x?f.find((e=>e.value===x)).list:q()||[])}),[x]),t().useEffect((()=>{_()}),[]);const C=t().useMemo((()=>d?`superSearch_${d}`:""),[d]),S=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=ao(h),I=t().useMemo((()=>!(w&&Fi(w))),[w]),N=t().useMemo((()=>!!h.length&&I),[h,I]),T=[{value:"and",text:p("qm.table.highSearch.andText")},{value:"or",text:p("qm.table.highSearch.orText")}],O=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:e.title}))),A=e=>["in","nin"].includes(e),P=(e,t)=>{let l;switch(e){case"number":l="number";break;case"date":l="date";break;case"checkbox":case"radio":l=t?"select-multiple":"select";break;default:l="text"}return l},F=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:p("qm.table.highSearch.gtText")},{value:"<",text:p("qm.table.highSearch.ltText")},{value:">=",text:p("qm.table.highSearch.gteText")},{value:"<=",text:p("qm.table.highSearch.lteText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:p("qm.table.highSearch.inText")},{value:"nin",text:p("qm.table.highSearch.ninText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:p("qm.table.highSearch.likeText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}]}return t},[H,k]=t().useState([{title:p("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,l)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(l)}},p("qm.table.highSearch.removeText")))},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,l)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:O,rules:[{required:!0,message:p("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var l,n;const a=Object.values(t)[0],r=null===(l=S.find((e=>e.dataIndex===a)))||void 0===l?void 0:l.filter.type,i=F(r);e.fieldType=r,e.expression=a?null===(n=i[0])||void 0===n?void 0:n.value:"",e.condition=A(e.expression)?[]:"",a||(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=>{var t;const l=null===(t=S.find((t=>t.dataIndex===e.fieldName)))||void 0===t?void 0:t.filter.type;return{type:"select",editable:!0,items:F(l),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=A(e.expression)?[]:""}}}},{title:p("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t;const l=S.find((t=>t.dataIndex===e.fieldName)),n=null==l?void 0:l.filter.type,a=(null==l||null===(t=l.filter)||void 0===t?void 0:t.items)??(null==l?void 0:l.dictItems)??[];return{type:P(n,A(e.expression)),editable:!0,items:a,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,l)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:T,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),L=()=>{C&&sessionStorage.setItem(C,JSON.stringify(h.filter((e=>!!e.fieldName))))},q=()=>{if(!C)return;const e=sessionStorage.getItem(C);return e?JSON.parse(e):null},_=async()=>{if(!C)return;const e=q();e&&m(e);let t=await Jo().getItem(C);t||(t=await $(C),Array.isArray(t)&&await Jo().setItem(C,t)),Array.isArray(t)&&t.length&&(b(t),!e&&E(t[0].value))},$=async e=>{const t=null==n?void 0:n.getComponentConfigApi;if(t)try{const l=await t({key:e});if(200===l.code)return l.data}catch(e){}},D=async(e,t)=>{const l=null==n?void 0:n.saveComponentConfigApi;if(l)try{await l({[e]:t})}catch(e){}},K=Ce("table");return t().createElement("div",{className:`${K}-super-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"container"},t().createElement(zs,{ref:u,size:r,columns:H,dataSource:h,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onRowClick:(e,t)=>{const{dataIndex:l}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(l)&&("bracketLeft"===l&&(e[l]=e[l]?"":"("),"bracketRight"===l&&(e[l]=e[l]?"":")"),m([...h]))},onDataChange:e=>{m(e)}},t().createElement(he,{type:"primary",icon:t().createElement(Se.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),po.highSearch.showSQL&&w&&t().createElement("code",{className:"lang-js"},w)),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(R.Input,{size:r,value:y,placeholder:p("qm.table.highSearch.configText"),disabled:I,onChange:e=>{const{value:t}=e.target;v(t)}}),t().createElement(he,{type:"primary",disabled:!y||I,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!C)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=to(),t=[...f,{text:y,value:e,list:h.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await Jo().setItem(C,t),await D(C,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${po.rowHeightMaps[r]}px`}},t().createElement("span",null,p("qm.table.highSearch.savedSetting"))),t().createElement("ul",null,f.map((e=>t().createElement("li",{key:e.value,className:Ee()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));b(t),e===x&&E(""),await Jo().setItem(C,t),await D(C,t)})(e.value)}},t().createElement(Se.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:di}},t().createElement(dt,null)))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>l(),style:{marginRight:8}},p("qm.table.highSearch.closeButton")),t().createElement(he,{type:"primary",disabled:N,onClick:()=>(c(),s(h.map((e=>X()(e,["index","pageIndex"])))),L(),void l())},p("qm.table.highSearch.searchButton"))))},cs=t().forwardRef(((e,l)=>{const{open:n=!0}=e,[a,r]=t().useState(!1),i=()=>{r(!0)};t().useImperativeHandle(l,(()=>({clickHandle:i})));const o=Ce("table"),s={visible:a,title:p("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>r(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-super-search`,title:p("qm.table.highSearch.text"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.FunnelPlotOutlined,null))),t().createElement(Wt,s,t().createElement(ss,{onClose:()=>r(!1)})))}));cs.displayName="SuperSearch";const ds=cs,us=t().forwardRef(((e,l)=>{const{tableColumns:n,showFullScreen:a,showReload:r,showPrint:o,showImport:s,showExport:c,showClipboard:d,showCollection:u,showFastSearch:h,showSuperSearch:m,showGroupSummary:f,showToolBox:b}=e,{global:y}=t().useContext(i),{tableProps:v,flattenColumns:x,isFullScreen:E,$size:C}=t().useContext(si),{uniqueKey:S,exportExcel:w}=v,I=t().useRef(null),N=t().useRef(null),T=t().useRef(null),O=t().useRef(null),A=t().useRef(null),P=t().useRef(null),F=t().useRef(null),H=t().useRef(null),k=t().useRef(null),L=t().useRef(null),q=t().useMemo((()=>S?`toolBox_${S}`:""),[S]),[_,$]=t().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),D={fullScreen:a,reload:r,print:o,import:s,export:c&&!(null!=w&&w.hideIcon),clipboard:d,collection:u,fastSearch:h,superSearch:m,groupSummary:f},[K,V]=t().useState(!1);$e((()=>{j()}),[_]),t().useEffect((()=>{M()}),[]),t().useImperativeHandle(l,(()=>({exportHandle:()=>{if(!A.current)return g("Table","执行导出需要配置 `exportExcel` 参数");A.current.clickHandle()}})));const M=()=>{if(!q||!b)return;const e=JSON.parse(localStorage.getItem(q));e||z(q).then((e=>{e&&($(Object.assign({},_,e)),localStorage.setItem(q,JSON.stringify(e)))})).catch((()=>{})),e&&$(Object.assign({},_,e))},j=()=>{if(!q||!b)return;const e={};for(const t in _)_[t]&&(e[t]=_[t]);localStorage.setItem(q,JSON.stringify(e)),U(q,e)},z=async e=>{const t=null==y?void 0:y.getComponentConfigApi;if(t)try{const l=await t({key:e});if(200===l.code)return l.data}catch(e){}},U=async(e,t)=>{const l=null==y?void 0:y.saveComponentConfigApi;if(l)try{await l({[e]:t})}catch(e){}},B=async e=>{V(!1),await ne(100),e.current.clickHandle()},W=(e,t)=>{$(Object.assign({},_,{[t]:e}))},G=Ce("table"),Y={"top-toolbox__popper":!0,[`${G}--lg`]:"large"===C,[`${G}--sm`]:"small"===C};return t().createElement(t().Fragment,null,a&&t().createElement(Co,{ref:I,isFullScreen:E,open:!b||_.fullScreen}),r&&t().createElement(wo,{ref:N,open:!b||_.reload}),o&&t().createElement(No,{ref:T,tableColumns:n,open:!b||_.print}),s&&t().createElement(Vo,{ref:O,tableColumns:n,open:!b||_.import}),c&&t().createElement(Uo,{ref:A,tableColumns:n,open:(!b||_.export)&&!(null!=w&&w.hideIcon)}),d&&t().createElement(Go,{ref:P,flattenColumns:x,open:!b||_.clipboard}),u&&t().createElement(Qo,{ref:F,columns:n,open:!b||_.collection}),h&&t().createElement(ns,{ref:H,open:!b||_.fastSearch}),f&&t().createElement(os,{ref:k,open:!b||_.groupSummary}),m&&t().createElement(ds,{ref:L,open:!b||_.superSearch}),b&&t().createElement(R.Dropdown,{overlay:(()=>{const e=[{key:"fullScreen",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.screen.full"))),onClick:()=>B(I)},{key:"reload",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.refresh.text"))),onClick:()=>B(N)},{key:"print",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.print.text"))),onClick:()=>B(T)},{key:"import",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.import.textNoSpace"))),onClick:()=>B(O)},{key:"export",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.export.textNoSpace"))),onClick:()=>B(A)},{key:"clipboard",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.clipboard.textNoSpace"))),onClick:()=>B(P)},{key:"collection",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.selectCollection.text"))),onClick:()=>B(F)},{key:"fastSearch",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.fastSearch.text"))),onClick:()=>B(H)},{key:"groupSummary",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.groupSummary.text"))),onClick:()=>B(k)},{key:"superSearch",label:t().createElement(t().Fragment,null,t().createElement(R.Checkbox,{checked:_.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.highSearch.text"))),onClick:()=>B(L)}];return t().createElement(R.Menu,{items:e.filter((e=>D[e.key]))})})(),trigger:["click"],placement:"bottomRight",overlayClassName:Ee()(Y),overlayStyle:{minWidth:120},visible:K,onVisibleChange:e=>{V(e)}},t().createElement("span",{className:`${G}-toolbox`,title:p("qm.table.toolbox.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.AppstoreAddOutlined,null)))))}));us.displayName="ToolBox";const ps=us,hs=e=>{const{columns:l}=e,{global:n}=t().useContext(i),{tableProps:a,tableRef:r,$size:o}=t().useContext(si),{uniqueKey:s,onlyShowIcon:c,columnsChange:d}=a,u=t().useRef([]),h=e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)),m=e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)),f=e=>e.filter((e=>!e.noAuth&&!e.fixed)),[g,b]=t().useState(!1),[y,v]=t().useState(h(l)),[x,E]=t().useState(m(l)),[C,S]=t().useState(f(l)),w=t().useMemo((()=>s?`table_${s}`:""),[s]),I=t().useMemo((()=>[...y,...C,...x]),[y,C,x]);$e((()=>{A(l),O(l),N(l)}),[l]),t().useEffect((()=>{T()}),[]);const N=e=>{if(!w)return;const t=e.map((e=>{const t={};return 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}})),l=JSON.parse(localStorage.getItem(w));(0,Q.isEqual)(t,l)||(localStorage.setItem(w,JSON.stringify(t)),(async(e,t)=>{const l=null==n?void 0:n.saveComponentConfigApi;if(l)try{await l({[e]:t})}catch(e){}})(w,t))},T=()=>{const e=(()=>{if(!w)return;const e=JSON.parse(localStorage.getItem(w));return e||(async e=>{const t=null==n?void 0:n.getComponentConfigApi;if(t)try{const l=await t({key:e});if(200===l.code)return l.data}catch(e){}})(w).then((e=>{if(!e)return N(l);localStorage.setItem(w,JSON.stringify(e)),T()})).catch((()=>{})),e?(0,Q.xor)(e.map((e=>e.dataIndex)),l.map((e=>e.dataIndex))).length>0?l.map((t=>{const{dataIndex:l}=t,n=e.find((e=>e.dataIndex===l));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):t})):e.map((e=>{const t=l.find((t=>t.dataIndex===e.dataIndex));return void 0===e.fixed&&delete t.fixed,{...t,...e}})):void 0})();e&&(O(e),null==d||d(e))},O=e=>{const t=h(e),l=m(e),n=f(e);return v(t),E(l),S(n),[...t,...n,...l]},A=e=>{const t=[];e.filter((e=>!e.noAuth)).forEach(((l,n)=>{const a=l.colSpan;a>1&&e.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+a))})),u.current=t},P=()=>{const e=[];I.forEach((t=>{const{colSpan:l,dataIndex:n}=t;if(0===l)return;if(1===l)return e.push(t);const a=u.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...u.current[a].map(((e,l)=>{let{dataIndex:n}=e;const a=I.find((e=>e.dataIndex===n));return l>0&&(void 0!==t.hidden&&(a.hidden=t.hidden),void 0!==t.fixed?a.fixed=t.fixed:a.fixed&&delete a.fixed),a})))})),l.forEach(((t,l)=>{t.noAuth&&e.findIndex((e=>e.dataIndex===t.dataIndex))<0&&e.splice(l,0,t)})),null==d||d(e)},F=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const n=O(l);null==d||d(n)},H=(e,n)=>{const{colSpan:a,noFixed:r}=e;if(0===a)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${n}-handle`];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(R.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,O(l),P()}}),t().createElement("i",{className:Ee()(i),title:p("qm.table.columnFilter.draggable")},t().createElement(Se.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title),"main"===n?t().createElement("span",{className:Ee()("fixed",r?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>F(e,"left")},t().createElement(Se.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>F(e,"right")},t().createElement(Se.StepForwardOutlined,null))):t().createElement("span",{className:Ee()("fixed",r?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>F(e)},t().createElement(Se.CloseCircleOutlined,null))))},k=Ce("table"),L={[`${k}__popper`]:!0,"column-filter__popper":!0,[`${k}--lg`]:"large"===o,[`${k}--sm`]:"small"===o},q=[`${k}-column-filter`,{selected:g}];return t().createElement(an(),{action:["click"],popupVisible:g,popup:t().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"reset"},t().createElement(he,{type:"text",size:"small",onClick:()=>{const e=se(r.current.originColumns);O(e),null==d||d(e)}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement(wl.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),l=y.map((e=>e.dataIndex));(0,Q.isEqual)(t,l)||v(e)},onEnd:()=>P()},y.map((e=>H(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement(wl.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:C,setList:e=>{const t=e.map((e=>e.dataIndex)),l=C.map((e=>e.dataIndex));(0,Q.isEqual)(t,l)||S(e)},onEnd:()=>P()},C.map((e=>H(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement(wl.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:x,setList:e=>{const t=e.map((e=>e.dataIndex)),l=x.map((e=>e.dataIndex));(0,Q.isEqual)(t,l)||E(e)},onEnd:()=>P()},x.map((e=>H(e,"right")))))),popupClassName:Ee()(L),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{b(e)},builtinPlacements:gi,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Ee()(q),title:c?p("qm.table.columnFilter.text"):void 0},t().createElement("i",{className:"svgicon icon"},t().createElement(Se.SettingOutlined,null)),!c&&t().createElement("span",null,p("qm.table.columnFilter.text"))))},ms=()=>t().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}));function fs(){return fs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},fs.apply(this,arguments)}const gs=e=>{const{column:l,filters:n}=e,{$size:a,setFilters:r,clearSuperFilters:i}=t().useContext(si),o=t().useRef(null),s=t().useRef(null),c=t().useRef(null),[d,u]=t().useState(!1),[h,m]=t().useState(!1),[f,b]=t().useState({}),y=t().useMemo((()=>{const{dataIndex:e,filter:t}=l;return`${e}|${t.type}`}),[l]),v=t().useMemo((()=>{let e=!1;for(const t in n[y])if(!ie(n[y][t])||h){e=!0;break}return e}),[y,n,h]);t().useEffect((()=>{d&&(ie(n[y])&&x(),setTimeout((()=>E()),50))}),[d]),t().useEffect((()=>{Object.keys(n).includes(y)||m(!1)}),[n]);const x=()=>{b({})},E=()=>{switch(l.filter.type){case"text":o.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},C=e=>{e&&b(e),i(),r((e=>{for(const t in e){for(const l in e[t])if(ie(e[t][l])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][l])continue;delete e[t][l]}Object.keys(e[t]).length||delete e[t]}return e})({...n,...f,...e})),u(!1)},S={text:e=>{var l;const{title:n}=e;return t().createElement(t().Fragment,null,t().createElement(R.Input,{ref:o,size:a,placeholder:p("qm.table.filter.searchText",{text:n}),style:{width:"180px"},value:(null===(l=f[y])||void 0===l?void 0:l.like)??"",disabled:h,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&C()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(R.Checkbox,{checked:h,onChange:e=>{const{checked:t}=e.target,l=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":l,like:null}}))),m(t)}},p("qm.table.filter.nullValue"))))},textarea:e=>{var l;const{title:n}=e;return t().createElement(t().Fragment,null,t().createElement(R.Input.TextArea,{ref:c,size:a,placeholder:p("qm.table.filter.searchAreaText",{text:n}),style:{width:"220px"},value:(null===(l=f[y])||void 0===l?void 0:l.likes)??"",disabled:h,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{likes:t||null}})))},onKeyDown:e=>{13===e.keyCode&&C()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(R.Checkbox,{checked:h,onChange:e=>{const{checked:t}=e.target,l=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":l,like:null}}))),m(t)}},p("qm.table.filter.nullValue"))))},number:e=>{const l=e=>{var t;return{value:(null===(t=f[y])||void 0===t?void 0:t[e])??"",size:a,onChange:t=>{(null==t?void 0:t.toString().replace(/^-|\./g,"").length)>17||b((l=>Object.assign({},l,{[y]:Object.assign({},l[y],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&C()}}};return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(R.InputNumber,fs({ref:s},l(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(R.InputNumber,fs({},l("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(R.InputNumber,fs({},l("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(R.InputNumber,fs({},l("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const l=e=>{var t;return{value:Ji(null===(t=f[y])||void 0===t?void 0:t[e],hi),format:hi,size:a,onChange:t=>{b((l=>Object.assign({},l,{[y]:Object.assign({},l[y],{[e]:eo(t,hi)})})))},onKeyDown:e=>{13===e.keyCode&&C()}}};return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(q,fs({},l(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(q,fs({},l("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(q,fs({},l("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(q,fs({},l("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{var l;const{filter:n,dictItems:a=[]}=e,r=n.items||a;return t().createElement("ul",null,t().createElement(R.Radio.Group,{style:{width:"100%"},value:null===(l=f[y])||void 0===l?void 0:l["=="],onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{"==":t}})))}},r.map((e=>t().createElement("li",{key:e.value},t().createElement(R.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{var l;const{filter:n,dictItems:a=[]}=e,r=n.items||a;return t().createElement("ul",null,t().createElement(R.Checkbox.Group,{style:{width:"100%"},value:null===(l=f[y])||void 0===l?void 0:l.in,onChange:e=>{b((t=>Object.assign({},t,{[y]:{in:e}})))}},r.map((e=>t().createElement("li",{key:e.value},t().createElement(R.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{var l;const{filter:n,dictItems:a=[]}=e,r=n.items||a;return t().createElement("div",{style:{height:200,...n.style}},t().createElement(oi,{multiple:!0,value:(null===(l=f[y])||void 0===l?void 0:l.in)||[],dataSource:r,onCheckChange:e=>{const t=e.map((e=>e.value));b((e=>Object.assign({},e,{[y]:{in:t}})))}}))}},w=Ce("table"),I={"head-filter__popper":!0,[`${w}--lg`]:"large"===a,[`${w}--sm`]:"small"===a},N=["cell--filter",{selected:d,actived:v}];return t().createElement(an(),{action:["click"],popupVisible:d,popup:(()=>{const e=l.filter.type,n=S[e];return n?t().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t().createElement("div",null,n(l)),t().createElement(R.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t().createElement(he,{size:a,onClick:()=>{C({[y]:{}})}},p("qm.table.filter.reset")),t().createElement(he,{type:"primary",size:a,onClick:()=>C()},p("qm.table.filter.search")))):(g("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Ee()(I),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:gi,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("div",{className:Ee()(N),title:p("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t().createElement("span",{className:"svgicon icon"},t().createElement(ms,null))))},bs=e=>{const{column:l}=e,{tableProps:n,tableRef:a,bordered:r}=t().useContext(si),{columns:i,resizable:o,columnsChange:s=te}=n,c={resizable:!0,"is--line":o&&!r};return t().createElement("div",{className:Ee()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=a.current,r=n.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=Ui(t,n.$table).left-n.$tableBody.parentNode.scrollLeft+o;n.$table.classList.add("c--resize"),r.style.left=`${d}px`,r.style.display="block";const u=l.width||l.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,n=u+t;n<(l.minWidth||po.defaultColumnWidth)||(p=Math.floor(n),r.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),r.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&($i(i,l.dataIndex).width=p,s([...i]))},!1}})},ys=e=>{const{selectionKeys:l}=e,{tableRef:n,tableProps:a,getRowKey:r,pagination:i,fetchParams:o,setSelectionKeys:s,setSpinning:c,isWebPagination:d}=t().useContext(si),{rowSelection:u}=a,{fetchAllRowKeys:h,onSelectAll:m}=u,f=t().useRef([]),g=t().useMemo((()=>u.selectAllOnCurrentPage??!1),[u]),b=t().useMemo((()=>(u.filterable??!0)&&!g),[u,g]),y=(()=>{const{allTableData:e,allRowKeys:t}=n.current,{disabled:a=(e=>!1)}=u;return g?(0,Q.union)((()=>{const{tableFullData:e}=n.current,{current:t,pageSize:l}=i;return d?e.slice((t-1)*l,t*l):e})().filter((e=>!a(e))).map((e=>r(e,e.index))),l):t.filter(((t,l)=>!a(e[l])))})(),v=l.length>0&&l.length<(h||g?i.total:n.current.allRowKeys.length),x=!!l.length&&l.length===(f.current.length||y.length),E=async()=>{const e=h;let t=[];c(!0);try{const l=await e.api(o);200===l.code&&(t=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,e.dataKey)??[],f.current=t)}catch(e){}return c(!1),t},C=async e=>{let t=[];t=h?e?await E():[]:e?y.slice(0):[],s(t),null==m||m(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(R.Checkbox,{checked:x,indeterminate:v,disabled:!y.length,onChange:e=>C(e.target.checked)}),b&&t().createElement(R.Dropdown,{overlayClassName:"all-selection__popper",overlay:(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{C(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=h?(0,Q.xor)(l,await E()):(0,Q.xor)(l,y),s(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{C(!1)}}];return t().createElement(R.Menu,{items:e})})()},t().createElement(Se.DownOutlined,{className:"svgicon icon"})),g&&t().createElement(R.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(Se.InfoCircleOutlined,{className:"info"})))},vs=e=>{const{style:l}=e,{tableProps:n,tableRef:a,isTreeTable:r,setRowExpandedKeys:i}=t().useContext(si),{expandable:o}=n,[s,c]=t().useState((null==o?void 0:o.defaultExpandAllRows)||!1);$e((()=>{const{allRowKeys:e,flattenRowKeys:t}=a.current;i(s?e.filter((e=>!(r&&t.includes(e)))):[])}),[s]);const d={[`${Ce("expand")}--icon`]:!0,expanded:s,collapsed:!s};return t().createElement("span",{className:Ee()(d),title:"",onClick:e=>{e.stopPropagation(),c(!s)},style:l})},xs=()=>t().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"})),Es=()=>t().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})),Cs=e=>{const{tableColumns:l,flattenColumns:n,sorter:a,filters:r}=e,{getRowKey:i,tableProps:o,tableRef:s,layout:c,scrollY:d,superFilters:u,selectionKeys:h,rightFixedColumns:m,firstDataIndex:f,isFetch:g,isTreeTable:b,isGroupSubtotal:y,tableChange:v,setSorter:x,setElementStore:E,resetTableScroll:C,getStickyLeft:S,getStickyRight:w,createGroupData:I,createTableFullData:N}=t().useContext(si),{ellipsis:T,resizable:O,multipleSort:A,rowSelection:P,expandable:F}=o,[H,k]=po.sortDirections,L=t().useRef(null),q=t().useMemo((()=>!g),[g]),_=t().useMemo((()=>!g),[g]),$=t().useMemo((()=>!(null!=F&&F.hideExpandAll)),[F]),D=t().useMemo((()=>!(!P||(g?!P.selectAllOnCurrentPage&&!P.fetchAllRowKeys:P.hideSelectAll))),[g,P]);$e((()=>{U(),v(),C()}),[a]),$e((()=>{G(),v(),C()}),[r]),$e((()=>{G(),v(),C()}),[u]),t().useEffect((()=>{K()}),[]);const K=()=>{E("$header",L.current)},V=e=>{const{dataIndex:l,type:n,sorter:r,title:i,description:o}=e;if(l===po.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},D?t().createElement(ys,{selectionKeys:h}):p("qm.table.config.selectionText"));if("radio"===n)return t().createElement("div",{className:"cell"},i)}const s=[];return s.push(t().createElement("div",{key:0,className:"cell",title:i},b&&l===f&&$?t().createElement(vs,null):null,l===po.expandableColumn&&$?t().createElement(vs,null):i)),o&&s.push(t().createElement(R.Tooltip,{key:1,placement:"top",title:o},t().createElement(Se.InfoCircleOutlined,{className:"tip"}))),r&&s.push(M(a[l])),s},M=e=>{const l=["svgicon cell--sorter__asc",{actived:e===H}],n=["svgicon cell--sorter__desc",{actived:e===k}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Ee()(l)},t().createElement(xs,null)),t().createElement("span",{className:Ee()(n)},t().createElement(Es,null)))},j=e=>t().createElement(gs,{column:e,filters:r}),z=(e,t)=>{const{sorter:l,dataIndex:n}=t;if(l){const e=a[n],t=e?e===k?null:k:H;A?(delete a[n],x(Object.assign({},a,{[n]:t}))):x(Object.assign({},{[n]:t}))}},U=()=>{q&&B()},B=e=>{const t=(0,Q.pickBy)(a,(e=>null!==e));for(const e in t){const l=n.find((t=>t.dataIndex===e));l?W(l,t[e]):delete t[e]}e||Object.keys(t).length||W({dataIndex:"index"},H)},W=(e,t)=>{const{tableFullData:l}=s.current,{dataIndex:n,sorter:a}=e,r=(e,l)=>{const a=Yi(e,n),r=Yi(l,n);return Number.isNaN(a-r)?t===H?a.toString().localeCompare(r.toString()):r.toString().localeCompare(a.toString()):t===H?a-r:r-a},i=y?I(no(l).sort("function"==typeof a?a:r)):l.sort("function"==typeof a?a:r).slice(0);N(i)},G=()=>{_&&Y()},Y=()=>{const{tableOriginData:e}=s.current,t=u.length?ao(u):ao(r),l=""!==t?y?I(Hi(no(e),t,b)):Hi(e,t,b):e;N(l),B(!0)},X=zi(l),Z=Ce("table"),{tableBodyWidth:J}=c;return t().createElement("div",{ref:L,className:`${Z}--header-wrapper`},t().createElement("table",{className:`${Z}--header`,cellSpacing:"0",cellPadding:"0",style:{width:J?`${J}px`:""}},(()=>{const{gutterWidth:e}=c;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:l,width:n,renderWidth:a}=e;return t().createElement("col",{key:l,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),d&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("thead",null,(e=>{const{isIE:l}=s.current,n=["gutter",{"cell-fix-right":!!m.length}],r=l?null:{right:m.length?0:""};return e.map(((e,l)=>t().createElement("tr",{key:l,className:"header--row"},e.map(((l,n)=>((e,l,n)=>{var r,i;const{isIE:o}=s.current,{gutterWidth:u}=c,{dataIndex:p,colSpan:h,rowSpan:m,fixed:f,align:g,theadAlign:b,theadClassName:y="",sorter:v,filter:x,required:E,headRender:C}=e;if(0===h)return null;const I=b||g,N=["header--column",{"col--ellipsis":e.ellipsis??T,"col--center":"center"===I,"col--right":"right"===I,"column--required":!!E,"column-has-sorter":v,"column-has-filter":x,"column--sort":!!a[p],"cell-fix-left":!o&&"left"===f,"cell-fix-right":!o&&"right"===f,"cell-fix-left-last":!(o||"left"!==f||null!==(r=n[l+1])&&void 0!==r&&r.fixed),"cell-fix-right-first":!(o||"right"!==f||null!==(i=n[l-1])&&void 0!==i&&i.fixed),[y]:!!y}],R=o?null:{left:"left"===f?`${S(p)}px`:"",right:"right"===f?`${w(p)+(d?u:0)}px`:""},A=O&&![po.expandableColumn,po.selectionColumn].includes(p);return t().createElement("th",{key:p,className:Ee()(N),colSpan:h,rowSpan:m,style:{...R},onClick:t=>z(t,e)},t().createElement("div",{className:"cell--wrapper"},C?t().createElement("div",{className:"cell--text cell"},C(e,s.current.tableFullData)):t().createElement(t().Fragment,null,t().createElement("div",{className:"cell--text"},V(e)),x?j(e):null)),A&&t().createElement(bs,{column:e}))})(l,n,e))),d&&t().createElement("th",{className:Ee()(n),style:{...r}}))))})(X))))},Ss=()=>{const{tableProps:e,tableRef:l,layout:n,flattenColumns:a,isDragMergeCell:r}=t().useContext(si),{mergeCells:i=[],onMergeChange:o}=e,[s,c]=t().useState(!1),d=t().useRef(null),u=t().useRef(null),h=t().useRef({x:0,y:0,disX:0,disY:0});$e((()=>{r||y()}),[r]);const m=()=>{y(),Ue(d.current,{display:"none"})},f=e=>{const t=[];for(let l=0;l<e.rowSpan;l++)for(let n=0;n<e.colSpan;n++)t.push([e.row+l,e.col+n]);return t},g=()=>{h.current={x:0,y:0,disX:0,disY:0},u.current&&!v(u.current)||(u.current=null,m()),c(!0),document.removeEventListener("mousemove",b)},b=e=>{const{pageX:t,pageY:l}=e,{x:a,y:r,disX:i,disY:o}=h.current;let s=i,c=o,u=t-a,p=l-r;return u<0&&(u=Math.abs(u),s=i-u,Ue(d.current,{left:`${s}px`})),p<0&&(p=Math.abs(p),c=o-p,Ue(d.current,{top:`${c+n.headerHeight}px`})),Ue(d.current,{width:`${u}px`,height:`${p}px`}),E(s,c,u,p),!1},y=()=>{const{elementStore:e}=l.current,t=e.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<t.length;e++){const l=t[e].children;for(let e=0;e<l.length;e++)l[e].classList.remove("selected")}},v=e=>1===e.rowSpan&&1===e.colSpan,x=e=>e.width||e.renderWidth||e.minWidth||po.defaultColumnWidth,E=(0,Q.debounce)(((e,t,n,r)=>{const{allTableData:i,scrollYStore:o}=l.current;let s=-1,c=-1,d=-1,p=-1;for(let e=0;e<i.length;e++)t>o.rowHeight*e&&t<o.rowHeight*(e+1)&&(s=e),t+r>o.rowHeight*e&&t+r<o.rowHeight*(e+1)&&(c=e);let h=0;for(let t=0;t<a.length;t++)e>h&&e<h+x(a[t])&&(d=t),e+n>h&&e+n<h+x(a[t])&&(p=t),h+=x(a[t]);const m={row:s,col:d,rowSpan:c-s+1,colSpan:p-d+1};(0,Q.isEqual)(u,m)||(u.current=m,((e,t,n,a)=>{const{elementStore:r,scrollYStore:i}=l.current,o=r.$tableBody.querySelectorAll("tbody > tr");for(let l=0;l<o.length;l++){const r=o[l].children;for(let o=0;o<r.length;o++)if(r[o].classList.remove("selected"),(e!==t||n!==a)&&l+i.startIndex>=e&&l+i.startIndex<=t){const e=Number(r[o].getAttribute("colspan")),t=Number(r[o].getAttribute("data-index")),l=e>1?t+e-1:t;l>=n&&l<=a&&r[o].classList.add("selected")}}})(s,c,d,p))}),10);return{dragStart:e=>{const{pageX:t,pageY:a}=e,{elementStore:r}=l.current,{x:i,y:o}=(e=>{let t=0,l=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,l+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:l}})(r.$table),{scrollLeft:s,scrollTop:p}=r.$tableBody.parentNode;u.current=null,h.current={x:t,y:a,disX:t+s-i,disY:a+p-(o+n.headerHeight)},Ue(d.current,{width:0,height:0,left:t-i+"px",top:a-o+"px",display:"block"}),y(),c(!1),document.addEventListener("mousemove",b,{passive:!0}),document.addEventListener("mouseup",g,{passive:!0,once:!0})},renderDragPanel:()=>t().createElement("div",{ref:d,className:"merge-cell-bar",onMouseDown:e=>e.stopPropagation()},s&&t().createElement(t().Fragment,null,t().createElement(he,{size:"small",className:"btn cancel",onClick:()=>{if(u.current&&!v(u.current)){const e=f(u.current),t=i.findIndex((t=>{const l=f(t);return(0,Q.intersectionWith)(l,e,Q.isEqual).length===l.length}));-1!==t&&(null==o||o(i.filter(((e,l)=>l!==t))))}m()}},p("qm.table.mergeCell.cancel")),t().createElement(he,{size:"small",type:"primary",className:"btn confirm",onClick:()=>{if(u.current&&!v(u.current)){const e=f(u.current);let t=!1;for(let l=0;l<i.length;l++)(0,Q.intersectionWith)(f(i[l]),e,Q.isEqual).length&&(t=!0);t||null==o||o([...i,u.current])}m()}},p("qm.table.mergeCell.confirm")))),closeDragPanel:m}};const ws=e=>{const{selectionKeys:l,column:n,record:a,rowKey:r}=e,{tableProps:i,tableRef:o,isTreeTable:s,getAllChildRowKeys:c}=t().useContext(si),{rowSelection:d}=i,u=t().useMemo((()=>n.type||""),[n.type]),p=e=>{const t=d.checkStrictly??!0;if(!s||t)return!1;const n=Mi(o.current.deriveRowKeys,e),a=c((null==n?void 0:n.children)??[]);return!(!Array.isArray(null==n?void 0:n.children)||Gi(l,(null==n?void 0:n.children.map((e=>e.rowKey)))||[]))&&a.some((e=>l.includes(e)))};return"radio"===u?(()=>{const e=d.disabled,n=null==e?void 0:e(a),i=!n&&l[0]===r;return t().createElement(R.Radio,{checked:i,disabled:n})})():(()=>{const e=d.disabled,n=null==e?void 0:e(a),i=!!l.includes(r);return t().createElement(R.Checkbox,{checked:i,indeterminate:p(r),disabled:n})})()},Is=e=>{const{record:l,rowKey:n,style:a}=e,{tableProps:r,rowExpandedKeys:i,setRowExpandedKeys:o}=t().useContext(si),{expandable:s={}}=r,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(l)),d=t().useMemo((()=>i.includes(n)),[i,n]);$e((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,l)}),[d]);const u={[`${Ce("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t().createElement("span",{className:Ee()(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==n)):[...i,n];o(t)},style:a})},Ns=t().forwardRef(((e,l)=>{const{size:n,defaultValue:a,value:r,min:i,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<i&&(t=i.toString()),p>=0&&""!==t&&(t=new($l())(t).toFixed(p)),t},E=void 0!==r,[C,S]=t().useState(a??""),w=b(E?r:C),I=y(w),N=t=>{var l;E?null===(l=e.onChange)||void 0===l||l.call(e,t):S(t)};return $e((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,I)}),[C]),t().createElement(R.Input,{ref:l,size:n,value:w,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:e=>{const t=y(e.target.value);let l=/^-?\d*(\.\d*)?$/.test(t)||""===t||"-"===t;if(0===p&&t.includes(".")&&(l=!1),i>=0&&t.startsWith("-")&&(l=!1),l){if(!h&&t.replace(/^-|\./g,"").length>17)return;N(t)}},onFocus:v,onBlur:()=>{var t;const l=x(I);l!==I&&N(l),null===(t=e.onBlur)||void 0===t||t.call(e,l,I)},onKeyUp:t=>{var l;13===t.keyCode&&(null===(l=e.onEnter)||void 0===l||l.call(e,x(I),I))}})}));Ns.displayName="InputNumber";const Ts=Ns;function Rs(){return Rs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Rs.apply(this,arguments)}const{Search:Os}=R.Input,As=e=>{var l,n,a,r;const{column:i,record:o,rowKey:s,columnKey:c,clicked:d,text:u}=e,{tableRef:h,tableBodyRef:m,$size:f,flattenColumns:b,doFieldValidate:y,dataChange:v}=t().useContext(si),x=t().useRef(null),E=t().useRef(null),C=t().useRef(null),S=t().useRef(null),w=t().useRef(null),I=t().useRef(!1),N=t().useRef([]),T=t().useRef({}),O=vo(),{store:A,fieldAuth:P}=h.current,F=(null===(l=i.editRender)||void 0===l?void 0:l.call(i,o,i))||{},[H,k]=t().useState(!1),[L,_]=t().useState(!1),[$,D]=t().useState(!1),[V,M]=t().useState(F.items||[]),[j,z]=t().useState(),U=(F.editable||(0,Q.isEqual)(d,[s,c]))&&!F.disabled&&!(null!==(n=P[c])&&void 0!==n&&n.disabled),B=`${s}|${c}`,W=2===d.length?`${d[0]}|${d[1]}`:"",G=![...A.state.required,...A.state.validate].some((e=>{let{x:t,y:l}=e;return t===s&&l===c})),Y=(null===(a=A.state.required.find((e=>{let{x:t,y:l}=e;return t===s&&l===c})))||void 0===a?void 0:a.text)||"",X=(null===(r=A.state.validate.find((e=>{let{x:t,y:l}=e;return t===s&&l===c})))||void 0===r?void 0:r.text)||"",Z=A.state.edited.some((e=>{let{x:t,y:l}=e;return t===s&&l===c})),J=U||!G||H||$||L,ee=()=>{v()};t().useEffect((()=>{J&&W===B&&re()}),[d]);const te=(e,t)=>{k(e),null==t||t()},ne=e=>{N.current=e},re=()=>{var e,t,l,n;const{type:a}=F;switch(a){case"text":null===(e=E.current)||void 0===e||e.focus();break;case"number":null===(t=C.current)||void 0===t||t.select();break;case"search-helper":null===(l=S.current)||void 0===l||l.focus();break;case"tree-helper":null===(n=w.current)||void 0===n||n.focus()}},ie=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0}))},oe=(e,t,l)=>{const{cornerSign:n=!0}=F.extra||{};A.addToUpdated(e),n&&A.addToEdited({x:t,y:l})},se=e=>""!==e?Number(e):"",ce={text:(e,l,n)=>{const{dataIndex:a}=l,{type:r,extra:i={},rules:o=[],onInput:d,onChange:u,onEnter:h,onBlur:m}=F,g=Yi(e,a),b=Object.assign({},{minRows:1,maxRows:4},i.autoSize),v=n?{rows:b.minRows,autoSize:b}:null,x=i.password?R.Input.Password:n?R.Input.TextArea:R.Input;return t().createElement(x,Rs({ref:E,size:f,value:g,maxLength:i.maxLength,showCount:i.showCount},v,{placeholder:i.placeholder||p("qm.table.editable.inputPlaceholder"),allowClear:i.allowClear,readOnly:i.readOnly,disabled:i.disabled,suffix:i.suffix,onChange:t=>{const l=t.target.value??"";Xi(e,a,l),y(o,l,s,c),O(),null==d||d({[B]:l}),I.current=!0},onFocus:()=>_(!0),onBlur:t=>{_(!1);const l=t.target.value??"";I.current&&(I.current=!1,oe(e,s,c),null==u||u({[B]:l},e),null==m||m({[B]:l},e),ee())},onKeyUp:t=>{if(13===t.keyCode){const l=t.target.value??"";null==h||h({[B]:l},e)}}}))},textarea:(e,t)=>ce.text(e,t,!0),number:(e,l)=>{const{dataIndex:n,precision:a,formatType:r}=l,{type:i,extra:o={},rules:d=[],onInput:u,onChange:h,onEnter:m,onBlur:g}=F,b=Yi(e,n);let v,x;return"finance"===r&&(v=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},x=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===r&&(v=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new($l())(e).times(100).toNumber()}`,x=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new($l())(e).times(.01).toString()),t().createElement(Ts,{ref:C,size:f,value:b,min:o.min,max:o.max,precision:a,stringMode:o.stringMode,prefix:o.prefix,suffix:o.suffix??("percent"===r?"%":void 0),placeholder:o.placeholder||p("qm.table.editable.inputPlaceholder"),maxLength:o.maxLength,allowClear:o.allowClear,readOnly:o.readOnly,disabled:o.disabled,formatter:v,parser:x,onChange:t=>{Xi(e,n,t),y(d,t,s,c),O(),null==u||u({[B]:t}),I.current=!0},onFocus:()=>_(!0),onBlur:(t,l)=>{if(_(!1),!I.current)return;I.current=!1;let a=o.stringMode?t:se(t);"percent"===r&&"."===l.charAt(l.length-1)&&(a=Number(t)/100),Xi(e,n,a),oe(e,s,c),null==h||h({[B]:a},e),null==g||g({[B]:a},e),ee()},onEnter:(t,l)=>{let n=o.stringMode?t:se(t);"percent"===r&&"."===l.charAt(l.length-1)&&(n=Number(t)/100),null==m||m({[B]:n},e)}})},select:(e,l,n)=>{const{dataIndex:a,dictItems:r=[]}=l,{type:i,extra:o={},rules:d=[],items:u,onChange:m,onEnter:g}=F,{elementStore:b}=h.current,v=u||r,x=Yi(e,a);let E=x;return t().createElement(R.Select,{mode:n?"multiple":void 0,size:f,dropdownClassName:"table-editable__popper",value:x||void 0,placeholder:o.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,listHeight:o.listHeight,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},showSearch:o.filterable??!0,filterOption:(e,t)=>{var l;const n=(null==t||null===(l=t.children)||void 0===l?void 0:l.toString())||"";return`${n}|${ha.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{Xi(e,a,t),y(d,t,s,c),oe(e,s,c),O(),null==m||m({[B]:t},e),ee()},onSelect:e=>{E=e},onInputKeyDown:t=>{13===t.keyCode&&ae((()=>null==g?void 0:g({[B]:E},e)))}},v.map((e=>t().createElement(R.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ce.select(e,t,!0),date:(e,l,n)=>{const{dataIndex:a}=l,{type:r,extra:i={},rules:o=[],onChange:d}=F,u=n?mi:hi,h=Yi(e,a);return t().createElement(q,{showTime:n,size:f,dropdownClassName:"table-editable__popper",value:Ji(h,u)??void 0,format:u,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:l}=i;return t&&l?e.isBefore(t,"day")||e.isAfter(l,"day"):t?e.isBefore(t,"day"):!!l&&e.isAfter(l,"day")})(e),placeholder:p(n?"qm.table.editable.datetimePlaceholder":"qm.table.editable.datePlaceholder"),allowClear:i.allowClear,disabled:i.disabled,style:{width:"100%"},onChange:t=>{const l=eo(t,u);Xi(e,a,l),y(o,l,s,c),oe(e,s,c),O(),null==d||d({[B]:l},e),ee()}})},datetime:(e,t)=>ce.date(e,t,!0),time:(e,l)=>{const{dataIndex:n}=l,{type:a,extra:r={},rules:i=[],onChange:o}=F,d=r.format||"HH:mm:ss",u=Yi(e,n);return t().createElement(K,{size:f,dropdownClassName:"table-editable__popper",value:Ji(u,d)??void 0,format:d,placeholder:p("qm.table.editable.datetimePlaceholder"),allowClear:r.allowClear,disabled:r.disabled,style:{width:"100%"},onChange:t=>{const l=eo(t,d);Xi(e,n,l),y(i,l,s,c),oe(e,s,c),O(),null==o||o({[B]:l},e),ee()}})},checkbox:(e,l)=>{const{dataIndex:n}=l,{type:a,extra:r={},onChange:i}=F,{trueValue:o=ui,falseValue:d=pi,disabled:u}=r,p=Yi(e,n);return t().createElement(R.Checkbox,{checked:p===o,disabled:u,onChange:t=>{const l=t.target.checked?o:d;Xi(e,n,l),oe(e,s,c),O(),null==i||i({[B]:l},e),ee()}})},switch:(e,l)=>{const{dataIndex:n}=l,{type:a,extra:r={},onChange:i}=F,{trueValue:o=ui,falseValue:d=pi,disabled:u}=r,p=Yi(e,n);return t().createElement(R.Switch,{checked:p===o,disabled:u,onChange:t=>{const l=t?o:d;Xi(e,n,l),oe(e,s,c),O(),null==i||i({[B]:l},e),ee()}})},"search-helper":(e,l)=>{const{dataIndex:n,precision:a}=l,{type:r,extra:i={},rules:o=[],helper:d={},onInput:u,onChange:h,onEnter:v}=F,E=Yi(e,n),C=d.fieldAliasMap;C||g("Table","helper 需要配置 `fieldAliasMap` 选项");const w="function"==typeof C?C():C||{};Object.keys(w).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值");const N=e=>{const{filterAliasMap:t}=d,l=""!==e?e:void 0,a="function"==typeof t?t():t??[],r={[n]:l};return a.forEach((e=>r[e]=l)),r},R=e=>{const{autoQueryAssign:t=!0}=d;t&&(T.current=N(e)),k(!0)},O=(t,n)=>{const{beforeOpen:a}=d,r=(a??le)({[B]:E},e,l);null!=r&&r.then?r.then((()=>{R(t),null==n||n()})).catch((()=>{})):!1!==r&&(R(t),null==n||n())},A=e=>{const t={};for(const l in w){const a=w[l];l!==n&&(t[l]=Qi(e,a))}const l=w[n]?Qi(e,w[n]):"";L(l,t);const{closed:a}=d;te(!1,(()=>ie(x.current))),re(),null==a||a(e)},P=()=>{const{onlySelect:e=!0}=d;I.current&&L(e?"":E),te(!1,(()=>ie(x.current)))},L=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",l=arguments.length>1?arguments[1]:void 0;if((0,Q.isPlainObject)(l)&&Object.keys(l).length){for(const t in l){const n=l[t],a=b.find((e=>e.dataIndex===t));if(a){var r;Xi(e,t,n,a.precision);const l=null===(r=a.editRender)||void 0===r?void 0:r.call(a,e,a);l&&Array.isArray(l.rules)&&y(l.rules,n,s,t)}else Xi(e,t,n)}m.current.forceUpdate()}Xi(e,n,t,a),y(o,t,s,c),oe(e,s,c),null==h||h({[B]:t},e),ee(),T.current={},I.current=!1,z(void 0)},q={visible:H,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Bl[f]+20}px`},onClose:()=>{P()}},_={...d,size:f,initialValue:Object.assign({},T.current,d.initialValue),onClose:e=>{e?A(e):P()}};return t().createElement(t().Fragment,null,t().createElement(Os,{ref:S,value:j??E,placeholder:i.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:i.allowClear,readOnly:i.readOnly,disabled:i.disabled,onBlur:e=>{var t;const{value:l}=e.target,{onlySelect:a=!0,table:r}=d;if(I.current&&!H)return l&&a&&null!=r&&null!==(t=r.fetch)&&void 0!==t&&t.api?(e=>{const{table:t,initialValue:l={}}=d,{beforeFetch:n=le}=t.fetch;return D(!0),new Promise((async(a,r)=>{const i=(0,Q.merge)({},t.fetch.params,{...l,...N(e)},{currentPage:1,pageSize:500});try{if(n(i)){const e=await t.fetch.api(i);200===e.code?a(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[]):r()}else r()}catch(e){r()}D(!1)}))})(l).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>Qi(t,w[n]).toString().includes(e)));if(1===t.length)return A(t[0]);O(e)}(e,l))).catch((()=>L(""))):void L(l)},onChange:e=>{const{value:t}=e.target;null==u||u({[B]:t}),I.current=!0,z(t)},onKeyUp:t=>{if(13===t.keyCode){const l=t.target.value??"";null==v||v({[B]:l},e)}},onDoubleClick:e=>{const{value:t}=e.target;O(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?O(e):L(""))}}),t().createElement(Wt,q,t().createElement(Gs,_)))},"search-helper-multiple":(e,l)=>{const{dataIndex:n}=l,{type:a,items:r=[],extra:i={},rules:o=[],helper:d={},onInput:u,onChange:h,onEnter:m}=F,b=Yi(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof v?v():v||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`");const C=t=>{const{beforeOpen:n}=d,a=(n??le)({[B]:b},e,l);null!=a&&a.then?a.then((()=>{k(!0),null==t||t()})).catch((()=>{})):!1!==a&&(k(!0),null==t||t())},S=()=>{te(!1,(()=>ie(x.current)))},w=t=>{Xi(e,n,t),y(o,t,s,c),oe(e,s,c),null==h||h({[B]:t},e,N.current),ee()},I={visible:H,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Bl[f]+20}px`},onClose:()=>{S()}},T={...d,size:f,multiple:!0,initialValue:(0,Q.merge)({},d.initialValue),defaultSelectedKeys:b,onClose:(e,t)=>{e?((e,t)=>{const{textKey:l,valueKey:n}=E;ne((0,Q.uniqBy)([...N.current.filter((e=>t.includes(e[n]))),...e],n));const a=N.current.map((e=>({text:e[l],value:e[n]}))),i=(0,Q.uniqBy)([...a,...r],"value").filter((e=>t.includes(e.value)));M(i),w(i.map((e=>e.value)));const{closed:o}=d;te(!1,(()=>ie(x.current))),null==o||o(N.current)})(e,t):S()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(R.Select,{mode:"multiple",open:!1,value:b,placeholder:i.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:i.allowClear,maxTagCount:i.collapseTags?"responsive":void 0,maxTagTextLength:i.maxTagTextLength,disabled:i.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&(null==m||m({[B]:b},e))},onDoubleClick:()=>{C()},onChange:e=>{const{valueKey:t}=E;ne(N.current.filter((l=>e.includes(l[t])))),w(e),O()}},V.map((e=>t().createElement(R.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(R.Button,{className:"ant-input-search-button",disabled:i.disabled,icon:t().createElement(Se.SearchOutlined,null),onClick:()=>{C()}})))),t().createElement(Wt,I,t().createElement(Gs,T)))},"tree-helper":(e,l)=>{const{dataIndex:n,precision:a}=l,{type:r,extra:i={},rules:o=[],helper:d={},onChange:u,onEnter:h}=F,v=Yi(e,n),E=d.fieldAliasMap;E||g("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof E?E():E||{};Object.keys(C).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值");const S=t=>{const{beforeOpen:n}=d,a=(n??le)({[B]:v},e,l);null!=a&&a.then?a.then((()=>{k(!0),null==t||t()})).catch((()=>{})):!1!==a&&(k(!0),null==t||t())},I=()=>{te(!1,(()=>ie(x.current)))},N=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",l=arguments.length>1?arguments[1]:void 0;if((0,Q.isPlainObject)(l)&&Object.keys(l).length){for(const t in l){const n=l[t],a=b.find((e=>e.dataIndex===t));if(a){var r;Xi(e,t,n,a.precision);const l=null===(r=a.editRender)||void 0===r?void 0:r.call(a,e,a);l&&Array.isArray(l.rules)&&y(l.rules,n,s,t)}else Xi(e,t,n)}m.current.forceUpdate()}Xi(e,n,t,a),y(o,t,s,c),oe(e,s,c),null==u||u({[B]:t},e),ee()},T={visible:H,title:p("qm.searchHelper.text"),width:d.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Bl[f]+20}px`},onClose:()=>{I()}},R={...d,defaultSelectedKeys:[v],size:f,onClose:e=>{e?(e=>{const t={};for(const l in C){const a=C[l];l!==n&&(t[l]=Qi(e,a))}const l=C[n]?Qi(e,C[n]):"";N(l,t);const{closed:a}=d;te(!1,(()=>ie(x.current))),re(),null==a||a(e)})(e):I()}};return t().createElement(t().Fragment,null,t().createElement(Os,{ref:w,value:v,allowClear:i.allowClear??!0,readOnly:i.readOnly,disabled:i.disabled,placeholder:i.placeholder||p("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target;t||O()},onKeyUp:t=>{if(13===t.keyCode){const l=t.target.value??"";null==h||h({[B]:l},e)}},onDoubleClick:()=>{S()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?S():N(""))}}),t().createElement(Wt,T,t().createElement(lc,R)))},"tree-helper-multiple":(e,l)=>{const{dataIndex:n}=l,{type:a,extra:r={},items:i=[],rules:o=[],helper:d={},onInput:u,onChange:h,onEnter:m}=F,b=Yi(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof v?v():v||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`");const C=t=>{const{beforeOpen:n}=d,a=(n??le)({[B]:b},e,l);null!=a&&a.then?a.then((()=>{k(!0),null==t||t()})).catch((()=>{})):!1!==a&&(k(!0),null==t||t())},S=()=>{te(!1,(()=>ie(x.current)))},w=t=>{Xi(e,n,t),y(o,t,s,c),oe(e,s,c),null==h||h({[B]:t},e,N.current),ee()},I={visible:H,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Bl[f]+20}px`},onClose:()=>{S()}},T={...d,size:f,multiple:!0,initialValue:(0,Q.merge)({},d.initialValue),defaultSelectedKeys:b,onClose:e=>{e?(e=>{const{textKey:t,valueKey:l}=E;ne(e);const n=N.current.map((e=>({text:e[t],value:e[l]})));M(n),w(n.map((e=>e.value)));const{closed:a}=d;te(!1,(()=>ie(x.current))),null==a||a(N.current)})(e):S()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(R.Select,{mode:"multiple",open:!1,value:b,placeholder:r.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:r.allowClear,maxTagCount:r.collapseTags?"responsive":void 0,maxTagTextLength:r.maxTagTextLength,disabled:r.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&(null==m||m({[B]:b},e))},onDoubleClick:()=>{C()},onChange:e=>{const{valueKey:t}=E;ne(N.current.filter((l=>e.includes(l[t])))),w(e),O()}},V.map((e=>t().createElement(R.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(R.Button,{className:"ant-input-search-button",disabled:r.disabled,icon:t().createElement(Se.SearchOutlined,null),onClick:()=>{C()}})))),t().createElement(Wt,I,t().createElement(lc,T)))}};return t().createElement(t().Fragment,null,J?(()=>{const{type:e}=F,l=ce[e];if(!l)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const n=["cell--edit",{"is-error":!G}];return t().createElement("div",{ref:x,className:Ee()(n)},l(o,i),!G&&t().createElement("div",{className:"cell-error"},Y||X))})():(()=>{const{extra:e={}}=F;return e.disabledColor?t().createElement("span",{style:{color:e.disabledColor}},u):t().createElement(t().Fragment,null,u)})(),Z&&t().createElement("i",{className:"cell--sign"}))},Ps=require("copy-to-clipboard");var Fs=n.n(Ps);const Hs=e=>{const{text:l,options:n,showMessage:a=!0,onCopy:r}=e;return Pt(e.children,{onClick:i=>{const o=t().Children.only(e.children),s=Fs()(l,n);null==r||r(l,s),s&&a&&R.message.success(p("qm.clipboard.success")),o&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(i)}})};Hs.displayName="QmCopyToClipboard";const ks=Hs;function Ls(){return Ls=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Ls.apply(this,arguments)}const qs=t().forwardRef(((l,n)=>{const{tableData:a,flattenColumns:r}=l,{getRowKey:i,tableProps:o,tableRef:c,editableColumns:d,leftFixedColumns:u,rightFixedColumns:h,firstDataIndex:m,sorter:f,layout:b,showFooter:y,scrollX:v,scrollY:x,selectionKeys:E,rowExpandedKeys:C,highlightKey:S,isPingLeft:w,isPingRight:I,isTableEmpty:N,isTreeTable:T,isGroupSubtotal:R,isWebPagination:O,isDragMergeCell:A,setElementStore:P,createTableFullData:F,setSelectionKeys:H,setHighlightKey:k,getStickyLeft:L,getStickyRight:q,scrollXToColumn:_,scrollYToRecord:$,rowInViewport:D,dataChange:K,setPingLeft:V,setPingRight:M,setFullScreen:j,setOverlay:z,findParentRowKeys:U,getAllChildRowKeys:B,triggerScrollYEvent:W,scrollBottomDebouncer:G}=t().useContext(si),{height:Y,minHeight:X,maxHeight:ee,rowSelection:ne,rowHighlight:ae,treeConfig:ie,expandable:oe,stripe:se,summation:ce,rowStyle:de,cellStyle:ue,spanMethod:pe,ellipsis:he,showHeader:me,rowDraggable:fe,onRowClick:ge,onRowDblclick:be,onRowContextmenu:ye,onRowEnter:ve}=o,xe=t().useRef(null),we=t().useRef(null),Ie=t().useRef({prevST:0,prevSL:0}),{dragStart:Ne,renderDragPanel:Te,closeDragPanel:Re}=Ss(),Oe={dateFormat:e=>{const t=e?s()(e).format(hi):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(mi):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(mi.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(Number(e))?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>Zi(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},Ae=t().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:l,tableFullHeight:n,tableAutoHeight:a}=b,r={};return N&&Object.assign(r,{minHeight:"100px"}),X&&Object.assign(r,{minHeight:Bi(X)-e-l+"px"}),ee&&Object.assign(r,{maxHeight:Bi(ee)-e-l+"px"}),Y||n||a?{...r,maxHeight:"",minHeight:"",height:`${t}px`}:r}),[Y,ee,X,N,b]),Pe=t().useMemo((()=>{const{tableBodyWidth:e,gutterWidth:t}=b;return e&&x?e-t:e}),[b,x]),Fe=t().useMemo((()=>{const{scrollYStore:e}=c.current,{viewportHeight:t,gutterWidth:l}=b;return Math.floor((v?t-l:t)/e.rowHeight)}),[b,v]),[He,ke]=t().useState([]),Le=vo(),qe=function(t,l){const[n,a]=e.useState(!1);return e.useEffect((()=>{let e;const n=t.current,r=t=>{e=t},i=t=>{((e,t)=>{const r=e.target,i=null==t?void 0:t.target,o=!r||!i,s=(null==n?void 0:n.contains(r))||(null==n?void 0:n.contains(i)),c=n===r,d=null==l?void 0:l.map((e=>document.querySelector(e))),u=(null==d?void 0:d.some((e=>null==e?void 0:e.contains(r))))||(null==d?void 0:d.includes(i));a(!(o||s||c||u))})(t,e)};return n&&(Ve(document,"mousedown",r),Ve(document,"mouseup",i)),()=>{n&&(Me(document,"mousedown",r),Me(document,"mouseup",i))}}),[t]),n}(xe,[".table-editable__popper"]);t().useImperativeHandle(n,(()=>({renderCellTitle:Ze,setClickedValues:je,forceUpdate:Le}))),$e((()=>{qe&&(je([]),A&&Re())}),[qe]),$e((()=>{He.length&&vi.focus(c.current.uid)}),[He]),t().useEffect((()=>{De(),Ke()}),[]);const _e=t().useCallback((e=>{var t,l;const{keyCode:n}=e;if(c.current.uid===(null===(t=vi.getFocusInstance())||void 0===t?void 0:t.id)&&(27===n&&(je([]),k(""),j(!1)),He.length&&(((e,t)=>{if(Z||!e||!t)return!1;let l=e;for(;l;){if(l===t)return!0;l=l.parentNode}return!1})(document.activeElement,xe.current)||"INPUT"!==(null===(l=document.activeElement)||void 0===l?void 0:l.tagName)))){if(13===n&&("radio"===(null==ne?void 0:ne.type)||ae)){const t=E[0]??S??null,l=a.find((e=>i(e,e.index)===t))??null;l&&(null==ve||ve(l,e))}if(38===n||40===n){var r,o;ze(e);const{allTableData:t}=c.current,l=O?ji(a):t,s=l.length;let d=l.findIndex((e=>i(e,e.index)===He[0]));const u=38===n?(--d+s)%s:++d%s,p=l[u],h=i(p,p.index);"radio"!==(null==ne?void 0:ne.type)||null!==(r=ne.disabled)&&void 0!==r&&r.call(ne,p)||H([h]),!ae||null!==(o=ae.disabled)&&void 0!==o&&o.call(ae,p)||k(h),D(u)||(38===n&&$(h,u),40===n&&$(h,Fe>u+1?0:u+1-Fe)),je([h,He[1]])}if(9===n){if(ze(e),!d.length)return je([]);const t=d.length;let l=d.findIndex((e=>e.dataIndex===He[1]));const n=++l%t,a=d[n].dataIndex;je([He[0],a]),_(a)}}}),[He,a,E,d,Fe]);t().useEffect((()=>{const e=Et()(document,"keydown",_e);return()=>e.remove()}),[_e]);const De=()=>{P("$tableBody",xe.current),P("$tableYspace",we.current)},Ke=()=>{z("overlay"===((e,t)=>{if(Z||!e||!t)return null;"float"===(t=re(t))&&(t="cssFloat");try{var l;const n=e.style[t];if(n)return n;const a=null===(l=document.defaultView)||void 0===l?void 0:l.getComputedStyle(e,"");return a?a[t]:""}catch(l){return e.style[t]}})(xe.current.parentNode,"overflowY"))},je=e=>{(0,Q.isEqual)(e,He)||ke(e)},Ue=(e,t,l)=>l?[...t,e]:t.filter((t=>t!==e)),Be=(e,t,l)=>{var n;const{deriveRowKeys:a}=c.current,r=Mi(a,e);let i=[];const o=B((null==r?void 0:r.children)||[]),s=(null===(n=io(a,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[];return i=l?[...new Set([...t,e,...o])]:t.filter((t=>![e,...o].includes(t))),s.forEach((e=>{var t;const l=Mi(a,e),n=Gi(i,(null==l||null===(t=l.children)||void 0===t?void 0:t.map((e=>e.rowKey)))||[]);i=n?[...i,e]:i.filter((t=>t!==e))})),i},We=e=>Array.isArray(e.children)&&e.children.length>0,Ge=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];return e.forEach((e=>{const a=e.index,o=i(e,e.index);if(n.push(Ye(e,a,o,l)),null!=oe&&oe.expandedRowRender){const{expandedRowClassName:l,rowExpandable:i=le}=oe;C.includes(o)&&i(e)&&n.push(t().createElement("tr",{key:`expand_${o}`,className:"body--row-expanded"},t().createElement("td",{colSpan:r.length,className:"body--column",style:{paddingLeft:ne?"100px":"50px"}},t().createElement("div",{className:Ee()("cell",l)},oe.expandedRowRender(e,a)))))}if((null==ie||!ie.virtual)&&We(e)){const t="function"!=typeof(null==oe?void 0:oe.rowExpandable)||oe.rowExpandable(e);C.includes(o)&&t&&n.push(...Ge(e.children,l+1))}})),n},Ye=function(e,l,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const i=["body--row",{"body--row-striped":se&&l%2!=0,"body--row-selected":E.includes(n),"body--row-current":S===n,...R?nt(e._group):null}];return t().createElement("tr",{key:n,className:Ee()(i)},r.map(((t,r)=>Xe(t,r,e,l,n,a))))},Xe=(e,l,n,a,r,o)=>{const{isIE:s,isOverlay:d}=c.current,{dataIndex:p,fixed:m,align:g,className:y=""}=e,{rowSpan:v,colSpan:C}=et(n,e,a,l),{gutterWidth:S}=b;if(!v||!C)return null;const w=e.ellipsis??he,I=!s&&"left"===m,N=!s&&"right"===m,O=["body--column",{"col--ellipsis":w,"col--center":"center"===g,"col--right":"right"===g,"column--sort":!!f[p],"cell-fix-left":I,"cell-fix-right":N,"cell-fix-left-last":I&&u[u.length-1].dataIndex===p,"cell-fix-right-first":N&&h[0].dataIndex===p,[y]:!!y}],A=s?null:{left:I?`${L(p)}px`:"",right:N?`${q(p)+(d&&x?S:0)}px`:""},P=de?"function"==typeof de?de(n,a):de:null,F=ue?"function"==typeof ue?ue(n,e,a,l):ue:null,_=R?lt(n._group):null,$=Ze(e,n,a,l);return t().createElement("td",{key:p,title:w?$:void 0,rowSpan:v>1?v:void 0,colSpan:C>1?C:void 0,"data-index":l,className:Ee()(O),style:{...A,..._,...P,...F},onClick:t=>((e,t,l)=>{var n,a;const{dataIndex:r}=l;if([po.expandableColumn,po.operationColumn].includes(r))return;const o=i(t,t.index);je([o,r]);const s=null===(n=l.editRender)||void 0===n?void 0:n.call(l,t,l),c=s&&!s.disabled,{type:d,selectByClickRow:u=!0,disabled:p=te}=ne||{};!d||p(t)||c||(u||r===po.selectionColumn)&&((e,t)=>{const{type:l,checkStrictly:n=!0,onSelect:a}=ne||{};if("radio"===l&&H([e]),"checkbox"===l){const l=!E.includes(e),r=T&&!n?Be(e,E,l):Ue(e,E,l);H(r),null==a||a(l,t,r)}})(o,t),[po.selectionColumn].includes(r)||(!ae||null!==(a=ae.disabled)&&void 0!==a&&a.call(ae,t)||c||k(o),null==ge||ge(t,l,e))})(t,n,e),onDoubleClick:t=>((e,t,l)=>{const{dataIndex:n}=l;[po.expandableColumn,po.selectionColumn,po.operationColumn].includes(n)||null==be||be(t,l,e)})(t,n,e),onContextMenu:t=>((e,t,l)=>{const{dataIndex:n}=l;[po.expandableColumn,po.selectionColumn,po.operationColumn].includes(n)||null==ye||ye(t,l,e)})(t,n,e)},t().createElement("div",{className:"cell"},Qe(e,n,a,l,$,r,o)),N&&d&&x&&h[h.length-1].dataIndex===p?t().createElement("i",{className:"gutter-overlay",style:{width:S,right:-1*(S+1)}}):null)},Qe=(e,l,n,a,r,i,o)=>{const{dataIndex:s,canCopy:c,editRender:d,render:u}=e,h=Yi(l,s);if(s===po.expandableColumn)return t().createElement(Is,{record:l,rowKey:i});if(s===po.selectionColumn)return t().createElement(ws,{selectionKeys:E,column:e,record:l,rowKey:i});const f=Je(h,e,l);if(d)return t().createElement(As,{column:e,record:l,rowKey:i,columnKey:s,clicked:He,text:f});const g=u?u(h,l,e,n,a):f;return T&&s===m?[tt(null!=ie&&ie.virtual?l._level:o),t().createElement(Is,{key:"expand",record:l,rowKey:i,style:We(l)?{}:{visibility:"hidden"}}),g]:c?t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},g),r&&t().createElement(ks,{text:r},t().createElement(Se.CopyOutlined,{className:"icon",title:p("qm.table.config.copyText"),onClick:e=>e.stopPropagation()}))):g},Ze=(e,t,l,n)=>{const{dataIndex:a,render:r}=e;if([po.expandableColumn,po.selectionColumn,po.operationColumn].includes(a))return"";let i="";const o=Yi(t,a);if("function"==typeof r){const a=r(o,t,e,l,n);i=J(a)?lo(a).join(""):a}else i=Je(o,e,t).toString();return i},Je=(e,t,l)=>{var n;const{dictItems:a,precision:r,formatType:i,editRender:o}=t,s=a||(null==o||null===(n=o(l,t))||void 0===n?void 0:n.items)||[],c=s.find((t=>t.value==e));let d=(null==c?void 0:c.text)??e??"";if(Array.isArray(e)&&(d=e.map((e=>{const t=s.find((t=>t.value==e));return(null==t?void 0:t.text)??e})).join(",")),r>=0&&""!==d&&(d=Number(d).toFixed(r)),i){const e=Oe[`${re(i)}Format`];e?d=e(d):g("Table","字段的格式化类型 `formatType` 配置不正确")}return d},et=(e,t,l,n)=>{let r=1,i=1;if("function"==typeof pe){const o=pe({row:e,column:t,rowIndex:l,columnIndex:n,tableData:a});if(Array.isArray(o)?(r=o[0],i=o[1]):(0,Q.isPlainObject)(o)&&(r=o.rowSpan,i=o.colSpan),e===a[0]&&0===r){r=1;for(let e=1;e<a.length;e++){const{rowSpan:l}=et(a[e],t,a[e].index,n);if(l>0)break;r++}}}const{mergeCells:o}=c.current;if(o.length>0){const e=o.find((e=>e.row===l&&e.col===n));e&&(r=e.rowSpan,i=e.colSpan)}return{rowSpan:r,colSpan:i}},tt=e=>e?t().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*po.treeTable.textIndent+"px"}}):null,lt=e=>{const{backgroundColor:t,color:l}=ce.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:l}},nt=e=>{const t=ce.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},at=Ce("table"),rt=A?{onMouseDown:Ne}:null;return t().createElement("div",{className:`${at}--body-wrapper`,style:{...Ae},onScroll:e=>{const{elementStore:t,scrollYLoad:l}=c.current,{prevST:n,prevSL:a}=Ie.current,r=x?b.gutterWidth:0,{scrollTop:i,scrollLeft:o}=e.target;if(o!==a){me&&(t.$header.scrollLeft=o),y&&(t.$footer.scrollLeft=o);const e=o>0,l=Math.ceil(o)+b.tableWidth<b.tableBodyWidth+r;w!==e&&V(e),I!==l&&M(l)}if(l&&i!==n&&W(i),x&&i!==n){const l=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(i)+b.viewportHeight-r>=l&&G(e)}Ie.current.prevST=i,Ie.current.prevSL=o}},t().createElement("div",{ref:we,className:"body--y-space"}),t().createElement("div",{className:"body--x-space",style:{width:Pe?`${Pe}px`:""}}),t().createElement("table",Ls({ref:xe,className:`${at}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},rt,{style:{width:Pe?`${Pe}px`:""}}),t().createElement("colgroup",null,r.map((e=>{const{dataIndex:l,width:n,renderWidth:a}=e;return t().createElement("col",{key:l,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})}))),fe?t().createElement(wl.ReactSortable,{itemKey:e=>i(e,e.index),tag:"tbody",animation:200,list:a,setList:e=>{const t=e.map((e=>i(e,e.index))),l=a.map((e=>i(e,e.index)));if((0,Q.isEqual)(t,l))return;const n=[];c.current.tableFullData.forEach((t=>{a.includes(t)?n.push(e.shift()):n.push(t)})),F(n),K()}},a.map((e=>Ye(e,e.index,i(e,e.index))))):t().createElement("tbody",null,Ge(a))),A&&Te())}));qs.displayName="TableBody";const _s=qs,$s=e=>{const{summationRows:l,flattenColumns:n}=e,{getRowKey:a,tableProps:r,tableRef:i,sorter:o,layout:s,scrollY:c,leftFixedColumns:d,rightFixedColumns:u,setElementStore:h,getStickyLeft:m,getStickyRight:f}=t().useContext(si),{footRender:g}=r,b=t().useRef(null);t().useEffect((()=>{y()}),[]);const y=()=>{h("$footer",b.current)},v=Ce("table"),{tableBodyWidth:x}=s;return t().createElement("div",{ref:b,className:`${v}--footer-wrapper`},g?g(n,i.current.tableFullData):t().createElement("table",{className:`${v}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:x?`${x}px`:""}},(()=>{const{gutterWidth:e}=s;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:l,width:n,renderWidth:a}=e;return t().createElement("col",{key:l,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),c&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("tfoot",null,(()=>{const{isIE:e}=i.current,a=["gutter",{"cell-fix-right":!!u.length}],r=e?null:{right:u.length?0:""};return l.map(((e,l)=>t().createElement("tr",{key:l,className:"footer--row"},n.map(((l,n)=>((e,l,n)=>{const{isIE:a}=i.current,{gutterWidth:r}=s,{dataIndex:h,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!o[h],"cell-fix-left":!a&&"left"===g,"cell-fix-right":!a&&"right"===g,"cell-fix-left-last":!a&&"left"===g&&d[d.length-1].dataIndex===h,"cell-fix-right-first":!a&&"right"===g&&u[0].dataIndex===h}],x=a?null:{left:"left"===g?`${m(h)}px`:"",right:"right"===g?`${f(h)+(c?r:0)}px`:""},E=null!=y&&y.render?y.render(i.current.tableFullData):Yi(l,`${h}_text`),C=0===n&&""===E?p("qm.table.config.summaryText"):E;return t().createElement("td",{key:h,title:C,className:Ee()(v),style:{...x}},t().createElement("div",{className:"cell"},C))})(l,e,n))),c&&t().createElement("td",{className:Ee()(a),style:{...r}}))))})())))};var Ds;!function(e){e.small="small",e.middle="default",e.large="default"}(Ds||(Ds={}));const Ks=e=>{var l,n;const{current:a,pageSize:r,total:o,config:s,onChange:c}=e,{global:d}=t().useContext(i),{tableProps:u,$size:p,setElementStore:h}=t().useContext(si),{infoBarConfig:m}=u,f=t().useRef(null);t().useEffect((()=>{g()}),[]);const g=()=>{h("$pager",f.current)},b=(e,t)=>{c(e,t)},y=(null==s?void 0:s.showSizeChanger)??po.pagination.showSizeChanger,v=(null==s?void 0:s.showQuickJumper)??po.pagination.showQuickJumper,x=(null==s?void 0:s.pageSizeOptions)||(null==d||null===(l=d.table)||void 0===l||null===(n=l.pagination)||void 0===n?void 0:n.pageSizeOptions)||po.pagination.pageSizeOptions,E={[`${Ce("table")}-pager`]:!0};return t().createElement("div",{ref:f,className:Ee()(E)},t().createElement("div",{className:"pager-alert"},"bottom"===(null==m?void 0:m.position)&&t().createElement(xo,{total:o})),t().createElement(R.Pagination,{size:Ds[p],showSizeChanger:y,showQuickJumper:v,pageSizeOptions:x,current:a,pageSize:r,total:o,onChange:b,onShowSizeChange:b}))},Vs=()=>{const{layout:e}=t().useContext(si),l=t().useMemo((()=>{const{headerHeight:t,viewportHeight:l}=e;return{top:`${t}px`,height:`${l}px`}}),[e]),n=Ce("table");return t().createElement("div",{className:`${n}--empty`,style:l},t().createElement(dt,null))};function Ms(){return Ms=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Ms.apply(this,arguments)}const js=t().forwardRef(((e,l)=>{const{rowKey:n,columns:a,loading:r,stripe:o,resizable:s,customClass:c,paginationConfig:d,tablePrint:u,exportExcel:p,infoBarConfig:h,topSpaceAlign:m,showTableInfo:f,showFullScreen:b,showRefresh:y,showToolBox:v,showColumnDefine:x,showHeader:E}=e,{size:C}=t().useContext(i),S=t().useMemo((()=>e.size??C??""),[e.size,C]),w=t().useRef(null),I=t().useRef(null),N=t().useRef(null),T=t().useRef(null),R=t().useRef(null),O=vo(),A=t().useCallback(((e,t)=>{const l="function"==typeof n?n(e,t):e[n];return void 0===l?(g("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):l}),[n]),{tableRef:P,tableFullData:F,setElementStore:H,setOriginColumns:k,setTableFullData:L,setTableOriginData:q,setAllTableData:_,setDeriveRowKeys:$,setFieldAuth:D,setMergeCells:K,setScrollYStore:V,setScrollYLoad:M,setResizeState:j,setHandleState:z,setSummaries:U,setSelectionRows:B,setShouldToTop:W,setRecordsMap:G,setOverlay:Y,clearElementStore:X,clearRecordsMap:J}=((e,l)=>{let{getRowKey:n,$size:a}=l;const r=t().useRef({uid:to(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],fieldAuth:{},mergeCells:[],scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:po.rowHeightMaps[a]},store:new uo,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,isOverlay:!1,isIE:!Z&&/MSIE|Trident/.test(navigator.userAgent)}),i=function(e,t,l){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.map((e=>{const r=n(e,e.index),o=l?`${l}#${r}`:`${r}`,s={level:a,rowKey:r,rowKeyPath:o};return e.children&&(s.children=i(e.children,r,o,a+1)),t?Object.assign({},s,{parentRowKey:t}):s}))},o=e=>{const t=[];return e.forEach((e=>{var l;null!==(l=e.children)&&void 0!==l&&l.length?t.push(...o(e.children)):t.push(e.rowKey)})),t};return{tableRef:r,...r.current,setElementStore:(e,t)=>{r.current.elementStore[e]=t},setOriginColumns:e=>{r.current.originColumns=e},setTableFullData:e=>{r.current.tableFullData=e},setTableOriginData:e=>{r.current.tableOriginData=e},setAllTableData:e=>{const t=ji(e);r.current.allTableData=t,r.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{r.current.deriveRowKeys=i(e,"",""),r.current.flattenRowKeys=o(r.current.deriveRowKeys),r.current.treeTable=r.current.deriveRowKeys.some((e=>Array.isArray(e.children)&&e.children.length))},setFieldAuth:(e,t)=>{r.current.fieldAuth[e]=t},setMergeCells:e=>{const t=[];e.forEach((e=>{t.push(e);for(let l=1;l<e.colSpan;l++)for(let n=0;n<e.rowSpan;n++)t.push({row:e.row+n,col:e.col+l,rowSpan:0,colSpan:0});for(let l=1;l<e.rowSpan;l++)for(let n=0;n<e.colSpan;n++)t.push({row:e.row+l,col:e.col+n,rowSpan:0,colSpan:0})})),r.current.mergeCells=t},setScrollYStore:e=>{r.current.scrollYStore=e},setResizeState:e=>{r.current.resizeState=e},setHandleState:e=>{r.current.handleState=e},setSummaries:e=>{r.current.summaries=e},setScrollYLoad:e=>{r.current.scrollYLoad=e},setShouldToTop:e=>{r.current.shouldToTop=e},setSelectionRows:e=>{r.current.selectionRows=e},setRecordsMap:(e,t)=>{r.current.recordsMap.set(e,t)},setOverlay:e=>{r.current.isOverlay=e},clearElementStore:()=>{for(const e in r.current.elementStore)r.current.elementStore[e]=null},clearRecordsMap:()=>{r.current.recordsMap.clear()}}})(0,{getRowKey:A,$size:S}),{tableData:ee,setTableData:te,filters:le,setFilters:ne,sorter:ae,setSorter:re,superFilters:ie,setSuperFilters:oe,pagination:ce,setPagination:de,selectionKeys:ue,setSelectionKeys:pe,rowExpandedKeys:he,setRowExpandedKeys:me,highlightKey:fe,setHighlightKey:ge,layout:be,setLayout:ye,permission:ve,setPermission:xe,spinning:Se,setSpinning:we,scrollX:Ie,setScrollX:Ne,scrollY:Te,setScrollY:Re,isPingLeft:Oe,setPingLeft:Ae,isPingRight:Pe,setPingRight:Fe,isFullScreen:He,setFullScreen:ke}=(e=>{var l,n;const{paginationConfig:a,rowSelection:r,expandable:o,rowHighlight:s}=e,{global:c}=t().useContext(i),d={current:po.pagination.current,pageSize:(null==a?void 0:a.pageSize)??(null==c||null===(l=c.table)||void 0===l||null===(n=l.pagination)||void 0===n?void 0:n.pageSize)??po.pagination.pageSize,total:0},u=(null==r?void 0:r.selectedRowKeys)??(null==r?void 0:r.defaultSelectedRowKeys)??[],p=(null==o?void 0:o.expandedRowKeys)??(null==o?void 0:o.defaultExpandedRowKeys)??[],[h,m]=t().useState([]),[f,g]=t().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),{}),[b,y]=t().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),{}),[v,x]=t().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),[]),[E,C]=t().useState(d),[S,w]=t().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),u),[I,N]=t().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),p),[T,R]=t().useState((null==s?void 0:s.currentRowKey)??""),[O,A]=t().useState({gutterWidth:mo(),tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[P,F]=t().useState({export:!0,import:!0,print:!0}),[H,k]=t().useState(!1),[L,q]=t().useState(!1),[_,$]=t().useState(!1),[D,K]=t().useState(!1),[V,M]=t().useState(!1),[j,z]=t().useState(!1);return{tableData:h,setTableData:m,filters:f,setFilters:g,sorter:b,setSorter:y,superFilters:v,setSuperFilters:x,pagination:E,setPagination:C,selectionKeys:S,setSelectionKeys:w,rowExpandedKeys:I,setRowExpandedKeys:N,highlightKey:T,setHighlightKey:R,layout:O,permission:P,setPermission:F,setLayout:A,spinning:H,setSpinning:k,scrollX:L,setScrollX:q,scrollY:_,setScrollY:$,isPingLeft:D,setPingLeft:K,isPingRight:V,setPingRight:M,isFullScreen:j,setFullScreen:z}})(e),{isFetch:Le,isWebPagination:qe,isScrollPagination:_e,showPagination:De,shouldUpdateHeight:Ke,tableColumns:Ve,flattenColumns:Me,editableColumns:je,summationColumns:ze,leftFixedColumns:Ue,rightFixedColumns:Be,firstDataIndex:We,showSummary:Ge,showFooter:Ye,isHeadGroup:Xe,bordered:Qe,isHeadSorter:Ze,isHeadFilter:Je,isServiceSummation:et,isSelectCollection:tt,isTableImport:lt,isTableClipboard:nt,isSuperSearch:at,isFastSearch:rt,isGroupSummary:it,isGroupSubtotal:ot,isDragMergeCell:st,isTreeTable:ct,isTableEmpty:dt,summationRows:ut,fetchParams:ht}=go(e,{getRowKey:A,tableRef:P,tableFullData:F,tableData:ee,sorter:ae,filters:le,superFilters:ie,pagination:ce}),{createElementStore:mt,tableStyles:ft,getSpan:gt,getStickyLeft:bt,getStickyRight:yt,scrollXToColumn:vt,scrollYToRecord:xt,rowInViewport:Et,calcTableHeight:Ct,resetTableScroll:St,doLayout:wt}=yo(e,{getRowKey:A,tableRef:P,$size:S,tableColumns:Ve,flattenColumns:Me,leftFixedColumns:Ue,layout:be,scrollY:Te,tableData:ee,showFooter:Ye,showPagination:De,isWebPagination:qe,isFullScreen:He,setLayout:ye,setScrollX:Ne,setScrollY:Re,setElementStore:H,setScrollYStore:V,setShouldToTop:W}),{initialTable:It,createTableFullData:Nt,getTableData:Tt,handleTableData:Rt,createTableData:Ot,createGroupData:At,createSelectionKeys:Pt,createSelectionRows:Ft,createRowExpandedKeys:Ht,findParentRowKeys:kt,getAllChildRowKeys:Lt,doFieldValidate:qt,getTableLog:_t,dataChange:$t,tableChange:Dt,toLastPage:Kt,toFirstPage:Vt,getPageCount:Mt,pagerChangeHandle:jt,triggerScrollYEvent:zt,scrollBottomDebouncer:Ut,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearRowSelection:Yt,clearRowHighlight:Xt,clearTableLog:Qt,destroy:Zt}=bo(e,{getRowKey:A,tableRef:P,tableElementRef:I,tableBodyRef:N,$size:S,tableColumns:Ve,tableFullData:F,pagination:ce,layout:be,filters:le,sorter:ae,superFilters:ie,fetchParams:ht,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,summationColumns:ze,shouldUpdateHeight:Ke,isFetch:Le,isTreeTable:ct,isWebPagination:qe,isScrollPagination:_e,isServiceSummation:et,isGroupSubtotal:ot,doLayout:wt,setTableData:te,setTableFullData:L,setTableOriginData:q,setAllTableData:_,setDeriveRowKeys:$,setPagination:de,setSpinning:we,setSorter:re,setFilters:ne,setSuperFilters:oe,setSelectionKeys:pe,setRowExpandedKeys:me,setHighlightKey:ge,setSelectionRows:B,setScrollYLoad:M,setScrollYStore:V,setFieldAuth:D,setResizeState:j,setSummaries:U,setPermission:xe,setRecordsMap:G,resetTableScroll:St,clearElementStore:X,clearRecordsMap:J});((e,l)=>{const{columns:n,summation:a,rowSelection:r,expandable:i,rowHighlight:o,mergeCells:s=[]}=e,{tableRef:c,topElementRef:d,tableElementRef:u,tableBodyRef:p,resizableBarRef:h,$size:m,scrollX:f,pagination:b,selectionKeys:y,rowExpandedKeys:v,highlightKey:x,summationRows:E,summationColumns:C,showSummary:S,isWebPagination:w,isScrollPagination:I,isTreeTable:N,toLastPage:T,toFirstPage:R,getPageCount:O,setHandleState:A,scrollYToRecord:P,setSelectionKeys:F,setOriginColumns:H,setSelectionRows:k,setRowExpandedKeys:L,setHighlightKey:q,setResizeState:_,setMergeCells:$,setPingRight:D,calcTableHeight:K,createSelectionKeys:V,createSelectionRows:M,createRowExpandedKeys:j,createElementStore:z,triggerScrollYEvent:U,forceUpdate:B,initialTable:W,destroy:G}=l,{elementStore:Y,handleState:X,scrollYLoad:Z}=c.current,J=t().useRef(E);$e((()=>{if(!r)return;const{onChange:e}=r;"radio"===r.type&&p.current.setClickedValues(y.length?[y[0],""]:[]),k(M(y)),null==e||e(y,c.current.selectionRows),S&&C.some((e=>e.summation.sumBySelection))&&B()}),[y]),$e((()=>{if(!i)return;const{allTableData:e,allRowKeys:t}=c.current,{onChange:l}=i;null==l||l(v,v.map((l=>e[t.findIndex((e=>e===l))])))}),[v]),$e((()=>{const{allTableData:e,allRowKeys:t}=c.current;var l;N&&L(j()),o&&(p.current.setClickedValues(x?[x,""]:[]),null===(l=o.onChange)||void 0===l||l.call(o,x,e[t.findIndex((e=>e===x))]??null))}),[x]),$e((()=>{var e;(0,Q.isEqual)(E,J.current)||(J.current=E,S&&a&&(null===(e=a.onChange)||void 0===e||e.call(a,E)))}),[E]),$e((()=>{const e=V(r.selectedRowKeys);(0,Q.isEqual)(e,y)||(F(e),N&&L(j()))}),[null==r?void 0:r.selectedRowKeys]),$e((()=>{const e=j(i.expandedRowKeys);(0,Q.isEqual)(e,v)||L(e)}),[null==i?void 0:i.expandedRowKeys]),$e((()=>{const{currentRowKey:e}=o;e!==x&&q(e??"")}),[null==o?void 0:o.currentRowKey]),$e((()=>{const{insert:e,remove:t}=X;e&&(w&&("after"===e?T():R()),P("","after"===e?1e5:0)),t&&b.current>O()&&T(),(e||t)&&A({insert:null,remove:!1})}),[b.total]),$e((()=>{Z&&U(Y.$tableBody.parentNode.scrollTop)}),[Z]),$e((()=>{D(f)}),[f]),$e((()=>{K()}),[m]),$e((()=>{$(s),p.current.forceUpdate()}),[s]),$e((()=>{Z&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),I&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Z,I]);const ee=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,l=window.innerHeight;l!==t&&(_(Object.assign({},e,{winHeight:l})),K())};t().useEffect((()=>(z({$toper:d.current,$table:u.current,$resizableBar:h.current}),H(se(n)),W(),$(s),window.addEventListener("resize",ee,!1),K(),()=>{G(),window.removeEventListener("resize",ee)})),[])})(e,{tableRef:P,topElementRef:w,tableElementRef:I,tableBodyRef:N,resizableBarRef:R,$size:S,scrollX:Ie,pagination:ce,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,showSummary:Ge,summationRows:ut,summationColumns:ze,isWebPagination:qe,isScrollPagination:_e,isTreeTable:ct,toLastPage:Kt,toFirstPage:Vt,getPageCount:Mt,setHandleState:z,scrollYToRecord:xt,setOriginColumns:k,setSelectionKeys:pe,setSelectionRows:B,setRowExpandedKeys:me,setHighlightKey:ge,setResizeState:j,setMergeCells:K,setPingRight:Fe,calcTableHeight:Ct,createSelectionKeys:Pt,createSelectionRows:Ft,createRowExpandedKeys:Ht,createElementStore:mt,triggerScrollYEvent:zt,forceUpdate:O,initialTable:It,destroy:Zt});const Jt=t().useMemo((()=>({getRowKey:A,tableProps:e,tableRef:P,tableBodyRef:N,$size:S,flattenColumns:Me,editableColumns:je,leftFixedColumns:Ue,rightFixedColumns:Be,firstDataIndex:We,sorter:ae,filters:le,superFilters:ie,layout:be,bordered:Qe,showFooter:Ye,showSummary:Ge,summationRows:ut,scrollX:Ie,scrollY:Te,pagination:ce,fetchParams:ht,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,isFetch:Le,isPingLeft:Oe,isPingRight:Pe,isHeadSorter:Ze,isHeadFilter:Je,isFullScreen:He,isTableEmpty:dt,isHeadGroup:Xe,isTreeTable:ct,isGroupSubtotal:ot,isWebPagination:qe,isDragMergeCell:st,dataChange:$t,tableChange:Dt,getTableData:Tt,setElementStore:H,createTableFullData:Nt,setSorter:re,setFilters:ne,setSuperFilters:oe,setSelectionKeys:pe,setHighlightKey:ge,setRowExpandedKeys:me,setSelectionRows:B,getSpan:gt,getStickyLeft:bt,getStickyRight:yt,scrollXToColumn:vt,scrollYToRecord:xt,rowInViewport:Et,setPagination:de,setPingLeft:Ae,setPingRight:Fe,setSpinning:we,setFullScreen:ke,setShouldToTop:W,setOverlay:Y,doFieldValidate:qt,createTableData:Ot,createGroupData:At,findParentRowKeys:kt,getAllChildRowKeys:Lt,triggerScrollYEvent:zt,scrollBottomDebouncer:Ut,resetTableScroll:St,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearRowSelection:Yt,clearRowHighlight:Xt})),[e,S,Me,je,Ue,Be,We,ae,le,ie,be,Qe,Ye,Ge,ut,Ie,Te,ce,ht,ue,he,fe,Le,Oe,Pe,Ze,Je,He,dt,Xe,ct,ot,qe,st]);((e,l)=>{const{getRowKey:n,tableProps:a,tableRef:r,toolBoxRef:i,flattenColumns:o,editableColumns:s,pagination:c,fetchParams:d,selectionKeys:u,rowExpandedKeys:p,highlightKey:h,isFetch:m,dataChange:f,getTableData:b,handleTableData:y,createTableData:v,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:C,doFieldValidate:S,setHandleState:w,setSelectionKeys:I,setRowExpandedKeys:N,setHighlightKey:T,setSelectionRows:R,setOriginColumns:O,forceUpdate:A,getTableLog:P,clearRowSelection:F,clearRowHighlight:H,clearTableSorter:k,clearTableFilter:L,clearSuperFilters:q,clearTableLog:_}=l,{columns:$,columnsChange:D}=a,K=(e,t,l)=>{for(let a=0;a<e.length;a++){const r=e[a],i=n(r,r.index);Array.isArray(r.children)&&K(r.children,t,l),t.includes(i)&&(null==l||l(r,i),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:async e=>{m&&(await b(),null==e||e())},GET_LOG:()=>P(),GET_FETCH_PARAMS:()=>{const e={};for(const t in d)Object.keys(c).includes(t)||(e[t]=d[t]);return e},CLEAR_TABLE_DATA:()=>{m||(F(),H(),k(),L(),q(),_(),v([]))},CLEAR_LOG:()=>{_()},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:e=>{I(e)},SET_HIGHLIGHT:e=>{T(e)},SET_EXPANDABLE:e=>{N(e)},SET_SELECTION_ROWS:e=>{R(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{O(e)},SET_TABLE_COLUMN:(e,t,l)=>{const n=$i($,e);if(!n)return g("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,Q.isPlainObject)(t))return g("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return g("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,Q.set)(n,e,t[e]);l&&(D?D([...$]):g("Table","需要设置 `columnsChange` 参数"))},INSERT_RECORDS:(e,t)=>{const{store:l,tableFullData:a}=r.current,i=(Array.isArray(e)?e:[e]).filter((e=>(0,Q.isPlainObject)(e)));if(!i.length)return;i.forEach((e=>{o.forEach((t=>{const{dataIndex:l}=t;[po.expandableColumn,po.selectionColumn,po.operationColumn].includes(l)||Xi(e,l,Yi(e,l))})),l.addToInserted(e)}));const s="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey);let d=a;if(c)d=s?[...i,...d]:d.concat(i);else{const e=oo(a,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?s?e.children.unshift(...i):e.children.push(...i):e.children=i)}v(d),c&&w(Object.assign({},r.current.handleState,{insert:s?"before":"after"})),f()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:l}=r.current,a=(Array.isArray(e)?e:[e]).map((e=>(0,Q.isPlainObject)(e)?n(e,e.index):e));if(!a.length)return;let i=!1;K(l,a,((e,l)=>{t.addToRemoved(e),s.forEach((n=>{const{dataIndex:a,editRender:r}=n,i=null==r?void 0:r(e,n);if(!i)return;const{rules:o=[],disabled:s}=i;!s&&o.length&&(t.removeFromRequired({x:l,y:a}),t.removeFromValidate({x:l,y:a}),t.removeFromEdited({x:l,y:a}))})),i=!0})),i&&(v(l),I(u.filter((e=>!a.includes(e)))),a.includes(h)&&H(),N(p.filter((e=>!a.includes(e)))),w(Object.assign({},r.current.handleState,{remove:!0})),f())},VALIDATE_FIELDS:(e,t)=>{r.current.allTableData.forEach((l=>{s.forEach((a=>{const{dataIndex:r,editRender:i}=a,o=null==i?void 0:i(l,a);if(!o)return;const s=n(l,l.index);if(e&&!e.includes(s))return;if(t&&!t.includes(r))return;const{rules:c=[],disabled:d}=o;!d&&c.length&&S(c,Yi(l,r),s,r)}))}));const{required:l,validate:a}=P(),i=[...l,...a];return i.length&&C(i[0].rowKey),A(),{required:l,validate:a}}})))})(l,{getRowKey:A,tableProps:e,tableRef:P,toolBoxRef:T,flattenColumns:Me,editableColumns:je,pagination:ce,fetchParams:ht,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,isFetch:Le,dataChange:$t,getTableData:Tt,handleTableData:Rt,createTableData:Ot,calcTableHeight:Ct,scrollXToColumn:vt,scrollYToRecord:xt,doFieldValidate:qt,setHandleState:z,setSelectionKeys:pe,setRowExpandedKeys:me,setHighlightKey:ge,setSelectionRows:B,setOriginColumns:k,forceUpdate:O,getTableLog:_t,clearRowSelection:Yt,clearRowHighlight:Xt,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearTableLog:Qt}),t().useEffect((()=>{vi.register(P.current.uid,l??{current:null})}),[]);const el=Ce("table"),tl={[`${el}--wrapper`]:!0,[`${el}--lg`]:"large"===S,[`${el}--sm`]:"small"===S,[`${el}--maximize`]:He,[c]:!!c},ll={[el]:!0,"is--border":Qe,"is--striped":o,"is--fixed":Ue.length||Be.length,"is--sortable":Ze,"is--filterable":Je,"is--head-group":Xe,"is--merge-cell":st,"is--empty":dt,"show--head":E,"show--foot":Ye,"ping--left":Oe,"ping--right":Pe,"scroll--x":Ie,"scroll--y":Te};return t().createElement(si.Provider,{value:Jt},t().createElement("div",{className:Ee()(tl)},f&&t().createElement("div",{ref:w,className:`${el}-top`},t().createElement("div",{className:`${el}-top__space`},"bottom"!==(null==h?void 0:h.position)&&t().createElement(xo,{total:ce.total}),t().createElement("div",{className:`${el}-top__space-slot`,style:{justifyContent:bi[m]}},e.children)),t().createElement("div",{className:`${el}-top__actions`},t().createElement(ps,{ref:T,showFullScreen:b,showReload:y&&Le,showPrint:ve.print&&!!u,showImport:ve.import&&lt,showExport:ve.export&&!!p,showClipboard:nt,showCollection:tt,showFastSearch:rt,showSuperSearch:at,showGroupSummary:it,showToolBox:v,tableColumns:Ve}),x&&t().createElement(hs,{columns:a}))),t().createElement(pt,{spinning:r??Se},t().createElement("div",{ref:I,className:Ee()(ll),style:ft},t().createElement("div",{className:`${el}--main-wrapper`},E&&t().createElement(Cs,{tableColumns:Ve,flattenColumns:Me,sorter:ae,filters:le}),t().createElement(_s,{ref:N,tableData:ee,flattenColumns:Me}),Ye&&t().createElement($s,{summationRows:ut,flattenColumns:Me})),Qe&&t().createElement("div",{className:`${el}--border-line`}),dt&&t().createElement(Vs,null),s&&t().createElement("div",{ref:R,className:`${el}--resizable-bar`}))),De&&t().createElement(Ks,Ms({},ce,{config:d,onChange:(e,t)=>jt({current:e,pageSize:t})}))))}));js.defaultProps={columns:[],dataSource:[],rowKey:"id",border:!0,resizable:!0,showHeader:!0,ellipsis:!0,multipleSort:!0,topSpaceAlign:"right",showFullScreen:!0,showRefresh:!0,showClipboard:!0,showSelectCollection:!0,showSuperSearch:!0,showFastSearch:!0,showGroupSummary:!0,showColumnDefine:!0,showTableInfo:!0},js.displayName="QmTable";const zs=js,Us=zs;function Bs(){return Bs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Bs.apply(this,arguments)}const Ws=e=>{var l;const{uniqueKey:n,multiple:a,initialValue:r,selectionRows:o,defaultSelectedKeys:s=[],filters:c=[],table:d={},onClose:u}=e,{size:h}=t().useContext(i),m=t().useMemo((()=>e.size??h??""),[e.size,h]),f=t().useRef(null),g=t().useRef(null),b=t().useRef(null),y=Qr(f),[v,x]=t().useState(d),[E,C]=t().useState(),[S,w]=t().useState(s),[I,N]=t().useState(!1),[T,R]=t().useState(300),[O,A]=t().useState(c),[P,F]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...d.columns||[]]),[H,k]=t().useState((0,Q.merge)({},null===(l=d.fetch)||void 0===l?void 0:l.params,r)),[L,q]=t().useState([]),_=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Bl[m]-30)},$=(0,Q.debounce)(_,5);$e((()=>{$()}),[y.width]),$e((()=>{(0,Q.isEqual)(c,O)||A(c)}),[c]),t().useEffect((()=>{D()}),[H]),t().useEffect((()=>{o&&b.current.SET_SELECTION_ROWS(o)}),[o]),t().useEffect((()=>{var e;r&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(r))}),[]);const D=async()=>{const{webPagination:e,fetch:t}=v;if(!e||null==t||!t.api)return;const{api:l,dataKey:n,beforeFetch:a=le}=t;if(a(H)){N(!0);try{const e=await l(H);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[];w([]),await ne(0),q(t)}}catch(e){}N(!1)}},K=e=>{a||(C(e),u(e))},V=e=>{k(Object.assign({},H,e))},M=Ce("search-helper"),j=v.webPagination?{dataSource:L,loading:I,webPagination:!0}:{fetch:{...v.fetch,params:H}};return t().createElement("div",{ref:f,className:`${M}--wrapper`},t().createElement("div",{className:"form-wrap"},O.length?t().createElement(pr,{ref:g,items:O,uniqueKey:n?`helper_${n}`:n,formType:"search",isAutoFocus:!1,fieldsChange:e=>A(e),onCollapse:()=>_(),onFinish:e=>V(e),onReset:async()=>{const[e,t]=await g.current.GET_FORM_DATA();e||V(t)}}):null),t().createElement("div",null,t().createElement(Us,Bs({ref:b,height:T,columns:P,rowKey:v.rowKey||"pageIndex"},j,{rowSelection:{type:a?"checkbox":"radio",clearableAfterFetched:!a,selectFirstRowOnChange:!0,selectedRowKeys:S,onChange:(e,t)=>{w(e),C(a?t:t[0])}},columnsChange:e=>F(e),onRowDblclick:K,onRowEnter:K}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Bl[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!E,onClick:()=>u(E,a?S:void 0)},p("qm.dialog.confirm"))))};Ws.displayName="SearchHelper";const Gs=Ws;function Ys(){return Ys=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},Ys.apply(this,arguments)}const Xs=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Xs(e.children)),e.children&&t.push(e.value)})),t},Qs=(e,t)=>{let l=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(l=Qs(e[n].children,t)),l)return l;if(t(e[n]))return e[n]}return l},Zs=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Zs(e.children,t),t(e)||e.children&&e.children.length))),Js=e=>{var l;const{uniqueKey:n,multiple:a,initialValue:r,selectionRows:o,defaultSelectedKeys:s=[],filters:c=[],table:d={},tree:u={},onClose:h}=e,{size:m}=t().useContext(i),f=t().useMemo((()=>e.size??m??""),[e.size,m]),b=t().useRef(null),y=t().useRef(null),v=t().useRef(null),x=Qr(b),[E,C]=t().useState(d),[S,w]=t().useState(),[I,N]=t().useState(s),[T,O]=t().useState(!1),[A,P]=t().useState(300),[F,H]=t().useState(300),[k,L]=t().useState(c),[q,_]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...d.columns||[]]),[$,D]=t().useState((0,Q.merge)({},null===(l=d.fetch)||void 0===l?void 0:l.params,r)),[K,V]=t().useState([]),M=()=>{const e=b.current,t=e.querySelector(".form-wrap"),l=e.querySelector(".input-wrap");P(e.offsetHeight-l.offsetHeight-10),H(e.offsetHeight-t.offsetHeight-2*Bl[f]-30)},j=(0,Q.debounce)(M,5);$e((()=>{j()}),[x.width]),$e((()=>{(0,Q.isEqual)(c,k)||L(c)}),[c]),t().useEffect((()=>{z()}),[$]),t().useEffect((()=>{o&&v.current.SET_SELECTION_ROWS(o)}),[o]),t().useEffect((()=>{var e;r&&(null===(e=y.current)||void 0===e||e.SET_FIELDS_VALUE(r)),ae()}),[]);const z=async()=>{const{webPagination:e,fetch:t}=E;if(!e||null==t||!t.api)return;const{api:l,dataKey:n,beforeFetch:a=le}=t;if(a($)){O(!0);try{const e=await l($);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[];N([]),await ne(0),V(t)}}catch(e){}O(!1)}},U=e=>{a||(w(e),h(e))},B=e=>{D(Object.assign({},$,e))},[W,G]=t().useState([]),[Y,X]=t().useState([]),[Z,J]=t().useState(""),ee=t().useRef(W),te=t().useRef([]);$e((()=>{X(Xs(W))}),[W]);const ae=async()=>{if(!u.fetch)return;const{api:e,params:t,dataKey:l,valueKey:n="value",textKey:a="text"}=u.fetch;try{const r=await e(t);if(200===r.code){const e=Array.isArray(r.data)?r.data:(0,Q.get)(r.data,l)??[],t=vl(e,n,a);G(t),ee.current=t,te.current=e}}catch(e){}},re=e=>`${e}|${ha.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ie=Ce("tree-table-helper"),oe=E.webPagination?{dataSource:K,loading:T,webPagination:!0}:{fetch:{...E.fetch,params:$}};return t().createElement("div",{ref:b,className:`${ie}--wrapper`},t().createElement(et,{defaultValue:200,style:{height:"100%"}},t().createElement(et.Pane,{min:100,style:{overflowY:"auto"}},t().createElement(R.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:p("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=Zs(ee.current,(t=>{if(!e)return!0;const l=t.text||"";return-1!==re(l).indexOf(e)}));J(e),G(t)})(e.target.value)}),t().createElement(R.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:A,defaultExpandAll:!0,expandedKeys:Y,treeData:W,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==re(t).indexOf(Z)},onExpand:e=>{X(e)},onSelect:e=>{const{valueKey:t="value"}=u.fetch;(e=>{if(!u.tableParamsMap)return g("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof u.tableParamsMap?u.tableParamsMap():u.tableParamsMap,l={};for(const n in t)l[n]=(0,Q.get)(e,t[n]);B(l)})(Qs(te.current,(l=>(0,Q.get)(l,t)===e[0]))||{})}})),t().createElement(et.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},k.length?t().createElement(pr,{ref:y,items:k,uniqueKey:n?`helper_${n}`:n,formType:"search",isAutoFocus:!1,fieldsChange:e=>L(e),onCollapse:()=>M(),onFinish:e=>B(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||B(t)}}):null),t().createElement("div",null,t().createElement(Us,Ys({ref:v,height:F,columns:q,rowKey:E.rowKey||"pageIndex"},oe,{rowSelection:{type:a?"checkbox":"radio",clearableAfterFetched:!a,selectFirstRowOnChange:!0,selectedRowKeys:I,onChange:(e,t)=>{N(e),w(a?t:t[0])}},columnsChange:e=>_(e),onRowDblclick:U,onRowEnter:U}))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Bl[f]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>h(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!S,onClick:()=>h(S,a?I:void 0)},p("qm.dialog.confirm"))))};Js.displayName="TreeTableHelper";const ec=Js,tc=e=>{var l,n,a;const{multiple:r,tree:o={},defaultSelectedKeys:s,onClose:c}=e,{size:d}=t().useContext(i),u=t().useMemo((()=>e.size??d??""),[e.size,d]),[h,m]=t().useState(),[f]=t().useState(null===(l=o.fetch)||void 0===l?void 0:l.params),g=Ce("tree-helper"),b=o.fetch?{...X()(o.fetch,["params","valueKey","textKey"]),params:f}:void 0;return t().createElement("div",{className:`${g}--wrapper`},t().createElement(oi,{multiple:r,fetch:b,fieldsDefine:{valueKey:null===(n=o.fetch)||void 0===n?void 0:n.valueKey,textKey:null===(a=o.fetch)||void 0===a?void 0:a.textKey},asyncLoad:o.asyncLoad,checkStrictly:o.checkStrictly,checkStrategy:o.checkStrategy,defaultSelectedKeys:s,defaultExpandAll:o.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Bl[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>c(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!h,onClick:()=>c(h)},p("qm.dialog.confirm"))))};tc.displayName="TreeHelper";const lc=tc;function nc(){return nc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e},nc.apply(this,arguments)}const ac="_startSign",rc="_endSign",ic=e=>{var l;const{uniqueKey:n,initialValue:a,filters:r=[],table:o={},onClose:s}=e,{size:c}=t().useContext(i),d=t().useMemo((()=>e.size??c??""),[e.size,c]),u=t().useRef(null),h=t().useRef(null),m=t().useRef(null),f=Qr(u),[g,b]=t().useState(o),[y,v]=t().useState(!1),[x,E]=t().useState([]),[C,S]=t().useState(300),[w,I]=t().useState(r),[N,T]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},{title:p("qm.form.rangeSearchHelper")[0],dataIndex:ac,width:80,align:"right",render:(e,l)=>t().createElement("span",{className:"icon-sign"},e)},...o.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:rc,fixed:"right",width:80,render:(e,l)=>t().createElement("span",{className:"icon-sign"},e)}]),[O,A]=t().useState((0,Q.merge)({},null===(l=o.fetch)||void 0===l?void 0:l.params,a)),[P,F]=t().useState([]),H=t().useMemo((()=>x.map((e=>null==e?void 0:e.pageIndex))),[x]),k=t().useMemo((()=>2===H.length&&H.every((e=>void 0!==e))),[H]),L=()=>{const e=u.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*Bl[d]-30)},q=(0,Q.debounce)(L,5);$e((()=>{q()}),[f.width]),$e((()=>{(0,Q.isEqual)(r,w)||I(r)}),[r]),t().useEffect((()=>{_()}),[O]);const _=async()=>{const{webPagination:e,fetch:t}=g;if(!e||null==t||!t.api)return;const{api:l,dataKey:n,beforeFetch:a=le}=t;if(a(O)){v(!0);try{const e=await l(O);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[];F(t)}}catch(e){}v(!1)}},$=(e,t)=>{delete e[t]},D=()=>{x.forEach((e=>{e&&($(e,ac),$(e,rc))})),E([])},K=e=>{D(),A(Object.assign({},O,e))},V=Ce("range-helper"),M=g.webPagination?{dataSource:P,loading:y,webPagination:!0}:{fetch:{...g.fetch,params:O}};return t().createElement("div",{ref:u,className:`${V}--wrapper`},t().createElement("div",{className:"form-wrap"},w.length?t().createElement(pr,{ref:h,items:w,initialValues:a,uniqueKey:n?`helper_${n}`:n,formType:"search",isAutoFocus:!1,fieldsChange:e=>I(e),onCollapse:()=>L(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await h.current.GET_FORM_DATA();e||K(t)}}):null),t().createElement("div",null,t().createElement(Us,nc({ref:m,height:C,columns:N,rowKey:g.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=H[0]&&e.pageIndex<=H[1]?{backgroundColor:"#f5f5f5"}:{}},M,{columnsChange:e=>T(e),onRowClick:(e,t)=>{const{dataIndex:l}=t;[ac,rc].includes(l)&&(l===ac&&(e[l]?($(e,l),E([void 0,x[1]])):e.pageIndex>H[1]?R.message.warning(p("qm.searchHelper.rangeStartTip")):(x[0]&&$(x[0],l),e[l]="[",E([e,x[1]]))),l===rc&&(e[l]?($(e,l),E([x[0],void 0])):e.pageIndex<H[0]?R.message.warning(p("qm.searchHelper.rangeEndTip")):(x[1]&&$(x[1],l),e[l]="]",E([x[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===H[0]&&(e[ac]="["),e.pageIndex===H[1]&&(e[rc]="]")}))}}),t().createElement(he,{type:"primary",icon:t().createElement(Se.ClearOutlined,null),title:p("qm.table.alert.clear"),onClick:()=>D()}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Bl[d]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>s(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!k,onClick:()=>s(x.map((e=>(e=>{const t={};for(const l in e)[ac,rc].includes(l)||(t[l]=e[l]);return t})(e))))},p("qm.dialog.confirm"))))};ic.displayName="RangeTableHelper";const oc=ic,sc={previewWidth:1100,defaultDistance:.45,logoHeight:60},cc=(0,e.createContext)(void 0);var dc=null;function uc(){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),l=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),r=e.match(/x64/i);if(!t&&!l&&r)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||r)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!l){var i=e.match(/Chrome\D?\d+/i);if(i&&(i=i[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function pc(e,t){var l;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(uc()){try{l=getCLodop()}catch(e){}if(!l&&"complete"!==document.readyState)return void R.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!l)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?l=a?e:t:dc?l=dc:((l=document.createElement("object")).setAttribute("width",0),l.setAttribute("height",0),l.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?l.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):l.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(l),dc=l),!l||!l.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),l;return l.VERSION<"6.2.2.6"&&uc(),l}catch(e){R.message.error("getLodop 出错:"+e)}}uc();const hc=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:l}=window.screen;if(t&&l)e[0]=t,e[1]=l;else{var n;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()),null===(n=t.parentNode)||void 0===n||n.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},mc=t().forwardRef(((e,l)=>{const{templateRender:n,directPrint:a}=e,{global:r}=t().useContext(i),{$$preview:o}=t().useContext(cc),{state:s,isWindowsPrinter:c,pageSize:d}=o,u=t().useRef(null),p=t().useRef({}),h=t().useRef([]),m=t().useRef([]),f=t().useRef([]),[b,y]=t().useState(!0);t().useImperativeHandle(l,(()=>({createPreviewDom:P,createExportHtml:H,createPrintHtml:F,SHOW_PREVIEW:k,DIRECT_PRINT:L}))),$e((()=>{A()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),t().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const v=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*sc.defaultDistance+10*sc.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[s,c,d]),x=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*sc.defaultDistance+10*sc.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return hc(v-10*(e.left-sc.defaultDistance)-10*(e.right-sc.defaultDistance))}),[s,v]),C=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return hc(x-10*(e.top-sc.defaultDistance)-10*(e.bottom-sc.defaultDistance))}),[s,x]),S=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:hc(10*e.left),right:hc(10*e.right),top:hc(10*e.top),bottom:hc(10*e.bottom)}}),[s]),I=t().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:l,top:n,bottom:a}=w,r=E+t+l,i=sc.previewWidth-r<=0?0:(sc.previewWidth-r)/2,o=Math.abs((1-S)*r/2);let c=0;return S>1&&(c=o>i?-1*i:-1*o),S<1&&(c=r-2*o>sc.previewWidth?0:i>0?o:(sc.previewWidth-(r-2*o))/2),{width:`${E}px`,height:"stylus"===e?"auto":C+"px",paddingLeft:`${t}px`,paddingRight:`${l}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${S})`,opacity:b?0:1}}),[s,b,w,S,C,E]),N=(h.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{var e,t;const l=(null==r||null===(e=r.print)||void 0===e?void 0:e.leftLogo)??"",n=(null==r||null===(t=r.print)||void 0===t?void 0:t.rightLogo)??"";return[`<tr style="height: ${sc.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',l?`<img src="${l}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',n?`<img src="${n}" 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},R=()=>{let e=document.createElement("tr");var t,l;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=T().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(l=p.current.templateEl.children[0]).children[0]?l.insertBefore(t,l.children[0]):l.appendChild(t),e=null},O=()=>{const e=p.current.templateEl.children[0].children,t=[],l=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",l.push(a),t.push(e[n].outerHTML)}m.current=l,h.current=t},A=()=>{if(!h.current.length)return;const{form:{setting:e,printerType:t}}=s;if(a)return f.current.push([T(),N(),...h.current]);const l=e.fixedLogo?C-sc.logoHeight:C;let n=[];if(f.current=[],"stylus"===t)f.current.push([T(),...e.fixedLogo?[N()]:[],...h.current]);else{let t=0;for(let a=0,r=m.current.length;a<r;a++){const i=h.current[a],o=m.current[a];e.fixedLogo||0!==a||(t+=sc.logoHeight),t+=o,t<=l?n.push(i):(f.current.push([T(),...e.fixedLogo?[N()]:[],...n]),n=[],t=0,a-=1),a===r-1&&n.length&&f.current.push([T(),...e.fixedLogo?[N()]:[],...n])}}var r;e.fixedLogo||null===(r=f.current[0])||void 0===r||r.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');o.setState({currentPage:1,totalPage:f.current.length}),P()},P=()=>{var e;const{currentPage:t}=s;let l=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;l+=(null===(e=f.current[t-1])||void 0===e?void 0:e.join(""))??"",l+="</table>",p.current.previewEl.innerHTML=l,p.current.previewEl.parentNode.scrollTop=0},F=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},H=()=>{const e=[];for(let t=0;t<h.current.length;t++)e[t]=h.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+T()+e.join("")+"</table>"},k=async()=>{var e;if("TABLE"!==(null===(e=p.current.templateEl)||void 0===e?void 0:e.tagName))return q();p.current.previewEl.innerHTML||(R(),await ne(0),O(),A(),y(!1))},L=async()=>{var e;if("TABLE"!==(null===(e=p.current.templateEl)||void 0===e?void 0:e.tagName))return q();R(),await ne(0),O(),A(),y(!1),o.doPrint(F()),await ne(0),o.doClose()},q=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},_={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:u,className:Ee()(_)},t().createElement(pt,{wrapperClassName:"spin",spinning:b,tip:"Loading..."},t().createElement("div",{className:"preview"},t().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},null==n?void 0:n()),t().createElement("div",{className:"workspace",style:I}))))}));mc.displayName="Container";const fc=mc;function gc(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class bc extends e.Component{constructor(){super(...arguments),gc(this,"formRef",t().createRef()),gc(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:sc.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:sc.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:sc.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:sc.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),gc(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})})),gc(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")}))),gc(this,"state",{formList:this.createFormList()}),gc(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())})),gc(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return t().createElement(t().Fragment,null,t().createElement(pr,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),t().createElement(he,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}gc(bc,"contextType",i);const yc=bc;function vc(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class xc extends e.Component{constructor(){var e,l,n;super(...arguments),vc(this,"provide",{$$preview:this}),vc(this,"containRef",t().createRef()),vc(this,"state",{visible:!1,form:{printerName:-1,printerType:(null===(e=this.props.defaultConfig)||void 0===e?void 0:e.printerType)||"laser",copies:(null===(l=this.props.defaultConfig)||void 0===l?void 0:l.copies)||1,scale:1,setting:{distance:{left:sc.defaultDistance,right:sc.defaultDistance,top:sc.defaultDistance,bottom:sc.defaultDistance},pageSize:"210*297",direction:(null===(n=this.props.defaultConfig)||void 0===n?void 0:n.direction)||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),vc(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),vc(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),vc(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 Jo().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),vc(this,"doClose",(()=>{var e,t;null===(e=(t=this.props).onClose)||void 0===e||e.call(t)})),vc(this,"getPrintConfig",(async e=>{const t=this.context.global,l=null==t?void 0:t.getComponentConfigApi;if(l)try{const t=await l({key:e});if(200===t.code)return t.data}catch(e){}})),vc(this,"savePrintConfig",(async(e,t)=>{const l=this.context.global,n=null==l?void 0:l.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),vc(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 ')),vc(this,"doPrint",(e=>{const t=pc();if(!t)return;const{uniqueKey:l,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:r,printerType:i,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=sc,{left:d,right:u,top:h,bottom:m}=a.distance;t.PRINT_INIT(l??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(r),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"===i&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===i&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*m*2,""),t.ADD_PRINT_TABLE(10*(h-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==i?10*(m-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():R.message.error(p("qm.print.printError"))},t.PRINT()})),vc(this,"doExport",(e=>{const t=pc();if(!t)return;const{uniqueKey:l,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(l??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&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(`${s()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:p("qm.print.laserPrinter"),value:"laser"},{text:p("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=pc(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const l=e.GET_PRINTER_COUNT();for(let n=0;n<l;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){g("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let t=await Jo().getItem(this.printerKey);var e;t||(t=await this.getPrintConfig(this.printerKey),(0,Q.isPlainObject)(t)&&await Jo().setItem(this.printerKey,t)),(0,Q.isPlainObject)(t)&&Object.keys(t).length&&(0,Q.merge)(this.state.form,{...t,printerName:(null===(e=this.printerItems.find((e=>e.text===t.printerName)))||void 0===e?void 0:e.value)??-1})}catch(e){}}render(){const{preview:e,templateRender:l}=this.props,{visible:n,form:a,currentPage:r,totalPage:i,printPage:o}=this.state,s=Ce("print-preview"),c={visible:n,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?t().createElement(t().Fragment,null,t().createElement("div",{className:Ee()(d)},t().createElement("div",{className:"outer"},t().createElement("div",{className:"header"},t().createElement("span",null,p("qm.print.printer"),":",t().createElement(R.Select,{value:a.printerName,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t().createElement(R.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.type"),":",t().createElement(R.Select,{value:a.printerType,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t().createElement(R.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.copies"),":",t().createElement(R.InputNumber,{value:a.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),t().createElement("span",null,p("qm.print.printPage.0"),t().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")),t().createElement("span",null,t().createElement(R.Pagination,{size:"small",current:r,pageSize:1,total:i,onChange:this.pageChangeHandle})),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(Se.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(Se.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),t().createElement("span",null,t().createElement(he,{icon:t().createElement(Se.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),t().createElement("div",{className:"main"},t().createElement(cc.Provider,{value:this.provide},t().createElement(fc,{ref:this.containRef,templateRender:l,directPrint:!1}))),t().createElement("div",{className:"footer"},t().createElement("span",null,p("qm.print.scale"),":",t().createElement(R.Slider,{value:a.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{scale:e}})))}}),t().createElement("em",{className:"scale-text"},`${Math.floor(100*a.scale)}%`)),t().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:r,totalPage:i}))))),t().createElement(Wt,c,t().createElement(yc,{setting:a.setting,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(cc.Provider,{value:this.provide},t().createElement(fc,{ref:this.containRef,templateRender:l,directPrint:!0}))}}vc(xc,"contextType",i);const Ec=xc;function Cc(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}class Sc extends e.Component{constructor(){super(...arguments),Cc(this,"previewRef",t().createRef()),Cc(this,"state",{visible:!1,loading:!1}),Cc(this,"clickHandle",(async()=>{this.setState({loading:!0});try{var e,t;const l=await(null===(e=(t=this.props).click)||void 0===e?void 0:e.call(t));if(this.setState({loading:!1}),"boolean"==typeof l&&!l)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),Cc(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:l,uniqueKey:n,defaultConfig:a,preview:r,closeAfterPrint:i}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${sc.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:l,uniqueKey:n,defaultConfig:a,preview:r,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return r?t().createElement(Wt,o,t().createElement(Ec,s)):e?t().createElement(Ec,s):null})),Cc(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:l,icon:n,type:a,disabled:r,shape:i}=this.props,o={size:l||this.context.size||"",type:a,shape:i,icon:n,loading:e,disabled:r,click:this.clickHandle};return t().createElement(t().Fragment,null,this.props.children&&t().createElement(he,o,this.props.children),this.createRender())}}Cc(Sc,"propTypes",{size:(e,t,l)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+l+"`. Validation failed.")},templateRender:r().elementType}),Cc(Sc,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(Se.PrinterOutlined,null)}),Cc(Sc,"contextType",i);const wc=Sc,Ic="1.6.1"})(),a})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={787:t=>{t.exports=e}},n={};function l(e){var a=n[e];if(void 0!==a)return a.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,l),r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{l.r(a),l.d(a,{Affix:()=>A.Affix,Alert:()=>A.Alert,Anchor:()=>A.Anchor,AutoComplete:()=>A.AutoComplete,Avatar:()=>A.Avatar,BackTop:()=>A.BackTop,Badge:()=>A.Badge,Breadcrumb:()=>A.Breadcrumb,Button:()=>A.Button,Calendar:()=>L,Card:()=>A.Card,Carousel:()=>A.Carousel,Cascader:()=>A.Cascader,Checkbox:()=>A.Checkbox,Col:()=>A.Col,Collapse:()=>A.Collapse,Comment:()=>A.Comment,ConfigProvider:()=>A.ConfigProvider,DatePicker:()=>_,Descriptions:()=>A.Descriptions,Divider:()=>A.Divider,Drawer:()=>A.Drawer,Dropdown:()=>A.Dropdown,Empty:()=>A.Empty,Form:()=>A.Form,Grid:()=>A.Grid,Image:()=>A.Image,Input:()=>A.Input,InputNumber:()=>A.InputNumber,Layout:()=>A.Layout,List:()=>A.List,Mentions:()=>A.Mentions,Menu:()=>A.Menu,Modal:()=>A.Modal,PageHeader:()=>A.PageHeader,Pagination:()=>A.Pagination,Popconfirm:()=>A.Popconfirm,Popover:()=>A.Popover,Progress:()=>A.Progress,QmAnchor:()=>Pt,QmButton:()=>me,QmCollapse:()=>$e,QmConfigProvider:()=>X,QmCopyToClipboard:()=>qs,QmCountup:()=>ot,QmCropper:()=>Mr,QmDivider:()=>Te,QmDownload:()=>xt,QmDrawer:()=>Mt,QmEmpty:()=>ut,QmForm:()=>br,QmModal:()=>Gt,QmPrint:()=>Nc,QmRangeTableHelper:()=>cc,QmSearchHelper:()=>Xs,QmSearchTree:()=>di,QmSpace:()=>xe,QmSpin:()=>ht,QmSplit:()=>tt,QmTable:()=>Ws,QmTabs:()=>_t,QmTinymce:()=>$r,QmTreeHelper:()=>ac,QmTreeTableHelper:()=>nc,QmUploadFile:()=>Br,QmUploadImg:()=>Jr,Radio:()=>A.Radio,Rate:()=>A.Rate,Result:()=>A.Result,Row:()=>A.Row,Select:()=>A.Select,Skeleton:()=>A.Skeleton,Slider:()=>A.Slider,Space:()=>A.Space,Spin:()=>A.Spin,Statistic:()=>A.Statistic,Steps:()=>A.Steps,Switch:()=>A.Switch,Tabs:()=>A.Tabs,Tag:()=>A.Tag,TimePicker:()=>M,Timeline:()=>A.Timeline,Tooltip:()=>A.Tooltip,Transfer:()=>A.Transfer,Tree:()=>A.Tree,TreeSelect:()=>A.TreeSelect,Typography:()=>A.Typography,Upload:()=>A.Upload,message:()=>A.message,notification:()=>A.notification,pinyin:()=>ya,version:()=>Tc});var e=l(787),t=l.n(e);const n=require("prop-types");var r=l.n(n);const i=(0,e.createContext)({locale:"zh-cn",size:"middle"}),o=require("dayjs");var s=l.n(o);const c={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传"},uploadCropper:{dragableText:"拖放或点击",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},mergeCell:{cancel:"恢复",confirm:"合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let d=c;function u(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const p=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const[l,a]=t;let r;const i=l.split(".");let o=d;for(let e=0,t=i.length;e<t;e++){if(r=o[i[e]],e===t-1)return u(r,a);if(!r)return"";o=r}return""},h=e=>{d=e||d,d.name&&s().locale(d.name)};class m extends Error{constructor(e){super(e),this.name="QmDesignError"}}function f(e,t){throw new m(`[${e}] ${t}`)}function g(e,t){console.warn(new m(`[${e}] ${t}`))}const b=e=>["","small","middle","large"].includes(e),y=require("dayjs/plugin/localeData");var v=l.n(y);const x=require("dayjs/plugin/advancedFormat");var E=l.n(x);const C=require("dayjs/plugin/customParseFormat");var S=l.n(C);const w=require("dayjs/plugin/quarterOfYear");var I=l.n(w);const N=require("dayjs/plugin/weekOfYear");var T=l.n(N);const R=require("dayjs/plugin/weekday");var O=l.n(R);s().extend(v()),s().extend(E()),s().extend(S()),s().extend(I()),s().extend(T()),s().extend(O());const A=require("antd"),P=require("rc-picker/es/generate/dayjs");var F=l.n(P);const H=require("antd/es/calendar/generateCalendar");var k=l.n(H);require("antd/es/calendar/style");const L=k()(F()),q=require("antd/es/date-picker/generatePicker");var $=l.n(q);require("antd/es/date-picker/style/index");const _=$()(F());function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},D.apply(this,arguments)}const K=e.forwardRef(((t,n)=>e.createElement(_,D({},t,{picker:"time",mode:void 0,ref:n}))));K.displayName="TimePicker";const V=e.forwardRef(((t,n)=>e.createElement(_.RangePicker,D({},t,{picker:"time",mode:void 0,ref:n}))));V.displayName="RangePicker",K.RangePicker=V;const M=K,j={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload"},uploadCropper:{dragableText:"Drop or click",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},mergeCell:{cancel:"reset",confirm:"merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},z=require("antd/es/locale/zh_CN");var U=l.n(z);const B=require("antd/es/locale/en_GB");function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const G={[j.name]:{qm:j,antd:l.n(B)()},[c.name]:{qm:c,antd:U()}};class Y extends e.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},h(G[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:n,size:l}=t.value,{locale:a,size:r}=e;return a!==n&&h(G[a].qm),a!==n||r!==l?{value:Object.assign({},t.value,{locale:a,size:r})}:null}render(){const{global:e}=this.props,{value:n}=this.state;return t().createElement(i.Provider,{value:n},t().createElement(A.ConfigProvider,{locale:G[n.locale].antd,componentSize:n.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}W(Y,"propTypes",{locale:r().string,size:(e,t,n)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},theme:r().string,global:r().object}),W(Y,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const X=Y,Q=require("omit.js");var Z=l.n(Q);const J=require("lodash-es"),ee="undefined"==typeof window,te=e=>t().isValidElement(e),ne=e=>te(e)&&e.type===t().Fragment,le=()=>{},ae=()=>!0,re=async e=>new Promise((t=>setTimeout(t,e))),ie=e=>{Promise.resolve().then(e)},oe=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),se=e=>!!(!e&&0!==e||(0,J.isArray)(e)&&!e.length||(0,J.isPlainObject)(e)&&!Object.keys(e).length),ce=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,J.isPlainObject)(e)||(0,J.isArray)(e)){const n=Array.isArray(e),l=n?[]:{};if(t.get(e))return e;t.set(e,l);const a=n?void 0:Object.keys(e);return function(e,t){let n=-1;const l=e.length;for(;++n<l;)t(e[n],n)}(a||e,((n,r)=>{a&&(r=n),l[r]=ce(e[r],t)})),l}return e},de=e=>(0,J.isNumber)(e)?`${e}px`:e.toString();function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},ue.apply(this,arguments)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class he extends e.Component{constructor(){super(...arguments),pe(this,"state",{isLoading:!1}),pe(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{var t,n;await(null===(t=(n=this.props).click)||void 0===t?void 0:t.call(n,e))}catch(e){g("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:n,authConfig:l,click:a,confirm:r}=this.props,{isLoading:i}=this.state,o=e||this.context.size||"",s=(0,J.isFunction)(a)?{onClick:this.clickHandle}:null,c={...Z()(this.props,["authConfig","click","confirm"]),size:o,loading:i||n||!1,...s};if(l){const{visible:e=1,disabled:t}=l||{};if(!e)return null;t&&(c.disabled=!0)}return r?t().createElement(A.Popconfirm,{title:r.title||p("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{var t,n;null===(t=r.onConfirm)||void 0===t||t.call(r),null===(n=c.onClick)||void 0===n||n.call(c,e)},onCancel:e=>{var t;null===(t=r.onCancel)||void 0===t||t.call(r,e)}},t().createElement(A.Button,ue({},c,{onClick:le}),this.props.children)):t().createElement(A.Button,c,this.props.children)}}pe(he,"propTypes",{click:r().func,confirm:r().shape({title:r().node,onConfirm:r().func,onCancel:r().func})}),pe(he,"contextType",i);const me=he;var fe,ge,be,ye;!function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(fe||(fe={}));class ve extends e.Component{render(){const{size:e}=this.props,n=e||this.context.size||"",l=(0,J.isNumber)(e)?e:fe[e||n||"default"],a={...this.props,size:l};return t().createElement(A.Space,a,this.props.children)}}ye=i,(be="contextType")in(ge=ve)?Object.defineProperty(ge,be,{value:ye,enumerable:!0,configurable:!0,writable:!0}):ge[be]=ye;const xe=ve,Ee=require("classnames");var Ce=l.n(Ee);const Se=e=>`qm-${e}`,we=require("@ant-design/icons");function Ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ne extends e.Component{constructor(){super(...arguments),Ie(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=le}=this.props;t(!e)}))}render(){const{size:e,label:n,extra:l,collapse:a,disabled:r,className:i,style:o,id:s}=this.props,c=e||this.context.size||"",d=Se("divider"),u={[d]:!0,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c};return t().createElement("div",{id:s,className:Ce()(u,i),style:o},t().createElement("span",{className:Ce()(`${d}__title`)},n),t().createElement("div",{className:Ce()(`${d}__extra`)},l),void 0!==a&&t().createElement(A.Button,{type:"link",className:Ce()(`${d}__collapse`),disabled:r,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}Ie(Ne,"propTypes",{label:r().string,size:(e,t,n)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},extra:r().oneOfType([r().element,r().string]),collapse:r().bool}),Ie(Ne,"contextType",i);const Te=Ne,Re=()=>({height:0,opacity:0}),Oe=(e,t)=>"height"===t.propertyName,Ae={motionName:"rc-collapse-motion",onEnterStart:Re,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Re,onEnterEnd:Oe,onLeaveEnd:Oe,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},Pe=require("rc-motion");var Fe=l.n(Pe);const He=t().forwardRef(((e,n)=>{const{forceRender:l,className:a,style:r,boxStyle:i,isActive:o}=e,[s,c]=t().useState(o||l);if(t().useEffect((()=>{(l||o)&&c(!0)}),[l,o]),!s)return null;const d=Se("collapse");return t().createElement("div",{ref:n,className:Ce()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},a),style:r},t().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));He.displayName="PanelContent";const ke=He;function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Le.apply(this,arguments)}const qe=e=>{const{defaultActive:n,label:l,extra:a,className:r,style:i,containerStyle:o,disabled:s,forceRender:c,destroyOnClose:d=!1,onChange:u}=e,[p,h]=t().useState(!!n),m=Se("collapse"),f=Ce()({[`${m}`]:!0,[`${m}-active`]:p,[`${m}-disabled`]:s},r);return t().createElement("div",{className:f,style:i},t().createElement(Te,{label:l,extra:a,collapse:p,disabled:s,onCollapseChange:e=>{h(e),null==u||u(e)}}),t().createElement(Fe(),Le({visible:p},Ae,{leavedClassName:`${m}-content-hidden`,forceRender:c,removeOnLeave:d}),((n,l)=>{let{className:a,style:r}=n;return t().createElement(ke,{ref:l,prefixCls:m,className:a,style:r,boxStyle:o,isActive:p,forceRender:c},e.children)})))};qe.displayName="QmCollapse";const $e=qe,_e=t().createContext(void 0);function De(t,n){const l=e.useRef(!1);e.useEffect((()=>{l.current?t():l.current=!0}),n)}const Ke=require("react-draggable");var Ve=l.n(Ke);const Me=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},je=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},ze=e=>e.stopPropagation(),Ue=e=>e.preventDefault(),Be=(e,t,n)=>{!ee&&e&&t&&((0,J.isPlainObject)(t)?Object.keys(t).forEach((n=>{Be(e,n,t[n])})):(t=oe(t),e.style[t]=n))},We=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Ge=(e,t)=>{let n=e;for(;n;){var l;if(null!==(l=n.classList)&&void 0!==l&&l.contains(t))return n;n=n.parentNode}return null},Ye=e=>{const{minValues:n,onDragChange:l,onDragging:a}=e,{splitRef:r,direction:i}=t().useContext(_e),[o,s]=t().useState(),[c,d]=t().useState(0),u="vertical"===i?"y":"x",h={[`${Se("split")}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return t().createElement(Ve(),{bounds:o,axis:u,position:{x:0,y:0},positionOffset:{[u]:-1*c},onStart:()=>{l(!0),(()=>{const e=r.current.children[0];if(!e)return;const t=(()=>{const{w:e,h:t}={w:r.current.offsetWidth,h:r.current.offsetHeight};return[n[0],("vertical"===i?t:e)-n[1]]})(),l=e.offsetWidth,a=e.offsetHeight;s({left:t[0]-l,right:t[1]-l,top:t[0]-a,bottom:t[1]-a})})()},onDrag:(e,t)=>{d(t[u]),a(t[u])},onStop:()=>l(!1)},t().createElement("div",{className:Ce()(h),title:p("qm.split.resize")}))};Ye.displayName="ResizeBar";const Xe=Ye,Qe=t().forwardRef(((e,n)=>{const{offset:l,className:a,style:r}=e,{direction:i,dragging:o}=t().useContext(_e),s="vertical"===i?"height":"width",c={[Se("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===i,vertical:"vertical"===i,[a]:!!a},d=void 0!==l?{[s]:de(l)}:{flex:1,[s]:0};return t().createElement("div",{ref:n,className:Ce()(c),style:{...d,...r}},e.children)}));Qe.displayName="QmSplitPane";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 l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Je.apply(this,arguments)}const et=e=>{const{direction:n="horizontal",defaultValue:l="50%",uniqueKey:a,className:r,style:o,onDragStart:s,onDrag:c=le,onDragEnd:d}=e,{global:u}=t().useContext(i),p=t().useRef(null),h=t().useRef(null),m=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=>{var t;const n=Number.parseInt((null===(t=e.props)||void 0===t?void 0:t.min)||0);return n>=0?n:0},b=t().useMemo((()=>a?`split_${a}`:""),[a]),[y,v]=t().useState(!1),[x,E]=t().useState(m(l)),C=t().useRef(0);De((()=>{y?(C.current="vertical"===n?h.current.offsetHeight:h.current.offsetWidth,null==s||s(f(x))):(null==d||d(f(x)),localStorage.setItem(b,x),I(b,x))}),[y]),t().useEffect((()=>{S()}),[]);const S=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(m(e)):w(b).then((e=>{localStorage.setItem(b,m(e||l)),S()})).catch((()=>{}))},w=async e=>{const t=null==u?void 0: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=null==u?void 0:u.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},N=t().useMemo((()=>({splitRef:p,direction:n,dragging:y})),[n,y]),T=[];t().Children.map(e.children,(e=>{var t;te(e)&&!ne(e)&&"QmSplitPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&T.push(e)}));const[R,O]=T,A=t().useMemo((()=>[g(R),g(O)]),[R,O]),P={[Se("split")]:!0,vertical:"vertical"===n};return t().createElement(_e.Provider,{value:N},t().createElement("div",{ref:p,className:Ce()(P,r),style:o},t().createElement(Ze,Je({},R.props,{ref:h,offset:x})),t().createElement(Xe,{minValues:A,onDragChange:e=>v(e),onDragging:e=>{const t=C.current+e;E(`${t}px`),c(t)}}),t().createElement(Ze,O.props)))};et.Pane=Ze,et.displayName="QmSplit";const tt=et,nt=require("react-countup");var lt=l.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 l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},at.apply(this,arguments)}function rt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class it extends e.Component{render(){const{size:e,className:n,style:l}=this.props,a=e||this.context.size||"",r=Se("countup"),i={[r]:!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a};return t().createElement(lt(),at({},this.props,{className:Ce()(i,n),style:l}),this.props.children)}}rt(it,"defaultProps",{duration:2}),rt(it,"contextType",i);const ot=it;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 l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},st.apply(this,arguments)}function ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class dt extends e.Component{render(){const{size:e,className:n}=this.props,l=e||this.context.size||"",a=Se("empty"),r={...this.props,image:A.Empty.PRESENTED_IMAGE_SIMPLE},i={[a]:!0,[`${a}--lg`]:"large"===l,[`${a}--sm`]:"small"===l};return t().createElement(A.Empty,st({},r,{className:Ce()(i,n)}))}}ct(dt,"contextType",i),ct(dt,"propTypes",{size:(e,t,n)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")}});const ut=dt;class pt extends e.Component{render(){const{fullHeight:e,style:n={}}=this.props,l={[`${Se("spin")}-full-height`]:e},a={wrapperClassName:Ce()(l),...Z()(this.props,["fullHeight"]),style:{...n,maxHeight:"none"}};return t().createElement(A.Spin,a,this.props.children)}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(pt,"defaultProps",{tip:"Loading...",fullHeight:!1});const ht=pt,mt=require("axios");var ft=l.n(mt);const gt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const n=window.URL.createObjectURL(e);let l=document.createElement("a");l.href=n,l.download=decodeURI(t),l.click(),l=null}};function bt(){return bt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},bt.apply(this,arguments)}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class vt extends e.Component{constructor(){super(...arguments),yt(this,"state",{loading:!1}),yt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{var e,t;const{action:n,beforeDownload:l=ae}=this.props,a=(0,J.isString)(n)?n:await this.getActionUrl();if(!a)return g("Download","参数 `action` 有误!");if(!l(a))return;await this.downloadFile(a),await re(100),null===(e=(t=this.props).onSuccess)||void 0===e||e.call(t),A.message.success(p("qm.download.success"))}catch(e){var n,l;null===(n=(l=this.props).onError)||void 0===n||n.call(l,e),A.message.error(p("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}async downloadFile(e){const{fileName:t,headers:n,params:l,withCredentials:a}=this.props,r=await ft()({url:e,params:l,headers:n,withCredentials:a,responseType:"blob"}),i=r.data,o=r.headers["content-disposition"],s=t||(o?o.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));gt(i,s)}render(){const{size:e}=this.props,{loading:n}=this.state,l=e||this.context.size||"",a=Z()(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t().createElement(A.Button,bt({},a,{size:l,loading:n,onClick:this.downloadHandle}),this.props.children)}}yt(vt,"propTypes",{action:r().oneOfType([r().string,r().shape({api:r().func.isRequired,params:r().object})]),size:(e,t,n)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},fileName:r().string,headers:r().object,withCredentials:r().bool,params:r().object,beforeDownload:r().func,onSuccess:r().func,onError:r().func}),yt(vt,"defaultProps",{icon:t().createElement(we.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),yt(vt,"contextType",i);const xt=vt,Et=require("add-dom-event-listener");var Ct=l.n(Et);const St=require("scroll-into-view-if-needed");var wt=l.n(St);class It extends e.Component{renderLabel(){const{activeKey:e,labels:n,onTabClick:l}=this.props;return n.map(((n,a)=>{const r={item:!0,actived:a===e};return t().createElement("div",{key:a,className:Ce()(r),onClick:e=>l(a,e)},t().createElement("span",null,n))}))}render(){return t().createElement(t().Fragment,null,this.renderLabel())}}const Nt=It;class Tt extends e.Component{render(){const{label:e,showDivider:n,className:l,style:a}=this.props,r={[Se("anchor-item")]:!0};return t().createElement("div",{className:Ce()(r,l),style:a},n&&t().createElement(Te,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Tt,"displayName","QmAnchorItem");const Rt=Tt;function Ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class At extends e.Component{constructor(){super(...arguments),Ot(this,"currentState","ready"),Ot(this,"itemsTotal",void 0),Ot(this,"timer",void 0),Ot(this,"scrollEvent",void 0),Ot(this,"scrollRef",(0,e.createRef)()),Ot(this,"state",{activeKey:0}),Ot(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),Ot(this,"onTabClickHandle",(e=>{const{labelList:t=[]}=this.props,n=this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e];n&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),wt()(n,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),Ot(this,"SCROLL_TO_ITEM",(e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)}))}get __is_conf(){var e;return!(null===(e=this.props.labelList)||void 0===e||!e.length)}componentDidMount(){this.scrollEvent=Ct()(this.scrollRef.current,"scroll",(0,J.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}createDistances(){var e;const{labelList:t=[]}=this.props;return(this.__is_conf?t.map((e=>document.getElementById(e.id))):Array.from((null===(e=this.scrollRef.current)||void 0===e?void 0:e.children)||[])).map((e=>((e,t)=>Math.abs(We(e)-We(t)))(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),n=this.createDistances();let l=-1;for(let e=0;e<n.length;e++){const a=n[e],r=n[e+1]||1e4;t>=a-1&&t<r&&(l=e)}return l}render(){const{activeKey:e}=this.state,{size:n,labelWidth:l,tabPosition:a,labelList:r=[],onTabClick:i,className:o,style:s}=this.props,c=n||this.context.size||"",d=Se("anchor"),u={[d]:!0,[`${d}-left`]:"left"===a,[`${d}-top`]:"top"===a,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c},p=[];t().Children.map(this.props.children,(e=>{var t;te(e)&&!ne(e)&&"QmAnchorItem"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&p.push(e)}));const h=this.__is_conf?r.map((e=>e.label)):p.map((e=>e.props.label)),m=this.__is_conf?r.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=h.length,t().createElement("div",{className:Ce()(u,o),style:s},t().createElement("div",{className:Ce()("anchor-nav"),style:{width:l?de(l):""}},t().createElement(Nt,{activeKey:e,labels:h,onTabClick:(e,t)=>{this.onTabClickHandle(e),null==i||i({label:h[e],id:m[e]},t)}})),t().createElement("div",{ref:this.scrollRef,className:Ce()("anchor-container")},this.__is_conf?this.props.children:p))}}Ot(At,"Item",Rt),Ot(At,"propTypes",{size:(e,t,n)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},labelWidth:(e,t,n)=>{if("number"!=typeof(l=e[t])&&void 0!==l&&!["px","rem","em","vw","vh","%"].some((e=>l.endsWith(e)))&&!l.startsWith("calc"))return f("Anchor","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.");var l},labelList:r().arrayOf(r().shape({id:r().string,label:r().string}))}),Ot(At,"defaultProps",{tabPosition:"left"}),Ot(At,"contextType",i);const Pt=At,Ft=function(e){if(!t().isValidElement(e))return null;for(var n=arguments.length,l=new Array(n>1?n-1:0),a=1;a<n;a++)l[a-1]=arguments[a];return t().cloneElement(e,...l)};class Ht extends e.Component{render(){return t().createElement(A.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Ht,"displayName","QmTabPane");const kt=Ht;function Lt(){return Lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Lt.apply(this,arguments)}function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class $t extends e.Component{render(){const{size:e,className:n,authConfig:l}=this.props,a=e||this.context.size||"",r=Se("tabs"),i={[r]:!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a},o={...Z()(this.props,["authConfig"]),size:a},s=[];if(t().Children.map(this.props.children,(e=>{var t;te(e)&&!ne(e)&&"QmTabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&s.push(e)})),l){const{fieldList:e=[]}=l||{};for(let t=0;t<s.length;t++){const n=s[t],l=e.find((e=>e.dataIndex===n.key)),{visible:a=1,disabled:r}=l||{};a?r&&(s[t]=Ft(n,{disabled:!0})):(s.splice(t,1),t--)}}return t().createElement(A.Tabs,Lt({},o,{className:Ce()(i,n)}),s)}}qt($t,"TabPane",kt),qt($t,"contextType",i),qt($t,"defaultProps",{tabBarGutter:10});const _t=$t;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 l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Dt.apply(this,arguments)}function Kt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Vt extends e.Component{constructor(){super(...arguments),Kt(this,"titleRef",t().createRef()),Kt(this,"$drawer",null),Kt(this,"opened",!1),Kt(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),Kt(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;var n,l;e?(this.opened=!0,(0,J.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(null===(n=(l=this.props).onClosed)||void 0===n||n.call(l),this.setState({fullscreen:!1}))})),Kt(this,"toggleHandle",(()=>{this.$drawer=Ge(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{var e,t;null===(e=(t=this.props).onFullChange)||void 0===e||e.call(t,this.state.fullscreen)}))})),Kt(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),Kt(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:n,loading:l,destroyOnClose:a}=this.props,{fullscreen:r}=this.state;n&&n!==e.visible&&(!a&&this.opened||(0,J.isUndefined)(l)&&this.setState({spinning:!0})),this.$drawer&&r!==t.fullscreen&&Be(this.$drawer,r?{width:"100%"}:{width:de(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{showFullScreen:n}=this.props;return t().createElement(t().Fragment,null,t().createElement("span",{ref:this.titleRef,className:Ce()("text")},this.props.title),n&&t().createElement("span",{className:Ce()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:n}=this.state,{size:l,className:a,loading:r,maskClosable:i,onClose:o}=this.props,s=this.context.global,c=l||this.context.size||"",d=Se("drawer"),u={[d]:!0,[`${d}--lg`]:"large"===c,[`${d}--sm`]:"small"===c};return t().createElement(A.Drawer,Dt({},Z()(this.props,["size","showFullScreen","loading","maskClosable","onClosed"]),{maskClosable:i??(null==s?void 0:s.maskClosable)??!1,className:Ce()(u,a),title:this.renderTitle(),footer:null,onClose:o,afterVisibleChange:this.afterVisibleChange}),this.props.children,(r||n||e)&&t().createElement(ht,{spinning:!0,className:Ce()(`${d}-spin`)}))}}Kt(Vt,"contextType",i),Kt(Vt,"propTypes",{size:(e,t,n)=>{if(!b(e[t]||""))return f("Drawer","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},spinning:r().bool}),Kt(Vt,"defaultProps",{width:"72%",showFullScreen:!0,destroyOnClose:!0,footer:null});const Mt=Vt;function jt(){return jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},jt.apply(this,arguments)}function zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ut="10vh";var Bt;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small"}(Bt||(Bt={}));class Wt extends e.Component{constructor(){super(...arguments),zt(this,"$event",null),zt(this,"draggleRef",t().createRef()),zt(this,"opened",!1),zt(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),zt(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=Ct()(document.body,"mousedown",ze))})),zt(this,"removeMouseDownEvent",(()=>{var e;this.$event&&(null===(e=this.$event)||void 0===e||e.remove(),this.$event=null)})),zt(this,"onStart",((e,t)=>{const{clientWidth:n,clientHeight:l}=window.document.documentElement,a=this.draggleRef.current.getBoundingClientRect();a&&this.setState({bounds:{left:-a.left+t.x,right:n-(a.right-t.x)-1,top:-a.top+t.y,bottom:l-(a.bottom-t.y)-1}})})),zt(this,"toggleHandle",(e=>{const t=Ge(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body"),{height:l}=this.props,{fullscreen:a}=this.state;a?(Be(t,{width:de(this.props.width||"60%"),height:"auto",top:Ut}),Be(n,{height:l?de(l):this.defaultHeight,maxHeight:"auto"===l?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(n,{height:`calc(100vh - ${Bt[this.$size]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{var e,t;null===(e=(t=this.props).onFullChange)||void 0===e||e.call(t,this.state.fullscreen)}))})),zt(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;null==e||e(),this.setState({fullscreen:!1})})),zt(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),zt(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${Ut} - ${Ut} - ${Bt[this.$size]}px)`}componentDidUpdate(e,t){const{visible:n,loading:l,stopMouseDownEvent:a,destroyOnClose:r}=this.props,{fullscreen:i}=this.state;if(n&&n!==e.visible){if(!r&&this.opened||(0,J.isUndefined)(l)&&this.setState({spinning:!0}),a&&this.addMouseDownEvent(),!r&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,J.isUndefined)(l)&&this.setState({spinning:!1})}),400)}n||this.removeMouseDownEvent(),i!==t.fullscreen&&(i?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:n}=this.state,{showFullScreen:l}=this.props;return t().createElement("div",{onMouseOver:()=>{n&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},t().createElement("span",{className:Ce()("text")},this.props.title),l&&t().createElement("span",{className:Ce()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:n,fullscreen:l,disabled:a,bounds:r,position:i}=this.state,{height:o,className:s,loading:c,draggable:d,maskClosable:u,bodyStyle:p,onClose:h}=this.props,m=this.context.global,f=Se("modal"),g={height:o?de(o):this.defaultHeight,maxHeight:"auto"===o?this.defaultHeight:"",overflow:"auto"},b={[f]:!0,[`${f}--lg`]:"large"===this.$size,[`${f}--sm`]:"small"===this.$size};return t().createElement(A.Modal,jt({},Z()(this.props,["showFullScreen","loading","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{maskClosable:u??(null==m?void 0:m.maskClosable)??!1,className:Ce()(b,s),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},g,p),onCancel:h,afterClose:this.afterVisibleChange,modalRender:e=>t().createElement(Ve(),{disabled:!d||a||l,bounds:r,position:i,onStart:(e,t)=>this.onStart(e,t)},t().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(c||n||e)&&t().createElement(ht,{spinning:!0,className:Ce()(`${f}-spin`)}))}}zt(Wt,"contextType",i),zt(Wt,"propTypes",{size:(e,t,n)=>{if(!b(e[t]||""))return f("Modal","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},spinning:r().bool}),zt(Wt,"defaultProps",{width:"60%",showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Ut}});const Gt=Wt,Yt=require("memoize-one");var Xt=l.n(Yt);const Qt=(0,e.createContext)(void 0),Zt=require("resize-observer-polyfill");var Jt=l.n(Zt);const en=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},tn=function(e,t){!ee&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(Jt())(en),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},nn=function(e,t){var n;e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||null===(n=e.__ro__)||void 0===n||n.disconnect())},ln=80,an="1",rn="0",on=400,sn=["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"],cn={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let dn,un,pn;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(dn||(dn={})),function(e){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"}(un||(un={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(pn||(pn={}));const hn={items:r().arrayOf(r().shape({type:r().string.isRequired,fieldName:r().string.isRequired})),initialValues:r().object,initialExtras:r().object,layout:r().oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!b(e[t]||""))return f("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:r().number,customClass:r().string,compactMode:r().bool,labelWidth:r().oneOfType([r().number,r().string]),labelAlign:r().oneOf(["left","right"]),labelWrap:r().bool,formType:r().oneOf(["default","search","onlyShow"]),disabled:r().bool,uniqueKey:r().string,defaultRows:r().number,defaultExpand:r().bool,searchButtonCols:r().number,scrollToFirstError:r().bool,authConfig:r().object,isAutoFocus:r().bool,isCollapse:r().bool,isFieldsDefine:r().bool,isSearchBtn:r().bool,isSubmitBtn:r().bool,fieldsChange:r().func,onValuesChange:r().func,onFieldsChange:r().func,onFinish:r().func,onFinishFailed:r().func,onReset:r().func,onCollapse:r().func},mn={layout:"horizontal",labelWidth:ln,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:le,onFieldsChange:le,onFinish:le,onFinishFailed:le,onReset:le,onCollapse:le,onFormItemsChange:le},fn=(e,t)=>{if(!e)return null;if(t===un.week){const t=e.match(/^(\d{4})-(\d+)/);return t?s()().year(Number(t[1])).week(Number(t[2])):null}if(t===un.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?s()().year(Number(t[1])).quarter(Number(t[2])):null}return s()(e,t)},gn=(e,t)=>e?s()(e).format(t):"",bn=e=>""===e||null==e,yn=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const n=t.split("|");let l="";for(let t=0,a=n.length;t<a;t++)l+=(e[n[t].trim()]??"")+(t===a-1?"":" | ");return l},vn=(e,t,n)=>{for(const l in n)if(Object.keys(t).includes(l)&&t[l]!==n[l])if(t[l].includes("|")){const a=t[l].split("|"),r=n[l].split("|");a.forEach(((t,n)=>e[t]=e[r[n]]))}else e[t[l]]=e[n[l]]},xn=(e,t,n)=>{for(const l in n)if(Object.keys(t).includes(l)&&t[l]!==n[l])if(t[l].includes("|")){const a=t[l].split("|"),r=n[l].split("|");a.forEach(((t,n)=>e[t]=e[r[n]]))}else e[t[l]]=e[n[l]]},En=(e,t,n)=>e.map((e=>{const l={value:e[t],text:e[n]};return e.disabled&&(l.disabled=!0),e.isLeaf&&(l.isLeaf=!0),!(0,J.isUndefined)(e.selectable)&&(l.selectable=e.selectable),Array.isArray(e.children)&&(l.children=En(e.children,t,n)),l})),Cn=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=Cn(n.children,t);if(e)return e}}return null},Sn=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const l=[];return e.forEach((e=>{e.value==t.split(",")[n]&&l.push(e),Array.isArray(e.children)&&l.push(...Sn(e.children,t,n+1))})),l},wn=(e,t,n,l)=>{var a;const r={};return r.filters=(null===(a=e.filters)||void 0===a?void 0:a.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})))||[],r.table={columns:e.columns||[],rowKey:e.valueName},r.fieldsDefine={valueKey:e.valueKey||e.valueName},r.fieldAliasMap={[l?"textKey":t]:e.displayName[0],[l?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(r.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(r.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&&(r.echoRequest.fieldAliasMap={[l?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(r.tree={fetch:{api:n(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{var t;const n={};return null===(t=e.treeSetting.relativeTable)||void 0===t||t.forEach((e=>n[e.tableField]=e.treeField)),n}}),e.emmediateSetting&&(r.columns=e.emmediateSetting.columns,r.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),r},In=require("react-sortablejs");function Nn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Tn extends e.Component{get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}constructor(e){super(e),Nn(this,"linkRef",t().createRef()),Nn(this,"state",{visible:!1}),this.initLocalfields()}async getTableFieldsConfig(e){const t=this.context.global,n=null==t?void 0:t.getComponentConfigApi;if(n)try{const t=await n({key:e});if(200===t.code)return t.data}catch(e){}}async saveTableColumnsConfig(e,t){const n=this.context.global,l=null==n?void 0:n.saveComponentConfigApi;if(l)try{await l({[e]:t})}catch(e){}}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getTableFieldsConfig(this.formUniqueKey).then((e=>{if(!e)return this.setLocalFields(this.props.items);localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()})).catch((()=>{})),e?(0,J.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:n}=t,l=e.find((e=>e.fieldName===n));return l?((0,J.isUndefined)(l.hidden)||(t.hidden=l.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,J.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),n=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,J.isEqual)(t,n)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveTableColumnsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;null==t||t([...e])}popup(){const{items:e}=this.props;return t().createElement(Qt.Consumer,null,(n=>{const l=n.$$form;return t().createElement("div",{className:Ce()("ant-dropdown-menu","fields-list")},t().createElement(In.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const n=t.map((e=>e.fieldName)),a=e.map((e=>e.fieldName));(0,J.isEqual)(n,a)||(l.setExpandHandle(!0),this.changeHandle(t),this.setLocalFields(t))}},e.map((n=>{var a;return t().createElement("li",{key:n.fieldName,className:"item",style:n.noAuth?{display:"none"}:void 0},t().createElement(A.Checkbox,{disabled:(null===(a=n.rules)||void 0===a?void 0:a.findIndex((e=>e.required)))>-1,checked:!n.hidden,onChange:t=>{const{checked:l}=t.target;n.hidden=!l,this.changeHandle(e),this.setLocalFields(e)}}),t().createElement(we.HolderOutlined,{className:"handle",title:p("qm.form.draggable")}),t().createElement("span",{className:"title"},l.getFormItemLabel(n.label||"")))}))))}))}render(){const{visible:e}=this.state,n=Se("form-fields-filter");return t().createElement(Qt.Consumer,null,(l=>{const{$size:a}=l.$$form,r={[n]:!0,[`${n}--lg`]:"large"===a,[`${n}--sm`]:"small"===a};return t().createElement(A.Dropdown,{overlayClassName:Ce()(r),overlay:this.popup(),trigger:["click"],placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,visible:e,onVisibleChange:e=>{this.setState({visible:e})}},t().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},t().createElement(we.UnorderedListOutlined,null)))}))}}Nn(Tn,"contextType",i);const Rn=Tn,On=e=>{const{value:n,bordered:l}=e;return t().createElement(A.Input,{value:n,title:n,bordered:l,readOnly:!0})};On.displayName="FormItemView";const An=On;function Pn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fn=t().forwardRef(((e,n)=>{const{$$form:l}=t().useContext(Qt),{value:a,onChange:r,onValuesChange:i}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:h,disabled:m,onBlur:f=le,onEnter:g=le}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:C,toTrim:S,autoComplete:w,secretType:I}=o,N=I&&(h||m),T=e=>{null==r||r(e),i(e)},R=v?A.Input.Password:A.Input,O=N?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e}(a,I):a;return l.isOnlyShow?t().createElement(An,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(O),bordered:d}):t().createElement(R,{ref:n,value:O,autoComplete:v?"new-password":w,placeholder:c,style:s,title:v?"":O,prefix:b,suffix:y,maxLength:x,bordered:d,allowClear:u,readOnly:h,disabled:m,onBlur:t=>{let n=t.target.value??"";if(S){const e=n.trim();n!==e&&(n=e,T(n))}(t=>{const{onBlur:n}=e;null==n||n(t)})(n),f(n)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),l.isFilterType&&l.SUBMIT_FORM()}},onChange:e=>{let t=e.target.value;(0,J.isRegExp)(E)&&(t=E.test(t)?t:a??""),C&&(t=t.toUpperCase()),T(t)}})}));Fn.displayName="VInput";class Hn extends e.Component{constructor(){super(...arguments),Pn(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(h)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Fn,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(r,t)}}))),u&&t().createElement(A.Col,null,e.renderFormItemButton(r,u)),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}Pn(Hn,"contextType",Qt);const kn=Hn,Ln=e=>{const{$$form:n}=t().useContext(Qt),{value:l=[],onChange:a,onValuesChange:r}=e,{options:i={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{prefix:h,suffix:m,maxLength:f}=i,g=e=>{const t=e.every((e=>!e))?[]:e;null==a||a(t),r(t,b(t))},b=e=>e.join(" - ");return n.isOnlyShow?t().createElement(An,{value:b(l),bordered:s}):t().createElement(A.Input.Group,null,t().createElement(A.Input,{value:l[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:o[0],prefix:h,suffix:m,maxLength:f,allowClear:c,bordered:s,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([t,l[1]])}}),t().createElement(A.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t().createElement(A.Input,{value:l[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:o[1],prefix:h,suffix:m,maxLength:f,bordered:s,allowClear:c,readOnly:d,disabled:u,onChange:e=>{const{value:t}=e.target;g([l[0],t])}}))};class qn extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,s),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(o)},required:e.getFormItemRequired(u)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Ln,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(r,t)}}))),c&&t().createElement(A.Col,{flex:de(c.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...c}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(qn,"contextType",Qt);const $n=qn,_n=require("big.js");var Dn=l.n(_n);function Kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Vn=t().forwardRef(((e,n)=>{const{$$form:l}=t().useContext(Qt),{value:a,onChange:r,onValuesChange:i}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:d=!0,readOnly:u,disabled:h,onBlur:m=le,onEnter:f=le}=e.option,{step:g=1,min:b,max:y,precision:v,stringMode:x,textAlign:E="left",controls:C=!0,formatter:S,parser:w}=o,I=t().useRef(a),N=e=>{const t=bn(e)?"":(0,J.isNumber)(e)?e.toFixed(v):new(Dn())(e).toFixed(v);return"function"==typeof S?S(t):t},T={[E]:!0,controls:C};return l.isOnlyShow?t().createElement(An,{value:N(a),bordered:d}):t().createElement(A.InputNumber,{ref:n,value:a,className:Ce()(T),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:C,precision:v,stringMode:x,formatter:S,parser:w,bordered:d,readOnly:u,disabled:h,onBlur:()=>{ie((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(I.current),m(I.current)}))},onKeyUp:e=>{13===e.keyCode&&f(a)},onChange:e=>{const t=e??"";!x&&t.toString().replace(/^-|\./g,"").length>17||(e=>{I.current=e,null==r||r(e),i(e,N(e))})(t)}})}));Vn.displayName="VInputNumber";class Mn extends e.Component{constructor(){super(...arguments),Kn(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(h)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Vn,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(r,n)}}))),u&&t().createElement(A.Col,null,e.renderFormItemButton(r,u)),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}Kn(Mn,"contextType",Qt);const jn=Mn,zn=e=>{const{$$form:n}=t().useContext(Qt),{value:l=[],onChange:a,onValuesChange:r}=e,{options:i={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:d,disabled:u}=e.option,{step:h=1,min:m=0,max:f,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=i,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),C(e)},C=e=>{const t=e.every((e=>null===e))?[]:[...e];null==a||a(t),r(t,S(t))},S=e=>bn(e)?"":e.map((e=>bn(e)?"":Number(e).toFixed(y))),w={[g]:!0,controls:b};return n.isOnlyShow?t().createElement(An,{value:S(l),bordered:s}):t().createElement(A.Input.Group,null,t().createElement(A.InputNumber,{value:l[0],className:Ce()("site-input-left",w),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:o[0],step:h,min:m,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{C([e,l[1]])},onBlur:()=>{E(l)}}),t().createElement(A.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:u,readOnly:!0}),t().createElement(A.InputNumber,{value:l[1],className:Ce()("site-input-right",w),style:{width:"calc(50% - 5px)"},placeholder:o[1],step:h,min:m,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:d,disabled:u,onChange:e=>{C([l[0],e])},onBlur:()=>{E(l)}}))};class Un extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,s),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(o)},required:e.getFormItemRequired(u)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(zn,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(r,t)}}))),c&&t().createElement(A.Col,{flex:de(c.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...c}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Un,"contextType",Qt);const Bn=Un;let Wn;function Gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Wn||(Wn={}));const{Search:Yn}=A.Input;class Xn extends e.Component{constructor(e){var t;super(e),t=this,Gn(this,"searchHelper",void 0),Gn(this,"alias",void 0),Gn(this,"extras",void 0),Gn(this,"deriveParams",void 0),Gn(this,"valueKey",void 0),Gn(this,"_is_change",!1),Gn(this,"_record",void 0),Gn(this,"_prevValue",void 0),Gn(this,"state",{visible:!1,loading:!1}),Gn(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Gn(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t}=this.props.option;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const{fieldAliasMap:n,extraAliasMap:l,fieldsDefine:a}=this.searchHelper;if(n||g("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof n?n():n||{},this.extras="function"==typeof l?l():l||{},a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(t)||g("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Gn(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),Gn(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),Gn(this,"getItemText",(async()=>{await this.props.waiting();const e=this.getItemValue();if(e===this._prevValue)return;this._prevValue=e;const{fetchApi:t,params:n={},formatter:l=(e=>e),dataKey:a,callback:r,fieldAliasMap:i,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof i?i():i||{},c="function"==typeof o?o():o||{},{value:d}=this.props;if(t&&!d&&e){this.setState({loading:!0});try{const i=await t(l({...n,key:e}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,a)??[];if(e[0]){const t=e[0];s&&vn(t,this.alias,s),c&&xn(t,this.extras,c),this._record=t,this.setFieldsValue(t),null==r||r([t])}}}catch(e){}this.setState({loading:!1})}})),Gn(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),Gn(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:n}=this.searchHelper,l=""!==e?e:void 0,a="function"==typeof n?n():n??[],r={[t]:l};return a.forEach((e=>r[e]=l)),r})),Gn(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:l=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(r,i)=>{const o=(0,J.merge)({},this.getLastedSearchHelper().table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!l(o))return i();this.setState({loading:!0});const e=await t.fetch.api(o);if(ie((()=>this.setState({loading:!1}))),200===e.code)return r(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}i()}))})),Gn(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const l in this.alias){const a=yn(e,this.alias[l]);void 0!==a&&(t.SET_FIELDS_VALUE({[l]:a}),l===n&&t.setViewValue(n,a))}for(const n in this.extras){const l=yn(e,this.extras[n]);void 0!==l&&t.SET_FIELDS_EXTRA({[n]:l})}})),Gn(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;const{fieldName:l}=t.props.option,a=e.filter((e=>{var a;return null===(a=yn(e,t.alias[l]))||void 0===a?void 0:a.toString().toLowerCase().includes(n.toLowerCase())}));if(1===a.length)return t.closeSearchHelper(a[0]);t.openSearchHelper(n)})),Gn(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:n}=this.context,{beforeOpen:l}=this.searchHelper,a=(l??ae)(n.state.formData);null!=a&&a.then?a.then((()=>{this.todoOpen(e),null==t||t()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),null==t||t())})),Gn(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const l in this.alias)l!==n&&t.SET_FIELDS_VALUE({[l]:yn(e,this.alias[l])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:yn(e,this.extras[n])});this._record=e;const l=yn(e,this.alias[n]);this.triggerChange(l),this.searchHelperChangeHandle(l);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{this.focus(),setTimeout((()=>null==a?void 0:a(e)),200)}))})),Gn(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,(()=>{this.focus()}))})),Gn(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});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),Gn(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,null==t||t(e,this._record)})),Gn(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e)})),Gn(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;null==t||t(e)})),Gn(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemText()}componentDidUpdate(){this.getItemText()}render(){const{$$form:e}=this.context,{visible:n,loading:l}=this.state,{value:a}=this.props,{type:r,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:n,title:p("qm.searchHelper.text"),width:s.width??"60%",loading:!1,bodyStyle:{paddingBottom:`${Wn[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getLastedSearchHelper(),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?t().createElement(An,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(Yn,{ref:e=>this[`${r}_Ref`]=e,value:a,title:a,loading:l,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:h,readOnly:m,disabled:f,onBlur:e=>{const{value:t}=e.target,{onlySelect:l=!0,table:a}=this.searchHelper;var r;this.triggerBlur(t),this._is_change&&!n&&(t?l?null!=a&&null!==(r=a.fetch)&&void 0!==r&&r.api&&this.getSearchHelperTableData(t).then((e=>this.resetSearchHelperValue(e,t))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(t):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:t}=e.target;!n&&this.openSearchHelper(t)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):ie((()=>this.clearSearchHelperValue())))}}),t().createElement(Gt,v,t().createElement(Xs,x)))}}Gn(Xn,"contextType",Qt);class Qn extends e.Component{constructor(e,t){let{$$form:n}=t;super(e),Gn(this,"promiseRef",void 0),Gn(this,"searchRef",void 0),Gn(this,"state",{searchHelper:{}}),Gn(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Gn(this,"getHelperConfig",(e=>{var t,n;const{global:l}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==l||null===(t=l.searchHelper)||void 0===t||!t.getServerConfig||null==l||null===(n=l.searchHelper)||void 0===n||!n.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const n=await l.searchHelper.getServerConfig({searchHelperId:a});if(200===n.code){const t=wn(Object.assign({},n.data,r),i,l.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:l,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(a),className:Ce()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Xn,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(i,t)}}))),p&&t().createElement(A.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(A.Col,{flex:de(u.labelWidth||ln)},e.renderFormItemExtra({fieldName:i,...u}))))}}Gn(Qn,"contextType",Qt);const Zn=Qn;function Jn(){return Jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Jn.apply(this,arguments)}function el(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const tl=n=>{class l extends e.Component{constructor(){var e;super(...arguments),e=this,el(this,"startClick",void 0),el(this,"event1",null),el(this,"event2",null),el(this,"$el",null),el(this,"omitClassNames",[]),el(this,"state",{clickOutside:!1}),el(this,"mousedownHandler",(e=>{this.startClick=e})),el(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),el(this,"documentHandler",((e,t)=>{var n,l;const a=e.target,r=null==t?void 0:t.target,i=!a||!r,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(a))||(null===(l=this.$el)||void 0===l?void 0:l.contains(r)),s=this.$el===a,c=this.omitClassNames.map((e=>document.querySelector(e))),d=c.some((e=>null==e?void 0:e.contains(a)))||c.includes(r);let u;u=!(i||o||s||d),this.setState({clickOutside:u})})),el(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),el(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=Ct()(document,"mousedown",this.mousedownHandler),this.event2=Ct()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){var e,t;null===(e=this.event1)||void 0===e||e.remove(),null===(t=this.event2)||void 0===t||t.remove()}render(){const{forwardedRef:e}=this.props,{clickOutside:l}=this.state;return t().createElement(n,Jn({ref:e},this.props,{clickOutside:l,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return el(l,"displayName",`OutsideClick(${n.displayName||n.name})`),t().forwardRef(((e,n)=>t().createElement(l,Jn({},e,{forwardedRef:n}))))},nl=require("rc-trigger");var ll,al,rl=l.n(nl);function il(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let ol=tl((al=class extends e.Component{constructor(e){var n;super(e),n=this,il(this,"searchHelper",void 0),il(this,"alias",void 0),il(this,"_records",[]),il(this,"searchRef",t().createRef()),il(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),il(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),il(this,"getLastedSearchHelper",(()=>{const e=Object.assign({},this.searchHelper,this.props.option.searchHelper);var t;return e.table&&!e.table.rowKey&&(e.table.rowKey=null===(t=this.alias)||void 0===t?void 0:t.valueKey),e})),il(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),il(this,"setItemList",(e=>{this.setState({itemList:e})})),il(this,"setRecords",(e=>{this._records=e})),il(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),il(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),il(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,l=(n??ae)(t.state.formData);null!=l&&l.then?l.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==l&&(this.setVisible(!0),null==e||e())})),il(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:l}=n.alias;n.setRecords((0,J.uniqBy)([...n._records.filter((e=>t.includes(e[l]))),...e],l));const a=n.recordsToDict();n.setItemList(a),n.triggerChange(a.map((e=>e.value)));const{closed:r}=n.searchHelper;n.setVisible(!1,(()=>{setTimeout((()=>null==r?void 0:r(n._records)),200)}))})),il(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:l}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[l])))),null==t||t(e),n(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:l=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(n,l),l)||(0,J.isEqual)(l,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){var e;if(await this.props.waiting(),!this.searchHelper)return;const{textKey:t,valueKey:n}=this.alias,{fetchApi:l,params:a={},formatter:r=(e=>e),dataKey:i,callback:o,fieldAliasMap:s}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},c="function"==typeof s?s():s||{},{value:d}=this.props;if(l&&!se(d)){this.setState({loading:!0});try{const e=await l(r({...a,keys:d}));if(200===e.code){let l=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[];l.forEach((e=>{null!=c&&c.valueKey&&c.valueKey!==n&&(e[n]=e[c.valueKey]),null!=c&&c.textKey&&c.textKey!==t&&(e[t]=e[c.textKey])})),l=l.filter((e=>d.includes(e[n])));const a=l.map((e=>({value:e[n],text:e[t]})));this.setRecords(l),this.setItemList(a),this.setViewValue(d),null==o||o(l)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n;const{$$form:l}=this.context,{visible:a,visible2:r,loading:i,itemList:o}=this.state,{value:s}=this.props,{fieldName:c,options:d={},searchHelper:u={},style:h={},placeholder:m=p("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:b,disabled:y}=this.props.option,{collapseTags:v,maxTagTextLength:x}=d,E={visible:a,title:p("qm.searchHelper.text"),width:u.width??"60%",loading:!1,bodyStyle:{paddingBottom:`${Wn[l.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C={...this.getLastedSearchHelper(),size:l.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${c}`:"",initialValue:(0,J.merge)({},u.initialValue),defaultSelectedKeys:s,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},S=o.filter((e=>null==s?void 0:s.includes(e.value))),w=t().createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),I=this.searchRef.current?this.searchRef.current.offsetWidth:300,N=Se("form-multiple-search-helper"),{size:T}=l.context,R={[N]:!0,[`${N}--lg`]:"large"===T,[`${N}--sm`]:"small"===T};null===(e=(n=this.props).setOmitClassNames)||void 0===e||e.call(n,[`.${N}`]);const O=o.filter((e=>null==s?void 0:s.includes(e.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t().createElement(An,{value:O,bordered:f}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(rl(),{popupVisible:!y&&r,popup:w,popupClassName:Ce()(R),popupStyle:{minWidth:I},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:cn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(A.Select,{mode:"multiple",maxTagCount:v?"responsive":void 0,maxTagTextLength:x,open:!1,value:s,placeholder:m,loading:i,bordered:f,allowClear:g,disabled:y,style:{width:"100%",...h},title:O,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;var n,l;t.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(l=this.props).setCurrentElement)||void 0===n||n.call(l,t),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},o.map((e=>t().createElement(A.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(A.Button,{className:"ant-input-search-button",disabled:y,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(Gt,E,t().createElement(Xs,C)))}},il(al,"contextType",Qt),ll=al))||ll;class sl extends e.Component{constructor(e,t){let{$$form:n}=t;super(e),il(this,"promiseRef",void 0),il(this,"state",{searchHelper:{}}),il(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),il(this,"getHelperConfig",(e=>{var t,n;const{global:l}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==l||null===(t=l.searchHelper)||void 0===t||!t.getServerConfig||null==l||null===(n=l.searchHelper)||void 0===n||!n.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const n=await l.searchHelper.getServerConfig({searchHelperId:a});if(200===n.code){const t=wn(Object.assign({},n.data,r),i,l.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:l,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(a),className:Ce()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ol,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,l)=>{f(t,l),e.setViewValue(i,n)}}))),p&&t().createElement(A.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(A.Col,{flex:de(u.labelWidth||ln)},e.renderFormItemExtra({fieldName:i,...u}))))}}il(sl,"contextType",Qt);const cl=sl;function dl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:ul}=A.Input;class pl extends e.Component{constructor(e){super(e),dl(this,"searchHelper",void 0),dl(this,"alias",void 0),dl(this,"extras",void 0),dl(this,"valueKey",void 0),dl(this,"_record",void 0),dl(this,"_prevValue",void 0),dl(this,"state",{visible:!1,loading:!1}),dl(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),dl(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t}=this.props.option;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const{fieldAliasMap:n,extraAliasMap:l,fieldsDefine:a}=this.searchHelper;if(n||g("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof n?n():n||{},this.extras="function"==typeof l?l():l||{},a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(t)||g("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),dl(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),dl(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),dl(this,"getItemText",(async()=>{await this.props.waiting();const e=this.getItemValue();if(e===this._prevValue)return;this._prevValue=e;const{fetchApi:t,params:n={},formatter:l=(e=>e),dataKey:a,fieldAliasMap:r,extraAliasMap:i}=this.searchHelper.echoRequest||{},o="function"==typeof r?r():r||{},s="function"==typeof i?i():i||{},{value:c}=this.props;if(t&&!c&&e){this.setState({loading:!0});try{const r=await t(l({...n,key:e}));if(200===r.code){const e=Array.isArray(r.data)?r.data:(0,J.get)(r.data,a)??[];if(e[0]){const t=e[0];o&&vn(t,this.alias,o),s&&xn(t,this.extras,s),this._record=t,this.setFieldsValue(t)}}}catch(e){}this.setState({loading:!1})}})),dl(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const l in this.alias){const a=yn(e,this.alias[l]);t.SET_FIELDS_VALUE({[l]:a}),l===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:yn(e,this.extras[n])})})),dl(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,l=(n??ae)(t.state.formData);null!=l&&l.then?l.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==l&&(this.setVisible(!0),null==e||e())})),dl(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const l in this.alias)l!==n&&t.SET_FIELDS_VALUE({[l]:yn(e,this.alias[l])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:yn(e,this.extras[n])});this._record=e;const l=yn(e,this.alias[n]);this.triggerChange(l);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==a?void 0:a(e)),200)}))})),dl(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});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),dl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)})),dl(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;null==t||t(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemText()}componentDidUpdate(){this.getItemText()}render(){const{$$form:e}=this.context,{visible:n,loading:l}=this.state,{value:a=""}=this.props,{type:r,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${Wn[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getLastedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?t().createElement(An,{value:a,bordered:u}):t().createElement(t().Fragment,null,t().createElement(ul,{ref:e=>this[`${r}_Ref`]=e,value:a,title:a,loading:l,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:h,readOnly:m,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"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t().createElement(Gt,v,t().createElement(nc,x)))}}dl(pl,"contextType",Qt);class hl extends e.Component{constructor(e,t){let{$$form:n}=t;super(e),dl(this,"promiseRef",void 0),dl(this,"state",{searchHelper:{}}),dl(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),dl(this,"getHelperConfig",(e=>{var t,n;const{global:l}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==l||null===(t=l.searchHelper)||void 0===t||!t.getServerConfig||null==l||null===(n=l.searchHelper)||void 0===n||!n.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const n=await l.searchHelper.getServerConfig({searchHelperId:a});if(200===n.code){const t=wn(Object.assign({},n.data,r),i,l.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:l,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(a),className:Ce()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(pl,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(i,t)}}))),p&&t().createElement(A.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(A.Col,{flex:de(u.labelWidth||ln)},e.renderFormItemExtra({fieldName:i,...u}))))}}dl(hl,"contextType",Qt);const ml=hl;var fl,gl;function bl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let yl=tl((gl=class extends e.Component{constructor(e){var n;super(e),n=this,bl(this,"searchHelper",void 0),bl(this,"alias",void 0),bl(this,"_records",[]),bl(this,"searchRef",t().createRef()),bl(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),bl(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),bl(this,"getLastedSearchHelper",(()=>{const e=Object.assign({},this.searchHelper,this.props.option.searchHelper);var t;return e.table&&!e.table.rowKey&&(e.table.rowKey=null===(t=this.alias)||void 0===t?void 0:t.valueKey),e})),bl(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),bl(this,"setItemList",(e=>{this.setState({itemList:e})})),bl(this,"setRecords",(e=>{this._records=e})),bl(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),bl(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),bl(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,l=(n??ae)(t.state.formData);null!=l&&l.then?l.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==l&&(this.setVisible(!0),null==e||e())})),bl(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:l}=n.alias;n.setRecords((0,J.uniqBy)([...n._records.filter((e=>t.includes(e[l]))),...e],l));const a=n.recordsToDict();n.setItemList(a),n.triggerChange(a.map((e=>e.value)));const{closed:r}=n.searchHelper;n.setVisible(!1,(()=>{setTimeout((()=>null==r?void 0:r(n._records)),200)}))})),bl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:l}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[l])))),null==t||t(e),n(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:n=[]}=e,{value:l=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(n,l),l)||(0,J.isEqual)(l,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){var e;if(await this.props.waiting(),!this.searchHelper)return;const{textKey:t,valueKey:n}=this.alias,{fetchApi:l,params:a={},formatter:r=(e=>e),dataKey:i,fieldAliasMap:o}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(l&&!se(c)){this.setState({loading:!0});try{const e=await l(r({...a,keys:c}));if(200===e.code){let l=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[];l.forEach((e=>{null!=s&&s.valueKey&&s.valueKey!==n&&(e[n]=e[s.valueKey]),null!=s&&s.textKey&&s.textKey!==t&&(e[t]=e[s.textKey])})),l=l.filter((e=>c.includes(e[n])));const a=l.map((e=>({value:e[n],text:e[t]})));this.setRecords(l),this.setItemList(a),this.setViewValue(c)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n;const{$$form:l}=this.context,{visible:a,visible2:r,loading:i,itemList:o}=this.state,{value:s}=this.props,{fieldName:c,options:d={},searchHelper:u={},style:h={},placeholder:m=p("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:b,disabled:y}=this.props.option,{collapseTags:v,maxTagTextLength:x}=d,E={visible:a,title:p("qm.searchHelper.text"),width:u.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${Wn[l.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C={...this.getLastedSearchHelper(),size:l.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${c}`:"",initialValue:(0,J.merge)({},u.initialValue),defaultSelectedKeys:s,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},S=o.filter((e=>null==s?void 0:s.includes(e.value))),w=t().createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),I=this.searchRef.current?this.searchRef.current.offsetWidth:300,N=Se("form-multiple-tree-table-helper"),{size:T}=l.context,R={[N]:!0,[`${N}--lg`]:"large"===T,[`${N}--sm`]:"small"===T};null===(e=(n=this.props).setOmitClassNames)||void 0===e||e.call(n,[`.${N}`]);const O=o.filter((e=>null==s?void 0:s.includes(e.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t().createElement(An,{value:O,bordered:f}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(rl(),{popupVisible:!y&&r,popup:w,popupClassName:Ce()(R),popupStyle:{minWidth:I},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:cn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(A.Select,{mode:"multiple",maxTagCount:v?"responsive":void 0,maxTagTextLength:x,open:!1,value:s,placeholder:m,loading:i,bordered:f,allowClear:g,disabled:y,style:{width:"100%",...h},title:O,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;var n,l;t.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(l=this.props).setCurrentElement)||void 0===n||n.call(l,t),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},o.map((e=>t().createElement(A.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(A.Button,{className:"ant-input-search-button",disabled:y,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(Gt,E,t().createElement(nc,C)))}},bl(gl,"contextType",Qt),fl=gl))||fl;class vl extends e.Component{constructor(e,t){let{$$form:n}=t;super(e),bl(this,"promiseRef",void 0),bl(this,"state",{searchHelper:{}}),bl(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),bl(this,"getHelperConfig",(e=>{var t,n;const{global:l}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==l||null===(t=l.searchHelper)||void 0===t||!t.getServerConfig||null==l||null===(n=l.searchHelper)||void 0===n||!n.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const n=await l.searchHelper.getServerConfig({searchHelperId:a});if(200===n.code){const t=wn(Object.assign({},n.data,r),i,l.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:l,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(a),className:Ce()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(yl,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,l)=>{f(t,l),e.setViewValue(i,n)}}))),p&&t().createElement(A.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(A.Col,{flex:de(u.labelWidth||ln)},e.renderFormItemExtra({fieldName:i,...u}))))}}bl(vl,"contextType",Qt);const xl=vl;function El(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cl=new Array(2).fill("");class Sl extends e.Component{constructor(e){var t;super(e),t=this,El(this,"searchHelper",void 0),El(this,"alias",void 0),El(this,"_is_change",!1),El(this,"_ceho_data",void 0),El(this,"_records",[]),El(this,"_is_clear",!1),El(this,"state",{visible:!1,loading:!1,itemList:[],textValue:Cl}),El(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props;this.searchHelper=Object.assign({},e,this.props.option.searchHelper);const t=this.searchHelper.fieldAliasMap;t||g("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof t?t():t||{},Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),El(this,"getLastedSearchHelper",(()=>Object.assign({},this.searchHelper,this.props.option.searchHelper))),El(this,"setItemList",(e=>{this.setState({itemList:e})})),El(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),El(this,"setTextValue",(e=>{this.setState({textValue:e})})),El(this,"setRecords",(e=>{this._records=e})),El(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),El(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,null==t||t(e),n(e,this.createViewText(),this._records)})),El(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(Cl),this.triggerChange([])})),El(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:n}=this.alias,l=e.map((e=>({value:e[t],text:e[n]})));this.setRecords(e),this.setItemList(l),this.setTextValue(l.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==a?void 0:a(this._records)),200)}))})),El(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,l=(n??ae)(t.state.formData);null!=l&&l.then?l.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==l&&(this.setVisible(!0),null==e||e())})),El(this,"createFilters",(e=>{const{fieldName:t}=this.props.option;return{[t]:se(e)?void 0:e}})),El(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:l=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(r,i)=>{const o=(0,J.merge)({},this.getLastedSearchHelper().table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!l(o))return i();this.setState({loading:!0});const e=await t.fetch.api(o);if(ie((()=>this.setState({loading:!1}))),200===e.code)return r(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}i()}))})),El(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:n}=t.state,{textKey:l}=t.alias,a=e.filter((e=>{var t;const a=null===(t=e[l])||void 0===t?void 0:t.toString().toLowerCase();return n.some((e=>null==a?void 0:a.includes(e.toLowerCase())))}));if(2===a.length)return t.closeSearchHelper(a);t.openSearchHelper()})),El(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:n=[]}=this.props;(0,J.isEqual)((0,J.intersection)(t,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:l}=this.context,{fieldName:a}=this.props.option;if(!(0,J.isEqual)(l[a],this._ceho_data)&&(this._ceho_data=l[a],this.setItemList(l[a]),n.length)){const e=Cl.map(((e,t)=>{var r;return(null===(r=l[a].find((e=>e.value===n[t])))||void 0===r?void 0:r.text)??""}));this.setTextValue(e)}}async getItemList(){if(await this.props.waiting(),!this.searchHelper)return;const{textKey:e,valueKey:t}=this.alias,{fetchApi:n,params:l={},formatter:a=(e=>e),dataKey:r,fieldAliasMap:i}=this.searchHelper.echoRequest||{},o="function"==typeof i?i():i||{},{value:s}=this.props;if(n&&!se(s)){this.setState({loading:!0});try{const i=await n(a({...l,keys:s}));if(200===i.code){let n=Array.isArray(i.data)?i.data:(0,J.get)(i.data,r)??[];n.forEach((n=>{null!=o&&o.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),null!=o&&o.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t]))).slice(0,2);const l=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(l),this.setTextValue(l.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:n=[]}=this.props,{visible:l,loading:a,textValue:r}=this.state,{fieldName:i,options:o={},searchHelper:s={},placeholder:c=p("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:h}=this.props.option,{onlySelect:m=!0}=this.searchHelper||s,f={visible:l,title:p("qm.searchHelper.text"),width:s.width??"65%",loading:!1,bodyStyle:{paddingBottom:`${Wn[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g={...this.getLastedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(An,{value:r.join(" - "),bordered:d}):t().createElement(t().Fragment,null,t().createElement(A.Input.Group,null,t().createElement(A.Input,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:h,onBlur:e=>{const{value:t}=e.target;var n,a;this._is_change&&!l&&(t?r.every((e=>!!e))&&null!==(n=this.searchHelper.table)&&void 0!==n&&null!==(a=n.fetch)&&void 0!==a&&a.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):r.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;m||(this._is_change=!0,this.setTextValue([t,r[1]]))}}),t().createElement(A.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:h,readOnly:!0}),t().createElement(A.Input.Search,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:a,bordered:d,allowClear:!0,readOnly:u,disabled:h,onBlur:e=>{const{value:t}=e.target;var n,a;this._is_change&&!l&&(t?r.every((e=>!!e))&&null!==(n=this.searchHelper.table)&&void 0!==n&&null!==(a=n.fetch)&&void 0!==a&&a.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):r.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:m||(this._is_change=!0,this.setTextValue([r[0],t]))},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t().createElement(Gt,f,t().createElement(cc,g)))}}El(Sl,"contextType",Qt);class wl extends e.Component{constructor(e,t){let{$$form:n}=t;super(e),El(this,"promiseRef",void 0),El(this,"state",{searchHelper:{}}),El(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),El(this,"getHelperConfig",(e=>{var t,n;const{global:l}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==l||null===(t=l.searchHelper)||void 0===t||!t.getServerConfig||null==l||null===(n=l.searchHelper)||void 0===n||!n.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const n=await l.searchHelper.getServerConfig({searchHelperId:a});if(200===n.code){const t=wn(Object.assign({},n.data,r),i,l.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:l,label:a,tooltip:r,fieldName:i,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(a),className:Ce()(i,c),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(h)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Sl,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,l)=>{m(t,l),e.setViewValue(i,n)}}))),u&&t().createElement(A.Col,null,e.renderFormItemButton(i,u)),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:i,...d}))))}}El(wl,"contextType",Qt);const Il=wl,Nl=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},disabled:s}=e.option,{falseValue:c=rn,trueValue:d=an}=i;return t().createElement(A.Checkbox,{checked:l===d,style:o,disabled:s||n.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{null==a||a(e),r(e,p(e===d?"am.form.trueText":"am.form.falseText"))})(t?d:c)}})};class Tl extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Nl,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(r,n)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Tl,"contextType",Qt);const Rl=Tl;function Ol(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Al=e=>{const{$$form:n}=t().useContext(Qt),{value:l,items:a,onChange:r,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,h=se(p)?a:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t().createElement(An,{value:m(l),bordered:c}):t().createElement(A.Checkbox.Group,{value:l,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{null==r||r(e),i(e,m(e))})(e)}},h.map((e=>t().createElement(A.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Pl extends e.Component{constructor(){super(...arguments),Ol(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const l=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(n=this.props.option.request)||void 0===n?void 0:n.params;(0,J.isEqual)(l,a)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:l,valueKey:a="value",textKey:r="text",callback:i}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,l)??[],n=t.map((e=>({value:e[a],text:e[r]})));this.setState({itemList:n},(()=>null==i?void 0:i(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:l,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(a),className:Ce()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Al,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(i,n)}}))),u&&t().createElement(A.Col,{flex:de(u.labelWidth||ln)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ol(Pl,"contextType",Qt);const Fl=Pl,Hl=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},allowClear:s=!0,readOnly:c,disabled:d}=e.option,{allowHalf:u,count:p=5,tooltips:h}=i;return t().createElement(A.Rate,{value:l,count:p,style:o,allowHalf:u,allowClear:s,tooltips:h,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{var t;null==a||a(e),r(e,(t=e,h?h[Math.ceil(t)-1]:t.toString()))})(e)}})};class kl extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Hl,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(r,n)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(kl,"contextType",Qt);const Ll=kl;function ql(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $l=e=>{const{$$form:n}=t().useContext(Qt),{value:l,items:a,onChange:r,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,h=se(p)?a:p,m=e=>{var t;return(null===(t=h.find((t=>t.value===e)))||void 0===t?void 0:t.text)??""};return n.isOnlyShow?t().createElement(An,{value:m(l),bordered:c}):t().createElement(A.Radio.Group,{value:l,style:{width:"100%",...s},disabled:u||n.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{null==r||r(e),i(e,m(e))})(t)}},h.map((e=>t().createElement(A.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class _l extends e.Component{constructor(){super(...arguments),ql(this,"state",{itemList:[]}),ql(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:l,valueKey:a="value",textKey:r="text",callback:i}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,l)??[],n=t.map((e=>({value:e[a],text:e[r]})));this.setState({itemList:n},(()=>null==i?void 0:i(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const l=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(n=this.props.option.request)||void 0===n?void 0:n.params;(0,J.isEqual)(l,a)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:l,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(a),className:Ce()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(h)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement($l,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(i,n)}}))),u&&t().createElement(A.Col,{flex:de(u.labelWidth||ln)},e.renderFormItemExtra({fieldName:i,...u}))))}}ql(_l,"contextType",Qt);const Dl=_l,Kl=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},disabled:s}=e.option,{falseValue:c=rn,trueValue:d=an}=i;return t().createElement(A.Switch,{checked:l===d,style:o,disabled:s||n.isOnlyShow,checkedChildren:t().createElement(we.CheckOutlined,null),unCheckedChildren:t().createElement(we.CloseOutlined,null),onChange:e=>{(e=>{null==a||a(e),r(e,p(e===d?"am.form.trueText":"am.form.falseText"))})(e?d:c)}})};class Vl extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Kl,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(r,n)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Vl,"contextType",Qt);const Ml=Vl,jl=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:h,onBlur:m=le,onEnter:f=le}=e.option,{showCount:g,maxLength:b,autoSize:y}=i,v=Object.assign({},{minRows:1,maxRows:3},y);return t().createElement(A.Input.TextArea,{value:l,placeholder:s,style:o,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:d,readOnly:u||n.isOnlyShow,disabled:h,onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;null==n||n(t)})(n),m(n)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;f(t)}},onChange:e=>{const{value:t}=e.target;(e=>{null==a||a(e),r(e)})(t)}})};class zl extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(jl,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,t)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(zl,"contextType",Qt);const Ul=zl,Bl=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:c=p("qm.form.datePlaceholder"),bordered:d=!0,allowClear:u=!0,readOnly:h,disabled:m}=e.option,{dateType:f="date",minDateTime:g,maxDateTime:b,shortCuts:y=!0}=i,v=t().createRef(),x=e=>{e&&"date"===f&&(e+=" 00:00:00"),null==a||a(e),r(e,E(e))},E=e=>bn(e)?"":["date","exactdate"].includes(f)?e.slice(0,10):e,C=e=>{let t=gn(s()().subtract(e,"day"),un[f]);"date"===f&&(t=t.slice(0,10)),x(t),v.current.blur(),v.current.focus()};return n.isOnlyShow?t().createElement(An,{value:E(l),bordered:d}):t().createElement(_,{ref:v,style:{width:"100%",...o},picker:dn[f],bordered:d,showToday:!1,showTime:"datetime"===f,allowClear:u,disabled:m,inputReadOnly:h,disabledDate:e=>((e,t)=>{let[n,l]=t;return n&&l?e.isBefore(n,"day")||e.isAfter(l,"day"):n?e.isBefore(n,"day"):!!l&&e.isAfter(l,"day")})(e,[g,b]),renderExtraFooter:y?()=>t().createElement(t().Fragment,null,t().createElement(A.Tag,{color:"processing",onClick:()=>C(0)},p("qm.form.datePickers")[0]),t().createElement(A.Tag,{color:"processing",onClick:()=>C(1)},p("qm.form.datePickers")[1]),t().createElement(A.Tag,{color:"processing",onClick:()=>C(7)},p("qm.form.datePickers")[2]),t().createElement(A.Tag,{color:"processing",onClick:()=>C(30)},p("qm.form.datePickers")[3])):void 0,value:fn(l,un[f]),onChange:(e,t)=>{x(t)}})};class Wl extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Bl,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(r,n)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Wl,"contextType",Qt);const Gl=Wl,Yl=e=>[s()().subtract(e,"day"),s()()],Xl=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.daterangePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:h}=e.option,{dateType:m="date",disableds:f=[!1,!1],minDateTime:g,maxDateTime:b,shortCuts:y=!0}=i,v={[p("qm.form.dateRangePickers")[0]]:Yl(7),[p("qm.form.dateRangePickers")[1]]:Yl(30),[p("qm.form.dateRangePickers")[2]]:Yl(90),[p("qm.form.dateRangePickers")[3]]:Yl(180)},x=e=>bn(e)?"":e.map((e=>["date","exactdate"].includes(m)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t().createElement(An,{value:x(l),bordered:c}):t().createElement(_.RangePicker,{style:{width:"100%",...o},picker:dn[m],bordered:c,showTime:"datetime"===m,allowClear:d,disabled:h?[!0,!0]:f,inputReadOnly:u,disabledDate:e=>((e,t)=>{let[n,l]=t;return n&&l?e.isBefore(n,"day")||e.isAfter(l,"day"):n?e.isBefore(n,"day"):!!l&&e.isAfter(l,"day")})(e,[g,b]),ranges:y?v:void 0,value:se(l)?null:[fn(null==l?void 0:l[0],un[m]),fn(null==l?void 0:l[1],un[m])],onChange:(e,t)=>{(e=>{"date"===m&&(e=e.map(((e,t)=>e?0===t?e+" 00:00:00":e+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),null==a||a(e),r(e,x(e))})(t)}})};class Ql extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Xl,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(r,n)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Ql,"contextType",Qt);const Zl=Ql,Jl=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.timePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:h}=e.option,{timeType:m="hour-minute-second",hourStep:f=1,minuteStep:g=1,secondStep:b=1}=i;return n.isOnlyShow?t().createElement(An,{value:l,bordered:c}):t().createElement(M,{style:{width:"100%",...o},bordered:c,showNow:!0,hourStep:f,minuteStep:g,secondStep:b,allowClear:d,disabled:h,inputReadOnly:u,format:pn[m],value:fn(l,pn[m]),onChange:(e,t)=>{(e=>{const t=gn(e,pn[m]);null==a||a(t),r(t)})(e)}})};class ea extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Jl,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,t)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(ea,"contextType",Qt);const ta=ea,na=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.timerangePlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:h}=e.option,{timeType:m="hour-minute-second",disableds:f=[!1,!1],hourStep:g=1,minuteStep:b=1,secondStep:y=1}=i,v=e=>bn(e)?"":e.join(" - ");return n.isOnlyShow?t().createElement(An,{value:v(l),bordered:c}):t().createElement(M.RangePicker,{style:{width:"100%",...o},bordered:c,showNow:!1,hourStep:g,minuteStep:b,secondStep:y,allowClear:d,disabled:h?[!0,!0]:f,inputReadOnly:u,format:pn[m],value:se(l)?null:[fn(null==l?void 0:l[0],pn[m]),fn(null==l?void 0:l[1],pn[m])],onChange:(e,t)=>{(e=>{const t=[gn(null==e?void 0:e[0],pn[m]),gn(null==e?void 0:e[1],pn[m])];null==a||a(t),r(t,v(t))})(e)}})};class la extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(na,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(r,n)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(la,"contextType",Qt);const aa=la,ra={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"}},ia="阿",oa="鿿",sa=1,ca=2,da=3;let ua,pa=null;function ha(e){return e||null===pa?("object"==typeof Intl&&Intl.Collator?(ua=new Intl.Collator(["zh-Hans-CN","zh-CN"]),pa=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):pa=!1,pa):pa}function ma(e){const t=ra.UNIHANS,n=ra.PINYINS,l=ra.EXCEPTIONS,a={source:e};if(e in l)return a.type=ca,a.target=l[e],a;let r,i=-1;if(e.charCodeAt(0)<256)return a.type=sa,a.target=e,a;if(r=ua.compare(e,ia),r<0)return a.type=da,a.target=e,a;if(0===r)a.type=ca,i=0;else{if(r=ua.compare(e,oa),r>0)return a.type=da,a.target=e,a;0===r&&(a.type=ca,i=t.length-1)}if(a.type=ca,i<0){let n=0,l=t.length-1;for(;n<=l;){i=~~((n+l)/2);const a=t[i];if(r=ua.compare(e,a),0===r)break;r>0?n=i+1:l=i-1}}return r<0&&i--,a.target=n[i],a.target||(a.type=da,a.target=a.source),a}function fa(e){return"string"==typeof e&&ha()?e.split("").map((e=>ma(e))):e}const ga={isSupported:ha,parse:fa,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(ra)})))},genToken:ma,convertToPinyin:(e,t,n)=>fa(e).map((e=>t&&e.type===ca?e.target.toLowerCase():e.target)).join(n||"")},ba={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}};ga.isSupported()&&ba.shouldPatch(ga.genToken)&&ga.patchDict(ba);const ya=ga;function va(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xa(){return xa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},xa.apply(this,arguments)}const{Option:Ea}=A.Select,Ca=e=>{const{$$form:n}=t().useContext(Qt),{value:l,items:a,multiple:r,loading:i,onChange:o,onValuesChange:s}=e,{options:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,readOnly:f,disabled:g}=e.option,{itemList:b=[],filterable:y=!0,listHeight:v=on,collapseTags:x,maxTagTextLength:E,openPyt:C=!0}=c,S=se(b)?a:b,w=e=>{var t;return r?S.filter((t=>null==e?void 0:e.includes(t.value))).map((e=>e.text)).join(","):(null===(t=S.find((t=>t.value===e)))||void 0===t?void 0:t.text)||""};return n.isOnlyShow?t().createElement(An,{value:w(l),bordered:h}):t().createElement(A.Select,xa({value:l,mode:r?"multiple":void 0,placeholder:u,style:d,loading:i,bordered:h,allowClear:m,disabled:g,showSearch:y,listHeight:v,maxTagCount:x?"responsive":void 0,maxTagTextLength:E},r?{title:w(l)}:null,{filterOption:(e,t)=>{var n;const l=(null==t||null===(n=t.children)||void 0===n?void 0:n.toString())||"",a=ya.parse(l).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${l}|${a}`:l).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,w(e),S)})(e)}}),S.map((e=>t().createElement(Ea,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Sa extends e.Component{constructor(){super(...arguments),va(this,"state",{itemList:[],loading:!1}),va(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:l,valueKey:a="value",textKey:r="text",callback:i}=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,J.get)(e.data,l)??[],n=t.map((e=>({value:e[a],text:e[r]})));this.setState({itemList:n},(()=>null==i?void 0:i(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const l=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(n=this.props.option.request)||void 0===n?void 0:n.params;(0,J.isEqual)(l,a)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:l}=this.state,{type:a,label:r,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(r),className:Ce()(o,u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(f)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t().createElement(Ca,{option:this.props.option,items:n,loading:l,multiple:this.props.multiple,onValuesChange:(t,n,l)=>{g(t,n,l),e.setViewValue(o,n)}}))),h&&t().createElement(A.Col,null,e.renderFormItemButton(o,h)),p&&t().createElement(A.Col,{flex:de(p.labelWidth||ln)},e.renderFormItemExtra({fieldName:o,...p}))))}}va(Sa,"contextType",Qt);const wa=Sa;function Ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Na extends e.Component{constructor(e){super(e),Ia(this,"searchHelper",void 0),Ia(this,"alias",void 0),Ia(this,"extras",void 0),Ia(this,"valueKey",void 0),Ia(this,"prevValue",""),Ia(this,"_record",void 0),Ia(this,"_prevValue",void 0),Ia(this,"searchRef",t().createRef()),Ia(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0}),Ia(this,"initialHandle",(async()=>{await this.props.waiting();const{helperConfig:e}=this.props,{fieldName:t,options:n,searchHelper:l}=this.props.option;this.searchHelper=Object.assign({},e,n,l);const{fieldAliasMap:a,extraAliasMap:r,fieldsDefine:i}=this.searchHelper;if(a||g("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),this.alias="function"==typeof a?a():a||{},this.extras="function"==typeof r?r():r||{},i){const e=["valueKey","displayKey","extraKey"];for(const t in i)e.includes(t)&&(this[t]=i[t])}Object.keys(this.alias).includes(t)||g("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),this.searchHelper.echoRequest&&!this.valueKey&&g("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Ia(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]})),Ia(this,"getLatestRequest",(()=>{var e;const{request:t,searchHelper:n}=this.props.option;return Object.assign({},null===(e=this.searchHelper)||void 0===e?void 0:e.request,t,null==n?void 0:n.request)})),Ia(this,"getItemText",(async()=>{await this.props.waiting();const e=this.getItemValue();if(e===this._prevValue)return;this._prevValue=e;const{fetchApi:t,params:n={},formatter:l=(e=>e),dataKey:a,fieldAliasMap:r,extraAliasMap:i}=this.searchHelper.echoRequest||{},o="function"==typeof r?r():r||{},s="function"==typeof i?i():i||{},{value:c}=this.props;if(t&&!c&&e)try{const r=await t(l({...n,key:e}));if(200===r.code){const e=Array.isArray(r.data)?r.data:(0,J.get)(r.data,a)??[];if(e[0]){const t=e[0];o&&vn(t,this.alias,o),s&&xn(t,this.extras,s),this._record=t,this.setFieldsValue(t)}}}catch(e){}})),Ia(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const l in this.alias){const a=yn(e,this.alias[l]);t.SET_FIELDS_VALUE({[l]:a}),l===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:yn(e,this.extras[n])});this._record=e,this.prevValue=yn(e,this.alias[n])??""})),Ia(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),Ia(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ia(this,"triggerChange",((e,t)=>{const{onChange:n,onValuesChange:l}=this.props;null==n||n(e),t&&l(e,this._record)})),Ia(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;null==t||t(e)})),Ia(this,"clickHandle",((e,t)=>{const{$$form:n}=this.context,{fieldName:l}=this.props.option;for(const t in this.alias)t!==l&&n.SET_FIELDS_VALUE({[t]:yn(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:yn(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=yn(e,this.alias[l]);this.prevValue=a??"",this.triggerChange(a,!0),t&&t()})),this.initialHandle()}componentDidMount(){this.getItemText()}componentDidUpdate(e){var t,n,l,a,r,i;const o=(null===(t=e.option.searchHelper)||void 0===t||null===(n=t.request)||void 0===n?void 0:n.params)||(null===(l=e.option.request)||void 0===l?void 0:l.params),s=(null===(a=this.props.option.searchHelper)||void 0===a||null===(r=a.request)||void 0===r?void 0:r.params)||(null===(i=this.props.option.request)||void 0===i?void 0:i.params);(0,J.isEqual)(o,s)||this.getItemList(),this.getItemText()}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:n,params:l={},formatter:a=(e=>e),dataKey:r}=this.getLatestRequest();if(n){this.setState({loading:!0});try{const i=await n(a({...l,[t]:e}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,r)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){var e;const{$$form:n}=this.context,{visible:l,loading:a,itemList:r}=this.state,{value:o}=this.props,{options:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{hideHeader:g,onlySelect:b=!0,listHeight:y=on}=s,v=(null===(e=this.searchHelper)||void 0===e?void 0:e.columns)||[],x=Se("form-immediate"),E=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,C=t().createElement(A.Spin,{spinning:a},r.length?t().createElement("table",{cellSpacing:0,cellPadding:0,className:Ce()("table")},!g&&t().createElement("thead",null,t().createElement("tr",null,v.filter((e=>!e.hidden)).map((e=>t().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t().createElement("tbody",null,r.map(((e,n)=>t().createElement("tr",{key:n,className:this.state.activeIndex===n?"active":"",onMouseEnter:()=>{this.setState({activeIndex:n})},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},v.filter((e=>!e.hidden)).map((n=>t().createElement("td",{key:n.dataIndex},(0,J.get)(e,n.dataIndex))))))))):t().createElement(ut,null));return t().createElement(i.Consumer,null,(e=>{const a={[x]:!0,[`${x}--lg`]:"large"===(null==e?void 0:e.size),[`${x}--sm`]:"small"===(null==e?void 0:e.size)};return n.isOnlyShow?t().createElement(An,{value:o,bordered:u}):t().createElement(rl(),{action:f?[]:["click"],popupVisible:!f&&l,popup:C,popupClassName:Ce()(a),popupStyle:{minWidth:E,maxHeight:y},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:cn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(A.Input,{ref:this.searchRef,placeholder:d,allowClear:h,bordered:u,readOnly:m,disabled:f,style:{width:"100%",...c},value:o,title:o,onFocus:()=>{!r.length&&this.fetchHandle(o)},onBlur:e=>{const{value:t}=e.target;b&&t!==this.prevValue&&this.triggerChange(this.prevValue,!1),this.triggerBlur(t)},onKeyUp:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(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),t?(this.handleVisibleChange(!0),this.triggerChange(t,!b)):this.clickHandle(null)}}))}))}}Ia(Na,"contextType",Qt);class Ta extends e.Component{constructor(e,t){let{$$form:n}=t;super(e),Ia(this,"promiseRef",void 0),Ia(this,"state",{searchHelper:{}}),Ia(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ia(this,"getHelperConfig",(e=>{var t,n;const{global:l}=e,{name:a,fieldsDefine:r}=this.props.option.searchHelper||{};if(!a)return;if(null==l||null===(t=l.searchHelper)||void 0===t||!t.getServerConfig||null==l||null===(n=l.searchHelper)||void 0===n||!n.createFetchApi)return g("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:i}=this.props.option;this.promiseRef=new Promise((async(e,t)=>{try{const n=await l.searchHelper.getServerConfig({searchHelperId:a});if(200===n.code){const t=wn(Object.assign({},n.data,r),i,l.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))})),this.getHelperConfig(n.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:l,label:a,tooltip:r,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(a),className:Ce()(i,d),tooltip:r,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(c)},required:e.getFormItemRequired(m)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Na,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(i,t)}}))),p&&t().createElement(A.Col,null,e.renderFormItemButton(i,p)),u&&t().createElement(A.Col,{flex:de(u.labelWidth||ln)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ia(Ta,"contextType",Qt);const Ra=Ta;class Oa extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,fieldName:a,className:r,style:i={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=le}=o,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===a))??[],n=c??t.length-1;t.slice(n+1).forEach((t=>{const n=d.find((e=>e.fieldName===t.fieldName));if(!n)return;const l=n.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${l}${a}`})}))}return t().createElement(A.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},t().createElement(Te,{id:a,label:l,className:r,extra:p.map((e=>e.text)).join(" | "),style:{...i},collapse:s[a],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[a]:t})}))),u(t)}}))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Oa,"contextType",Qt);const Aa=Oa;function Pa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fa(){return Fa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Fa.apply(this,arguments)}const Ha=(e,t,n,l)=>e.map((e=>e[n]===t?{...e,children:l}:e.children?{...e,children:Ha(e.children,t,n,l)}:e)),ka=e=>{const{$$form:n}=t().useContext(Qt),{value:l,items:a,multiple:r,loading:i,onChange:o,onValuesChange:s}=e,{options:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:m=!0,asyncLoad:f,readOnly:g,disabled:b}=e.option,{itemList:y,filterable:v=!0,listHeight:x=on,checkStrictly:E,checkStrategy:C="SHOW_CHILD",collapseTags:S,openPyt:w=!0}=c,[I,N]=t().useState(se(y)?a:y);De((()=>{N(se(y)?a:y)}),[y,a]);const T=e=>{var t;return(null===(t=Cn(I,e))||void 0===t?void 0:t.text)||""},R=e=>r?e.map((e=>T(e))).filter((e=>!!e)).join(","):T(e);return n.isOnlyShow?t().createElement(An,{value:R(l),bordered:h}):t().createElement(A.TreeSelect,Fa({fieldNames:{label:"text",value:"value",children:"children"},value:l,multiple:r,treeCheckable:r,treeCheckStrictly:E,showCheckedStrategy:A.TreeSelect[C],placeholder:u,listHeight:x,style:d,loading:i,bordered:h,allowClear:m,disabled:b,treeDefaultExpandAll:!f,showSearch:v,maxTagCount:S?"responsive":void 0,loadData:f?async e=>{let{key:t,children:n}=e;if(!f||n)return;const{fetchApi:l,params:a,dataKey:r,textKey:i="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=f;if(l)try{const e=await l(c({...a,[o]:t}));if(200===e.code){const n=Array.isArray(e.data)?e.data:(0,J.get)(e.data,r)??[],l=Ha(I,t,o,En(n,o,i));N(l),null==s||s(n)}}catch(e){}}:void 0,treeData:I},r?{title:R(l)}:null,{filterTreeNode:(e,t)=>{var n;const l=(null==t||null===(n=t.text)||void 0===n?void 0:n.toString())||"",a=ya.parse(l).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${l}|${a}`:l).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,R(e),I)})(e)}}))};class La extends e.Component{constructor(){super(...arguments),Pa(this,"state",{itemList:[],loading:!1}),Pa(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:l,valueKey:a="value",textKey:r="text",callback:i}=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,J.get)(e.data,l)??[],n=En(t,a,r);this.setState({itemList:n},(()=>null==i?void 0:i(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const l=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(n=this.props.option.request)||void 0===n?void 0:n.params;(0,J.isEqual)(l,a)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:l}=this.state,{type:a,label:r,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(r),className:Ce()(o,u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(m)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(r)}},t().createElement(ka,{option:this.props.option,items:n,loading:l,multiple:this.props.multiple,onValuesChange:(t,n,l)=>{f(t,n,l),e.setViewValue(o,n)}}))),p&&t().createElement(A.Col,{flex:de(p.labelWidth||ln)},e.renderFormItemExtra({fieldName:o,...p}))))}}Pa(La,"contextType",Qt);const qa=La;function $a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _a(){return _a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},_a.apply(this,arguments)}const Da=e=>{const{$$form:n}=t().useContext(Qt),{value:l,multiple:a,items:r}=e,{options:i={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:h}=e.option,{changeOnSelect:m,checkStrictly:f,checkStrategy:g="SHOW_PARENT",filterable:b=!0,openPyt:y=!0}=i,{itemList:v=[]}=i,x=se(v)?r:v,E=e=>se(e)?"":a?e.map((e=>Sn(x,e).map((e=>e.text)).join("/"))).join(","):Sn(x,e).map((e=>e.text)).join("/");return n.isOnlyShow?t().createElement(An,{value:E(l),bordered:c}):t().createElement(A.Cascader,_a({value:(e=>se(e)?[]:a?e.map((e=>e.split(","))):e.split(","))(l),fieldNames:{label:"text",value:"value",children:"children"},options:x,multiple:a,maxTagCount:"responsive",changeOnSelect:m||f,showCheckedStrategy:A.Cascader[g],placeholder:s,style:o,bordered:c,allowClear:d,disabled:h,showSearch:b&&{filter:(e,t)=>t.some((t=>{var n;const l=(null==t||null===(n=t.text)||void 0===n?void 0:n.toString())||"",a=ya.parse(l).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(y?`${l}|${a}`:l).toLowerCase().indexOf(e.toLowerCase())>=0}))}},a?{title:E(l)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:l}=e;null==n||n(t),l(t,E(t),x)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class Ka extends e.Component{constructor(){super(...arguments),$a(this,"state",{itemList:[],loading:!1}),$a(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:l,valueKey:a="value",textKey:r="text",callback:i}=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,J.get)(e.data,l)??[],n=En(t,a,r);this.setState({itemList:n},(()=>null==i?void 0:i(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const l=null===(t=e.option.request)||void 0===t?void 0:t.params,a=null===(n=this.props.option.request)||void 0===n?void 0:n.params;(0,J.isEqual)(l,a)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:l}=this.state,{type:a,label:r,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(r),className:Ce()(o,u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(d)},required:e.getFormItemRequired(m)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(r)}},t().createElement(Da,{option:this.props.option,multiple:n,items:l,onValuesChange:(t,n,l)=>{f(t,n,l),e.setViewValue(o,n)}}))),p&&t().createElement(A.Col,{flex:de(p.labelWidth||ln)},e.renderFormItemExtra({fieldName:o,...p}))))}}$a(Ka,"contextType",Qt);const Va=Ka,Ma=require("china-area-data");var ja=l.n(Ma);function za(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ua=["110000","120000","310000","500000"],Ba=["810000","820000"],Wa=[{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"}],Ga=[{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"}],Ya=e=>ya.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Xa=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(n>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...Ua,...Ba].includes(e))):Object.keys(e[t])).map((l=>({l:Ya(e[t][l].slice(0,1)).toUpperCase(),n:e[t][l],c:l,p:t,children:Xa(e,l,n+1)})))},Qa=(e,t)=>t.map((t=>({l:Ya(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Za extends e.Component{constructor(e){super(e),za(this,"searchRef",t().createRef()),za(this,"scrollRef",t().createRef()),za(this,"zxsAndGa",void 0),za(this,"provinces",void 0),za(this,"allCities",void 0),za(this,"letterCities",void 0),za(this,"state",{visible:!1,select_type:"0",active_key:""}),za(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),za(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||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(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),wt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){var t;return(null===(t=this.allCities.find((t=>t.c===e)))||void 0===t?void 0:t.n)||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Qa(ja(),Ua)},{l:"Z2",n:"港澳",c:"",p:"",children:Qa(ja(),Ba)}]}createProvince(){return(Xa(ja(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Ga.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Ua,...Ba].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t().createElement(A.Radio.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},t().createElement(A.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),t().createElement(A.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?Wa:Ga).map((n=>t().createElement("li",{key:n.value,className:Ce()({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t().createElement(A.Select,{size:"small",placeholder:p("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>{var n;return((null==t||null===(n=t.children)||void 0===n?void 0:n.toString())||"").toLowerCase().indexOf(e.toLowerCase())>=0},value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t().createElement(A.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:n}=this.state;return("0"===n?this.provinces:this.letterCities).map(((n,l)=>{var a;return t().createElement("div",{key:l},t().createElement("dt",{ref:e=>this[`${n.l}Ref`]=e},n.n,":"),t().createElement("dd",null,null===(a=n.children)||void 0===a?void 0:a.map((n=>t().createElement("li",{key:n.c,className:Ce()({actived:n.c===e}),onClick:()=>this.clickHadnle(n.c)},n.n)))))}))}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:l}=this.props,{options:a={},style:r={},placeholder:o=p("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,h=Se("form-city-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,f=this.createTextValue(l),g=t().createElement("div",{className:"container",style:{...r}},t().createElement("div",{className:"city-drop"},t().createElement("div",{className:"city-drop-toper"},t().createElement("div",{className:"city-drop-toper__type"},this.renderType()),t().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t().createElement("div",{className:"city-drop-letter"},this.renderLetter()),t().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t().createElement("dl",null,this.renderCity(l)))));return t().createElement(i.Consumer,null,(l=>{const a={[h]:!0,[`${h}--lg`]:"large"===(null==l?void 0:l.size),[`${h}--sm`]:"small"===(null==l?void 0:l.size)};return e.isOnlyShow?t().createElement(An,{value:f,bordered:s}):t().createElement(rl(),{action:u?[]:["click"],popupVisible:!u&&n,popup:g,popupClassName:Ce()(a),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:cn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(A.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:{width:"100%",...r},value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}za(Za,"contextType",Qt);class Ja extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(Za,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(r,n)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}za(Ja,"contextType",Qt);const er=Ja;function tr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const nr=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:nr(e,n)})))};class lr extends e.Component{constructor(e){super(e),tr(this,"searchRef",t().createRef()),tr(this,"prevText",void 0),tr(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),tr(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const n=nr(ja(),"86")||[];this.state={results:n,visible:!1,values:[],tabs:[n.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(){var e;return!(null===(e=this.props.option.request)||void 0===e||!e.fetchApi)}get leave(){return this.isFetch?4:3}setInputReadonly(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>{var n,l;return null===(n=this.state.tabs[t])||void 0===n||null===(l=n.find((t=>t.value===e)))||void 0===l?void 0:l.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 l=0;l<t.length;l++){const a=Cn(e,t[l]);if(a&&se(a.children)){this.isFetch&&this.getStreetList(t[l]);break}Array.isArray(null==a?void 0:a.children)&&(n[l+1]=null==a?void 0: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:l=(e=>e),dataKey:a,valueKey:r="value",textKey:i="text"}=t;if(n)try{const t=await n(l({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,J.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[i],value:e[r]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,l)=>{var a;const r=(null===(a=n.find((t=>t.value===e[l])))||void 0===a?void 0:a.text)||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[l]})`;return t().createElement(A.Tabs.TabPane,{key:l.toString(),tab:r},t().createElement("div",{className:"region-box"},n.map((n=>t().createElement("span",{key:n.value,className:Ce()({"region-box__item":!0,actived:e.includes(n.value.toString())}),title:n.text,onClick:()=>{let{values:e}=this.state;e[l]=n.value.toString(),e=e.slice(0,l+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.leave-1:this.leave;if(l+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(l+1)}))}},n.text)))))}));return n.length?t().createElement(A.Tabs,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t().createElement(ut,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:l}=this.props,{options:a={},style:r={},placeholder:o=p("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,h=Se("form-region-select"),m=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,f=t().createElement("div",{className:"container"},this.renderTabs());let g=this.prevText;if(!n){const e=this.createTextValue(l);(""===e||e.split("/").every((e=>""!==e)))&&(g=e,this.prevText=g)}return t().createElement(i.Consumer,null,(l=>{const a={[h]:!0,[`${h}--lg`]:"large"===(null==l?void 0:l.size),[`${h}--sm`]:"small"===(null==l?void 0:l.size)};return e.isOnlyShow?t().createElement(An,{value:g,bordered:s}):t().createElement(rl(),{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:Ce()(a),popupStyle:{minWidth:m},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:cn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(A.Input,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:{width:"100%",...r},readOnly:d,disabled:u,value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&ie((()=>this.initial()))}}))}))}}tr(lr,"contextType",Qt);class ar extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(lr,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(r,n)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}tr(ar,"contextType",Qt);const rr=ar,ir=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},upload:o={},style:s={},disabled:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:p,fileSize:h,onRemove:m}=i,{action:f,headers:g,params:b,withCredentials:y=!1,dataKey:v="",fieldAliasMap:x,button:E}=o,C="function"==typeof x?x():x||{};return t().createElement(Br,{name:"file",action:f,multiple:d,headers:g,data:b,withCredentials:y,maxCount:u,fileTypes:p,fileSize:h,disabled:c||n.isOnlyShow,button:E,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)},fileList:l,onChange:e=>{let{file:t,fileList:n}=e;(e=>{const t=e.map((e=>{var t,n;const l={};for(const t in C){var a,r;l[t]=e[t]||(null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r?void 0:r[C[t]])||""}return{uid:e.uid,name:e.name,...l,url:e.url||(v?(0,J.get)(null===(n=e.response)||void 0===n?void 0:n.data,v):null===(t=e.response)||void 0===t?void 0:t.data)||"",status:e.status}}));null==a||a(t),t.every((e=>"done"===e.status&&e.url))&&r(t)})(n)},onRemove:m})};class or extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(ir,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,"")}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(or,"contextType",Qt);const sr=or,cr=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},upload:o={},style:s={},disabled:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:p,quality:h,openCropper:m,fileTypes:f,fileSize:g,onRemove:b}=i,{action:y,headers:v,params:x,withCredentials:E=!1,dataKey:C="",fieldAliasMap:S}=o,w="function"==typeof S?S():S||{};return t().createElement(Jr,{name:"file",action:y,multiple:d,headers:v,data:x,withCredentials:E,maxCount:u,fixedSize:p,quality:h,openCropper:m,fileTypes:f,fileSize:g,disabled:c||n.isOnlyShow,fileList:l,onChange:e=>{let{file:t,fileList:n}=e;(e=>{const t=e.map((e=>{var t,n;const l={};for(const t in w){var a,r;l[t]=e[t]||(null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r?void 0:r[w[t]])||""}return{uid:e.uid,name:e.name,...l,url:e.url||(C?(0,J.get)(null===(n=e.response)||void 0===n?void 0:n.data,C):null===(t=e.response)||void 0===t?void 0:t.data)||"",status:e.status}}));null==a||a(t),t.every((e=>"done"===e.status&&e.url))&&r(t)})(n)},onRemove:b})};class dr extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(cr,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,"")}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(dr,"contextType",Qt);const ur=dr,pr=e=>{const{$$form:n}=t().useContext(Qt),{value:l,onChange:a,onValuesChange:r}=e,{options:i={},upload:o,style:s={},placeholder:c=p("qm.form.inputPlaceholder"),readOnly:d,disabled:u}=e.option,{tinymce:h,thresholdSize:m}=i;return t().createElement($r,{value:l,tinymce:h,upload:o,thresholdSize:m,style:{width:"100%",...s},disabled:d||u||n.isOnlyShow,onChange:e=>{(e=>{null==a||a(e),r(e)})(e)}})};class hr extends e.Component{render(){const{$$form:e}=this.context,{type:n,label:l,tooltip:a,fieldName:r,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=le}=this.props.option;return t().createElement(A.Form.Item,{label:e.renderFormLabel(l),className:Ce()(r,c),tooltip:a,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(s)},required:e.getFormItemRequired(p)},t().createElement(A.Row,{wrap:!1,gutter:4},t().createElement(A.Col,{flex:"auto"},t().createElement(A.Form.Item,{name:r,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(l)}},t().createElement(pr,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(r,t)}}))),d&&t().createElement(A.Col,{flex:de(d.labelWidth||ln)},e.renderFormItemExtra({fieldName:r,...d}))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(hr,"contextType",Qt);const mr=hr;function fr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class gr extends e.Component{constructor(e){super(e),fr(this,"provide",{$$form:this,echo_data:{}}),fr(this,"_initialValues",void 0),fr(this,"_initialOthers",void 0),fr(this,"_initialExtras",void 0),fr(this,"_fieldAuth",{}),fr(this,"wrapperRef",t().createRef()),fr(this,"formRef",t().createRef()),fr(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),fr(this,"resizeObserveHandler",(()=>{var e;const t=null===(e=this.wrapperRef.current)||void 0===e?void 0:e.offsetWidth;if(void 0===t||0===t||this.props.cols>0)return;let n=Math.floor(t/300);n=24%n==0?n:n-1,n=n<1?1:n,n=n>8?8:n,n!==this.state.flexCols&&this.setState({flexCols:n})})),fr(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),fr(this,"getFormItems",Xt()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),fr(this,"getFlattenItems",Xt()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,J.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),fr(this,"valuesChangeHandle",((e,t)=>{var n,l;null===(n=(l=this.props).onValuesChange)||void 0===n||n.call(l,e,this._initialValues)})),fr(this,"fieldsChangeHandle",((e,t)=>{var n,l;null===(n=(l=this.props).onFieldsChange)||void 0===n||n.call(l,e,t)})),fr(this,"finishHandle",(e=>{var t,n;null===(t=(n=this.props).onFinish)||void 0===t||t.call(n,Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),fr(this,"finishFailedHandle",(e=>{var t,n;let{values:l,errorFields:a}=e;null===(t=(n=this.props).onFinishFailed)||void 0===t||t.call(n,a)})),fr(this,"openValidateInfo",(e=>{const n=t().createElement("ul",null,e.map((e=>{const{label:n}=this.formItems.find((t=>t.fieldName===e.name[0]));return t().createElement("li",{key:e.name[0],style:{color:"#f5222d"}},"[",("string"==typeof n?`${n}: `:"")+e.errors.join(","),"]")})));A.notification.error({message:p("qm.form.validatePrompt"),description:n,duration:10})})),fr(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&wt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!(null==e||!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(){tn(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){nn(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&g("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),n={};for(const l in e)t.includes(l)||(n[l]=e[l]);return Object.assign({},n)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,J.isPlainObject)(e.extra))).forEach((n=>{t[n.fieldName]=e[n.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,J.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:n,options:l}=e;return t=t??void 0,sn.includes(n)&&(t=t??[]),"CHECKBOX"!==n&&"SWITCH"!==n||(t=t??(null==l?void 0:l.falseValue)??rn),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)}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t!==this.getViewValue(e)&&this.setState((n=>({viewData:Object.assign({},n.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){this.setState({collapse:e},(()=>{var e,t;null===(e=(t=this.props).onCollapse)||void 0===e||e.call(t,this.state.collapse)}))}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){var t,n;if("string"==typeof e)return e;const{fieldName:l,options:a={}}=e,{itemList:r=[]}=a;if(!r.length)return g("Form",`fieldName 为 ${l} 的表单项的 \`itemList\` 配置有误`),"";const i=(null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([l])[l])??this._initialValues[l]??r[0].value;return(null===(n=r.find((e=>e.value===i)))||void 0===n?void 0:n.text)||""}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 l=this.formItems.findIndex((e=>e===this.dividers[t+1]));l=l>-1?l:void 0,e.push(this.formItems.slice(n,l).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:n}=e;if("DIVIDER"===t)return!0;const l=this.getBlockDerivedItems();for(let e=0,t=l.length;e<t;e++){var a;const t=l[e],r=this.dividers.find((e=>e.fieldName===t[0].fieldName)),i=(null==r||null===(a=r.collapse)||void 0===a?void 0:a.showLimit)??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===n&&e>i)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const n=e[t];if(bn(n)&&(e[t]=""),Array.isArray(n)&&n.forEach(((n,l)=>{bn(n)&&(e[t][l]="")})),t.includes("|")&&Array.isArray(n)){const[l,a]=t.split("|");e[l]=n[0]??"",e[a]=n[1]??""}}if(this.isFilterType)for(const t in e)se(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=Z()(e,["fetch"]);if(e.fetch){const{api:n,params:l,dataKey:a}=e.fetch;try{const e=await n(l);200===e.code&&(t=(a?(0,J.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){var n,l;const e=this.props.items.map((e=>{const{fieldName:n}=e,l=t.fieldList.find((e=>e.dataIndex===n));if(l){const{visible:t=1,disabled:a,secretName:r}=l;t||(e.noAuth=!0),a&&(e.disabled=!0),r&&(e.options?e.options.secretType=r:e.options={secretType:r}),this.setFieldAuth(n,{visible:t,disabled:a,secretName:r})}return e}));null===(n=(l=this.props).fieldsChange)||void 0===n||n.call(l,e)}}INPUT(e){return t().createElement(kn,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement($n,{option:e})}INPUT_NUMBER(e){return t().createElement(jn,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(Bn,{option:e})}SEARCH_HELPER(e){return t().createElement(Zn,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t().createElement(cl,{option:e})}TREE_TABLE_HELPER(e){return t().createElement(ml,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t().createElement(xl,{option:e})}RANGE_SEARCH_HELPER(e){return t().createElement(Il,{option:e})}CHECKBOX(e){return t().createElement(Rl,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(Fl,{option:e})}RATE(e){return t().createElement(Ll,{option:e})}RADIO(e){return t().createElement(Dl,{option:e})}SWITCH(e){return t().createElement(Ml,{option:e})}TEXT_AREA(e){return t().createElement(Ul,{option:e})}DATE(e){return t().createElement(Gl,{option:e})}RANGE_DATE(e){return t().createElement(Zl,{option:e})}TIME(e){return t().createElement(ta,{option:e})}RANGE_TIME(e){return t().createElement(aa,{option:e})}SELECT(e){return t().createElement(wa,{option:e})}MULTIPLE_SELECT(e){return t().createElement(wa,{option:e,multiple:!0})}IMMEDIATE(e){return t().createElement(Ra,{option:e})}DIVIDER(e){return t().createElement(Aa,{option:e})}TREE_SELECT(e){return t().createElement(qa,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(qa,{option:e,multiple:!0})}CASCADER(e){return t().createElement(Va,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(Va,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(er,{option:e})}REGION_SELECT(e){return t().createElement(rr,{option:e})}UPLOAD_FILE(e){return t().createElement(sr,{option:e})}UPLOAD_IMG(e){return t().createElement(ur,{option:e})}TINYMCE(e){return t().createElement(mr,{option:e})}renderFormLabel(e){if(!(0,J.isPlainObject)(e))return e;const{type:n,fieldName:l,options:a={},placeholder:r,disabled:i,onChange:o=le}=e,{itemList:s=[]}=a;return t().createElement(A.Form.Item,{name:l,noStyle:!0},"SELECT"===n&&t().createElement(A.Select,{placeholder:r,disabled:i,style:{width:"calc(100% - 10px)"},onChange:e=>o(e,s.find((t=>t.value===e)).text)},s.map((e=>t().createElement(A.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text)))))}renderFormItemExtra(e){const{fieldName:n,isTooltip:l,style:a={},render:r}=e,{extra:i}=this.state;if(l)return t().createElement(A.Tooltip,{className:"extra-tooltip",title:i[n]},t().createElement(we.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n));return t().createElement("div",{className:"extra-text",title:r?"":i[n],style:a},t().createElement("span",{className:"extra-overflow-cut"},r?r(o,this):i[n]))}renderFormItemButton(e,t){const n=this.formItems.find((t=>t.fieldName===e)),l="function"==typeof t?t(n):t;return this.isOnlyShow?null:l}renderFormItem(e){const{label:n,fieldName:l,invisible:a,className:r,labelWidth:i=this.props.labelWidth,rules:o=[],style:s={},render:c}=e;return se(this.state.formData)?null:t().createElement(A.Form.Item,{label:n,name:l,rules:o,hidden:a,className:Ce()(l,r),style:{width:"100%",...s},labelCol:{flex:de(i)}},null==c?void 0:c(e,this))}createFormItem(e){return(0,J.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(g("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:n,defaultRows:l,isFieldsDefine:a}=this.props,r=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)r.push({});r.push(e);for(let e=0;e<n;e++)r.push({})}));const i=24/e,o=[],s=r.reduce(((e,t)=>{const{selfCol:n=1}=t,l=e+n;return o.push(l),l}),0),c=l>Math.ceil(s/e)?Math.ceil(s/e):l,d=[],u=r.map(((n,l)=>{let{selfCol:a=1}=n;const{type:r,fieldName:s}=n;a=a>=24||"DIVIDER"===r||"TINYMCE"===r?e:a;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[l]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(o[l]),t().createElement(A.Col,{key:s??l,span:a*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},r?this.createFormItem(ce(n)):null)}));return a&&"default"===n&&u.push(t().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:n,collapse:l}=this.state,{searchButtonCols:a,isSearchBtn:r,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=a||1,c=n-e%n-s;return r?t().createElement(A.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t().createElement(A.Space,{style:{marginBottom:12}},t().createElement(me,{type:"primary",size:this.$size,icon:t().createElement(we.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),t().createElement(me,{size:this.$size,icon:t().createElement(we.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),i?this.createFieldsDefine():null,this.showFilterCollapse&&t().createElement("a",{onClick:()=>this.setExpandHandle(!l)},l?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(l?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:n,isSubmitBtn:l}=this.props;if(this.isFilterType)return null;const a=24/e;return l&&"default"===n?t().createElement(A.Row,{gutter:0},t().createElement(A.Col,{key:"-",span:a},t().createElement(A.Form.Item,null,t().createElement(A.Space,{style:{marginBottom:12}},t().createElement(me,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),t().createElement(me,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:l}=this.props;return t().createElement(Rn,{uniqueKey:e,items:n,fieldsChange:l})}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,l]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>{var t;return null===(t=this[`${e.fieldName}_Ref`])||void 0===t?void 0:t.searchRef._is_change})).map((e=>({name:[e.fieldName],errors:[p("qm.form.searchHelperTips")],warnings:[]})));n||a.length?t((n||[]).concat(a)):e(l)}))}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(){var e,t;let n=[];const l=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName));l.length&&(n=this.flattenItems.map((e=>e.fieldName)).filter((e=>!l.includes(e)))),this.formRef.current.resetFields(n.length?n:void 0),this.setState((e=>{const t=Object.keys(e.other),n=Object.keys(this._initialOthers),l=t.filter((e=>!n.includes(e))),a={};return l.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),null===(e=(t=this.props).onReset)||void 0===e||e.call(t)}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){g("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:l,fieldsChange:a}=this.props,r=l.find((t=>t.fieldName===e));if(!r)return g("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(r.noAuth)return g("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||(0,J.set)(r,n,t[n]));n&&(a?a([...l]):g("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:l,disabled:a,labelWidth:r,labelAlign:i,labelWrap:o,customClass:s}=this.props,c=Se("form"),d={required:"${label}"+p("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return t().createElement("div",{ref:this.wrapperRef,className:Ce()(u,e),style:n},t().createElement(A.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:l,labelAlign:i,labelWrap:o,colon:!1,disabled:a,labelCol:{flex:this.verticalLayout?"initial":de(r)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t().createElement(Qt.Provider,{value:this.provide},t().createElement(A.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}fr(gr,"contextType",i),fr(gr,"propTypes",hn),fr(gr,"defaultProps",mn);const br=gr,yr={onActivate:n.func,onAddUndo:n.func,onBeforeAddUndo:n.func,onBeforeExecCommand:n.func,onBeforeGetContent:n.func,onBeforeRenderUI:n.func,onBeforeSetContent:n.func,onBeforePaste:n.func,onBlur:n.func,onChange:n.func,onClearUndos:n.func,onClick:n.func,onContextMenu:n.func,onCommentChange:n.func,onCopy:n.func,onCut:n.func,onDblclick:n.func,onDeactivate:n.func,onDirty:n.func,onDrag:n.func,onDragDrop:n.func,onDragEnd:n.func,onDragGesture:n.func,onDragOver:n.func,onDrop:n.func,onExecCommand:n.func,onFocus:n.func,onFocusIn:n.func,onFocusOut:n.func,onGetContent:n.func,onHide:n.func,onInit:n.func,onKeyDown:n.func,onKeyPress:n.func,onKeyUp:n.func,onLoadContent:n.func,onMouseDown:n.func,onMouseEnter:n.func,onMouseLeave:n.func,onMouseMove:n.func,onMouseOut:n.func,onMouseOver:n.func,onMouseUp:n.func,onNodeChange:n.func,onObjectResizeStart:n.func,onObjectResized:n.func,onObjectSelected:n.func,onPaste:n.func,onPostProcess:n.func,onPostRender:n.func,onPreProcess:n.func,onProgressState:n.func,onRedo:n.func,onRemove:n.func,onReset:n.func,onSaveContent:n.func,onSelectionChange:n.func,onSetAttrib:n.func,onSetContent:n.func,onShow:n.func,onSubmit:n.func,onUndo:n.func,onVisualAid:n.func,onSkinLoadError:n.func,onThemeLoadError:n.func,onModelLoadError:n.func,onPluginLoadError:n.func,onIconsLoadError:n.func,onLanguageLoadError:n.func},vr={apiKey:n.string,id:n.string,inline:n.bool,init:n.object,initialValue:n.string,onEditorChange:n.func,value:n.string,tagName:n.string,cloudChannel:n.string,plugins:n.oneOfType([n.string,n.array]),toolbar:n.oneOfType([n.string,n.array]),disabled:n.bool,textareaName:n.string,tinymceScriptSrc:n.string,rollback:n.oneOfType([n.number,n.oneOf([!1])]),scriptLoading:n.shape({async:n.bool,defer:n.bool,delay:n.number}),...yr},xr=e=>"function"==typeof e,Er=e=>e in yr,Cr=e=>e.substr(2),Sr=(e,t,n,l,a)=>((t,n,l,a,r,i,o)=>{const s=Object.keys(r).filter(Er),c=Object.keys(i).filter(Er),d=s.filter((e=>void 0===i[e])),u=c.filter((e=>void 0===r[e]));d.forEach((e=>{const t=Cr(e),n=o[t];l(t,n),delete o[t]})),u.forEach((l=>{const a=((t,n)=>l=>{var a;return null===(a=t(n))||void 0===a?void 0:a(l,e)})(t,l),r=Cr(l);o[r]=a,n(r,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,n,l);let wr=0;const Ir=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return wr++,e+"_"+n+wr+String(t)},Nr=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Tr=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Rr=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Or=()=>({listeners:[],scriptId:Ir("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Ar=(()=>{let e=Or();return{load:(t,n,l,a,r,i)=>{const o=()=>((t,n,l,a,r,i)=>{const o=n.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=l,o.async=a,o.defer=r;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),n.head&&n.head.appendChild(o)})(e.scriptId,t,n,l,a);e.scriptLoaded?i():(e.listeners.push(i),e.scriptLoading||(e.scriptLoading=!0,r>0?setTimeout(o,r):o()))},reinitialize:()=>{e=Or()}}})(),Pr=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Fr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Hr extends e.Component{constructor(t){var n,l;super(t),n=this,Fr(this,"editor",void 0),Fr(this,"id",void 0),Fr(this,"elementRef",void 0),Fr(this,"inline",void 0),Fr(this,"currentContent",void 0),Fr(this,"boundHandlers",void 0),Fr(this,"rollbackTimer",void 0),Fr(this,"valueCursor",void 0),Fr(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})),Fr(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){}})),Fr(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Fr(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))}})),Fr(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Fr(this,"initialise",(function(){var e,t;let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const a=n.elementRef.current;if(!a)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})(a)){if(0===l)setTimeout((()=>n.initialise(1)),1);else{if(!(l<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>n.initialise(l+1)),100)}return}const r=Pr(n.view);if(!r)throw new Error("tinymce should have been loaded into global scope");const i={...n.props.init,selector:void 0,target:a,readonly:n.props.disabled,inline:n.inline,plugins:(o=null===(e=n.props.init)||void 0===e?void 0:e.plugins,s=n.props.plugins,Tr(o).concat(Tr(s))),toolbar:n.props.toolbar??(null===(t=n.props.init)||void 0===t?void 0:t.toolbar),setup:e=>{n.editor=e,n.bindHandlers({}),n.inline&&!Nr(a)&&e.once("PostRender",(t=>{e.setContent(n.getInitialValue(),{no_events:!0})})),n.props.init&&xr(n.props.init.setup)&&n.props.init.setup(e)},init_instance_callback:e=>{const t=n.getInitialValue();n.currentContent=n.currentContent??e.getContent(),n.currentContent!==t&&(n.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const l=n.props.disabled??!1;Rr(n.editor,l?"readonly":"design"),n.props.init&&xr(n.props.init.init_instance_callback)&&n.props.init.init_instance_callback(e)}};var o,s;n.inline||(a.style.visibility=""),Nr(a)&&(a.value=n.getInitialValue()),r.init(i)})),this.id=this.props.id||Ir("tiny-react"),this.elementRef=e.createRef(),this.inline=this.props.inline??(null===(l=this.props.init)||void 0===l?void 0:l.inline)??!1,this.boundHandlers={}}get view(){var e;return(null===(e=this.elementRef.current)||void 0===e?void 0:e.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 l of[t,n])if(l)try{e.selection.moveToBookmark(l),this.valueCursor=l;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Rr(this.editor,e?"readonly":"design")}}}componentDidMount(){if(null!==Pr(this.view))this.initialise();else if(this.elementRef.current&&this.elementRef.current.ownerDocument){var e,t,n;Ar.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),(null===(e=this.props.scriptLoading)||void 0===e?void 0:e.async)??!1,(null===(t=this.props.scriptLoading)||void 0===t?void 0:t.defer)??!1,(null===(n=this.props.scriptLoading)||void 0===n?void 0:n.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(){var e,t,n;return(null===(e=Pr(this.view))||void 0===e||null===(t=e.Env)||void 0===t||null===(n=t.browser)||void 0===n?void 0:n.isIE())?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){Sr(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),l=t(this.props);!n&&l?(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&&!l&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}function kr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Lr;Fr(Hr,"propTypes",vr),Fr(Hr,"defaultProps",{cloudChannel:"6"}),function(e){e["zh-cn"]="zh_CN",e.en="en"}(Lr||(Lr={}));class qr extends e.Component{constructor(){super(...arguments),kr(this,"defaultOption",{height:400,plugins:"preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap emoticons",menubar:"file edit view insert format tools table help",toolbar:"undo redo | bold italic underline strikethrough | fontfamily fontsize blocks | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media template link anchor codesample | ltr rtl"})}render(){var e;const{size:n,className:l,style:a,tinymce:r={},upload:i={},thresholdSize:o=.5,tinymceScriptSrc:s,disabled:c,value:d,onChange:u=le}=this.props,h=this.context.global,m=this.context.locale,f=n||this.context.size||"",g=Se("tinymce"),b={[g]:!0,[`${g}--lg`]:"large"===f,[`${g}--sm`]:"small"===f},y={init:{height:r.height||this.defaultOption.height,plugins:r.plugins||this.defaultOption.plugins,toolbar:r.toolbar||this.defaultOption.toolbar,menubar:r.menubar||this.defaultOption.menubar,language:Lr[m],skin:"tinymce-5",...Z()(r,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,n)=>{const{action:l,headers:a,withCredentials:r,dataKey:s}=i,c=`data:image/jpeg;base64,${e.base64()}`,d=new FormData;d.append("file",e.blob(),e.filename());const u=e.blob().size;if(l&&u/1024/1024>o)try{const{data:e}=await ft().post(l,d,{headers:a,withCredentials:r});200===e.code&&t(s?(0,J.get)(e.data,s):e.data)}catch(e){A.message.error(p("qm.uploadCropper.uploadError"))}else t(c)}))},value:d,disabled:c,tinymceScriptSrc:s||(null==h||null===(e=h.tinymce)||void 0===e?void 0:e.scriptSrc)||void 0,onEditorChange:(e,t)=>{u(t.getContent())}};return t().createElement("div",{className:Ce()(b,l),style:a},t().createElement(Hr,y))}}kr(qr,"contextType",i),kr(qr,"propTypes",{size:(e,t,n)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")}});const $r=qr,_r=require("cropperjs");var Dr=l.n(_r);function Kr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Vr extends e.Component{constructor(){super(...arguments),Kr(this,"imgRef",t().createRef()),Kr(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:n,alt:l,imgStyle:a,...r}=this.props,i={};for(const e in r)void 0!==this.props[e]&&(i[e]=this.props[e]);this.cropper=new(Dr())(this.imgRef.current,i)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:n,src:l,alt:a,imgStyle:r}=this.props,i={[Se("cropper")]:!0};return t().createElement("div",{className:Ce()(i,e),style:n},t().createElement("img",{ref:this.imgRef,src:l,alt:a,style:{maxWidth:"100%",...r}}))}}Kr(Vr,"defaultProps",{src:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0});const Mr=Vr;function jr(){return jr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},jr.apply(this,arguments)}function zr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ur extends e.Component{constructor(){super(...arguments),zr(this,"beforeUpload",((e,t)=>new Promise((async(n,l)=>{const{fileTypes:a=[],fileSize:r,beforeUpload:i}=this.props,o=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!r||e.size/1024/1024<r,c=o&&s;if(o||A.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),s||A.message.warning(p("qm.upload.sizeLimit",{size:r})),!c)return c||A.Upload.LIST_IGNORE;if(i){const a=i(e,t);if(!0===a)return n(e);if(!1===a)return l("not upload");if(a&&"function"==typeof a.then)try{n(await a)}catch(e){l(e)}}n(e)}))))}async downloadFile(e,t){const n=await ft()({url:e,responseType:"blob"}),l=n.data,a=n.headers["content-disposition"],r=t||(a?a.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));gt(l,r)}render(){const{button:e,disabled:n,onChange:l}=this.props,a=Se("upload-file");return t().createElement(A.Upload,jr({className:a},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,onChange:e=>{null==l||l(e)},onPreview:async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){A.message.error(p("qm.download.error"))}},onDownload:async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){A.message.error(p("qm.download.error"))}}}),this.props.children?this.props.children:t().createElement(A.Button,{icon:(null==e?void 0:e.icon)||t().createElement(we.UploadOutlined,null),disabled:n},(null==e?void 0:e.text)||p("qm.upload.text")))}}zr(Ur,"defaultProps",{name:"file",multiple:!0,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)}});const Br=Ur;function Wr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Gr extends e.Component{constructor(){super(...arguments),Wr(this,"cropperRef",t().createRef()),Wr(this,"beforeUploadRef",void 0),Wr(this,"fileRef",void 0),Wr(this,"resolveRef",void 0),Wr(this,"rejectRef",void 0),Wr(this,"state",{src:""}),Wr(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:n,uid:l}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let a=new File([e],n,{type:t});a.uid=l;const{fileTypes:r=[],fileSize:i}=this.props;if(r.length&&!r.includes(a.name.slice(a.name.lastIndexOf(".")+1).toLowerCase()))return A.message.warning(p("qm.upload.tooltip",{type:r.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(a);const o=this.beforeUploadRef(a,[a]);if("boolean"==typeof o||o){if(!0===o)return this.resolveRef(a);if(!1===o)return this.rejectRef("not upload");if(o&&"function"==typeof o.then)try{const e=await o,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),this.resolveRef(a)}catch(e){this.rejectRef(e)}}else g("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await re(100),this.onClose()})),Wr(this,"onOk",(()=>{this.confirmHandle()})),Wr(this,"onClose",(()=>{this.rejectRef(),this.setSrc("")}))}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:n}=this.props,l=Array.isArray(e)?e[0]:e;if(!l)return null;const{beforeUpload:a,...r}=l.props;return this.beforeUploadRef=a,t().createElement(l.type,{...r,beforeUpload:(e,t)=>new Promise((async(l,a)=>{if(n&&!await n(e,t))return void a();this.fileRef=e,this.resolveRef=l,this.rejectRef=a;const r=new FileReader;r.onload=()=>{this.setSrc(r.result),r.onload=null},r.readAsDataURL(e)}))})}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return t().createElement("div",{className:"cropper-preview"},t().createElement("div",{className:"cropper-area"},t().createElement("div",{className:"img-cropper"},t().createElement(Mr,{ref:this.cropperRef,aspectRatio:e?e[0]/e[1]:e,src:this.state.src,dragMode:"move",preview:".preview"})),t().createElement("div",{className:"actions"},t().createElement(A.Space,{size:"small"},t().createElement(A.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},p("qm.uploadCropper.zoomIn")),t().createElement(A.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},p("qm.uploadCropper.zoomOut")),t().createElement(A.Button,{type:"primary",size:"middle",icon:t().createElement(we.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},p("qm.uploadCropper.rotatePlus")),t().createElement(A.Button,{type:"primary",size:"middle",icon:t().createElement(we.RotateLeftOutlined,null),onClick:()=>this.rotateHandle(-90)},p("qm.uploadCropper.rotateSubtract"))))),t().createElement("div",{className:"preview-area"},t().createElement("div",{className:"preview",style:this.previewSize})))}render(){const{src:e}=this.state,n=Se("cropper-preview");return t().createElement(t().Fragment,null,this.renderUpload(),e&&t().createElement(A.Modal,{visible:!0,wrapClassName:Ce()(n),title:p("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}Wr(Gr,"contextType",i);const Yr=Gr;function Xr(){return Xr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Xr.apply(this,arguments)}function Qr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Zr extends e.Component{constructor(){super(...arguments),Qr(this,"state",{previewVisible:!1,previewImage:"",previewTitle:""}),Qr(this,"beforeUpload",((e,t)=>new Promise((async(t,n)=>{const{fileTypes:l=[],fileSize:a}=this.props,r=!l.length||l.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),i=!a||e.size/1024/1024<a,o=r&&i;if(r||A.message.warning(p("qm.upload.tooltip",{type:l.join(",")})),i||A.message.warning(p("qm.upload.sizeLimit",{size:a})),!o)return o||A.Upload.LIST_IGNORE;t(e)})))),Qr(this,"handlePreview",(async e=>{e.url||e.preview||(e.preview=await(e=>new Promise(((t,n)=>{const l=new FileReader;l.readAsDataURL(e),l.onload=()=>t(l.result),l.onerror=e=>n(e)})))(e.originFileObj)),this.setState({previewImage:e.url||e.preview,previewVisible:!0,previewTitle:e.name||e.url.substring(e.url.lastIndexOf("/")+1)})}))}get showUploadButton(){var e;const t=(null===(e=this.props.fileList)||void 0===e?void 0:e.length)??0;return!this.props.maxCount||t<this.props.maxCount}render(){const{previewVisible:e,previewImage:n,previewTitle:l}=this.state,{fileList:a,fixedSize:r,quality:i,fileTypes:o,fileSize:s,openCropper:c,beforeCrop:d}=this.props,u=Se("upload-img"),h=t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("div",{style:{marginTop:8}},p("qm.uploadCropper.dragableText"))),m=t().createElement(A.Upload,Xr({className:u},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,onPreview:this.handlePreview}),this.showUploadButton?h:null);return t().createElement(t().Fragment,null,c?t().createElement(Yr,{fixedSize:r,quality:i,fileTypes:o,fileSize:s,beforeCrop:d},m):m,t().createElement("div",{style:{display:"none"}},t().createElement(A.Image.PreviewGroup,{preview:{visible:e,onVisibleChange:e=>{this.setState({previewVisible:e})}}},null==a?void 0:a.map((e=>t().createElement(A.Image,{key:e.uid,src:e.url,alt:""}))))))}}Qr(Zr,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const Jr=Zr;function ei(t){const[n,l]=e.useState({width:0,height:0});return e.useEffect((()=>{const e=t.current,n=e=>{const{inlineSize:t,blockSize:n}=e.contentBoxSize[0];l({width:t,height:n})};return e&&tn(e,n),()=>{e&&nn(e,n)}}),[t]),n}const ti=(e,t,n)=>{let l;for(let a=0;a<e.length;a++){const r=e[a];if(r.children)if(r.children.some((e=>e[n]===t)))l=r[n];else{const e=ti(r.children,t,n);e&&(l=e)}}return l},ni=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&ni(e.children,t),t(e)||e.children&&e.children.length))),li=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...li(e.children,t)),t(e)&&n.push(e)})),n},ai=(e,t)=>{let n=null;for(let l=0;l<e.length;l++){if(Array.isArray(e[l].children)&&(n=ai(e[l].children,t)),n)return n;if(t(e[l]))return e[l]}return n},ri=(e,t,n,l)=>e.map((e=>e[n]===t?{...e,children:l}:e.children?{...e,children:ri(e.children,t,n,l)}:e)),ii=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ii(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},oi=(e,t,n)=>{for(let l=0;l<e.length;l++){if(e[l][n]===t)return[t];if(Array.isArray(e[l].children)){const a=oi(e[l].children,t,n);if(a)return[e[l][n],a].flat()}}},si=(e,t)=>{var n;const l=(null===(n=e.children)||void 0===n?void 0:n.map((e=>e[t])))||[];return Array.isArray(e.children)&&e.children.forEach((e=>l.push(...si(e,t)))),l},ci=t().forwardRef(((e,n)=>{const{filterable:l=!0,multiple:a,draggable:r,dataSource:o,fetch:s,asyncLoad:c,checkStrictly:d,checkStrategy:u="SHOW_CHILD",placeholder:h=p("qm.form.inputPlaceholder"),fieldsDefine:m,value:f,height:g,defaultSelectedKeys:b=[],defaultExpandAll:y=!0,showSearchBar:v=!0,showCollapse:x=!0,onSelectChange:E,onCheckChange:C,onDragChange:S}=e,{size:w}=t().useContext(i),I=t().useMemo((()=>e.size??w??""),[e.size,w]),N=(null==m?void 0:m.valueKey)||"value",T=(null==m?void 0:m.textKey)||"text",R=(null==m||m.children,t().useRef(null)),O=ei(R),[P,F]=t().useState(g),[H,k]=t().useState(!1),L=(0,J.debounce)((()=>{F(R.current.offsetHeight-G.current.offsetHeight-10)}),5);De((()=>{g||L()}),[O.height]);const[q,$]=t().useState([]),[_,D]=t().useState({}),[K,V]=t().useState([]),[M,j]=t().useState([]),[z,U]=t().useState(""),[B,W]=t().useState(y),G=t().useRef(null),Y=t().useRef([]),X=t().useRef([]);t().useEffect((()=>{Array.isArray(o)&&(Q(o),V(Z(o)),D({}))}),[o]),t().useEffect((()=>{ne()}),[]),De((()=>{ne()}),[null==s?void 0:s.params]),De((()=>{j(te())}),[_]),t().useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=ai(q,(t=>e===t[N]));n&&(Array.isArray(n.children)?n.children.push(t):n.children=[t],Q([...q]))},REMOVE_RECORD:e=>{const t=ti(q,e,N);if(void 0===t&&q.find((t=>t[N]===e)))Q(q.filter((t=>t[N]!==e)));else{var n;const l=ai(q,(e=>t===e[N]));if(!l)return;const a=null===(n=l.children)||void 0===n?void 0:n.findIndex((t=>e===t[N]));a>=0&&(l.children.splice(a,1),Q([...q]))}},UPDATE_RECORD:(e,t)=>{const n=ai(q,(t=>e===t[N]));n&&((0,J.merge)(n,t),Q([...q]))}})));const Q=e=>{$(e),Y.current=e,X.current=ii(e,N)},Z=e=>{if(a)return b;const t=li(e,(e=>b.includes(e[T])));return 1===t.length?[t[0][N]]:[]},ee=e=>{var t;return(null===(t=oi(q,e,N))||void 0===t?void 0:t.slice(0,-1))||[]},te=()=>{if(y)return X.current;const e=[];return K.forEach((t=>{if(a){if("SHOW_ALL"===u&&!X.current.includes(t)&&e.push(...ee(t)),"SHOW_CHILD"===u&&e.push(...ee(t)),"SHOW_PARENT"===u){const n=Cn(q,t);if(n){const l=ee(t),a=si(n,N);e.push(...l,...[t,...a].filter((e=>X.current.includes(e))))}}}else e.push(...ee(t))})),[...new Set(e)]},ne=async()=>{if(!s)return;const{api:e,params:t,dataKey:n,callback:l}=s;try{k(!0);const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,n)??[];Q(e),V(Z(e)),D({}),null==l||l(e)}}catch(e){}k(!1)},le=e=>`${e}|${ya.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ae=Se("search-tree"),re={[ae]:!0,[`${ae}--lg`]:"large"===I,[`${ae}--sm`]:"small"===I};return t().createElement("div",{ref:R,className:Ce()(re)},t().createElement("div",{ref:G,className:"topper"},v&&t().createElement(A.Input.Search,{value:z,size:I,placeholder:h,allowClear:!0,onChange:e=>(e=>{if(!l)return;const t=ni(Y.current,(t=>{if(!e)return!0;const n=t[T]||"";return-1!==le(n).indexOf(e)}));U(e),$(t),y||e?j(ii(t,N)):D({})})(e.target.value)}),x&&t().createElement("a",{className:"trigger",onClick:()=>{W(!B),j(B?[]:X.current)}},B?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(B?"qm.form.collect":"qm.form.spread"))),t().createElement(ht,{spinning:H},t().createElement(A.Tree,{fieldNames:{title:T,key:N,children:"children"},multiple:a,draggable:r,blockNode:r,checkable:a,selectable:!a,height:P,disabled:e.disabled,checkStrictly:d,selectedKeys:f??K,checkedKeys:f??K,expandedKeys:M,treeData:q,loadData:c?async e=>{let{key:t,children:n}=e;if(!s||n)return;const{api:l,params:a,dataKey:r,formatter:i=(e=>e)}=s;try{const e=await l(i({...a,[N]:t}));if(200===e.code){const n=Array.isArray(e.data)?e.data:(0,J.get)(e.data,r)??[],l=ri(Y.current,t,N,n);Q(l)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!z)return!1;const t=e[T]||"";return-1!==le(t).indexOf(z)},onDragEnter:e=>{j(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,l=e.node.pos.split("-"),a=e.dropPosition-Number(l[l.length-1]),r=(e,t,n)=>{for(let l=0;l<e.length;l++){if(e[l][N]===t)return n(e[l],l,e);e[l].children&&r(e[l].children,t,n)}},i=[...q];let o;if(r(i,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)r(i,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];r(i,t,((t,l,a)=>{n=a,e=l})),-1===a?n.splice(e,0,o):n.splice(e+1,0,o)}else r(i,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));Q(i)},onDragEnd:e=>{null==S||S(e,q)},onExpand:e=>{j(e)},onSelect:e=>{V(e);const t=li(Y.current,(t=>e.includes((0,J.get)(t,N))));null==E||E(a?t:t[0])},onCheck:e=>{d&&(e=e.checked),V(e),"SHOW_CHILD"===u&&(e=e.filter((e=>!X.current.includes(e)))),"SHOW_PARENT"===u&&(e=e.filter(((e,t,n)=>!n.includes(ti(q,e,N)))));const t=li(Y.current,(t=>e.includes((0,J.get)(t,N))));null==C||C(a?t:t[0])}})))}));ci.displayName="QmSearchTree";const di=ci,ui=(0,e.createContext)(void 0),pi={dataIndex:r().string.isRequired,title:r().string.isRequired,description:r().string,colSpan:r().number,width:r().number,minWidth:r().number,fixed:r().oneOf(["left","right"]),align:r().oneOf(["left","center","right"]),theadAlign:r().oneOf(["left","center","right"]),printFixed:r().bool,hidden:r().bool,noAuth:r().bool,noFixed:r().bool,ellipsis:r().bool,className:r().string,theadClassName:r().string,children:r().array,sorter:r().oneOfType([r().bool,r().func]),filter:r().shape({type:r().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:r().arrayOf(r().shape({text:r().string,value:r().oneOfType([r().string,r().number])})),style:r().object}),precision:r().number,formatType:r().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:r().bool,canCopy:r().bool,editRender:r().func,dictItems:r().arrayOf(r().shape({text:r().string,value:r().oneOfType([r().string,r().number])})),summation:r().shape({sumBySelection:r().bool,displayWhenNotSelect:r().bool,dataKey:r().string,unit:r().string,render:r().func}),groupSummary:r().shape({dataKey:r().string,unit:r().string,render:r().func}),headRender:r().func,render:r().func},hi=(r().arrayOf(r().shape(pi)).isRequired,r().func,r().array,r().oneOfType([r().string,r().func]).isRequired,r().bool,r().bool,r().shape({api:r().func.isRequired,params:r().object.isRequired,formatter:r().func,beforeFetch:r().func,afterFetch:r().func,stopToFirst:r().bool,dataKey:r().string,callback:r().func}),r().bool,r().bool,r().string,r().string,r().bool,r().bool,r().oneOfType([r().object,r().func]),r().oneOfType([r().object,r().func]),r().array,r().func,r().bool,r().bool,r().shape({type:r().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:r().array,selectedRowKeys:r().array,hideSelectAll:r().bool,checkStrictly:r().bool,filterable:r().bool,selectByClickRow:r().bool,selectFirstRowOnChange:r().bool,clearableAfterFetched:r().bool,selectAllOnCurrentPage:r().bool,fetchSelectedRows:r().shape({api:r().func.isRequired,params:r().object,dataKey:r().string}),fetchAllRowKeys:r().shape({api:r().func.isRequired,params:r().object,dataKey:r().string}),disabled:r().func,onChange:r().func,onSelect:r().func,onSelectAll:r().func}),r().shape({currentRowKey:r().oneOfType([r().number,r().string]),disabled:r().func,onChange:r().func}),r().shape({virtual:r().bool}),r().shape({defaultExpandAllRows:r().bool,defaultExpandedRowKeys:r().array,expandedRowKeys:r().array,hideExpandAll:r().bool,rowExpandable:r().func,expandedRowClassName:r().string,expandedRowRender:r().func,onExpand:r().func,onChange:r().func}),r().shape({groupItems:r().arrayOf(r().shape({dataIndex:r().string.isRequired,titleIndex:r().string,color:r().string,backgroundColor:r().string})),fetch:r().shape({api:r().func.isRequired,params:r().object,dataKey:r().string}),onChange:r().func}),r().func,r().bool,r().bool,r().bool,r().bool,r().shape({current:r().number,pageSize:r().number,pageSizeOptions:r().array,showSizeChanger:r().bool,showQuickJumper:r().bool}),r().shape({fileName:r().string,fetch:r().shape({api:r().func.isRequired,params:r().object}),beforeExport:r().func,cellStyle:r().bool,hideIcon:r().bool}),r().shape({showLogo:r().bool}),r().shape({fetch:r().shape({api:r().func.isRequired,params:r().object,dataKey:r().string}),fieldList:r().arrayOf(r().object)}),r().shape({position:r().oneOf(["top","bottom"]),hideAlert:r().bool,hideClearButton:r().bool}),r().oneOf(["left","right"]),r().func,r().func,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().bool,r().func,r().func,r().func,r().func,r().func,r().func,r().func,r().func,r().func,10),mi="1",fi="0",gi="YYYY-MM-DD",bi="YYYY-MM-DD HH:mm:ss",yi="YYYYMMDDHHmmss",vi={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 xi;!function(e){e.left="flex-start",e.right="flex-end"}(xi||(xi={}));let Ei=[];const Ci={getFocusInstance:function(){return Ei[0]??null},getInstance:function(e){return Ei.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Ei.findIndex((e=>e===t))&&(this.deregister(e),Ei=[t,...Ei])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Ei=[{id:e,vm:t},...Ei])},deregister:function(e){e&&(Ei=Ei.filter((t=>t.id!==e)))}},Si=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],wi={operations:function(e){const t=e.split(" "),n=[];let l=0;n[l]=[];for(let e=0;e<t.length;e++)Si.includes(t[e])?(n[l]=n[l].join(" "),l++,n[l]=[]):n[l].push(t[e]);return n[l]=n[l].join(" "),n},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let n=0,l=(e=Array.isArray(e)?e:[e]).length;n<l;n++)t+="number"==typeof e[n]?e[n]:"'"+e[n]+"'",n<l-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 "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},Ii=["==","<",">","<=",">=","!=","like","likes","in","nin"],Ni=function(e,t){let n="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?n+=" "+e[t]+" ":n+=e[t];const l=n.split(" ").filter((e=>""!==e));for(let e=0;e<l.length;e++)Ii.includes(l[e])&&("this"!=l[e-1]?l[e-1]=t+"."+l[e-1]:l[e-1]=t),Ii.includes(l[e])&&(l.splice(e-1,3,`__query__(${l[e-1]}, '${l[e]}', ${l[e+1]})`),e-=2);return l.join(" ")},Ti=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Ri=["string","number","boolean","symbol"],Oi=e=>Ri.includes(typeof e),Ai=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Pi=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Ti,"\\$1"),"i");window.__query__=function(){return((e,t,n)=>{e=e??"";let l=!0;switch(t){case"like":l=null!==e.toString().match(Pi(n));break;case"likes":l=n.split(/,|,/).some((t=>null!==e.toString().match(Pi(t))));break;case"in":Oi(n)&&(n=[n]),Array.isArray(n)&&(l=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Oi(n)&&(n=[n]),Array.isArray(n)&&(l=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":l=(Ai(e)?e.slice(0,10):e)!=n;break;case"<":l=(Ai(e)?e.slice(0,10):e)<n;break;case"<=":l=(Ai(e)?e.slice(0,10):e)<=n;break;case">":l=(Ai(e)?e.slice(0,10):e)>n;break;case">=":l=(Ai(e)?e.slice(0,10):e)>=n;break;default:l=(Ai(e)?e.slice(0,10):e)==n}return l})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const Fi=wi.stringify,Hi=wi.array_format,ki=function(e){let t=0;const n=e.length;for(let l=0;l<n;l++){const n=e.charAt(l);"("===n&&t++,")"===n&&t--}return 0===t},Li=(e,t,n)=>{let l=[];if(t=wi.replace_symbols(t),n){const n=new Function("record",`return ${Ni(t,"record")};`);l=uo(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Ni(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)n(e,t)&&l.push(e[t])}return l},qi=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...qi(e.children)):t.push(e)})),t},$i=e=>{const t=[];return e.forEach((e=>{let n=e;e.children&&(n={...e},n.children=$i(e.children)),e.hidden||e.noAuth||t.push(n)})),t},_i=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(..._i(e.children))})),t},Di=(e,t)=>e.map((e=>(e.children&&(e.children=Di(e.children,t)),null==t||t(e),e))),Ki=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Ki(n.children,t);if(e)return e}}return null},Vi=e=>{const t=e.children;return t?t[0].children?Vi(t[0]):t[0]:e},Mi=e=>{const t=e.children;return t?t[t.length-1].children?Mi(t[t.length-1]):t[t.length-1]:e},ji=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),zi=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=zi(n.children,t);if(e)return e}}return null},Ui=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Ui(e.children))})),t},Bi=e=>{let t=1;const n=(e,l)=>{if(l&&(e.level=l.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((l=>{e.fixed?l.fixed=e.fixed:delete l.fixed,n(l,e),t+=l.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,n(e,null)}));const l=[];for(let e=0;e<t;e++)l.push([]);return _i(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,l[e.level-1].push(e)})),l},Wi=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const l=e.parentNode;if(n.top+=e.offsetTop,n.left+=e.offsetLeft,l&&l!==document.documentElement&&l!==document.body&&(n.top-=l.scrollTop,n.left-=l.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Wi(e.offsetParent,t,n)}return n},Gi=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Yi=(e,t)=>(0,J.transform)(e,((e,n,l)=>{(0,J.isEqual)(n,t[l])||(e[l]=(0,J.isPlainObject)(n)&&(0,J.isPlainObject)(t[l])?Yi(n,t[l]):n)})),Xi=(e,t)=>(0,J.intersection)(e,t).length===t.length,Qi=(e,t)=>(0,J.get)(e,t)??"",Zi=(e,t,n,l)=>{l>=0&&null!=n&&(n=Number(n).toFixed(l)),(0,J.set)(e,t,n??"")},Ji=(e,t)=>{if(!t.includes("|"))return Qi(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(Qi(e,t))})),n.join(" | ")},eo=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let l=n?t[0].slice(1):t[0],a="";for(;l.length>3;)a=`,${l.slice(-3)}${a}`,l=l.slice(0,l.length-3);return l&&(a=l+a),`${n}${a}${t[1]?`.${t[1]}`:""}`},to=(e,t)=>e?s()(e,t):null,no=(e,t)=>e?s()(e).format(t):"",lo=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},ao=e=>{const t=[];if(te(e)){const{children:n}=e.props;Array.isArray(n)?n.forEach((e=>t.push(...ao(e)))):n&&t.push(...ao(n))}else t.push(e);return t},ro=e=>e.filter((e=>!e._group)),io=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n="";if(Array.isArray(e)){let l=0;for(let a=0,r=e.length;a<r;a++){const r=e[a];if(!r.fieldName)continue;const i=Array.isArray(r.condition)?Hi(r.condition):Fi(r.condition,"^");n+=`${r.bracketLeft} ${t?`${r.fieldName}|${r.fieldType}`:r.fieldName} ${r.expression} ${i} ${r.bracketRight} ${r.logic} `,l=r.logic.length}n=n.slice(0,-1*l-2)}else{const l=5;for(const l in e){const[a,r]=l.includes("|")?l.split("|"):[l,""],i=e[l];for(const e in i)n+=`${t?`${a}|${r}`:a} ${e} ${Array.isArray(i[e])?Hi(i[e]):Fi(i[e],"^")} and `}n=n.slice(0,-1*l)}return n.replace(/\s+/g," ").trim()},oo=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((n=>{const l=JSON.stringify((t=>{const n=[];return e.forEach((e=>n.push(Qi(t,e)))),n})(n));t[l]=t[l]||[],t[l].push(n)})),Object.keys(t).map((e=>t[e]))},so=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].rowKey===t)return[t];if(Array.isArray(e[n].children)){const l=so(e[n].children,t);if(l)return[e[n].rowKey,l].flat()}}},co=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=co(n.children,t);if(e)return e}if(t(n))return n}return null},uo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&uo(e.children,t),t(e)||e.children&&e.children.length)));function po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ho=class{constructor(){po(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),po(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),po(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)})),po(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),po(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)})),po(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),po(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)})),po(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),po(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),po(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),po(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),po(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),po(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),po(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),po(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},mo={defaultColumnWidth:80,selectionColumnWidth:50,rowHeightMaps:{large:42,middle:34,small:26},sortDirections:["ascend","descend"],pagination:{current:1,pageSize:20,pageSizeOptions:[10,20,30,40,50],showSizeChanger:!0,showQuickJumper:!0},groupSummary:{total:{text:"记录数",value:"*"},recordTotalIndex:"nRecordsCount",summaryFieldName:"tsummary",groupbyFieldName:"tgroupby"},highSearch:{showSQL:!1},treeTable:{textIndent:17},dataKey:"records",summationKey:"summation",totalKey:"total",virtualScrollY:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};let fo;const go=()=>{var e;if(ee)return 0;if(void 0!==fo)return fo;const t=document.createElement("div");t.className="qm-scrollbar__wrap",t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const n=t.offsetWidth;t.style.overflow="scroll";const l=document.createElement("div");l.style.width="100%",t.appendChild(l);const a=l.offsetWidth;return null===(e=t.parentNode)||void 0===e||e.removeChild(t),fo=n-a,fo},bo=e=>e.map((e=>(e.children&&(e.children.forEach((t=>{t.parentDataIndex=e.dataIndex,e.fixed?t.fixed=e.fixed:delete t.fixed})),e.children=bo(e.children)),e))),yo=(e,n)=>{const{fetch:l,columns:a,height:r,minHeight:i,maxHeight:o,border:s=!0,rowSelection:c,summation:d,expandable:u,webPagination:h,scrollPagination:m,dragMergeCell:f,showSuperSearch:g,showFastSearch:b,showGroupSummary:y,showTableImport:v,showClipboard:x,showSelectCollection:E,footRender:C}=e,{tableRef:S,tableFullData:w,tableData:I,sorter:N,filters:T,superFilters:R,pagination:O}=n,{selectionRows:A,summaries:P}=S.current,F=t().useMemo((()=>!(null==l||!l.api)),[null==l?void 0:l.api]),H=t().useMemo((()=>!F&&!!h),[F,h]),k=t().useMemo((()=>F&&!!m),[F,m]),L=t().useMemo((()=>(F||H)&&!k),[F,H,k]),q=t().useMemo((()=>!!(r||i||o)),[r,i,o]),$=t().useMemo((()=>(e=>{const t=(e=>{const t=[],n=[],l=[];for(let a=0;a<e.length;a++){const r=e[a];"left"===r.fixed?t.push(r):"right"===r.fixed?n.push(r):l.push(r)}return[...t,...l,...n]})(bo(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:mo.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:mo.selectionColumnWidth,fixed:"left",type:t}})(c),l=null!=(a=u)&&a.expandedRowRender?{dataIndex:mo.expandableColumn,title:"",width:mo.selectionColumnWidth,fixed:"left",type:"expand"}:null;var a;return n&&t.unshift(n),l&&t.unshift(l),$i(t)})(a)),[a]),_=t().useMemo((()=>qi($)),[$]),D=t().useMemo((()=>_.filter((e=>"function"==typeof e.editRender))),[_]),K=t().useMemo((()=>_.filter((e=>!!e.summation))),[_]),V=t().useMemo((()=>_.filter((e=>"left"===e.fixed))),[_]),M=t().useMemo((()=>_.filter((e=>"right"===e.fixed))),[_]),j=t().useMemo((()=>{const e=_.filter((e=>![mo.expandableColumn,mo.selectionColumn,mo.operationColumn].includes(e.dataIndex)));return e.length?e[0].dataIndex:""}),[_]),z=t().useMemo((()=>K.length>0),[K]),U=t().useMemo((()=>!!C||z),[C,z]),B=t().useMemo((()=>Bi($).length>1),[$]),W=t().useMemo((()=>s||B),[s,B]),G=t().useMemo((()=>_.some((e=>e.sorter))),[_]),Y=t().useMemo((()=>_.some((e=>e.filter))),[_]),X=t().useMemo((()=>K.some((e=>!!e.summation.dataKey))),[K]),Q=t().useMemo((()=>!F&&!!v),[F,v]),Z=t().useMemo((()=>!!x&&D.length>0),[x,D]),J=t().useMemo((()=>!!E&&"checkbox"===(null==c?void 0:c.type)),[E,c]),ee=t().useMemo((()=>!!g&&Y),[g,Y]),te=t().useMemo((()=>!F&&!!b&&Y),[F,b,Y]),ne=t().useMemo((()=>!!y&&_.some((e=>!!e.groupSummary))),[_]),le=t().useMemo((()=>{var e;return!(null==d||null===(e=d.groupItems)||void 0===e||!e.length)}),[d]),ae=t().useMemo((()=>!!f&&!F&&!h),[f,F,h]),re=t().useMemo((()=>w.some((e=>Array.isArray(e.children)&&e.children.length))),[w]),ie=t().useMemo((()=>!I.length),[I]),oe=t().useMemo((()=>(()=>{const e={};return K.forEach((t=>{const{dataIndex:n,precision:l,summation:a}=t,{sumBySelection:r,displayWhenNotSelect:i,unit:o}=a,s=le?ro(S.current.tableFullData):S.current.tableFullData,c=!A.length&&!!i;let d=(!r||c?s:A).reduce(((e,t)=>{if(null!=t&&t[mo.summaryIgnore])return e;const l=Number(Qi(t,n));return Number.isNaN(l)?e:new(Dn())(e).plus(l).toNumber()}),0);!Object.keys(P).includes(n)||r&&!c||(d=Number(Qi(P,n))),Zi(e,n,d);let u=l>=0?d.toFixed(l):d;u=eo(u),Zi(e,`${n}_text`,o?`${u} ${o}`:u)})),[e]})()),[w,A,P]),se=t().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(K)),[K]),ce=t().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(N),t=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[l,a]=mo.showFilterType?t.split("|"):[t,""],r=e[t];Object.keys(r).forEach((e=>{n.push({type:a,bracketLeft:"",fieldName:l,expression:e,value:r[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{n.push({type:mo.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(T,R);return{...e?{[mo.sorterFieldName]:e}:null,...t.length?{[mo.filterFieldName]:t}:null,...se?{[mo.groupSummary.summaryFieldName]:se,usedJH:1}:null,...(null==l?void 0:l.params)??null,[mo.currentPageName]:O.current,[mo.pageSizeName]:O.pageSize}}),[null==l?void 0:l.params,O.current,O.pageSize,N,T,R,se]);return{isFetch:F,isWebPagination:H,isScrollPagination:k,showPagination:L,shouldUpdateHeight:q,tableColumns:$,flattenColumns:_,editableColumns:D,summationColumns:K,leftFixedColumns:V,rightFixedColumns:M,firstDataIndex:j,showSummary:z,showFooter:U,isHeadGroup:B,bordered:W,isHeadSorter:G,isHeadFilter:Y,isServiceSummation:X,isSelectCollection:J,isTableImport:Q,isTableClipboard:Z,isSuperSearch:ee,isFastSearch:te,isGroupSummary:ne,isGroupSubtotal:le,isDragMergeCell:ae,isTreeTable:re,isTableEmpty:ie,summationRows:oe,fetchParams:ce}},vo=(n,l)=>{const{rowKey:a,dataSource:r,summation:i,fetch:o,rowSelection:s,expandable:c,treeConfig:d,authConfig:u,ignorePageIndex:p,columnsChange:h,onScrollEnd:m,onDataChange:f,onDataLoad:b,onChange:y}=n,{getRowKey:v,tableRef:x,tableElementRef:E,tableBodyRef:C,$size:S,tableColumns:w,tableFullData:I,pagination:N,layout:T,filters:R,sorter:O,superFilters:A,fetchParams:P,selectionKeys:F,rowExpandedKeys:H,highlightKey:k,summationColumns:L,shouldUpdateHeight:q,isFetch:$,isTreeTable:_,isWebPagination:D,isScrollPagination:K,isServiceSummation:V,isGroupSubtotal:M,doLayout:j,setTableData:z,setTableFullData:U,setTableOriginData:B,setAllTableData:W,setDeriveRowKeys:G,setPagination:Y,setSpinning:X,setSorter:Q,setFilters:ee,setSuperFilters:te,setSelectionKeys:ne,setRowExpandedKeys:le,setHighlightKey:re,setSelectionRows:ie,setScrollYLoad:oe,setScrollYStore:ce,setFieldAuth:de,setResizeState:ue,setSummaries:pe,setPermission:he,setRecordsMap:me,resetTableScroll:fe,clearElementStore:ge,clearRecordsMap:be}=l,{store:ye}=x.current,ve=ei(E),xe=t().useRef({...P}),Ee=t().useRef({list:[],maps:new Map});De((()=>{j()}),[w,S,T.tableAutoHeight]),De((()=>{Ce()}),[ve]),De((()=>{tt(),nt(),lt(),$||(D&&Be(),Ke(r))}),[r,null==o?void 0:o.params]),De((()=>{const e=qe(P,xe.current);e||$&&(null==s?void 0:s.clearableAfterFetched)&&at(),e||!(P[mo.currentPageName]>1)||null!=o&&o.stopToFirst?$&&_e():Be(),xe.current=P}),[P]),De((()=>{D&&Qe(),K||fe(),He()}),[N.current,N.pageSize]),De((()=>{$||Se(I.length),j()}),[I]),De((()=>{_&&null!=d&&d.virtual&&(We(),Qe())}),[H]);const Ce=()=>{const{scrollYLoad:e,resizeState:t}=x.current,{height:n}=t,{width:l,height:a}=ve,r=a!==n;j(),r&&q&&e&&Qe(),ue(Object.assign({},t,{width:l,height:a}))},Se=e=>{e!==N.total&&Y((t=>Object.assign({},t,{total:e})))},we=(0,J.debounce)((e=>{je(),null==m||m(e)})),Ie=e=>M?Ne(Te(e,0)):e,Ne=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ne(e.children)),delete e.children,t.push(e)})),t},Te=(e,t)=>{var n;const l=null===(n=i.groupItems)||void 0===n?void 0:n[t];return l?oo(e,[l.dataIndex]).map((e=>{const n={children:Te(e,t+1),_group:l.dataIndex};return"function"!=typeof a&&Zi(n,a.toString(),lo()),l.titleIndex&&Zi(n,l.titleIndex,Qi(e[0],l.titleIndex)),Zi(n,l.dataIndex,Qi(e[0],l.dataIndex)),L.forEach((e=>{var t;const{dataIndex:l}=e,a=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[mo.summaryIgnore])return e;const n=Number(Qi(t,l));return Number.isNaN(n)?e:e+n}),0);Zi(n,l,a)})),n})):(e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e)},Re=e=>{const{selectionRows:t,allTableData:n,recordsMap:l}=x.current;if($)return[...t.filter((t=>e.includes(v(t,t.index)))),...n.filter((n=>{const l=v(n,n.index);return e.includes(l)&&-1===t.findIndex((e=>v(e,e.index)===l))}))];const a=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];l.has(n)&&a.push(l.get(n))}return a},Oe=e=>{const{type:t,checkStrictly:n=!0}=s||{},l=Array.isArray(e)?e:F;let a=[];return x.current.treeTable&&!n&&l.forEach((e=>{a.push(...((e,t)=>{var n;const{deriveRowKeys:l}=x.current,a=zi(l,e);let r=[];if(!a)return r;const i=Pe((null==a?void 0:a.children)||[]),o=(null===(n=so(l,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[];return r=[...new Set([...t,...i])],o.forEach((e=>{var t;const n=zi(l,e),a=Xi(r,(null==n||null===(t=n.children)||void 0===t?void 0:t.map((e=>e.rowKey)))||[]);r=a?[...r,e]:r.filter((t=>t!==e))})),r})(e,l))})),a="radio"===t?l.slice(0,1):[...new Set([...l,...a])],a},Ae=e=>{const{allRowKeys:t,deriveRowKeys:n,flattenRowKeys:l}=x.current,{defaultExpandAllRows:a,expandedRowRender:r}=c||{},i=Array.isArray(e)?e:H;if(x.current.treeTable){r&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...F];k&&e.unshift(k);let o=[];return e.forEach((e=>{const t=so(n,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=a?t:[...new Set([...i,...o])],o.filter((e=>!l.includes(e)))}return c?a?t.slice(0):[...i]:[]},Pe=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...Pe(e[n].children)),t.push(e[n].rowKey);return t},Fe=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Fe(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...Fe(e,n[n.length-1])),n},He=(0,J.debounce)((()=>{Me(),null==y||y(N,Le(R),ke(O),A,{currentDataSource:Ye()})})),ke=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},Le=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[l,a]=n.split("|");t[mo.showFilterType?`${l}|${a}`:l]=e[n]}return t},qe=(e,t)=>{const n=Object.keys(Yi(e,t));return 1===n.length&&(n.includes(mo.currentPageName)||n.includes(mo.pageSizeName))},$e=async()=>{var e;if(!o)return;const{formatter:t=(e=>e),beforeFetch:n=ae,afterFetch:l,callback:a}=o;if(!n(P))return;const r=K&&P[mo.currentPageName]>xe.current[mo.currentPageName]&&qe(P,xe.current),s=!(null==i||null===(e=i.fetch)||void 0===e||!e.api);X(!0);try{const[e,n]=s?await Promise.all([o.api(t(P)),i.fetch.api(t(P))]):[await o.api(t(P))];if(s?200===e.code&&200===n.code:200===e.code){const t=o.dataKey??mo.dataKey;let i=(0,J.get)(e.data,t)??[];i="function"==typeof l?await l(i):i;const s=(0,J.get)(e.data,t.replace(/[^.]+$/,mo.totalKey))||i.length||0;Ke(r?x.current.tableFullData.concat(i):i),Se(s),Ve((null==n?void 0:n.data)||e.data),null==a||a(e.data)}}catch(e){}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(o)&&(o.stopToFirst=!1),X(!1)},_e=function(t,n){const l=e.useRef();return e.useEffect((()=>()=>clearTimeout(l.current)),[]),()=>{clearTimeout(l.current),l.current=setTimeout(t,undefined)}}($e),Ke=e=>{const t=e=>e.map(((e,n)=>(Array.isArray(e.children)&&e.children.length&&(e.children=t(e.children)),e.index=n,p||(e.pageIndex=(e=>{const{current:t,pageSize:n}=N;return!$||K?e:(t-1)*n+e})(n)),e))),n=Ie(t(e));Ze(n),Je(n),et(),ne(Oe()),le(Ae()),ie(Re(F)),Me(),null==b||b(n)},Ve=e=>{var t;if(!V)return;const n=(null==i||null===(t=i.fetch)||void 0===t?void 0:t.dataKey)??mo.summationKey,l=(n?(0,J.get)(e,n):e)??{},a={};L.filter((e=>!!e.summation.dataKey)).forEach((e=>{Zi(a,e.dataIndex,Number(Qi(l,e.summation.dataKey)))})),pe(a)},Me=()=>{const{type:e,selectFirstRowOnChange:t}=s||{};if("radio"===e&&t){const e=Ye();if(e.length){const t=v(e[0],e[0].index);ne([t])}else ne([])}},je=()=>{if(!K)return;const e=Ue();N.current>=e||ze({...N,current:N.current+1})},ze=e=>{let{current:t,pageSize:n}=e;Y((e=>Object.assign({},e,{current:t,pageSize:n})))},Ue=()=>{const{pageSize:e,total:t}=N;return Math.ceil(t/e)},Be=()=>{ze(Object.assign({},N,{current:1}))},We=()=>{if(!x.current.treeTable||null==d||!d.virtual)return;const e=Ge(x.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=x.current,{rowExpandable:n}=c||{},l=[];return"function"==typeof n&&e.forEach(((e,a)=>!n(e)&&l.push(t[a]))),l.length?H.filter((e=>!l.includes(e))):H})());Ee.current.list=e,Ee.current.maps.clear(),e.forEach(((e,t)=>Ee.current.maps.set(e.rowKey,t)))},Ge=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Ge(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&n.push({rowKey:e.rowKey,level:e.level})})),n},Ye=()=>D?(()=>{const{current:e,pageSize:t}=N;return x.current.tableFullData.slice((e-1)*t,e*t)})():x.current.tableFullData,Xe=e=>{const{scrollYLoad:t,scrollYStore:n}=x.current;z(t?e.slice(n.startIndex,n.endIndex):e)},Qe=()=>{let e=Ye();x.current.treeTable&&null!=d&&d.virtual&&(e=(e=>{const{allTableData:t,allRowKeys:n}=x.current,{list:l,maps:a}=Ee.current,r=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];a.has(i)&&(t[e]._level=l[a.get(i)].level,r.push(t[e]))}return r})()),oe(e.length>mo.virtualScrollY),(e=>{const{elementStore:t,scrollYStore:n,scrollYLoad:l}=x.current,{startIndex:a,rowHeight:r}=n;let i="",o="";l&&(i=`translateY(${Math.max(0,a*r)+"px"})`,o=e.length*r+"px"),t.$tableBody.style.transform=i,t.$tableYspace.style.height=o})(e),Xe(e)},Ze=e=>{U(e),W(e),G(e),We(),Qe()},Je=e=>{B(e)},et=()=>{const{allTableData:e}=x.current;be(),e.forEach((e=>me(v(e,e.index),e)))},tt=()=>{Q({})},nt=()=>{ee({})},lt=()=>{te([])},at=()=>{ne([])};return{initialTable:()=>{(async()=>{if(!u)return;let e=Z()(u,["fetch"]);if(u.fetch){const{api:t,params:n,dataKey:l}=u.fetch;try{const a=await t(n);200===a.code&&(e=(l?(0,J.get)(a.data,l):a.data)??{})}catch(e){}}if(Object.keys(e).length){const{isExport:t=1,isImport:n=1,isPrint:l=1}=e;he((e=>Object.assign({},e,{export:!!t,import:!!n,print:!!l})))}if(Array.isArray(e.fieldList)){const{originColumns:t}=x.current,l=Di(n.columns,(n=>{const{dataIndex:l}=n,a=e.fieldList.find((e=>e.dataIndex===l));if(a){const{visible:e=1,disabled:r,secretName:i}=a,o=Ki(t,l);de(l,{visible:e,disabled:r,secretName:i}),e||(n.noAuth=!0,o.noAuth=!0),i&&(n.formatType=`secret-${i}`,o.formatType=`secret-${i}`)}}));null==h||h(l)}})(),k&&C.current.setClickedValues([k,""]),"radio"===(null==s?void 0:s.type)&&F.length&&C.current.setClickedValues([F[0],""]),$?$e():Ke(r)},createTableFullData:Ze,getTableData:$e,handleTableData:Xe,createTableData:Ke,createGroupData:Ie,createSelectionKeys:Oe,createSelectionRows:Re,createRowExpandedKeys:Ae,findParentRowKeys:Fe,getAllChildRowKeys:Pe,doFieldValidate:(e,t,n,l)=>{if(!Array.isArray(e))return g("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(ye.removeFromRequired({x:n,y:l}),ye.removeFromValidate({x:n,y:l}),e.forEach((e=>{var a;e.required&&se(t)&&ye.addToRequired({x:n,y:l,text:e.message}),"function"!=typeof e.validator||null!==(a=e.validator)&&void 0!==a&&a.call(e,t)||ye.addToValidate({x:n,y:l,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:l,removed:a}=ye.state,r=(0,J.intersection)(n,a),i=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:i(e),validate:i(t),inserted:n.filter((e=>!r.includes(e))),updated:l.filter((e=>![...(0,J.intersection)(l,n),...(0,J.intersection)(l,a)].includes(e))),removed:a.filter((e=>!r.includes(e)))}},dataChange:()=>{null==f||f(x.current.tableFullData)},tableChange:He,toLastPage:()=>{const e=Ue();N.current!==e&&ze(Object.assign({},N,{current:e}))},toFirstPage:Be,getPageCount:Ue,pagerChangeHandle:ze,triggerScrollYEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=x.current,{startIndex:n,endIndex:l,offsetSize:a,visibleSize:r,rowHeight:i}=t,o=Math.floor(e/i),s=Math.max(0,o-1-a),c=o+r+a;(o<=n||o>=l-r-1)&&(n===s&&l===c||(ce(Object.assign({},t,{startIndex:s,endIndex:c})),Qe()))}(e)},scrollBottomDebouncer:we,clearTableSorter:tt,clearTableFilter:nt,clearSuperFilters:lt,clearRowSelection:at,clearRowHighlight:()=>{re("")},clearTableLog:()=>{ye.clearAllLog()},destroy:()=>{ge(),ye.destroy(),Ci.deregister(x.current.uid)}}},xo=(e,n)=>{const{height:l,minHeight:a,maxHeight:r,resizable:i,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,$size:u,tableColumns:p,flattenColumns:h,leftFixedColumns:m,layout:f,scrollY:g,tableData:b,showFooter:y,showPagination:v,isWebPagination:x,isFullScreen:E,setLayout:C,setScrollX:S,setScrollY:w,setElementStore:I,setScrollYStore:N,setShouldToTop:T}=n,R=t().useRef(g),O=t().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=f,n={};return a&&Object.assign(n,{minHeight:`${Gi(a)}px`}),r&&Object.assign(n,{maxHeight:`${Gi(r)}px`}),E?{...n,maxHeight:"",minHeight:"",height:`${e}px`}:l?{...n,height:"auto"!==l?`${Gi(l)}px`:`${t}px`}:n}),[l,r,a,E,f]),A=(e,t)=>{const{elementStore:n,scrollYStore:l,allTableData:a}=d.current,r=n.$tableBody.parentNode;if(void 0!==t&&t>=0)r.scrollTop=t*l.rowHeight;else{const t=(x?Ui(b):a).findIndex((t=>e===c(t,t.index)));r.scrollTop=(t<0?0:t)*l.rowHeight}};return{createElementStore:e=>{Object.keys(e).forEach((t=>{I(t,e[t])}))},tableStyles:O,getSpan:(e,t,n,l,a)=>{let r=1,i=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:l,tableData:a});Array.isArray(o)?(r=o[0],i=o[1]):(0,J.isPlainObject)(o)&&(r=o.rowSpan,i=o.colSpan)}const{mergeCells:o}=d.current;if(o.length>0){const e=o.find((e=>e.row===n&&e.col===l));e&&(r=e.rowSpan,i=e.colSpan)}return{rowSpan:r,colSpan:i}},getStickyLeft:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Vi(Ki(p,e)).dataIndex);let t=0;for(let n=0;n<h.length;n++){const l=h[n];if(l.dataIndex===e)break;t+=Gi(l.width||l.renderWidth||0)}return t},getStickyRight:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Mi(Ki(p,e)).dataIndex);let t=0;for(let n=h.length-1;n>=0;n--){const l=h[n];if(l.dataIndex===e)break;t+=Gi(l.width||l.renderWidth||0)}return t},scrollXToColumn:(e,t)=>{const{elementStore:n}=d.current,l=void 0===t?h.findIndex((t=>t.dataIndex===e)):t;if(l<0)return;const a=m.map((e=>e.width||e.renderWidth||mo.defaultColumnWidth)).reduce(((e,t)=>e+t),0);n.$tableBody.parentNode.scrollLeft=n.$tableBody.querySelectorAll("tbody > tr > td")[l].offsetLeft-a},scrollYToRecord:A,rowInViewport:e=>{const{elementStore:t,scrollYStore:n}=d.current,{viewportHeight:l,gutterWidth:a}=f,r=e*n.rowHeight,i=t.$tableBody.parentNode;return!(r<i.scrollTop||r+n.rowHeight>i.scrollTop+(scrollX?l-a:l))},calcTableHeight:()=>{if("auto"!==l)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(v?Wn["small"!==u?"middle":u]+hi:0)-hi;C((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&A("",0),T(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const l=e.$table.offsetHeight,a=o?e.$header.offsetHeight:f.headerHeight,r=y?e.$footer.offsetHeight:f.footerHeight,i=l-a-r,s=e.$tableBody.offsetHeight,c=t||s>i;let p=0;if(E){const t=e.$toper?e.$toper.offsetHeight+hi:0,l=e.$pager?e.$pager.offsetHeight+hi:0;p=n.winHeight-t-l-20}i!==f.viewportHeight&&(e=>{const{scrollYStore:t,isIE:n}=d.current,{startIndex:l,endIndex:a}=t,r=mo.rowHeightMaps[u],i=Math.max(8,Math.ceil(e/r)+2),o=n?5:0;N(Object.assign({},t,{visibleSize:i,offsetSize:o,endIndex:Math.max(l+i+o,a),rowHeight:r}))})(i),R.current=c,w(c),C((e=>Object.assign({},e,{headerHeight:a,footerHeight:r,viewportHeight:i,tableBodyHeight:s,tableFullHeight:p})))})(),(()=>{const{elementStore:e}=d.current,t=e.$table.clientWidth,n=R.current?f.gutterWidth:0,{defaultColumnWidth:l}=mo,a=h.filter((e=>"number"!=typeof e.width));let r=0;if(h.forEach((e=>{"number"==typeof e.width&&(e.renderWidth=void 0)})),a.length>0){if(h.forEach((e=>{r+=e.width||e.minWidth||l})),r<=t-n){S(!1);const e=t-n-r;if(1===a.length&&i)a[0].renderWidth=(a[0].minWidth||l)+e;else{const t=e/a.reduce(((e,t)=>e+(t.minWidth||l)),0);let n=0;a.forEach(((e,a)=>{if(0===a)return;const r=Math.floor((e.minWidth||l)*t);n+=r,e.renderWidth=(e.minWidth||l)+r})),i&&(a[0].renderWidth=(a[0].minWidth||l)+e-n)}}else S(!0),a.forEach((e=>{e.renderWidth=e.minWidth||l}));C((e=>Object.assign({},e,{tableBodyWidth:Math.max(r,t)})))}else h.forEach((e=>{e.renderWidth=e.width||e.minWidth||l,r+=e.renderWidth})),S(r>t),C((e=>Object.assign({},e,{tableBodyWidth:r})));C((e=>Object.assign({},e,{tableWidth:t})))})()}}};function Eo(){const[,t]=e.useReducer((e=>e+1),0);return t}const Co=e=>{const{total:n}=e,{tableRef:l,tableProps:a,selectionKeys:r,isHeadSorter:i,isHeadFilter:o,isTreeTable:s,clearTableSorter:c,clearTableFilter:d,clearSuperFilters:u,clearRowSelection:h,clearRowHighlight:m}=t().useContext(ui),{infoBarConfig:f,rowSelection:g,rowHighlight:b}=a,{allTableData:y}=l.current,{hideAlert:v,hideClearButton:x}=f||{},E=t().useMemo((()=>!v),[v]),C=t().useMemo((()=>!x&&!!(i||o||g||b)),[x,i,o,g,b]),S={[`${Se("table")}__alert`]:!0};return E?t().createElement("div",{className:Ce()(S)},t().createElement("i",{className:"svgicon icon"},t().createElement(we.InfoCircleFilled,null)),t().createElement("span",null,p("qm.table.alert.total",{total:s?y.length:n}),g?`,${p("qm.table.alert.selected",{total:r.length})}`:""),C&&t().createElement("em",{onClick:()=>{c(),d(),u(),h(),m()}},p("qm.table.alert.clear"))):null},So=t().forwardRef(((e,n)=>{const{isFullScreen:l,open:a=!0}=e,{setFullScreen:r}=t().useContext(ui),i=()=>{r(!l)};t().useImperativeHandle(n,(()=>({clickHandle:i})));const o=Se("table");return a?t().createElement("span",{className:`${o}-full-screen`,title:p(l?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},l?t().createElement(we.FullscreenExitOutlined,null):t().createElement(we.FullscreenOutlined,null))):null}));So.displayName="FullScreen";const wo=So,Io=t().forwardRef(((e,n)=>{const{open:l=!0}=e,{getTableData:a}=t().useContext(ui),r=()=>{a()};t().useImperativeHandle(n,(()=>({clickHandle:r})));const i=Se("table");return l?t().createElement("span",{className:`${i}-reload`,title:p("qm.table.refresh.text"),onClick:()=>r()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ReloadOutlined,null))):null}));Io.displayName="Reload";const No=Io,To=t().forwardRef(((e,n)=>{var l,a;const{tableColumns:r,open:o=!0}=e,{global:s}=t().useContext(i),{tableRef:c,tableBodyRef:d,tableProps:u,flattenColumns:h,summationRows:m,showSummary:f,getSpan:g}=t().useContext(ui),{tablePrint:b,showHeader:y}=u,v=(null==s||null===(l=s.print)||void 0===l?void 0:l.leftLogo)??"",x=(null==s||null===(a=s.print)||void 0===a?void 0:a.rightLogo)??"",E=!(!v&&!x),C=t().useMemo((()=>ce(ji(r,[mo.expandableColumn,mo.selectionColumn,mo.operationColumn]))),[r]),S=t().useMemo((()=>ce(ji(h,[mo.expandableColumn,mo.selectionColumn,mo.operationColumn]))),[h]),w=t().useMemo((()=>ce(r.filter((e=>e.printFixed)))),[r]),I=(e,t)=>{const n=Object.assign({},Ki(t,e.parentDataIndex));return n.children=[e],n.level&&n.level>1?I(n,t):n},N=(e,t)=>(0,J.map)((0,J.groupBy)((0,J.flatten)(e),t),(0,J.spread)((function(){for(var e=arguments.length,n=new Array(e),l=0;l<e;l++)n[l]=arguments[l];return(0,J.mergeWith)(...n,((e,n)=>{if(Array.isArray(e))return N(e.concat(n),t)}))}))),T=()=>{const{allTableData:e}=c.current,t=(e=>{const t=[];let n=[],l=0,a=0;for(;a<e.length;){const r=e[a];l+=r.width||r.renderWidth||r.minWidth||mo.defaultColumnWidth,l<=mo.printWidth?(n.push(r),a===e.length-1&&t.push(n),a++):a>0?(e.splice(0,a),w.length&&e.unshift(...w),t.push(n),n=[],l=0,a=0):(r.width=mo.printWidth,n.push(r),t.push(n),a++)}return t})([...S]),n=((e,t)=>{const n=[];return e.forEach((e=>{let l=[];e.forEach((e=>{1===e.level?l.push(e):l.push(I(e,t))})),l=(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]})))(l),n.push(Bi(l))})),n})(t,C);let l=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)l+=R(n[a],t[a],e),l+='<div class="page-break"></div>';return l+"</body></html>"},R=(e,t,n)=>{const{showLogo:l=!0}=b;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((e=>{let{width:t,minWidth:n,renderWidth:l}=e;return`<col style="width:${t||l||n||mo.defaultColumnWidth}px">`})).join("")}</colgroup>`,y&&(a+=["<thead>",l&&E?`<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">',v?`<img src="${v}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',x?`<img src="${x}" 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}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(a+=`<tbody>${n.map((e=>`<tr>${t.map(((t,l)=>{const{rowSpan:a,colSpan:r}=g(e,t,e.index,l,n);return a&&r?`<td rowspan="${a}" colspan="${r}">${((e,t,n,l)=>d.current.renderCellTitle(n,e,t,l))(e,e.index,t,l)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&m.length&&(a+=["<tfoot>",m.map((e=>`<tr>${t.map(((t,l)=>{const{dataIndex:a,summation:r}=t,i=null!=r&&r.render?r.render(n):Qi(e,`${a}_text`);return`<td>${0===l&&""===i?p("qm.table.config.summaryText"):i}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},O=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:l,isDownload:a}={filename:"print",type:"html",isDownload:!1},r=`${n}.${l}`;if(window.Blob){const e=new Blob([t],{type:`text/${l}`});if(!a)return Promise.resolve({type:l,content:t,blob:e});gt(e,r)}})(0,T()))||void 0===e||e.then((e=>{let{content:t,blob:n}=e,l=document.createElement("iframe");l.setAttribute("frameborder","0"),l.setAttribute("width","100%"),l.setAttribute("height","0"),l.style.display="none",document.body.appendChild(l),c.current.isIE?(l.contentDocument.write(t),l.contentDocument.execCommand("print"),l.parentNode.removeChild(l),l=null):(l.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{l.parentNode.removeChild(l),l=null}))},l.src=URL.createObjectURL(n))}))};t().useImperativeHandle(n,(()=>({clickHandle:O})));const A=Se("table");return o?t().createElement("span",{className:`${A}-print`,title:p("qm.table.print.text"),onClick:()=>O()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PrinterOutlined,null))):null}));To.displayName="TablePrint";const Ro=To,Oo=require("exceljs");var Ao=l.n(Oo);const Po="606060",Fo="thin",Ho="d4d4d4",ko=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Lo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},qo=()=>({top:{style:Fo,color:{argb:Ho}},left:{style:Fo,color:{argb:Ho}},bottom:{style:Fo,color:{argb:Ho}},right:{style:Fo,color:{argb:Ho}}}),$o=e=>{const{children:t}=e;return t&&t.length?$o(t[0]):e},_o=e=>{const{precision:t,formatType:n}=e,l=t>=0?t?`0.${new Array(t).fill("0").join("")}`:"0":"";return l?{numFmt:l}:"percent"===n?{numFmt:t>=0?`${l}%`:"0%"}:"finance"===n?{numFmt:t>=0?`#,##${l}`:"#,##0"}:null},Do=()=>{const{tableRef:e,tableProps:n,getSpan:l,showSummary:a,isHeadGroup:r}=t().useContext(ui),{spanMethod:i,showHeader:o}=n,s=(e,t)=>{var n;return(null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)??""};return{exportXLSX:async(t,n,s,c)=>{const{columns:d,footSummation:u}=t,{scrollYStore:{rowHeight:h}}=e.current,m=qi(d),f=Bi(d),g=[],b=[],y=[],v=[];let x=0;const E={};m.forEach((e=>{const{dataIndex:t,title:n,width:l,minWidth:a,renderWidth:r}=e;E[t]=n,y.push({key:t,width:(l||r||a||mo.defaultColumnWidth)/8})})),o&&(r?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:l,rowSpan:a}=e,r=$o(e),i=m.findIndex((e=>{let{dataIndex:t}=e;return t===r.dataIndex}));n[r.dataIndex]=e.title,0!==l&&(l>1||a>1)&&v.push({s:{r:t,c:i},e:{r:t+a-1,c:i+l-1}})})),g.push(n)})):(m.forEach(((e,t)=>{const{colSpan:n,rowSpan:l}=e;(n>1||l>1)&&v.push({s:{r:x,c:t},e:{r:x+l-1,c:t+n-1}})})),g.push(E)),x+=g.length);const C=n.map(((e,t)=>{const a={};return m.forEach(((r,o)=>{if("function"==typeof i){const{rowSpan:a,colSpan:i}=l(e,r,t,o,n);(i>1||a>1)&&v.push({s:{r:t+x,c:o},e:{r:t+x+a-1,c:o+i-1}})}const s=["percent","finance"].includes(r.formatType);a[r.dataIndex]=s?Qi(e,r.dataIndex):c(e,t,r,o)})),a}));x+=C.length,a&&u&&s(m,n).forEach(((e,t)=>{const l={};m.forEach(((t,a)=>{const{dataIndex:r,summation:i}=t,o=null!=i&&i.render?i.render(n):Qi(e,r);l[r]=0===a&&""===o?p("qm.table.config.summaryText"):te(o)?ao(o).join(""):o})),b.push(l)}));const{sheetName:S,useStyle:w}=t,I=new(Ao().Workbook),N=I.addWorksheet(S);N.columns=y,o&&N.addRows(g).forEach((e=>{w&&ko(e,h),e.eachCell((e=>{const t=N.getColumn(e.col),n=Ki(d,t.key),{align:l}=n;Lo(e,l),w&&Object.assign(e,{font:{bold:!0,color:{argb:Po}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:qo()})}))})),N.addRows(C).forEach((e=>{w&&ko(e,h),e.eachCell((e=>{const t=N.getColumn(e.col),n=Ki(d,t.key),{align:l}=n;Lo(e,l),Object.assign(e,_o(n)),w&&Object.assign(e,{font:{color:{argb:Po}},border:qo()})}))})),a&&u&&N.addRows(b).forEach((e=>{w&&ko(e,h),e.eachCell((e=>{const t=N.getColumn(e.col),n=Ki(d,t.key),{align:l}=n;Lo(e,l),Object.assign(e,_o(n)),w&&Object.assign(e,{font:{color:{argb:Po}},border:qo()})}))})),v.forEach((e=>{let{s:t,e:n}=e;N.mergeCells(t.r+1,t.c+1,n.r+1,n.c+1)}));const T=await I.xlsx.writeBuffer();return new Blob([T],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const n=e=>{let t=e;const n=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),l=-1!==e.indexOf('"');return l&&(t=t.replace(/"/g,'""')),(n||l)&&(t='"'+t+'"'),t},l="\ufeff"+(e=>{let t,l,a,r,i="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],l=0;l<a.cells.length;l+=1)r=a.cells[l],i=i+(l?",":"")+n(r.textContent.trim());i+="\r\n"}return i})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,n)=>{t=t||"",n=n||512;const l=window.atob(e),a=[];let r;for(r=0;r<l.length;r+=n){const e=l.slice(r,r+n),t=new Array(e.length);let i;for(i=0;i<e.length;i+=1)t[i]=e.charCodeAt(i);const o=new window.Uint8Array(t);a.push(o)}return new window.Blob(a,{type:t})})((a=l,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:n,file:l}=e,a=qi(n),r=new FileReader;r.onerror=()=>{A.message.error(p("qm.table.import.error"))},r.onload=e=>{const n=a.map((e=>e.title)),l=new(Ao().Workbook),r=e.target;r?l.xlsx.load(r.result).then((e=>{const l=e.worksheets[0];if(l){const e=l.getSheetValues(),r=e.findIndex((e=>e&&e.length>0)),i=e[r],o=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,i);if(o){const l=e.slice(r+1).map((e=>{const t={};e.forEach(((e,n)=>{let l=e;(0,J.isPlainObject)(l)&&(l=e.text),(0,J.isDate)(l)&&(l=no(e,bi)),t[i[n]]=l}));const l={};return n.forEach(((e,n)=>{const{dataIndex:r,dictItems:i}=a[n];var o;Array.isArray(i)&&(null!==(o=t[e])&&void 0!==o&&o.includes(",")?t[e]=t[e].split(",").map((e=>s(i,e))).filter((e=>""!==e)):t[e]=s(i,t[e])),Zi(l,r,t[e])})),l}));null==t||t(l)}else A.message.error(p("qm.table.import.error"))}else A.message.error(p("qm.table.import.error"))})):A.message.error(p("qm.table.import.error"))},r.readAsArrayBuffer(l)}}},Ko=e=>{const{fileType:n,onChange:l}=e;let a,r;const i=Se("table"),o=e=>{const t=e.name,n=t.lastIndexOf("."),l=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:l}};return t().createElement(me,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),r=document.createElement("input"),a.className=`${i}--file-form`,r.name="file",r.type="file",a.appendChild(r),document.body.appendChild(a)),new Promise(((e,n)=>{const l=!t.type;r.multiple=!!t.multiple,r.accept=l?"":`.${t.type}`,r.onchange=i=>{const{files:s}=i.target,c=s[0];let d="";if(!l)for(let e=0;e<s.length;e++){const{type:n}=o(s[e]);if(t.type!==n){d=n;break}}d?(A.message.warning(p("qm.upload.notType",{type:d})),n()):e(c),document.body.removeChild(a),a=null,r=null},a.reset(),r.click()}))})({type:n});null==l||l(e.name,e)}catch(e){}})()},p("qm.upload.text"))},Vo=e=>{const{columns:n,onClose:l}=e,{tableRef:a,tableProps:r,createTableData:i,dataChange:o}=t().useContext(ui),{beforeTableImport:s}=r,{importXLSX:c}=Do(),d=t().useRef(null),[u,h]=t().useState(!1),[m,f]=t().useState(!0),g=e=>e.filter((e=>![mo.expandableColumn,mo.selectionColumn,"index","pageIndex",mo.operationColumn].includes(e.dataIndex))),[b,y]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName",render:(e,n)=>{const{fileName:l}=n.GET_FIELDS_VALUE(["fileName"]);return t().createElement(t().Fragment,null,l?t().createElement("span",null,l):t().createElement(Ko,{fileType:n.state.formData.fileType,onChange:(e,t)=>{n.SET_FIELDS_VALUE({fileName:e,file:t}),t&&f(!1)}}))}},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:p("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:p("qm.table.import.fillText"),value:"fill"},{text:p("qm.table.import.addText"),value:"add"},{text:p("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{b.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,y([...b])}},{type:"INPUT_NUMBER",label:p("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:1,max:a.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),v=Se("table");return t().createElement("div",{className:`${v}-import__setting`},t().createElement(br,{ref:d,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:b,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(me,{onClick:()=>l(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(me,{type:"primary",loading:u,disabled:m,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||(h(!0),c({columns:g(n),file:t.file},(async e=>{const{tableFullData:n,store:r}=a.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=await s(e)}catch(e){}if("fill"===t.importType&&i(e),"add"===t.importType&&i([...n,...e]),"insert"===t.importType){const{tableFullData:n}=a.current,l=t.posIndex,r=n.slice(0,l).concat(e).concat(n.slice(l));i(r)}e.forEach((e=>{r.addToInserted(e)})),o(),A.message.success(p("qm.table.import.success",{total:e.length})),h(!1),l()})))})()},p("qm.table.import.text"))))},Mo=t().forwardRef(((e,n)=>{const{tableColumns:l,open:a=!0}=e,[r,i]=t().useState(!1),o=()=>{i(!0)};t().useImperativeHandle(n,(()=>({clickHandle:o})));const s={[`${Se("table")}-import`]:!0},c={visible:r,title:p("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Ce()(s),title:p("qm.table.import.textNoSpace"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ImportOutlined,null))),t().createElement(Gt,c,t().createElement(Vo,{columns:l,onClose:()=>i(!1)})))}));Mo.displayName="TableImport";const jo=Mo,zo=e=>{const{columns:n,onChange:l}=e,{$size:a}=t().useContext(ui),r=t().useRef([]),[i,o]=t().useState(!1),[s,c]=t().useState(n);De((()=>{u()}),[s]),t().useEffect((()=>{d()}),[n]);const d=()=>{const e=[];n.forEach(((t,l)=>{const a=t.colSpan;a>1&&n.slice(l+1,l+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(n.slice(l,l+a))})),r.current=e},u=()=>{const e=[];s.forEach((t=>{const{colSpan:n,dataIndex:l}=t;if(0===n)return;if(1===n)return e.push(t);const a=r.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(l)));if(-1===a)return e.push(t);e.push(...r[a].map(((e,n)=>{let{dataIndex:l}=e;const a=s.find((e=>e.dataIndex===l));return n>0&&void 0!==t.hidden&&(a.hidden=t.hidden),a})))})),null==l||l(e)},h=Se("table"),m={[`${h}__popper`]:!0,"column-filter__popper":!0,[`${h}--lg`]:"large"===a,[`${h}--sm`]:"small"===a},f=[`${h}-column-filter`,{selected:i}];return t().createElement(rl(),{action:["click"],popupVisible:i,popup:t().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"main"},t().createElement(In.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),n=s.map((e=>e.dataIndex));(0,J.isEqual)(t,n)||c(e)}},s.map((e=>((e,n)=>{const{colSpan:l}=e;if(0===l)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=["svgicon","handle","main-handle"];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(A.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,c([...s])}}),t().createElement("i",{className:Ce()(a),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title))})(e)))))),popupClassName:Ce()(m),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{o(e)},builtinPlacements:vi,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Ce()(f),title:p("qm.table.columnFilter.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),t().createElement("span",null,p("qm.table.columnFilter.text"))))},Uo=e=>{const{defaultValue:n,onClose:l,onOk:a}=e,{tableProps:r,pagination:i,showSummary:o}=t().useContext(ui),{rowSelection:c}=r,d=t().useRef(null),[u,h]=t().useState(!1),m=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(yi)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:"all","startIndex|endIndex":[1,i.total],footSummation:o?1:0,useStyle:0},n,{columns:ce(n.columns||[])})),[]),[f,g]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:p("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:p("qm.table.export.all"),value:"all"},{text:p("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==(null==c?void 0:c.type)},{text:p("qm.table.export.custom"),value:"custom"}]},onChange:e=>{f.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,g([...f])}},options:{min:1},disabled:!0},{type:"INPUT",label:p("qm.table.columnFilter.text"),fieldName:"columns",render:(e,n)=>t().createElement(zo,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:p("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!o,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:p("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),b=Se("table");return t().createElement("div",{className:`${b}-export__setting`},t().createElement(br,{ref:d,initialValues:m,items:f,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(me,{onClick:()=>l(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(me,{type:"primary",loading:u,onClick:()=>(async()=>{const[e,t]=await d.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);a(t),await re(1e3),h(!1),l()}})()},p("qm.table.export.text"))))},Bo=t().forwardRef(((e,n)=>{const{tableColumns:l,open:a=!0}=e,{global:r}=t().useContext(i),{tableRef:o,tableBodyRef:c,tableProps:d,flattenColumns:u,pagination:h,fetchParams:m,isFetch:f,isGroupSubtotal:g,showSummary:b,getSpan:y}=t().useContext(ui),{exportExcel:v,fetch:x,showHeader:E}=d,[C,S]=t().useState(!1),[w,I]=t().useState(!1),N=t().useMemo((()=>{var e;return!(null==v||null===(e=v.fetch)||void 0===e||!e.api)}),[v]),T=t().useMemo((()=>!h.total||w),[h.total,w]),R=t().useMemo((()=>ji(l,[mo.expandableColumn,mo.selectionColumn,mo.operationColumn])),[l]),O=t().useMemo((()=>ji(u,[mo.expandableColumn,mo.selectionColumn,mo.operationColumn])),[u]),P=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:l}=e,a=(g?ro(t):t).reduce(((e,t)=>{if(null!=t&&t[mo.summaryIgnore])return e;const n=Number(Qi(t,l));return Number.isNaN(n)?e:e+n}),0);Zi(n,l,a)})),[n]},F=(e,t,n,l)=>{const{precision:a,formatType:r}=n;let i=c.current.renderCellTitle(n,e,t,l);return a>=0&&!r&&""!==i&&(i=Number(i)),i},{exportXLSX:H,exportCSV:k}=Do(),L=async e=>{const{api:t,dataKey:n}=x;let l=[];try{I(!0);const a=await t({...m,[mo.currentPageName]:1,[mo.pageSizeName]:e??h.total});200===a.code&&(l=(Array.isArray(a.data)?a.data:(0,J.get)(a.data,n)??[]).map(((e,t)=>{const n={...e,index:t,pageIndex:t};return O.forEach(((e,t)=>{const{dataIndex:l}=e;"index"!==l&&"pageIndex"!==l&&Zi(n,l,Qi(n,l))})),n})))}catch(e){}return I(!1),l},q=e=>{var t;const n=null==r||null===(t=r.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},$=(null==v?void 0:v.fileName)??`${s()().format(yi)}.xlsx`,_=$.slice($.lastIndexOf(".")+1).toLowerCase(),D=()=>{if(T)return A.message.warning(p("qm.table.export.warnText"));N?(async e=>{I(!0);try{const{api:t,params:n}=v.fetch,l=await t({columns:O.map((e=>{const{title:t,dataIndex:n,hidden:l}=e,{type:a}=e.filter||{};return{title:t,dataIndex:n,type:a,hidden:l}})),...m,...n,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[mo.currentPageName]:void 0,[mo.pageSizeName]:void 0});l.data&&(gt(l.data,e),q(e))}catch(e){}I(!1)})($):S(!0)};t().useImperativeHandle(n,(()=>({clickHandle:D})));const K={[`${Se("table")}-export`]:!0},V={visible:C,title:p("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},M={fileName:$.slice(0,$.lastIndexOf(".")),fileType:_,columns:R,useStyle:null!=v&&v.cellStyle?1:0};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Ce()(K),title:p("qm.table.export.textNoSpace"),onClick:()=>D()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.DownloadOutlined,null))),t().createElement(Gt,V,t().createElement(Uo,{defaultValue:M,onClose:()=>S(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:n,exportType:l,startIndex:a=1,endIndex:r}=e,{allTableData:i,selectionRows:s}=o.current;let c=[];if(f?("all"===l&&(c=await L()),"custom"===l&&(c=await L(r),c=c.slice(a-1))):("all"===l&&(c=i.slice(0)),"custom"===l&&(c=i.slice(a-1,r||void 0))),"selected"===l&&(c=s.slice(0)),"function"==typeof(null==v?void 0:v.beforeExport))try{c=null==v?void 0:v.beforeExport(c)}catch(e){}if("xlsx"===n){const n=await H(e,c,P,F);gt(n,`${t}.xlsx`),q(`${t}.xlsx`)}if("csv"===n){const n=k(e,((e,t)=>{const{columns:n,footSummation:l}=e,a=Bi(n),r=qi(n);let i='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${r.map((e=>{let{width:t,minWidth:n,renderWidth:l}=e;return`<col style="width:${t||l||n||mo.defaultColumnWidth}px">`})).join("")}</colgroup>`,E&&(i+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(i+=`<tbody>${t.map((e=>`<tr>${r.map(((n,l)=>{const{rowSpan:a,colSpan:r}=y(e,n,e.index,l,t);return a&&r?`<td rowspan="${a}" colspan="${r}">${F(e,e.index,n,l)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),b&&l&&(i+=["<tfoot>",P(r,t).map((e=>`<tr>${r.map(((n,l)=>{const{dataIndex:a,summation:r}=n,i=null!=r&&r.render?r.render(t):Qi(e,a);return`<td>${0===l&&""===i?p("qm.table.config.summaryText"):te(i)?ao(i).join(""):i}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i})(e,c));gt(n,`${t}.csv`),q(`${t}.csv`)}})(Object.assign({},e,{columns:$i(e.columns)}))}})))}));Bo.displayName="TableExport";const Wo=Bo,Go=e=>{const{columns:n,onClose:l}=e,{tableRef:a,tableBodyRef:r,tableProps:i,dataChange:o}=t().useContext(ui),{beforeClipboard:s}=i,c=t().useRef(null),[d,u]=t().useState([{type:"INPUT_NUMBER",label:p("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:p("qm.table.clipboard.colIndex"),fieldName:"dataIndex",options:{itemList:n.map(((e,t)=>({value:t,text:e.title})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:p("qm.table.clipboard.content"),fieldName:"content",placeholder:p("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[h,m]=t().useState(!1),f=Se("table");return t().createElement("div",{className:`${f}-clipboard__setting`},t().createElement("h3",{className:"info"},p("qm.table.clipboard.supportText")),t().createElement(br,{ref:c,initialValues:{},initialExtras:{rowIndex:"行",dataIndex:"列"},items:d,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(me,{onClick:()=>l(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(me,{type:"primary",loading:h,onClick:()=>(async()=>{var e;const[t,i]=await c.current.GET_FORM_DATA();if(t)return;const{tableFullData:d,store:u}=a.current;m(!0);const h=i.content.trim().replace(/(\r|\n)$/,"");let f=h.replace(/"[^"]+"/g,"^");((null===(e=h.match(/"[^"]+"/g))||void 0===e?void 0:e.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,t)=>n[i.dataIndex+t].dataIndex)))}catch(t){}g.forEach(((e,t)=>{e.forEach(((e,l)=>{const r=d[i.rowIndex-1+t],o=n[i.dataIndex+l];if(r&&o){let t=!1;if(o.editRender){var s,c;const e=o.editRender(r,o);t=!(e.disabled||(null===(s=e.extra)||void 0===s?void 0:s.disabled)||null!==(c=a.current.fieldAuth[o.dataIndex])&&void 0!==c&&c.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&(Zi(r,o.dataIndex,e),u.addToUpdated(r))}}))})),r.current.forceUpdate(),o(),A.message.success(p("qm.table.clipboard.success",{total:g.length})),m(!1),l()})()},p("qm.table.clipboard.text"))))},Yo=t().forwardRef(((e,n)=>{const{flattenColumns:l,open:a=!0}=e,[r,i]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![mo.expandableColumn,mo.selectionColumn,"index","pageIndex",mo.operationColumn].includes(e.dataIndex))))(l)),[l]),s=()=>{i(!0)};t().useImperativeHandle(n,(()=>({clickHandle:s})));const c={[`${Se("table")}-clipboard`]:!0},d={visible:r,title:p("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Ce()(c),title:p("qm.table.clipboard.textNoSpace"),onClick:()=>s()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CopyOutlined,null))),t().createElement(Gt,d,t().createElement(Go,{columns:o,onClose:()=>i(!1)})))}));Yo.displayName="TableClipboard";const Xo=Yo,Qo=e=>{const{columns:n,onClose:l}=e,{tableProps:a,tableRef:r,$size:i,selectionKeys:o,setSelectionKeys:s}=t().useContext(ui),{rowKey:c}=a,d=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=d(e.children)),t})),[u,h]=t().useState([{title:p("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...d(n.filter((e=>![mo.expandableColumn,mo.selectionColumn,"index","pageIndex",mo.operationColumn].includes(e.dataIndex))))]),[m]=t().useState(r.current.selectionRows.map((e=>({...e,children:void 0}))));return t().createElement(t().Fragment,null,t().createElement(Bs,{size:i,columns:u,dataSource:m,rowKey:c,minHeight:338,rowSelection:{type:"checkbox",selectedRowKeys:o,onChange:e=>s(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>h(e)}),t().createElement("div",{style:{height:10}}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(me,{onClick:()=>l()},p("qm.table.selectCollection.closeButton"))))},Zo=t().forwardRef(((e,n)=>{const{columns:l,open:a=!0}=e,{tableProps:r,getRowKey:i,isFetch:o,isTableEmpty:s,setSelectionKeys:c,setSelectionRows:d}=t().useContext(ui),{rowSelection:u}=r,[h,m]=t().useState(!1),f=t().useRef(!1);De((()=>{!f.current&&g()}),[s]);const g=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=u;if(o&&e)try{const n=await e.api(e.params);if(200===n.code){let l=Array.isArray(n.data)?n.data:(0,J.get)(n.data,e.dataKey)??[];l=l.filter((e=>!t(e))),d(l),c(l.map(((e,t)=>i(e,t)))),f.current=!0}}catch(e){}},b=()=>{m(!0)};t().useImperativeHandle(n,(()=>({clickHandle:b})));const y=Se("table"),v={visible:h,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>m(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:`${y}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>b()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CheckSquareOutlined,null))),t().createElement(Gt,v,t().createElement(Qo,{columns:l,onClose:()=>m(!1)})))}));Zo.displayName="SelectCollection";const Jo=Zo,es=require("localforage");var ts=l.n(es);const ns=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),ls=e=>{const{onClose:n}=e,{global:l}=t().useContext(i),{tableProps:a,tableRef:r,getRowKey:o,$size:s,flattenColumns:c,pagination:d,setPagination:u,scrollYToRecord:h,setHighlightKey:m,setShouldToTop:f,isTreeTable:b,isWebPagination:y}=t().useContext(ui),{uniqueKey:v}=a,x=t().useRef(null),E=t().useRef(null),C=t().useRef([]),S=t().useRef(""),w=t().useRef(-1),I=t().useRef("stop");De((()=>{const{current:e,pageSize:t}=d,n=r.current.tableFullData.slice((e-1)*t,e*t),l=Ui(n).findIndex((e=>o(e,e.index)===S.current));h("",l)}),[d.current]);const N=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},T=e=>e.filter((e=>null==e?void 0:e.dataIndex)).map((e=>({type:N(e.filter.type),fieldName:e.dataIndex,label:e.title,tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await x.current.GET_FORM_DATA(),[n,l]=await E.current.GET_FORM_DATA(),a=(0,J.omitBy)(Object.assign({},t,l),se);F(a)}}))),R={case:0,fullchar:0},O=t().useMemo((()=>c.filter((e=>![mo.expandableColumn,mo.selectionColumn,"index","pageIndex",mo.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[P,F]=t().useState({}),[H,k]=t().useState(R),[L]=t().useState(T([O[0]])),[q]=t().useState(T(O.slice(1))),[$,_]=t().useState(0),D=t().useMemo((()=>!Object.keys(P).length),[P]);De((()=>{I.current="ready"}),[P,H]);const K=e=>{k(Object.assign({},H,e))},V=(e,t,n)=>new Promise(((l,a)=>{A.Modal.confirm({title:p("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),l()},onCancel:()=>{n(),l()}})})),M=async e=>{if(!Object.keys(P).length)return A.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.queryCondition")});if("ready"===I.current&&(I.current="stop",C.current=(e=>{const{allTableData:t}=r.current,n=[];for(let l=0,a=t.length;l<a;l++){const a=t[l];let r=!0;for(const t in e){const{type:n}=O.find((e=>e.dataIndex===t)).filter;let l=Qi(a,t),i=!0;if("text"===n||"textarea"===n?i=new RegExp(H.fullchar?`^${e[t]}$`:e[t],H.case?"":"i").test(l):(l=ns(l)?l.slice(0,10):l,i=l==e[t]),!i){r=!1;break}}r&&n.push(a)}return n})(P),_(C.current.length)),!C.current.length)return m(""),A.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>C.current.length-1&&await V(p("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=C.current.length-1))),"prev"===e&&(w.current=w.current<0?C.current.length-1:w.current-1,w.current<0&&await V(p("qm.table.fastSearch.toStart"),(()=>w.current=C.current.length-1),(()=>w.current=0)));const t=C.current[w.current],n=o(t,t.index);let l=t.index;if(b&&y){const e=so(r.current.deriveRowKeys,n)[0];l=r.current.tableFullData.findIndex((t=>o(t,t.index)===e))}((e,t)=>{if(S.current=e,y){const{pageSize:e}=d,n=Math.ceil((t+1)/e);f(!1),u(Object.assign({},d,{current:n}))}else h(e)})(n,l),m(n)},j=()=>{x.current.RESET_FORM(),E.current.RESET_FORM()},z=t().useMemo((()=>v?`fastSearch_${v}`:""),[v]),[U,B]=t().useState([]),[W,G]=t().useState(""),[Y,X]=t().useState("");De((()=>{if(Y){const{filters:e,config:t}=U.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(Z()(e,q.map((e=>e.fieldName)))),E.current.SET_FIELDS_VALUE(Z()(e,L.map((e=>e.fieldName)))),F(e),k(t)}else j(),F({}),k(R)}),[Y]),t().useEffect((()=>{Q()}),[]);const Q=async()=>{if(!z)return;let e=await ts().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await ts().setItem(z,e)),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))},ee=async e=>{const t=null==l?void 0:l.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},te=async(e,t)=>{const n=null==l?void 0:l.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},ne=Se("table");return t().createElement("div",{className:`${ne}-fast-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"top"},t().createElement("div",{className:"container"},t().createElement(_t,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t().createElement("span",null,p("qm.table.alert.total",{total:$}))},t().createElement(_t.TabPane,{tab:p("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t().createElement(br,{ref:x,items:L,cols:1,labelWidth:110})),t().createElement(_t.TabPane,{tab:p("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t().createElement(br,{ref:E,items:q,cols:1,labelWidth:110})))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(A.Input,{size:s,value:W,placeholder:p("qm.table.highSearch.configText"),disabled:D,onChange:e=>{const{value:t}=e.target;G(t)}}),t().createElement(me,{type:"primary",disabled:!W||D,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=lo(),t=[...U,{text:W,value:e,list:{filters:P,config:H}}];B(t),X(e),G(""),await ts().setItem(z,t),await te(z,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${mo.rowHeightMaps[s]}px`}},t().createElement("span",null,p("qm.table.fastSearch.savedSetting"))),t().createElement("ul",null,U.map((e=>t().createElement("li",{key:e.value,className:Ce()({selected:e.value===Y}),title:e.text,onClick:()=>(e=>{X(e!==Y?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=U.filter((t=>t.value!==e));B(t),e===Y&&X(""),await ts().setItem(z,t),await te(z,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!U.length&&t().createElement("div",{style:{padding:hi}},t().createElement(ut,null)))))),t().createElement("div",{className:"bottom"},t().createElement("div",null,t().createElement(A.Checkbox,{checked:!!H.case,onChange:e=>K({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t().createElement(A.Checkbox,{checked:!!H.fullchar,onChange:e=>K({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t().createElement("div",null,t().createElement(me,{onClick:()=>j()},p("qm.table.fastSearch.clear"))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Wn[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(me,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.fastSearch.closeButton")),t().createElement(me,{type:"primary",style:{marginRight:8},onClick:()=>M("prev")},p("qm.table.fastSearch.queryPrev")),t().createElement(me,{type:"primary",onClick:()=>M("next")},p("qm.table.fastSearch.queryNext"))))},as=t().forwardRef(((e,n)=>{const{open:l=!0}=e,{$size:a}=t().useContext(ui),[r,i]=t().useState(!1),o=()=>{i(!0)};t().useImperativeHandle(n,(()=>({clickHandle:o})));const s=Se("table"),c={visible:r,title:p("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Wn[a]+20}px`},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,l&&t().createElement("span",{className:`${s}-super-search`,title:p("qm.table.fastSearch.text"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.MonitorOutlined,null))),t().createElement(Gt,c,t().createElement(ls,{onClose:()=>i(!1)})))}));as.displayName="FastSearch";const rs=as,is=e=>{const{columns:n,group:l,summary:a}=e,{tableRef:r,tableProps:i,$size:o,pagination:c,fetchParams:d,isFetch:u}=t().useContext(ui),{fetch:h}=i,m=e=>{const t=n.find((t=>t.dataIndex===e));return{title:t.title,precision:t.precision,dictItems:t.dictItems??[]}},f=l.map((e=>({dataIndex:e.group,...m(e.group)}))),g=a.map((e=>e.summary===mo.groupSummary.total.value?{dataIndex:e.summary,title:mo.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...m(e.summary),formula:e.formula})),b=t().useMemo((()=>Object.assign({},d,{[mo.sorterFieldName]:void 0,[mo.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[mo.groupSummary.groupbyFieldName]:l.map((e=>e.group)).join(","),usedJH:2,[mo.currentPageName]:1})),[d,l,a]),[y,v]=t().useState(((e,t)=>[{title:p("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{var t;const l=null===(t=n.find((t=>t.dataIndex===e.dataIndex)))||void 0===t?void 0:t.groupSummary;let a=l?{summation:l}:null;return e.dataIndex===mo.groupSummary.total.value&&(a={dataIndex:mo.groupSummary.recordTotalIndex,summation:{render:()=>c.total}}),{...e,..."count"===e.formula||"sum"===e.formula?a:null}}))])(f,g)),[x]=t().useState(u?[]:(e=>{const t=oo(e,l.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};y.forEach((n=>{const{dataIndex:l}=n;"index"!==l&&Zi(t,l,Qi(e[0],l))})),a.forEach((n=>{const l=n.summary!==mo.groupSummary.total.value?n.summary:mo.groupSummary.recordTotalIndex,a=n.formula;"count"===a&&Zi(t,l,e.length),"sum"===a&&Zi(t,l,(0,J.sumBy)(e,l)),"max"===a&&Zi(t,l,(0,J.maxBy)(e,l)[l]),"min"===a&&Zi(t,l,(0,J.minBy)(e,l)[l]),"avg"===a&&Zi(t,l,((0,J.sumBy)(e,l)/e.length).toFixed(2))})),n.push(t)})),n})(r.current.tableFullData)),E={size:o,height:400,...u?{fetch:{api:h.api,params:b,dataKey:null==h?void 0:h.dataKey}}:{dataSource:x},columns:y,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${s()().format("YYYYMMDDHHmmss")}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>v(e)};return t().createElement(Bs,E)},os=e=>{const{onClose:n}=e,{global:l}=t().useContext(i),{tableProps:a,$size:r,flattenColumns:o}=t().useContext(ui),{uniqueKey:s}=a,c=t().useRef(null),d=t().useRef(null),[u,h]=t().useState(!1),[m,f]=t().useState([]),[b,y]=t().useState(""),[v,x]=t().useState("");De((()=>{if(v){const{group:e,summary:t}=m.find((e=>e.value===v)).list;T(e),F(t)}else{const e=q();T((null==e?void 0:e.group)||[]),F((null==e?void 0:e.summary)||[])}}),[v]),t().useEffect((()=>{$()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),C=t().useMemo((()=>o.filter((e=>![mo.expandableColumn,mo.selectionColumn,"index","pageIndex",mo.operationColumn].includes(e.dataIndex)))),[o]),S=C.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[mo.groupSummary.total,...C.filter((e=>!!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex})))],I=[{text:p("qm.table.groupSummary.sumText"),value:"sum"},{text:p("qm.table.groupSummary.maxText"),value:"max"},{text:p("qm.table.groupSummary.minText"),value:"min"},{text:p("qm.table.groupSummary.avgText"),value:"avg"},{text:p("qm.table.groupSummary.countText"),value:"count"}],[N,T]=t().useState([]),[R,O]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t().createElement("div",null,t().createElement(me,{type:"text",onClick:()=>{c.current.REMOVE_RECORDS(n)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:p("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:S.map((e=>({...e,disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[P,F]=t().useState([]),[H,k]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t().createElement("div",null,t().createElement(me,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:p("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:w.map((e=>({...e,disabled:P.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:p("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===mo.groupSummary.total.value?I.slice(I.length-1):I})}]),L=t().useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=P.length&&P.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,P]),q=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},$=async()=>{if(!E)return;const e=q();if(e){const{group:t,summary:n}=e;T(t),F(n)}let t=await ts().getItem(E);t||(t=await _(E),Array.isArray(t)&&await ts().setItem(E,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},_=async e=>{const t=null==l?void 0:l.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},D=async(e,t)=>{const n=null==l?void 0:l.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},K=Se("table"),V={visible:u,title:p("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>h(!1)};return t().createElement("div",{className:`${K}-group-summary__setting`},t().createElement("div",{className:"main"},t().createElement("div",{style:{width:"30%"}},t().createElement(Bs,{ref:c,size:r,columns:R,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>O(e),onDataChange:e=>{T(e)}},t().createElement(me,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{c.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"container line"},t().createElement(Bs,{ref:d,size:r,columns:H,dataSource:P,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{F(e)}},t().createElement(me,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(A.Input,{size:r,value:b,placeholder:p("qm.table.groupSummary.configText"),disabled:L,onChange:e=>{const{value:t}=e.target;y(t)}}),t().createElement(me,{type:"primary",disabled:!b||L,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=lo(),t=[...m,{text:b,value:e,list:{group:N.filter((e=>!!e.group)),summary:P.filter((e=>!!e.summary))}}];f(t),x(e),y(""),await ts().setItem(E,t),await D(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${mo.rowHeightMaps[r]}px`}},t().createElement("span",null,p("qm.table.groupSummary.savedSetting"))),t().createElement("ul",null,m.map((e=>t().createElement("li",{key:e.value,className:Ce()({selected:e.value===v}),title:e.text,onClick:()=>(e=>{x(e!==v?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=m.filter((t=>t.value!==e));f(t),e===v&&x(""),await ts().setItem(E,t),await D(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!m.length&&t().createElement("div",{style:{padding:hi}},t().createElement(ut,null)))))),t().createElement(Gt,V,t().createElement(is,{columns:C,group:N,summary:P})),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(me,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.groupSummary.closeButton")),t().createElement(me,{type:"primary",disabled:L,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:N.filter((e=>!!e.group)),summary:P.filter((e=>!!e.summary))})),void h(!0))},p("qm.table.groupSummary.confirmButton"))))},ss=t().forwardRef(((e,n)=>{const{open:l=!0}=e,[a,r]=t().useState(!1),i=()=>{r(!0)};t().useImperativeHandle(n,(()=>({clickHandle:i})));const o=Se("table"),s={visible:a,title:p("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>r(!1)};return t().createElement(t().Fragment,null,l&&t().createElement("span",{className:`${o}-group-summary`,title:p("qm.table.groupSummary.text"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PieChartOutlined,null))),t().createElement(Gt,s,t().createElement(os,{onClose:()=>r(!1)})))}));ss.displayName="GroupSummary";const cs=ss,ds=e=>{const{onClose:n}=e,{global:l}=t().useContext(i),{tableProps:a,$size:r,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(ui),{uniqueKey:d}=a,u=t().useRef(null),[h,m]=t().useState([]),[f,b]=t().useState([]),[y,v]=t().useState(""),[x,E]=t().useState("");De((()=>{m(x?f.find((e=>e.value===x)).list:q()||[])}),[x]),t().useEffect((()=>{$()}),[]);const C=t().useMemo((()=>d?`superSearch_${d}`:""),[d]),S=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=io(h),I=t().useMemo((()=>!(w&&ki(w))),[w]),N=t().useMemo((()=>!!h.length&&I),[h,I]),T=[{value:"and",text:p("qm.table.highSearch.andText")},{value:"or",text:p("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:e.title}))),O=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},F=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:p("qm.table.highSearch.gtText")},{value:"<",text:p("qm.table.highSearch.ltText")},{value:">=",text:p("qm.table.highSearch.gteText")},{value:"<=",text:p("qm.table.highSearch.lteText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:p("qm.table.highSearch.inText")},{value:"nin",text:p("qm.table.highSearch.ninText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:p("qm.table.highSearch.likeText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}]}return t},[H,k]=t().useState([{title:p("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t().createElement("div",null,t().createElement(me,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(n)}},p("qm.table.highSearch.removeText")))},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:p("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,l;const a=Object.values(t)[0],r=null===(n=S.find((e=>e.dataIndex===a)))||void 0===n?void 0:n.filter.type,i=F(r);e.fieldType=r,e.expression=a?null===(l=i[0])||void 0===l?void 0:l.value:"",e.condition=O(e.expression)?[]:"",a||(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=>{var t;const n=null===(t=S.find((t=>t.dataIndex===e.fieldName)))||void 0===t?void 0:t.filter.type;return{type:"select",editable:!0,items:F(n),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=O(e.expression)?[]:""}}}},{title:p("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t;const n=S.find((t=>t.dataIndex===e.fieldName)),l=null==n?void 0:n.filter.type,a=(null==n||null===(t=n.filter)||void 0===t?void 0:t.items)??(null==n?void 0:n.dictItems)??[];return{type:P(l,O(e.expression)),editable:!0,items:a,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:T,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),L=()=>{C&&sessionStorage.setItem(C,JSON.stringify(h.filter((e=>!!e.fieldName))))},q=()=>{if(!C)return;const e=sessionStorage.getItem(C);return e?JSON.parse(e):null},$=async()=>{if(!C)return;const e=q();e&&m(e);let t=await ts().getItem(C);t||(t=await _(C),Array.isArray(t)&&await ts().setItem(C,t)),Array.isArray(t)&&t.length&&(b(t),!e&&E(t[0].value))},_=async e=>{const t=null==l?void 0:l.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},D=async(e,t)=>{const n=null==l?void 0:l.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},K=Se("table");return t().createElement("div",{className:`${K}-super-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"container"},t().createElement(Bs,{ref:u,size:r,columns:H,dataSource:h,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(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]?"":")"),m([...h]))},onDataChange:e=>{m(e)}},t().createElement(me,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),mo.highSearch.showSQL&&w&&t().createElement("code",{className:"lang-js"},w)),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(A.Input,{size:r,value:y,placeholder:p("qm.table.highSearch.configText"),disabled:I,onChange:e=>{const{value:t}=e.target;v(t)}}),t().createElement(me,{type:"primary",disabled:!y||I,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!C)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=lo(),t=[...f,{text:y,value:e,list:h.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await ts().setItem(C,t),await D(C,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${mo.rowHeightMaps[r]}px`}},t().createElement("span",null,p("qm.table.highSearch.savedSetting"))),t().createElement("ul",null,f.map((e=>t().createElement("li",{key:e.value,className:Ce()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));b(t),e===x&&E(""),await ts().setItem(C,t),await D(C,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:hi}},t().createElement(ut,null)))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(me,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.highSearch.closeButton")),t().createElement(me,{type:"primary",disabled:N,onClick:()=>(c(),s(h.map((e=>Z()(e,["index","pageIndex"])))),L(),void n())},p("qm.table.highSearch.searchButton"))))},us=t().forwardRef(((e,n)=>{const{open:l=!0}=e,[a,r]=t().useState(!1),i=()=>{r(!0)};t().useImperativeHandle(n,(()=>({clickHandle:i})));const o=Se("table"),s={visible:a,title:p("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>r(!1)};return t().createElement(t().Fragment,null,l&&t().createElement("span",{className:`${o}-super-search`,title:p("qm.table.highSearch.text"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.FunnelPlotOutlined,null))),t().createElement(Gt,s,t().createElement(ds,{onClose:()=>r(!1)})))}));us.displayName="SuperSearch";const ps=us,hs=t().forwardRef(((e,n)=>{const{tableColumns:l,showFullScreen:a,showReload:r,showPrint:o,showImport:s,showExport:c,showClipboard:d,showCollection:u,showFastSearch:h,showSuperSearch:m,showGroupSummary:f,showToolBox:b}=e,{global:y}=t().useContext(i),{tableProps:v,flattenColumns:x,isFullScreen:E,$size:C}=t().useContext(ui),{uniqueKey:S,exportExcel:w}=v,I=t().useRef(null),N=t().useRef(null),T=t().useRef(null),R=t().useRef(null),O=t().useRef(null),P=t().useRef(null),F=t().useRef(null),H=t().useRef(null),k=t().useRef(null),L=t().useRef(null),q=t().useMemo((()=>S?`toolBox_${S}`:""),[S]),[$,_]=t().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),D={fullScreen:a,reload:r,print:o,import:s,export:c&&!(null!=w&&w.hideIcon),clipboard:d,collection:u,fastSearch:h,superSearch:m,groupSummary:f},[K,V]=t().useState(!1);De((()=>{j()}),[$]),t().useEffect((()=>{M()}),[]),t().useImperativeHandle(n,(()=>({exportHandle:()=>{if(!O.current)return g("Table","执行导出需要配置 `exportExcel` 参数");O.current.clickHandle()}})));const M=()=>{if(!q||!b)return;const e=JSON.parse(localStorage.getItem(q));e||z(q).then((e=>{e&&(_(Object.assign({},$,e)),localStorage.setItem(q,JSON.stringify(e)))})).catch((()=>{})),e&&_(Object.assign({},$,e))},j=()=>{if(!q||!b)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(q,JSON.stringify(e)),U(q,e)},z=async e=>{const t=null==y?void 0:y.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},U=async(e,t)=>{const n=null==y?void 0:y.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},B=async e=>{V(!1),await re(100),e.current.clickHandle()},W=(e,t)=>{_(Object.assign({},$,{[t]:e}))},G=Se("table"),Y={"top-toolbox__popper":!0,[`${G}--lg`]:"large"===C,[`${G}--sm`]:"small"===C};return t().createElement(t().Fragment,null,a&&t().createElement(wo,{ref:I,isFullScreen:E,open:!b||$.fullScreen}),r&&t().createElement(No,{ref:N,open:!b||$.reload}),o&&t().createElement(Ro,{ref:T,tableColumns:l,open:!b||$.print}),s&&t().createElement(jo,{ref:R,tableColumns:l,open:!b||$.import}),c&&t().createElement(Wo,{ref:O,tableColumns:l,open:(!b||$.export)&&!(null!=w&&w.hideIcon)}),d&&t().createElement(Xo,{ref:P,flattenColumns:x,open:!b||$.clipboard}),u&&t().createElement(Jo,{ref:F,columns:l,open:!b||$.collection}),h&&t().createElement(rs,{ref:H,open:!b||$.fastSearch}),f&&t().createElement(cs,{ref:k,open:!b||$.groupSummary}),m&&t().createElement(ps,{ref:L,open:!b||$.superSearch}),b&&t().createElement(A.Dropdown,{overlay:(()=>{const e=[{key:"fullScreen",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.screen.full"))),onClick:()=>B(I)},{key:"reload",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.refresh.text"))),onClick:()=>B(N)},{key:"print",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.print.text"))),onClick:()=>B(T)},{key:"import",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.import.textNoSpace"))),onClick:()=>B(R)},{key:"export",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.export.textNoSpace"))),onClick:()=>B(O)},{key:"clipboard",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.clipboard.textNoSpace"))),onClick:()=>B(P)},{key:"collection",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.selectCollection.text"))),onClick:()=>B(F)},{key:"fastSearch",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.fastSearch.text"))),onClick:()=>B(H)},{key:"groupSummary",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.groupSummary.text"))),onClick:()=>B(k)},{key:"superSearch",label:t().createElement(t().Fragment,null,t().createElement(A.Checkbox,{checked:$.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.highSearch.text"))),onClick:()=>B(L)}];return t().createElement(A.Menu,{items:e.filter((e=>D[e.key]))})})(),trigger:["click"],placement:"bottomRight",overlayClassName:Ce()(Y),overlayStyle:{minWidth:120},visible:K,onVisibleChange:e=>{V(e)}},t().createElement("span",{className:`${G}-toolbox`,title:p("qm.table.toolbox.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.AppstoreAddOutlined,null)))))}));hs.displayName="ToolBox";const ms=hs,fs=e=>{const{columns:n}=e,{global:l}=t().useContext(i),{tableProps:a,tableRef:r,$size:o}=t().useContext(ui),{uniqueKey:s,onlyShowIcon:c,columnsChange:d}=a,u=t().useRef([]),h=e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)),m=e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)),f=e=>e.filter((e=>!e.noAuth&&!e.fixed)),[g,b]=t().useState(!1),[y,v]=t().useState(h(n)),[x,E]=t().useState(m(n)),[C,S]=t().useState(f(n)),w=t().useMemo((()=>s?`table_${s}`:""),[s]),I=t().useMemo((()=>[...y,...C,...x]),[y,C,x]);De((()=>{O(n),R(n),N(n)}),[n]),t().useEffect((()=>{T()}),[]);const N=e=>{if(!w)return;const t=e.map((e=>{const t={};return void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),n=JSON.parse(localStorage.getItem(w));(0,J.isEqual)(t,n)||(localStorage.setItem(w,JSON.stringify(t)),(async(e,t)=>{const n=null==l?void 0:l.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(w,t))},T=()=>{const e=(()=>{if(!w)return;const e=JSON.parse(localStorage.getItem(w));return e||(async e=>{const t=null==l?void 0:l.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(w).then((e=>{if(!e)return N(n);localStorage.setItem(w,JSON.stringify(e)),T()})).catch((()=>{})),e?(0,J.xor)(e.map((e=>e.dataIndex)),n.map((e=>e.dataIndex))).length>0?n.map((t=>{const{dataIndex:n}=t,l=e.find((e=>e.dataIndex===n));return l?(void 0!==l.hidden&&(t.hidden=l.hidden),void 0!==l.fixed&&(t.fixed=l.fixed),void 0!==l.width&&(t.width=l.width),void 0!==l.renderWidth&&(t.renderWidth=l.renderWidth),t):t})):e.map((e=>{const t=n.find((t=>t.dataIndex===e.dataIndex));return void 0===e.fixed&&delete t.fixed,{...t,...e}})):void 0})();e&&(R(e),null==d||d(e))},R=e=>{const t=h(e),n=m(e),l=f(e);return v(t),E(n),S(l),[...t,...l,...n]},O=e=>{const t=[];e.filter((e=>!e.noAuth)).forEach(((n,l)=>{const a=n.colSpan;a>1&&e.slice(l+1,l+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(l,l+a))})),u.current=t},P=()=>{const e=[];I.forEach((t=>{const{colSpan:n,dataIndex:l}=t;if(0===n)return;if(1===n)return e.push(t);const a=u.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(l)));if(-1===a)return e.push(t);e.push(...u.current[a].map(((e,n)=>{let{dataIndex:l}=e;const a=I.find((e=>e.dataIndex===l));return n>0&&(void 0!==t.hidden&&(a.hidden=t.hidden),void 0!==t.fixed?a.fixed=t.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((t,n)=>{t.noAuth&&e.findIndex((e=>e.dataIndex===t.dataIndex))<0&&e.splice(n,0,t)})),null==d||d(e)},F=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const l=R(n);null==d||d(l)},H=(e,l)=>{const{colSpan:a,noFixed:r}=e;if(0===a)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${l}-handle`];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(A.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:l}=t.target;e.hidden=!l,R(n),P()}}),t().createElement("i",{className:Ce()(i),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title),"main"===l?t().createElement("span",{className:Ce()("fixed",r?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>F(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>F(e,"right")},t().createElement(we.StepForwardOutlined,null))):t().createElement("span",{className:Ce()("fixed",r?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>F(e)},t().createElement(we.CloseCircleOutlined,null))))},k=Se("table"),L={[`${k}__popper`]:!0,"column-filter__popper":!0,[`${k}--lg`]:"large"===o,[`${k}--sm`]:"small"===o},q=[`${k}-column-filter`,{selected:g}];return t().createElement(rl(),{action:["click"],popupVisible:g,popup:t().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"reset"},t().createElement(me,{type:"text",size:"small",onClick:()=>{const e=ce(r.current.originColumns);R(e),null==d||d(e)}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement(In.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,J.isEqual)(t,n)||v(e)},onEnd:()=>P()},y.map((e=>H(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement(In.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:C,setList:e=>{const t=e.map((e=>e.dataIndex)),n=C.map((e=>e.dataIndex));(0,J.isEqual)(t,n)||S(e)},onEnd:()=>P()},C.map((e=>H(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement(In.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:x,setList:e=>{const t=e.map((e=>e.dataIndex)),n=x.map((e=>e.dataIndex));(0,J.isEqual)(t,n)||E(e)},onEnd:()=>P()},x.map((e=>H(e,"right")))))),popupClassName:Ce()(L),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{b(e)},builtinPlacements:vi,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Ce()(q),title:c?p("qm.table.columnFilter.text"):void 0},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),!c&&t().createElement("span",null,p("qm.table.columnFilter.text"))))},gs=()=>t().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}));function bs(){return bs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},bs.apply(this,arguments)}const ys=e=>{const{column:n,filters:l}=e,{$size:a,setFilters:r,clearSuperFilters:i}=t().useContext(ui),o=t().useRef(null),s=t().useRef(null),c=t().useRef(null),[d,u]=t().useState(!1),[h,m]=t().useState(!1),[f,b]=t().useState({}),y=t().useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),v=t().useMemo((()=>{let e=!1;for(const t in l[y])if(!se(l[y][t])||h){e=!0;break}return e}),[y,l,h]);t().useEffect((()=>{d&&(se(l[y])&&x(),setTimeout((()=>E()),50))}),[d]),t().useEffect((()=>{Object.keys(l).includes(y)||m(!1)}),[l]);const x=()=>{b({})},E=()=>{switch(n.filter.type){case"text":o.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},C=e=>{e&&b(e),i(),r((e=>{for(const t in e){for(const n in e[t])if(se(e[t][n])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][n])continue;delete e[t][n]}Object.keys(e[t]).length||delete e[t]}return e})({...l,...f,...e})),u(!1)},S={text:e=>{var n;const{title:l}=e;return t().createElement(t().Fragment,null,t().createElement(A.Input,{ref:o,size:a,placeholder:p("qm.table.filter.searchText",{text:l}),style:{width:"180px"},value:(null===(n=f[y])||void 0===n?void 0:n.like)??"",disabled:h,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&C()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(A.Checkbox,{checked:h,onChange:e=>{const{checked:t}=e.target,n=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":n,like:null}}))),m(t)}},p("qm.table.filter.nullValue"))))},textarea:e=>{var n;const{title:l}=e;return t().createElement(t().Fragment,null,t().createElement(A.Input.TextArea,{ref:c,size:a,placeholder:p("qm.table.filter.searchAreaText",{text:l}),style:{width:"220px"},value:(null===(n=f[y])||void 0===n?void 0:n.likes)??"",disabled:h,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{likes:t||null}})))},onKeyDown:e=>{13===e.keyCode&&C()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(A.Checkbox,{checked:h,onChange:e=>{const{checked:t}=e.target,n=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":n,like:null}}))),m(t)}},p("qm.table.filter.nullValue"))))},number:e=>{const n=e=>{var t;return{value:(null===(t=f[y])||void 0===t?void 0:t[e])??"",size:a,onChange:t=>{(null==t?void 0:t.toString().replace(/^-|\./g,"").length)>17||b((n=>Object.assign({},n,{[y]:Object.assign({},n[y],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&C()}}};return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(A.InputNumber,bs({ref:s},n(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(A.InputNumber,bs({},n("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(A.InputNumber,bs({},n("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(A.InputNumber,bs({},n("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const n=e=>{var t;return{value:to(null===(t=f[y])||void 0===t?void 0:t[e],gi),format:gi,size:a,onChange:t=>{b((n=>Object.assign({},n,{[y]:Object.assign({},n[y],{[e]:no(t,gi)})})))},onKeyDown:e=>{13===e.keyCode&&C()}}};return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(_,bs({},n(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(_,bs({},n("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(_,bs({},n("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(_,bs({},n("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{var n;const{filter:l,dictItems:a=[]}=e,r=l.items||a;return t().createElement("ul",null,t().createElement(A.Radio.Group,{style:{width:"100%"},value:null===(n=f[y])||void 0===n?void 0:n["=="],onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{"==":t}})))}},r.map((e=>t().createElement("li",{key:e.value},t().createElement(A.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{var n;const{filter:l,dictItems:a=[]}=e,r=l.items||a;return t().createElement("ul",null,t().createElement(A.Checkbox.Group,{style:{width:"100%"},value:null===(n=f[y])||void 0===n?void 0:n.in,onChange:e=>{b((t=>Object.assign({},t,{[y]:{in:e}})))}},r.map((e=>t().createElement("li",{key:e.value},t().createElement(A.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{var n;const{filter:l,dictItems:a=[]}=e,r=l.items||a;return t().createElement("div",{style:{height:200,...l.style}},t().createElement(di,{multiple:!0,value:(null===(n=f[y])||void 0===n?void 0:n.in)||[],dataSource:r,onCheckChange:e=>{const t=e.map((e=>e.value));b((e=>Object.assign({},e,{[y]:{in:t}})))}}))}},w=Se("table"),I={"head-filter__popper":!0,[`${w}--lg`]:"large"===a,[`${w}--sm`]:"small"===a},N=["cell--filter",{selected:d,actived:v}];return t().createElement(rl(),{action:["click"],popupVisible:d,popup:(()=>{const e=n.filter.type,l=S[e];return l?t().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t().createElement("div",null,l(n)),t().createElement(A.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t().createElement(me,{size:a,onClick:()=>{C({[y]:{}})}},p("qm.table.filter.reset")),t().createElement(me,{type:"primary",size:a,onClick:()=>C()},p("qm.table.filter.search")))):(g("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Ce()(I),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{u(e)},builtinPlacements:vi,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("div",{className:Ce()(N),title:p("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t().createElement("span",{className:"svgicon icon"},t().createElement(gs,null))))},vs=e=>{const{column:n}=e,{tableProps:l,tableRef:a,bordered:r}=t().useContext(ui),{columns:i,resizable:o,columnsChange:s=le}=l,c={resizable:!0,"is--line":o&&!r};return t().createElement("div",{className:Ce()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:l}=a.current,r=l.$resizableBar,o=t.offsetWidth/2,c=e.clientX,d=Wi(t,l.$table).left-l.$tableBody.parentNode.scrollLeft+o;l.$table.classList.add("c--resize"),r.style.left=`${d}px`,r.style.display="block";const u=n.width||n.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,l=u+t;l<(n.minWidth||mo.defaultColumnWidth)||(p=Math.floor(l),r.style.left=`${t+d}px`)},document.onmouseup=function(){l.$table.classList.remove("c--resize"),r.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Ki(i,n.dataIndex).width=p,s([...i]))},!1}})},xs=e=>{const{selectionKeys:n}=e,{tableRef:l,tableProps:a,getRowKey:r,pagination:i,fetchParams:o,setSelectionKeys:s,setSpinning:c,isWebPagination:d}=t().useContext(ui),{rowSelection:u}=a,{fetchAllRowKeys:h,onSelectAll:m}=u,f=t().useRef([]),g=t().useMemo((()=>u.selectAllOnCurrentPage??!1),[u]),b=t().useMemo((()=>(u.filterable??!0)&&!g),[u,g]),y=(()=>{const{allTableData:e,allRowKeys:t}=l.current,{disabled:a=(e=>!1)}=u;return g?(0,J.union)((()=>{const{tableFullData:e}=l.current,{current:t,pageSize:n}=i;return d?e.slice((t-1)*n,t*n):e})().filter((e=>!a(e))).map((e=>r(e,e.index))),n):t.filter(((t,n)=>!a(e[n])))})(),v=n.length>0&&n.length<(h||g?i.total:l.current.allRowKeys.length),x=!!n.length&&n.length===(f.current.length||y.length),E=async()=>{const e=h;let t=[];c(!0);try{const n=await e.api(o);200===n.code&&(t=Array.isArray(n.data)?n.data:(0,J.get)(n.data,e.dataKey)??[],f.current=t)}catch(e){}return c(!1),t},C=async e=>{let t=[];t=h?e?await E():[]:e?y.slice(0):[],s(t),null==m||m(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(A.Checkbox,{checked:x,indeterminate:v,disabled:!y.length,onChange:e=>C(e.target.checked)}),b&&t().createElement(A.Dropdown,{overlayClassName:"all-selection__popper",overlay:(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{C(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=h?(0,J.xor)(n,await E()):(0,J.xor)(n,y),s(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{C(!1)}}];return t().createElement(A.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),g&&t().createElement(A.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},Es=e=>{const{style:n}=e,{tableProps:l,tableRef:a,isTreeTable:r,setRowExpandedKeys:i}=t().useContext(ui),{expandable:o}=l,[s,c]=t().useState((null==o?void 0:o.defaultExpandAllRows)||!1);De((()=>{const{allRowKeys:e,flattenRowKeys:t}=a.current;i(s?e.filter((e=>!(r&&t.includes(e)))):[])}),[s]);const d={[`${Se("expand")}--icon`]:!0,expanded:s,collapsed:!s};return t().createElement("span",{className:Ce()(d),title:"",onClick:e=>{e.stopPropagation(),c(!s)},style:n})},Cs=()=>t().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"})),Ss=()=>t().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t().createElement("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})),ws=e=>{const{tableColumns:n,flattenColumns:l,sorter:a,filters:r}=e,{getRowKey:i,tableProps:o,tableRef:s,layout:c,scrollY:d,superFilters:u,selectionKeys:h,rightFixedColumns:m,firstDataIndex:f,isFetch:g,isTreeTable:b,isGroupSubtotal:y,tableChange:v,setSorter:x,setElementStore:E,resetTableScroll:C,getStickyLeft:S,getStickyRight:w,createGroupData:I,createTableFullData:N}=t().useContext(ui),{ellipsis:T,resizable:R,multipleSort:O,rowSelection:P,expandable:F}=o,[H,k]=mo.sortDirections,L=t().useRef(null),q=t().useMemo((()=>!g),[g]),$=t().useMemo((()=>!g),[g]),_=t().useMemo((()=>!(null!=F&&F.hideExpandAll)),[F]),D=t().useMemo((()=>!(!P||(g?!P.selectAllOnCurrentPage&&!P.fetchAllRowKeys:P.hideSelectAll))),[g,P]);De((()=>{U(),v(),C()}),[a]),De((()=>{G(),v(),C()}),[r]),De((()=>{G(),v(),C()}),[u]),t().useEffect((()=>{K()}),[]);const K=()=>{E("$header",L.current)},V=e=>{const{dataIndex:n,type:l,sorter:r,title:i,description:o}=e;if(n===mo.selectionColumn&&"checkbox"===l){if("checkbox"===l)return t().createElement("div",{className:"cell"},D?t().createElement(xs,{selectionKeys:h}):p("qm.table.config.selectionText"));if("radio"===l)return t().createElement("div",{className:"cell"},i)}const s=[];return s.push(t().createElement("div",{key:0,className:"cell",title:i},b&&n===f&&_?t().createElement(Es,null):null,n===mo.expandableColumn&&_?t().createElement(Es,null):i)),o&&s.push(t().createElement(A.Tooltip,{key:1,placement:"top",title:o},t().createElement(we.InfoCircleOutlined,{className:"tip"}))),r&&s.push(M(a[n])),s},M=e=>{const n=["svgicon cell--sorter__asc",{actived:e===H}],l=["svgicon cell--sorter__desc",{actived:e===k}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Ce()(n)},t().createElement(Cs,null)),t().createElement("span",{className:Ce()(l)},t().createElement(Ss,null)))},j=e=>t().createElement(ys,{column:e,filters:r}),z=(e,t)=>{const{sorter:n,dataIndex:l}=t;if(n){const e=a[l],t=e?e===k?null:k:H;O?(delete a[l],x(Object.assign({},a,{[l]:t}))):x(Object.assign({},{[l]:t}))}},U=()=>{q&&B()},B=e=>{const t=(0,J.pickBy)(a,(e=>null!==e));for(const e in t){const n=l.find((t=>t.dataIndex===e));n?W(n,t[e]):delete t[e]}e||Object.keys(t).length||W({dataIndex:"index"},H)},W=(e,t)=>{const{tableFullData:n}=s.current,{dataIndex:l,sorter:a}=e,r=(e,n)=>{const a=Qi(e,l),r=Qi(n,l);return Number.isNaN(a-r)?t===H?a.toString().localeCompare(r.toString()):r.toString().localeCompare(a.toString()):t===H?a-r:r-a},i=y?I(ro(n).sort("function"==typeof a?a:r)):n.sort("function"==typeof a?a:r).slice(0);N(i)},G=()=>{$&&Y()},Y=()=>{const{tableOriginData:e}=s.current,t=u.length?io(u):io(r),n=""!==t?y?I(Li(ro(e),t,b)):Li(e,t,b):e;N(n),B(!0)},X=Bi(n),Q=Se("table"),{tableBodyWidth:Z}=c;return t().createElement("div",{ref:L,className:`${Q}--header-wrapper`},t().createElement("table",{className:`${Q}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},(()=>{const{gutterWidth:e}=c;return t().createElement("colgroup",null,l.map((e=>{const{dataIndex:n,width:l,renderWidth:a}=e;return t().createElement("col",{key:n,style:{width:`${l||a}px`,minWidth:`${l||a}px`}})})),d&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("thead",null,(e=>{const{isIE:n}=s.current,l=["gutter",{"cell-fix-right":!!m.length}],r=n?null:{right:m.length?0:""};return e.map(((e,n)=>t().createElement("tr",{key:n,className:"header--row"},e.map(((n,l)=>((e,n,l)=>{var r,i;const{isIE:o}=s.current,{gutterWidth:u}=c,{dataIndex:p,colSpan:h,rowSpan:m,fixed:f,align:g,theadAlign:b,theadClassName:y="",sorter:v,filter:x,required:E,headRender:C}=e;if(0===h)return null;const I=b||g,N=["header--column",{"col--ellipsis":e.ellipsis??T,"col--center":"center"===I,"col--right":"right"===I,"column--required":!!E,"column-has-sorter":v,"column-has-filter":x,"column--sort":!!a[p],"cell-fix-left":!o&&"left"===f,"cell-fix-right":!o&&"right"===f,"cell-fix-left-last":!(o||"left"!==f||null!==(r=l[n+1])&&void 0!==r&&r.fixed),"cell-fix-right-first":!(o||"right"!==f||null!==(i=l[n-1])&&void 0!==i&&i.fixed),[y]:!!y}],O=o?null:{left:"left"===f?`${S(p)}px`:"",right:"right"===f?`${w(p)+(d?u:0)}px`:""},A=R&&![mo.expandableColumn,mo.selectionColumn].includes(p);return t().createElement("th",{key:p,className:Ce()(N),colSpan:h,rowSpan:m,style:{...O},onClick:t=>z(t,e)},t().createElement("div",{className:"cell--wrapper"},C?t().createElement("div",{className:"cell--text cell"},C(e,s.current.tableFullData)):t().createElement(t().Fragment,null,t().createElement("div",{className:"cell--text"},V(e)),x?j(e):null)),A&&t().createElement(vs,{column:e}))})(n,l,e))),d&&t().createElement("th",{className:Ce()(l),style:{...r}}))))})(X))))},Is=()=>{const{tableProps:e,tableRef:n,layout:l,flattenColumns:a,isDragMergeCell:r}=t().useContext(ui),{mergeCells:i=[],onMergeChange:o}=e,[s,c]=t().useState(!1),d=t().useRef(null),u=t().useRef(null),h=t().useRef({x:0,y:0,disX:0,disY:0});De((()=>{r||y()}),[r]);const m=()=>{y(),Be(d.current,{display:"none"})},f=e=>{const t=[];for(let n=0;n<e.rowSpan;n++)for(let l=0;l<e.colSpan;l++)t.push([e.row+n,e.col+l]);return t},g=()=>{h.current={x:0,y:0,disX:0,disY:0},u.current&&!v(u.current)||(u.current=null,m()),c(!0),document.removeEventListener("mousemove",b)},b=e=>{const{pageX:t,pageY:n}=e,{x:a,y:r,disX:i,disY:o}=h.current;let s=i,c=o,u=t-a,p=n-r;return u<0&&(u=Math.abs(u),s=i-u,Be(d.current,{left:`${s}px`})),p<0&&(p=Math.abs(p),c=o-p,Be(d.current,{top:`${c+l.headerHeight}px`})),Be(d.current,{width:`${u}px`,height:`${p}px`}),E(s,c,u,p),!1},y=()=>{const{elementStore:e}=n.current,t=e.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<t.length;e++){const n=t[e].children;for(let e=0;e<n.length;e++)n[e].classList.remove("selected")}},v=e=>1===e.rowSpan&&1===e.colSpan,x=e=>e.width||e.renderWidth||e.minWidth||mo.defaultColumnWidth,E=(0,J.debounce)(((e,t,l,r)=>{const{allTableData:i,scrollYStore:o}=n.current;let s=-1,c=-1,d=-1,p=-1;for(let e=0;e<i.length;e++)t>o.rowHeight*e&&t<o.rowHeight*(e+1)&&(s=e),t+r>o.rowHeight*e&&t+r<o.rowHeight*(e+1)&&(c=e);let h=0;for(let t=0;t<a.length;t++)e>h&&e<h+x(a[t])&&(d=t),e+l>h&&e+l<h+x(a[t])&&(p=t),h+=x(a[t]);const m={row:s,col:d,rowSpan:c-s+1,colSpan:p-d+1};(0,J.isEqual)(u,m)||(u.current=m,((e,t,l,a)=>{const{elementStore:r,scrollYStore:i}=n.current,o=r.$tableBody.querySelectorAll("tbody > tr");for(let n=0;n<o.length;n++){const r=o[n].children;for(let o=0;o<r.length;o++)if(r[o].classList.remove("selected"),(e!==t||l!==a)&&n+i.startIndex>=e&&n+i.startIndex<=t){const e=Number(r[o].getAttribute("colspan")),t=Number(r[o].getAttribute("data-index")),n=e>1?t+e-1:t;n>=l&&n<=a&&r[o].classList.add("selected")}}})(s,c,d,p))}),10);return{dragStart:e=>{const{pageX:t,pageY:a}=e,{elementStore:r}=n.current,{x:i,y:o}=(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}})(r.$table),{scrollLeft:s,scrollTop:p}=r.$tableBody.parentNode;u.current=null,h.current={x:t,y:a,disX:t+s-i,disY:a+p-(o+l.headerHeight)},Be(d.current,{width:0,height:0,left:t-i+"px",top:a-o+"px",display:"block"}),y(),c(!1),document.addEventListener("mousemove",b,{passive:!0}),document.addEventListener("mouseup",g,{passive:!0,once:!0})},renderDragPanel:()=>t().createElement("div",{ref:d,className:"merge-cell-bar",onMouseDown:e=>e.stopPropagation()},s&&t().createElement(t().Fragment,null,t().createElement(me,{size:"small",className:"btn cancel",onClick:()=>{if(u.current&&!v(u.current)){const e=f(u.current),t=i.findIndex((t=>{const n=f(t);return(0,J.intersectionWith)(n,e,J.isEqual).length===n.length}));-1!==t&&(null==o||o(i.filter(((e,n)=>n!==t))))}m()}},p("qm.table.mergeCell.cancel")),t().createElement(me,{size:"small",type:"primary",className:"btn confirm",onClick:()=>{if(u.current&&!v(u.current)){const e=f(u.current);let t=!1;for(let n=0;n<i.length;n++)(0,J.intersectionWith)(f(i[n]),e,J.isEqual).length&&(t=!0);t||null==o||o([...i,u.current])}m()}},p("qm.table.mergeCell.confirm")))),closeDragPanel:m}};const Ns=e=>{const{selectionKeys:n,column:l,record:a,rowKey:r}=e,{tableProps:i,tableRef:o,isTreeTable:s,getAllChildRowKeys:c}=t().useContext(ui),{rowSelection:d}=i,u=t().useMemo((()=>l.type||""),[l.type]),p=e=>{const t=d.checkStrictly??!0;if(!s||t)return!1;const l=zi(o.current.deriveRowKeys,e),a=c((null==l?void 0:l.children)??[]);return!(!Array.isArray(null==l?void 0:l.children)||Xi(n,(null==l?void 0:l.children.map((e=>e.rowKey)))||[]))&&a.some((e=>n.includes(e)))};return"radio"===u?(()=>{const e=d.disabled,l=null==e?void 0:e(a),i=!l&&n[0]===r;return t().createElement(A.Radio,{checked:i,disabled:l})})():(()=>{const e=d.disabled,l=null==e?void 0:e(a),i=!!n.includes(r);return t().createElement(A.Checkbox,{checked:i,indeterminate:p(r),disabled:l})})()},Ts=e=>{const{record:n,rowKey:l,style:a}=e,{tableProps:r,rowExpandedKeys:i,setRowExpandedKeys:o}=t().useContext(ui),{expandable:s={}}=r,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t().useMemo((()=>i.includes(l)),[i,l]);De((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${Se("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t().createElement("span",{className:Ce()(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==l)):[...i,l];o(t)},style:a})},Rs=t().forwardRef(((e,n)=>{const{size:l,defaultValue:a,value:r,min:i,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<i&&(t=i.toString()),p>=0&&""!==t&&(t=new(Dn())(t).toFixed(p)),t},E=void 0!==r,[C,S]=t().useState(a??""),w=b(E?r:C),I=y(w),N=t=>{var n;E?null===(n=e.onChange)||void 0===n||n.call(e,t):S(t)};return De((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,I)}),[C]),t().createElement(A.Input,{ref:n,size:l,value:w,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:e=>{const t=y(e.target.value);let n=/^-?\d*(\.\d*)?$/.test(t)||""===t||"-"===t;if(0===p&&t.includes(".")&&(n=!1),i>=0&&t.startsWith("-")&&(n=!1),n){if(!h&&t.replace(/^-|\./g,"").length>17)return;N(t)}},onFocus:v,onBlur:()=>{var t;const n=x(I);n!==I&&N(n),null===(t=e.onBlur)||void 0===t||t.call(e,n,I)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(I),I))}})}));Rs.displayName="InputNumber";const Os=Rs;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 l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},As.apply(this,arguments)}const{Search:Ps}=A.Input,Fs=e=>{var n,l,a,r;const{column:i,record:o,rowKey:s,columnKey:c,clicked:d,text:u}=e,{tableRef:h,tableBodyRef:m,$size:f,flattenColumns:b,doFieldValidate:y,dataChange:v}=t().useContext(ui),x=t().useRef(null),E=t().useRef(null),C=t().useRef(null),S=t().useRef(null),w=t().useRef(null),I=t().useRef(!1),N=t().useRef([]),T=t().useRef({}),R=Eo(),{store:O,fieldAuth:P}=h.current,F=(null===(n=i.editRender)||void 0===n?void 0:n.call(i,o,i))||{},[H,k]=t().useState(!1),[L,q]=t().useState(!1),[$,D]=t().useState(!1),[K,V]=t().useState(F.items||[]),[j,z]=t().useState(),U=(F.editable||(0,J.isEqual)(d,[s,c]))&&!F.disabled&&!(null!==(l=P[c])&&void 0!==l&&l.disabled),B=`${s}|${c}`,W=2===d.length?`${d[0]}|${d[1]}`:"",G=![...O.state.required,...O.state.validate].some((e=>{let{x:t,y:n}=e;return t===s&&n===c})),Y=(null===(a=O.state.required.find((e=>{let{x:t,y:n}=e;return t===s&&n===c})))||void 0===a?void 0:a.text)||"",X=(null===(r=O.state.validate.find((e=>{let{x:t,y:n}=e;return t===s&&n===c})))||void 0===r?void 0:r.text)||"",Q=O.state.edited.some((e=>{let{x:t,y:n}=e;return t===s&&n===c})),Z=U||!G||H||$||L,ee=()=>{v()};t().useEffect((()=>{Z&&W===B&&le()}),[d]);const te=(e,t)=>{k(e),null==t||t()},ne=e=>{N.current=e},le=()=>{var e,t,n,l;const{type:a}=F;switch(a){case"text":null===(e=E.current)||void 0===e||e.focus();break;case"number":null===(t=C.current)||void 0===t||t.select();break;case"search-helper":null===(n=S.current)||void 0===n||n.focus();break;case"tree-helper":null===(l=w.current)||void 0===l||l.focus()}},re=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0}))},oe=(e,t,n)=>{const{cornerSign:l=!0}=F.extra||{};O.addToUpdated(e),l&&O.addToEdited({x:t,y:n})},se=e=>""!==e?Number(e):"",ce={text:(e,n,l)=>{const{dataIndex:a}=n,{type:r,extra:i={},rules:o=[],onInput:d,onChange:u,onEnter:h,onBlur:m}=F,g=Qi(e,a),b=Object.assign({},{minRows:1,maxRows:4},i.autoSize),v=l?{rows:b.minRows,autoSize:b}:null,x=i.password?A.Input.Password:l?A.Input.TextArea:A.Input;return t().createElement(x,As({ref:E,size:f,value:g,maxLength:i.maxLength,showCount:i.showCount},v,{autoComplete:i.password?"new-password":"off",placeholder:i.placeholder||p("qm.table.editable.inputPlaceholder"),allowClear:i.allowClear,readOnly:i.readOnly,disabled:i.disabled,suffix:i.suffix,onChange:t=>{const n=t.target.value??"";Zi(e,a,n),y(o,n,s,c),R(),null==d||d({[B]:n}),I.current=!0},onFocus:()=>q(!0),onBlur:t=>{q(!1);const n=t.target.value??"";I.current&&(I.current=!1,oe(e,s,c),null==u||u({[B]:n},e),null==m||m({[B]:n},e),ee())},onKeyUp:t=>{if(13===t.keyCode){const n=t.target.value??"";null==h||h({[B]:n},e)}}}))},textarea:(e,t)=>ce.text(e,t,!0),number:(e,n)=>{const{dataIndex:l,precision:a,formatType:r}=n,{type:i,extra:o={},rules:d=[],onInput:u,onChange:h,onEnter:m,onBlur:g}=F,b=Qi(e,l);let v,x;return"finance"===r&&(v=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},x=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===r&&(v=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(Dn())(e).times(100).toNumber()}`,x=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Dn())(e).times(.01).toString()),t().createElement(Os,{ref:C,size:f,value:b,min:o.min,max:o.max,precision:a,stringMode:o.stringMode,prefix:o.prefix,suffix:o.suffix??("percent"===r?"%":void 0),placeholder:o.placeholder||p("qm.table.editable.inputPlaceholder"),maxLength:o.maxLength,allowClear:o.allowClear,readOnly:o.readOnly,disabled:o.disabled,formatter:v,parser:x,onChange:t=>{Zi(e,l,t),y(d,t,s,c),R(),null==u||u({[B]:t}),I.current=!0},onFocus:()=>q(!0),onBlur:(t,n)=>{if(q(!1),!I.current)return;I.current=!1;let a=o.stringMode?t:se(t);"percent"===r&&"."===n.charAt(n.length-1)&&(a=Number(t)/100),Zi(e,l,a),oe(e,s,c),null==h||h({[B]:a},e),null==g||g({[B]:a},e),ee()},onEnter:(t,n)=>{let l=o.stringMode?t:se(t);"percent"===r&&"."===n.charAt(n.length-1)&&(l=Number(t)/100),null==m||m({[B]:l},e)}})},select:(e,n,l)=>{const{dataIndex:a,dictItems:r=[]}=n,{type:i,extra:o={},rules:d=[],items:u,onChange:m,onEnter:g}=F,{elementStore:b}=h.current,v=u||r,x=Qi(e,a);let E=x;return t().createElement(A.Select,{mode:l?"multiple":void 0,size:f,dropdownClassName:"table-editable__popper",value:x||void 0,placeholder:o.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,listHeight:o.listHeight,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},showSearch:o.filterable??!0,filterOption:(e,t)=>{var n;const l=(null==t||null===(n=t.children)||void 0===n?void 0:n.toString())||"";return`${l}|${ya.parse(l).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{Zi(e,a,t),y(d,t,s,c),oe(e,s,c),R(),null==m||m({[B]:t},e),ee()},onSelect:e=>{E=e},onInputKeyDown:t=>{13===t.keyCode&&ie((()=>null==g?void 0:g({[B]:E},e)))}},v.map((e=>t().createElement(A.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ce.select(e,t,!0),date:(e,n,l)=>{const{dataIndex:a}=n,{type:r,extra:i={},rules:o=[],onChange:d}=F,u=l?bi:gi,h=Qi(e,a);return t().createElement(_,{showTime:l,size:f,dropdownClassName:"table-editable__popper",value:to(h,u)??void 0,format:u,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=i;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:p(l?"qm.table.editable.datetimePlaceholder":"qm.table.editable.datePlaceholder"),allowClear:i.allowClear,disabled:i.disabled,style:{width:"100%"},onChange:t=>{const n=no(t,u);Zi(e,a,n),y(o,n,s,c),oe(e,s,c),R(),null==d||d({[B]:n},e),ee()}})},datetime:(e,t)=>ce.date(e,t,!0),time:(e,n)=>{const{dataIndex:l}=n,{type:a,extra:r={},rules:i=[],onChange:o}=F,d=r.format||"HH:mm:ss",u=Qi(e,l);return t().createElement(M,{size:f,dropdownClassName:"table-editable__popper",value:to(u,d)??void 0,format:d,placeholder:p("qm.table.editable.datetimePlaceholder"),allowClear:r.allowClear,disabled:r.disabled,style:{width:"100%"},onChange:t=>{const n=no(t,d);Zi(e,l,n),y(i,n,s,c),oe(e,s,c),R(),null==o||o({[B]:n},e),ee()}})},checkbox:(e,n)=>{const{dataIndex:l}=n,{type:a,extra:r={},onChange:i}=F,{trueValue:o=mi,falseValue:d=fi,disabled:u}=r,p=Qi(e,l);return t().createElement(A.Checkbox,{checked:p===o,disabled:u,onChange:t=>{const n=t.target.checked?o:d;Zi(e,l,n),oe(e,s,c),R(),null==i||i({[B]:n},e),ee()}})},switch:(e,n)=>{const{dataIndex:l}=n,{type:a,extra:r={},onChange:i}=F,{trueValue:o=mi,falseValue:d=fi,disabled:u}=r,p=Qi(e,l);return t().createElement(A.Switch,{checked:p===o,disabled:u,onChange:t=>{const n=t?o:d;Zi(e,l,n),oe(e,s,c),R(),null==i||i({[B]:n},e),ee()}})},"search-helper":(e,n)=>{const{dataIndex:l,precision:a}=n,{type:r,extra:i={},rules:o=[],helper:d={},onInput:u,onChange:h,onEnter:v}=F,E=Qi(e,l),C=d.fieldAliasMap;C||g("Table","helper 需要配置 `fieldAliasMap` 选项");const w="function"==typeof C?C():C||{};Object.keys(w).includes(l)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值");const N=e=>{const{filterAliasMap:t}=d,n=""!==e?e:void 0,a="function"==typeof t?t():t??[],r={[l]:n};return a.forEach((e=>r[e]=n)),r},R=e=>{const{autoQueryAssign:t=!0}=d;t&&(T.current=N(e)),k(!0)},O=(t,l)=>{const{beforeOpen:a}=d,r=(a??ae)({[B]:E},e,n);null!=r&&r.then?r.then((()=>{R(t),null==l||l()})).catch((()=>{})):!1!==r&&(R(t),null==l||l())},A=e=>{const t={};for(const n in w){const a=w[n];n!==l&&(t[n]=Ji(e,a))}const n=w[l]?Ji(e,w[l]):"";L(n,t);const{closed:a}=d;te(!1,(()=>re(x.current))),le(),null==a||a(e)},P=()=>{const{onlySelect:e=!0}=d;I.current&&L(e?"":E),te(!1,(()=>re(x.current)))},L=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(n)&&Object.keys(n).length){for(const t in n){const l=n[t],a=b.find((e=>e.dataIndex===t));if(a){var r;Zi(e,t,l,a.precision);const n=null===(r=a.editRender)||void 0===r?void 0:r.call(a,e,a);n&&Array.isArray(n.rules)&&y(n.rules,l,s,t)}else Zi(e,t,l)}m.current.forceUpdate()}Zi(e,l,t,a),y(o,t,s,c),oe(e,s,c),null==h||h({[B]:t},e),ee(),T.current={},I.current=!1,z(void 0)},q={visible:H,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Wn[f]+20}px`},onClose:()=>{P()}},$={...d,size:f,initialValue:Object.assign({},T.current,d.initialValue),onClose:e=>{e?A(e):P()}};return t().createElement(t().Fragment,null,t().createElement(Ps,{ref:S,value:j??E,placeholder:i.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:i.allowClear,readOnly:i.readOnly,disabled:i.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:a=!0,table:r}=d;if(I.current&&!H)return n&&a&&null!=r&&null!==(t=r.fetch)&&void 0!==t&&t.api?(e=>{const{table:t,initialValue:n={}}=d,{beforeFetch:l=ae}=t.fetch;return D(!0),new Promise((async(a,r)=>{const i=(0,J.merge)({},t.fetch.params,{...n,...N(e)},{currentPage:1,pageSize:500});try{if(l(i)){const e=await t.fetch.api(i);200===e.code?a(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):r()}else r()}catch(e){r()}D(!1)}))})(n).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>Ji(t,w[l]).toString().includes(e)));if(1===t.length)return A(t[0]);O(e)}(e,n))).catch((()=>L(""))):void L(n)},onChange:e=>{const{value:t}=e.target;null==u||u({[B]:t}),I.current=!0,z(t)},onKeyUp:t=>{if(13===t.keyCode){const n=t.target.value??"";null==v||v({[B]:n},e)}},onDoubleClick:e=>{const{value:t}=e.target;O(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?O(e):L(""))}}),t().createElement(Gt,q,t().createElement(Xs,$)))},"search-helper-multiple":(e,n)=>{const{dataIndex:l}=n,{type:a,items:r=[],extra:i={},rules:o=[],helper:d={},onInput:u,onChange:h,onEnter:m}=F,b=Qi(e,l),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof v?v():v||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`");const C=t=>{const{beforeOpen:l}=d,a=(l??ae)({[B]:b},e,n);null!=a&&a.then?a.then((()=>{k(!0),null==t||t()})).catch((()=>{})):!1!==a&&(k(!0),null==t||t())},S=()=>{te(!1,(()=>re(x.current)))},w=t=>{Zi(e,l,t),y(o,t,s,c),oe(e,s,c),null==h||h({[B]:t},e,N.current),ee()},I={visible:H,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Wn[f]+20}px`},onClose:()=>{S()}},T={...d,size:f,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:b,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:l}=E;ne((0,J.uniqBy)([...N.current.filter((e=>t.includes(e[l]))),...e],l));const a=N.current.map((e=>({text:e[n],value:e[l]}))),i=(0,J.uniqBy)([...a,...r],"value").filter((e=>t.includes(e.value)));V(i),w(i.map((e=>e.value)));const{closed:o}=d;te(!1,(()=>re(x.current))),null==o||o(N.current)})(e,t):S()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(A.Select,{mode:"multiple",open:!1,value:b,placeholder:i.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:i.allowClear,maxTagCount:i.collapseTags?"responsive":void 0,maxTagTextLength:i.maxTagTextLength,disabled:i.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&(null==m||m({[B]:b},e))},onDoubleClick:()=>{i.disabled||C()},onChange:e=>{const{valueKey:t}=E;ne(N.current.filter((n=>e.includes(n[t])))),w(e),R()}},K.map((e=>t().createElement(A.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(A.Button,{className:"ant-input-search-button",disabled:i.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{C()}})))),t().createElement(Gt,I,t().createElement(Xs,T)))},"tree-helper":(e,n)=>{const{dataIndex:l,precision:a}=n,{type:r,extra:i={},rules:o=[],helper:d={},onChange:u,onEnter:h}=F,v=Qi(e,l),E=d.fieldAliasMap;E||g("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof E?E():E||{};Object.keys(C).includes(l)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值");const S=t=>{const{beforeOpen:l}=d,a=(l??ae)({[B]:v},e,n);null!=a&&a.then?a.then((()=>{k(!0),null==t||t()})).catch((()=>{})):!1!==a&&(k(!0),null==t||t())},I=()=>{te(!1,(()=>re(x.current)))},N=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(n)&&Object.keys(n).length){for(const t in n){const l=n[t],a=b.find((e=>e.dataIndex===t));if(a){var r;Zi(e,t,l,a.precision);const n=null===(r=a.editRender)||void 0===r?void 0:r.call(a,e,a);n&&Array.isArray(n.rules)&&y(n.rules,l,s,t)}else Zi(e,t,l)}m.current.forceUpdate()}Zi(e,l,t,a),y(o,t,s,c),oe(e,s,c),null==u||u({[B]:t},e),ee()},T={visible:H,title:p("qm.searchHelper.text"),width:d.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Wn[f]+20}px`},onClose:()=>{I()}},O={...d,defaultSelectedKeys:[v],size:f,onClose:e=>{e?(e=>{const t={};for(const n in C){const a=C[n];n!==l&&(t[n]=Ji(e,a))}const n=C[l]?Ji(e,C[l]):"";N(n,t);const{closed:a}=d;te(!1,(()=>re(x.current))),le(),null==a||a(e)})(e):I()}};return t().createElement(t().Fragment,null,t().createElement(Ps,{ref:w,value:v,allowClear:i.allowClear??!0,readOnly:i.readOnly,disabled:i.disabled,placeholder:i.placeholder||p("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target;t||R()},onKeyUp:t=>{if(13===t.keyCode){const n=t.target.value??"";null==h||h({[B]:n},e)}},onDoubleClick:()=>{S()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?S():N(""))}}),t().createElement(Gt,T,t().createElement(ac,O)))},"tree-helper-multiple":(e,n)=>{const{dataIndex:l}=n,{type:a,extra:r={},items:i=[],rules:o=[],helper:d={},onInput:u,onChange:h,onEnter:m}=F,b=Qi(e,l),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof v?v():v||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`");const C=t=>{const{beforeOpen:l}=d,a=(l??ae)({[B]:b},e,n);null!=a&&a.then?a.then((()=>{k(!0),null==t||t()})).catch((()=>{})):!1!==a&&(k(!0),null==t||t())},S=()=>{te(!1,(()=>re(x.current)))},w=t=>{Zi(e,l,t),y(o,t,s,c),oe(e,s,c),null==h||h({[B]:t},e,N.current),ee()},I={visible:H,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${Wn[f]+20}px`},onClose:()=>{S()}},T={...d,size:f,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:b,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=E;ne(e);const l=N.current.map((e=>({text:e[t],value:e[n]})));V(l),w(l.map((e=>e.value)));const{closed:a}=d;te(!1,(()=>re(x.current))),null==a||a(N.current)})(e):S()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(A.Select,{mode:"multiple",open:!1,value:b,placeholder:r.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:r.allowClear,maxTagCount:r.collapseTags?"responsive":void 0,maxTagTextLength:r.maxTagTextLength,disabled:r.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&(null==m||m({[B]:b},e))},onDoubleClick:()=>{r.disabled||C()},onChange:e=>{const{valueKey:t}=E;ne(N.current.filter((n=>e.includes(n[t])))),w(e),R()}},K.map((e=>t().createElement(A.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(A.Button,{className:"ant-input-search-button",disabled:r.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{C()}})))),t().createElement(Gt,I,t().createElement(ac,T)))}};return t().createElement(t().Fragment,null,Z?(()=>{const{type:e}=F,n=ce[e];if(!n)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const l=["cell--edit",{"is-error":!G}];return t().createElement("div",{ref:x,className:Ce()(l)},n(o,i),!G&&t().createElement("div",{className:"cell-error"},Y||X))})():(()=>{const{extra:e={}}=F;return e.disabledColor?t().createElement("span",{style:{color:e.disabledColor}},u):t().createElement(t().Fragment,null,u)})(),Q&&t().createElement("i",{className:"cell--sign"}))},Hs=require("copy-to-clipboard");var ks=l.n(Hs);const Ls=e=>{const{text:n,options:l,showMessage:a=!0,onCopy:r}=e;return Ft(e.children,{onClick:i=>{const o=t().Children.only(e.children),s=ks()(n,l);null==r||r(n,s),s&&a&&A.message.success(p("qm.clipboard.success")),o&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(i)}})};Ls.displayName="QmCopyToClipboard";const qs=Ls;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 l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},$s.apply(this,arguments)}const _s=t().forwardRef(((n,l)=>{const{tableData:a,flattenColumns:r}=n,{getRowKey:i,tableProps:o,tableRef:c,editableColumns:d,leftFixedColumns:u,rightFixedColumns:h,firstDataIndex:m,sorter:f,layout:b,showFooter:y,scrollX:v,scrollY:x,selectionKeys:E,rowExpandedKeys:C,highlightKey:S,isPingLeft:w,isPingRight:I,isTableEmpty:N,isTreeTable:T,isGroupSubtotal:R,isWebPagination:O,isDragMergeCell:A,setElementStore:P,createTableFullData:F,setSelectionKeys:H,setHighlightKey:k,getStickyLeft:L,getStickyRight:q,scrollXToColumn:$,scrollYToRecord:_,rowInViewport:D,dataChange:K,setPingLeft:V,setPingRight:M,setFullScreen:j,setOverlay:z,findParentRowKeys:U,getAllChildRowKeys:B,triggerScrollYEvent:W,scrollBottomDebouncer:G}=t().useContext(ui),{height:Y,minHeight:X,maxHeight:Q,rowSelection:Z,rowHighlight:ne,treeConfig:re,expandable:ie,stripe:se,summation:ce,rowStyle:de,cellStyle:ue,spanMethod:pe,ellipsis:he,showHeader:me,rowDraggable:fe,onRowClick:ge,onRowDblclick:be,onRowContextmenu:ye,onRowEnter:ve}=o,xe=t().useRef(null),Ee=t().useRef(null),Ie=t().useRef({prevST:0,prevSL:0}),{dragStart:Ne,renderDragPanel:Te,closeDragPanel:Re}=Is(),Oe={dateFormat:e=>{const t=e?s()(e).format(gi):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(bi):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(bi.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(Number(e))?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>eo(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},Ae=t().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:l,tableAutoHeight:a}=b,r={};return N&&Object.assign(r,{minHeight:"100px"}),X&&Object.assign(r,{minHeight:Gi(X)-e-n+"px"}),Q&&Object.assign(r,{maxHeight:Gi(Q)-e-n+"px"}),Y||l||a?{...r,maxHeight:"",minHeight:"",height:`${t}px`}:r}),[Y,Q,X,N,b]),Pe=t().useMemo((()=>{const{tableBodyWidth:e,gutterWidth:t}=b;return e&&x?e-t:e}),[b,x]),Fe=t().useMemo((()=>{const{scrollYStore:e}=c.current,{viewportHeight:t,gutterWidth:n}=b;return Math.floor((v?t-n:t)/e.rowHeight)}),[b,v]),[He,ke]=t().useState([]),Le=Eo(),qe=function(t,n){const[l,a]=e.useState(!1);return e.useEffect((()=>{let e;const l=t.current,r=t=>{e=t},i=t=>{((e,t)=>{const r=e.target,i=null==t?void 0:t.target,o=!r||!i,s=(null==l?void 0:l.contains(r))||(null==l?void 0:l.contains(i)),c=l===r,d=null==n?void 0:n.map((e=>document.querySelector(e))),u=(null==d?void 0:d.some((e=>null==e?void 0:e.contains(r))))||(null==d?void 0:d.includes(i));a(!(o||s||c||u))})(t,e)};return l&&(Me(document,"mousedown",r),Me(document,"mouseup",i)),()=>{l&&(je(document,"mousedown",r),je(document,"mouseup",i))}}),[t]),l}(xe,[".table-editable__popper"]);t().useImperativeHandle(l,(()=>({renderCellTitle:Ze,setClickedValues:Ve,forceUpdate:Le}))),De((()=>{qe&&(Ve([]),A&&Re())}),[qe]),De((()=>{He.length&&Ci.focus(c.current.uid)}),[He]),t().useEffect((()=>{_e(),Ke()}),[]);const $e=t().useCallback((e=>{var t,n;const{keyCode:l}=e;if(c.current.uid===(null===(t=Ci.getFocusInstance())||void 0===t?void 0:t.id)&&(27===l&&(Ve([]),k(""),j(!1)),He.length&&(((e,t)=>{if(ee||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1})(document.activeElement,xe.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)))){if(13===l&&("radio"===(null==Z?void 0:Z.type)||ne)){const t=E[0]??S??null,n=a.find((e=>i(e,e.index)===t))??null;n&&(null==ve||ve(n,e))}if(38===l||40===l){var r,o;Ue(e);const{allTableData:t}=c.current,n=O?Ui(a):t,s=n.length;let d=n.findIndex((e=>i(e,e.index)===He[0]));const u=38===l?(--d+s)%s:++d%s,p=n[u],h=i(p,p.index);"radio"!==(null==Z?void 0:Z.type)||null!==(r=Z.disabled)&&void 0!==r&&r.call(Z,p)||H([h]),!ne||null!==(o=ne.disabled)&&void 0!==o&&o.call(ne,p)||k(h),D(u)||(38===l&&_(h,u),40===l&&_(h,Fe>u+1?0:u+1-Fe)),Ve([h,He[1]])}if(9===l){if(Ue(e),!d.length)return Ve([]);const t=d.length;let n=d.findIndex((e=>e.dataIndex===He[1]));const l=++n%t,a=d[l].dataIndex;Ve([He[0],a]),$(a)}}}),[He,a,E,d,Fe]);t().useEffect((()=>{const e=Ct()(document,"keydown",$e);return()=>e.remove()}),[$e]);const _e=()=>{P("$tableBody",xe.current),P("$tableYspace",Ee.current)},Ke=()=>{z("overlay"===((e,t)=>{if(ee||!e||!t)return null;"float"===(t=oe(t))&&(t="cssFloat");try{var n;const l=e.style[t];if(l)return l;const a=null===(n=document.defaultView)||void 0===n?void 0:n.getComputedStyle(e,"");return a?a[t]:""}catch(n){return e.style[t]}})(xe.current.parentNode,"overflowY"))},Ve=e=>{(0,J.isEqual)(e,He)||ke(e)},ze=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Be=(e,t,n)=>{var l;const{deriveRowKeys:a}=c.current,r=zi(a,e);let i=[];const o=B((null==r?void 0:r.children)||[]),s=(null===(l=so(a,e))||void 0===l?void 0:l.slice(0,-1).reverse())||[];return i=n?[...new Set([...t,e,...o])]:t.filter((t=>![e,...o].includes(t))),s.forEach((e=>{var t;const n=zi(a,e),l=Xi(i,(null==n||null===(t=n.children)||void 0===t?void 0:t.map((e=>e.rowKey)))||[]);i=l?[...i,e]:i.filter((t=>t!==e))})),i},We=e=>Array.isArray(e.children)&&e.children.length>0,Ge=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const l=[];return e.forEach((e=>{const a=e.index,o=i(e,e.index);if(l.push(Ye(e,a,o,n)),null!=ie&&ie.expandedRowRender){const{expandedRowClassName:n,rowExpandable:i=ae}=ie;C.includes(o)&&i(e)&&l.push(t().createElement("tr",{key:`expand_${o}`,className:"body--row-expanded"},t().createElement("td",{colSpan:r.length,className:"body--column",style:{paddingLeft:Z?"100px":"50px"}},t().createElement("div",{className:Ce()("cell",n)},ie.expandedRowRender(e,a)))))}if((null==re||!re.virtual)&&We(e)){const t="function"!=typeof(null==ie?void 0:ie.rowExpandable)||ie.rowExpandable(e);C.includes(o)&&t&&l.push(...Ge(e.children,n+1))}})),l},Ye=function(e,n,l){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const i=["body--row",{"body--row-striped":se&&n%2!=0,"body--row-selected":E.includes(l),"body--row-current":S===l,...R?lt(e._group):null}];return t().createElement("tr",{key:l,className:Ce()(i)},r.map(((t,r)=>Xe(t,r,e,n,l,a))))},Xe=(e,n,l,a,r,o)=>{const{isIE:s,isOverlay:d}=c.current,{dataIndex:p,fixed:m,align:g,className:y=""}=e,{rowSpan:v,colSpan:C}=et(l,e,a,n),{gutterWidth:S}=b;if(!v||!C)return null;const w=e.ellipsis??he,I=!s&&"left"===m,N=!s&&"right"===m,O=["body--column",{"col--ellipsis":w,"col--center":"center"===g,"col--right":"right"===g,"column--sort":!!f[p],"cell-fix-left":I,"cell-fix-right":N,"cell-fix-left-last":I&&u[u.length-1].dataIndex===p,"cell-fix-right-first":N&&h[0].dataIndex===p,[y]:!!y}],A=s?null:{left:I?`${L(p)}px`:"",right:N?`${q(p)+(d&&x?S:0)}px`:""},P=de?"function"==typeof de?de(l,a):de:null,F=ue?"function"==typeof ue?ue(l,e,a,n):ue:null,$=R?nt(l._group):null,_=Ze(e,l,a,n);return t().createElement("td",{key:p,title:w?_:void 0,rowSpan:v>1?v:void 0,colSpan:C>1?C:void 0,"data-index":n,className:Ce()(O),style:{...A,...$,...P,...F},onClick:t=>((e,t,n)=>{var l,a;const{dataIndex:r}=n;if([mo.expandableColumn,mo.operationColumn].includes(r))return;const o=i(t,t.index);Ve([o,r]);const s=null===(l=n.editRender)||void 0===l?void 0:l.call(n,t,n),c=s&&!s.disabled,{type:d,selectByClickRow:u=!0,disabled:p=le}=Z||{};!d||p(t)||c||(u||r===mo.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:l=!0,onSelect:a}=Z||{};if("radio"===n&&H([e]),"checkbox"===n){const n=!E.includes(e),r=T&&!l?Be(e,E,n):ze(e,E,n);H(r),null==a||a(n,t,r)}})(o,t),[mo.selectionColumn].includes(r)||(!ne||null!==(a=ne.disabled)&&void 0!==a&&a.call(ne,t)||c||k(o),null==ge||ge(t,n,e))})(t,l,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:l}=n;[mo.expandableColumn,mo.selectionColumn,mo.operationColumn].includes(l)||null==be||be(t,n,e)})(t,l,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:l}=n;[mo.expandableColumn,mo.selectionColumn,mo.operationColumn].includes(l)||null==ye||ye(t,n,e)})(t,l,e)},t().createElement("div",{className:"cell"},Qe(e,l,a,n,_,r,o)),N&&d&&x&&h[h.length-1].dataIndex===p?t().createElement("i",{className:"gutter-overlay",style:{width:S,right:-1*(S+1)}}):null)},Qe=(e,n,l,a,r,i,o)=>{const{dataIndex:s,canCopy:c,editRender:d,render:u}=e,h=Qi(n,s);if(s===mo.expandableColumn)return t().createElement(Ts,{record:n,rowKey:i});if(s===mo.selectionColumn)return t().createElement(Ns,{selectionKeys:E,column:e,record:n,rowKey:i});const f=Je(h,e,n);if(d)return t().createElement(Fs,{column:e,record:n,rowKey:i,columnKey:s,clicked:He,text:f});const g=u?u(h,n,e,l,a):f;return T&&s===m?[tt(null!=re&&re.virtual?n._level:o),t().createElement(Ts,{key:"expand",record:n,rowKey:i,style:We(n)?{}:{visibility:"hidden"}}),g]:c?t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},g),r&&t().createElement(qs,{text:r},t().createElement(we.CopyOutlined,{className:"icon",title:p("qm.table.config.copyText"),onClick:e=>e.stopPropagation()}))):g},Ze=(e,t,n,l)=>{const{dataIndex:a,render:r}=e;if([mo.expandableColumn,mo.selectionColumn,mo.operationColumn].includes(a))return"";let i="";const o=Qi(t,a);if("function"==typeof r){const a=r(o,t,e,n,l);i=te(a)?ao(a).join(""):a}else i=Je(o,e,t).toString();return i},Je=(e,t,n)=>{var l;const{dictItems:a,precision:r,formatType:i,editRender:o}=t,s=a||(null==o||null===(l=o(n,t))||void 0===l?void 0:l.items)||[],c=s.find((t=>t.value==e));let d=(null==c?void 0:c.text)??e??"";if(Array.isArray(e)&&(d=e.map((e=>{const t=s.find((t=>t.value==e));return(null==t?void 0:t.text)??e})).join(",")),r>=0&&""!==d&&(d=Number(d).toFixed(r)),i){const e=Oe[`${oe(i)}Format`];e?d=e(d):g("Table","字段的格式化类型 `formatType` 配置不正确")}return d},et=(e,t,n,l)=>{let r=1,i=1;if("function"==typeof pe){const o=pe({row:e,column:t,rowIndex:n,columnIndex:l,tableData:a});if(Array.isArray(o)?(r=o[0],i=o[1]):(0,J.isPlainObject)(o)&&(r=o.rowSpan,i=o.colSpan),e===a[0]&&0===r){r=1;for(let e=1;e<a.length;e++){const{rowSpan:n}=et(a[e],t,a[e].index,l);if(n>0)break;r++}}}const{mergeCells:o}=c.current;if(o.length>0){const e=o.find((e=>e.row===n&&e.col===l));e&&(r=e.rowSpan,i=e.colSpan)}return{rowSpan:r,colSpan:i}},tt=e=>e?t().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*mo.treeTable.textIndent+"px"}}):null,nt=e=>{const{backgroundColor:t,color:n}=ce.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:n}},lt=e=>{const t=ce.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},at=Se("table"),rt=A?{onMouseDown:Ne}:null;return t().createElement("div",{className:`${at}--body-wrapper`,style:{...Ae},onScroll:e=>{const{elementStore:t,scrollYLoad:n}=c.current,{prevST:l,prevSL:a}=Ie.current,r=x?b.gutterWidth:0,{scrollTop:i,scrollLeft:o}=e.target;if(o!==a){me&&(t.$header.scrollLeft=o),y&&(t.$footer.scrollLeft=o);const e=o>0,n=Math.ceil(o)+b.tableWidth<b.tableBodyWidth+r;w!==e&&V(e),I!==n&&M(n)}if(n&&i!==l&&W(i),x&&i!==l){const n=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(i)+b.viewportHeight-r>=n&&G(e)}Ie.current.prevST=i,Ie.current.prevSL=o}},t().createElement("div",{ref:Ee,className:"body--y-space"}),t().createElement("div",{className:"body--x-space",style:{width:Pe?`${Pe}px`:""}}),t().createElement("table",$s({ref:xe,className:`${at}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},rt,{style:{width:Pe?`${Pe}px`:""}}),t().createElement("colgroup",null,r.map((e=>{const{dataIndex:n,width:l,renderWidth:a}=e;return t().createElement("col",{key:n,style:{width:`${l||a}px`,minWidth:`${l||a}px`}})}))),fe?t().createElement(In.ReactSortable,{itemKey:e=>i(e,e.index),tag:"tbody",animation:200,list:a,setList:e=>{const t=e.map((e=>i(e,e.index))),n=a.map((e=>i(e,e.index)));if((0,J.isEqual)(t,n))return;const l=[];c.current.tableFullData.forEach((t=>{a.includes(t)?l.push(e.shift()):l.push(t)})),F(l),K()}},a.map((e=>Ye(e,e.index,i(e,e.index))))):t().createElement("tbody",null,Ge(a))),A&&Te())}));_s.displayName="TableBody";const Ds=_s,Ks=e=>{const{summationRows:n,flattenColumns:l}=e,{getRowKey:a,tableProps:r,tableRef:i,sorter:o,layout:s,scrollY:c,leftFixedColumns:d,rightFixedColumns:u,setElementStore:h,getStickyLeft:m,getStickyRight:f}=t().useContext(ui),{footRender:g}=r,b=t().useRef(null);t().useEffect((()=>{y()}),[]);const y=()=>{h("$footer",b.current)},v=Se("table"),{tableBodyWidth:x}=s;return t().createElement("div",{ref:b,className:`${v}--footer-wrapper`},g?g(l,i.current.tableFullData):t().createElement("table",{className:`${v}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:x?`${x}px`:""}},(()=>{const{gutterWidth:e}=s;return t().createElement("colgroup",null,l.map((e=>{const{dataIndex:n,width:l,renderWidth:a}=e;return t().createElement("col",{key:n,style:{width:`${l||a}px`,minWidth:`${l||a}px`}})})),c&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("tfoot",null,(()=>{const{isIE:e}=i.current,a=["gutter",{"cell-fix-right":!!u.length}],r=e?null:{right:u.length?0:""};return n.map(((e,n)=>t().createElement("tr",{key:n,className:"footer--row"},l.map(((n,l)=>((e,n,l)=>{const{isIE:a}=i.current,{gutterWidth:r}=s,{dataIndex:h,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!o[h],"cell-fix-left":!a&&"left"===g,"cell-fix-right":!a&&"right"===g,"cell-fix-left-last":!a&&"left"===g&&d[d.length-1].dataIndex===h,"cell-fix-right-first":!a&&"right"===g&&u[0].dataIndex===h}],x=a?null:{left:"left"===g?`${m(h)}px`:"",right:"right"===g?`${f(h)+(c?r:0)}px`:""},E=null!=y&&y.render?y.render(i.current.tableFullData):Qi(n,`${h}_text`),C=0===l&&""===E?p("qm.table.config.summaryText"):E;return t().createElement("td",{key:h,title:C,className:Ce()(v),style:{...x}},t().createElement("div",{className:"cell"},C))})(n,e,l))),c&&t().createElement("td",{className:Ce()(a),style:{...r}}))))})())))};var Vs;!function(e){e.small="small",e.middle="default",e.large="default"}(Vs||(Vs={}));const Ms=e=>{var n,l;const{current:a,pageSize:r,total:o,config:s,onChange:c}=e,{global:d}=t().useContext(i),{tableProps:u,$size:p,setElementStore:h}=t().useContext(ui),{infoBarConfig:m}=u,f=t().useRef(null);t().useEffect((()=>{g()}),[]);const g=()=>{h("$pager",f.current)},b=(e,t)=>{c(e,t)},y=(null==s?void 0:s.showSizeChanger)??mo.pagination.showSizeChanger,v=(null==s?void 0:s.showQuickJumper)??mo.pagination.showQuickJumper,x=(null==s?void 0:s.pageSizeOptions)||(null==d||null===(n=d.table)||void 0===n||null===(l=n.pagination)||void 0===l?void 0:l.pageSizeOptions)||mo.pagination.pageSizeOptions,E={[`${Se("table")}-pager`]:!0};return t().createElement("div",{ref:f,className:Ce()(E)},t().createElement("div",{className:"pager-alert"},"bottom"===(null==m?void 0:m.position)&&t().createElement(Co,{total:o})),t().createElement(A.Pagination,{size:Vs[p],showSizeChanger:y,showQuickJumper:v,pageSizeOptions:x,current:a,pageSize:r,total:o,onChange:b,onShowSizeChange:b}))},js=()=>{const{layout:e}=t().useContext(ui),n=t().useMemo((()=>{const{headerHeight:t,viewportHeight:n}=e;return{top:`${t}px`,height:`${n}px`}}),[e]),l=Se("table");return t().createElement("div",{className:`${l}--empty`,style:n},t().createElement(ut,null))};function zs(){return zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},zs.apply(this,arguments)}const Us=t().forwardRef(((e,n)=>{const{rowKey:l,columns:a,loading:r,stripe:o,resizable:s,customClass:c,paginationConfig:d,tablePrint:u,exportExcel:p,infoBarConfig:h,topSpaceAlign:m,showTableInfo:f,showFullScreen:b,showRefresh:y,showToolBox:v,showColumnDefine:x,showHeader:E}=e,{size:C}=t().useContext(i),S=t().useMemo((()=>e.size??C??""),[e.size,C]),w=t().useRef(null),I=t().useRef(null),N=t().useRef(null),T=t().useRef(null),R=t().useRef(null),O=Eo(),A=t().useCallback(((e,t)=>{const n="function"==typeof l?l(e,t):e[l];return void 0===n?(g("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n}),[l]),{tableRef:P,tableFullData:F,setElementStore:H,setOriginColumns:k,setTableFullData:L,setTableOriginData:q,setAllTableData:$,setDeriveRowKeys:_,setFieldAuth:D,setMergeCells:K,setScrollYStore:V,setScrollYLoad:M,setResizeState:j,setHandleState:z,setSummaries:U,setSelectionRows:B,setShouldToTop:W,setRecordsMap:G,setOverlay:Y,clearElementStore:X,clearRecordsMap:Q}=((e,n)=>{let{getRowKey:l,$size:a}=n;const r=t().useRef({uid:lo(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],fieldAuth:{},mergeCells:[],scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:mo.rowHeightMaps[a]},store:new ho,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,isOverlay:!1,isIE:!ee&&/MSIE|Trident/.test(navigator.userAgent)}),i=function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.map((e=>{const r=l(e,e.index),o=n?`${n}#${r}`:`${r}`,s={level:a,rowKey:r,rowKeyPath:o};return e.children&&(s.children=i(e.children,r,o,a+1)),t?Object.assign({},s,{parentRowKey:t}):s}))},o=e=>{const t=[];return e.forEach((e=>{var n;null!==(n=e.children)&&void 0!==n&&n.length?t.push(...o(e.children)):t.push(e.rowKey)})),t};return{tableRef:r,...r.current,setElementStore:(e,t)=>{r.current.elementStore[e]=t},setOriginColumns:e=>{r.current.originColumns=e},setTableFullData:e=>{r.current.tableFullData=e},setTableOriginData:e=>{r.current.tableOriginData=e},setAllTableData:e=>{const t=Ui(e);r.current.allTableData=t,r.current.allRowKeys=t.map((e=>l(e,e.index)))},setDeriveRowKeys:e=>{r.current.deriveRowKeys=i(e,"",""),r.current.flattenRowKeys=o(r.current.deriveRowKeys),r.current.treeTable=r.current.deriveRowKeys.some((e=>Array.isArray(e.children)&&e.children.length))},setFieldAuth:(e,t)=>{r.current.fieldAuth[e]=t},setMergeCells:e=>{const t=[];e.forEach((e=>{t.push(e);for(let n=1;n<e.colSpan;n++)for(let l=0;l<e.rowSpan;l++)t.push({row:e.row+l,col:e.col+n,rowSpan:0,colSpan:0});for(let n=1;n<e.rowSpan;n++)for(let l=0;l<e.colSpan;l++)t.push({row:e.row+n,col:e.col+l,rowSpan:0,colSpan:0})})),r.current.mergeCells=t},setScrollYStore:e=>{r.current.scrollYStore=e},setResizeState:e=>{r.current.resizeState=e},setHandleState:e=>{r.current.handleState=e},setSummaries:e=>{r.current.summaries=e},setScrollYLoad:e=>{r.current.scrollYLoad=e},setShouldToTop:e=>{r.current.shouldToTop=e},setSelectionRows:e=>{r.current.selectionRows=e},setRecordsMap:(e,t)=>{r.current.recordsMap.set(e,t)},setOverlay:e=>{r.current.isOverlay=e},clearElementStore:()=>{for(const e in r.current.elementStore)r.current.elementStore[e]=null},clearRecordsMap:()=>{r.current.recordsMap.clear()}}})(0,{getRowKey:A,$size:S}),{tableData:Z,setTableData:te,filters:ne,setFilters:le,sorter:ae,setSorter:re,superFilters:ie,setSuperFilters:oe,pagination:se,setPagination:de,selectionKeys:ue,setSelectionKeys:pe,rowExpandedKeys:he,setRowExpandedKeys:me,highlightKey:fe,setHighlightKey:ge,layout:be,setLayout:ye,permission:ve,setPermission:xe,spinning:Ee,setSpinning:we,scrollX:Ie,setScrollX:Ne,scrollY:Te,setScrollY:Re,isPingLeft:Oe,setPingLeft:Ae,isPingRight:Pe,setPingRight:Fe,isFullScreen:He,setFullScreen:ke}=(e=>{var n,l;const{paginationConfig:a,rowSelection:r,expandable:o,rowHighlight:s}=e,{global:c}=t().useContext(i),d={current:mo.pagination.current,pageSize:(null==a?void 0:a.pageSize)??(null==c||null===(n=c.table)||void 0===n||null===(l=n.pagination)||void 0===l?void 0:l.pageSize)??mo.pagination.pageSize,total:0},u=(null==r?void 0:r.selectedRowKeys)??(null==r?void 0:r.defaultSelectedRowKeys)??[],p=(null==o?void 0:o.expandedRowKeys)??(null==o?void 0:o.defaultExpandedRowKeys)??[],[h,m]=t().useState([]),[f,g]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),{}),[b,y]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),{}),[v,x]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),[]),[E,C]=t().useState(d),[S,w]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),u),[I,N]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),p),[T,R]=t().useState((null==s?void 0:s.currentRowKey)??""),[O,A]=t().useState({gutterWidth:go(),tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[P,F]=t().useState({export:!0,import:!0,print:!0}),[H,k]=t().useState(!1),[L,q]=t().useState(!1),[$,_]=t().useState(!1),[D,K]=t().useState(!1),[V,M]=t().useState(!1),[j,z]=t().useState(!1);return{tableData:h,setTableData:m,filters:f,setFilters:g,sorter:b,setSorter:y,superFilters:v,setSuperFilters:x,pagination:E,setPagination:C,selectionKeys:S,setSelectionKeys:w,rowExpandedKeys:I,setRowExpandedKeys:N,highlightKey:T,setHighlightKey:R,layout:O,permission:P,setPermission:F,setLayout:A,spinning:H,setSpinning:k,scrollX:L,setScrollX:q,scrollY:$,setScrollY:_,isPingLeft:D,setPingLeft:K,isPingRight:V,setPingRight:M,isFullScreen:j,setFullScreen:z}})(e),{isFetch:Le,isWebPagination:qe,isScrollPagination:$e,showPagination:_e,shouldUpdateHeight:Ke,tableColumns:Ve,flattenColumns:Me,editableColumns:je,summationColumns:ze,leftFixedColumns:Ue,rightFixedColumns:Be,firstDataIndex:We,showSummary:Ge,showFooter:Ye,isHeadGroup:Xe,bordered:Qe,isHeadSorter:Ze,isHeadFilter:Je,isServiceSummation:et,isSelectCollection:tt,isTableImport:nt,isTableClipboard:lt,isSuperSearch:at,isFastSearch:rt,isGroupSummary:it,isGroupSubtotal:ot,isDragMergeCell:st,isTreeTable:ct,isTableEmpty:dt,summationRows:ut,fetchParams:pt}=yo(e,{getRowKey:A,tableRef:P,tableFullData:F,tableData:Z,sorter:ae,filters:ne,superFilters:ie,pagination:se}),{createElementStore:mt,tableStyles:ft,getSpan:gt,getStickyLeft:bt,getStickyRight:yt,scrollXToColumn:vt,scrollYToRecord:xt,rowInViewport:Et,calcTableHeight:Ct,resetTableScroll:St,doLayout:wt}=xo(e,{getRowKey:A,tableRef:P,$size:S,tableColumns:Ve,flattenColumns:Me,leftFixedColumns:Ue,layout:be,scrollY:Te,tableData:Z,showFooter:Ye,showPagination:_e,isWebPagination:qe,isFullScreen:He,setLayout:ye,setScrollX:Ne,setScrollY:Re,setElementStore:H,setScrollYStore:V,setShouldToTop:W}),{initialTable:It,createTableFullData:Nt,getTableData:Tt,handleTableData:Rt,createTableData:Ot,createGroupData:At,createSelectionKeys:Pt,createSelectionRows:Ft,createRowExpandedKeys:Ht,findParentRowKeys:kt,getAllChildRowKeys:Lt,doFieldValidate:qt,getTableLog:$t,dataChange:_t,tableChange:Dt,toLastPage:Kt,toFirstPage:Vt,getPageCount:Mt,pagerChangeHandle:jt,triggerScrollYEvent:zt,scrollBottomDebouncer:Ut,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearRowSelection:Yt,clearRowHighlight:Xt,clearTableLog:Qt,destroy:Zt}=vo(e,{getRowKey:A,tableRef:P,tableElementRef:I,tableBodyRef:N,$size:S,tableColumns:Ve,tableFullData:F,pagination:se,layout:be,filters:ne,sorter:ae,superFilters:ie,fetchParams:pt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,summationColumns:ze,shouldUpdateHeight:Ke,isFetch:Le,isTreeTable:ct,isWebPagination:qe,isScrollPagination:$e,isServiceSummation:et,isGroupSubtotal:ot,doLayout:wt,setTableData:te,setTableFullData:L,setTableOriginData:q,setAllTableData:$,setDeriveRowKeys:_,setPagination:de,setSpinning:we,setSorter:re,setFilters:le,setSuperFilters:oe,setSelectionKeys:pe,setRowExpandedKeys:me,setHighlightKey:ge,setSelectionRows:B,setScrollYLoad:M,setScrollYStore:V,setFieldAuth:D,setResizeState:j,setSummaries:U,setPermission:xe,setRecordsMap:G,resetTableScroll:St,clearElementStore:X,clearRecordsMap:Q});((e,n)=>{const{columns:l,summation:a,rowSelection:r,expandable:i,rowHighlight:o,mergeCells:s=[]}=e,{tableRef:c,topElementRef:d,tableElementRef:u,tableBodyRef:p,resizableBarRef:h,$size:m,scrollX:f,pagination:b,selectionKeys:y,rowExpandedKeys:v,highlightKey:x,summationRows:E,summationColumns:C,showSummary:S,isWebPagination:w,isScrollPagination:I,isTreeTable:N,toLastPage:T,toFirstPage:R,getPageCount:O,setHandleState:A,scrollYToRecord:P,setSelectionKeys:F,setOriginColumns:H,setSelectionRows:k,setRowExpandedKeys:L,setHighlightKey:q,setResizeState:$,setMergeCells:_,setPingRight:D,calcTableHeight:K,createSelectionKeys:V,createSelectionRows:M,createRowExpandedKeys:j,createElementStore:z,triggerScrollYEvent:U,forceUpdate:B,initialTable:W,destroy:G}=n,{elementStore:Y,handleState:X,scrollYLoad:Q}=c.current,Z=t().useRef(E);De((()=>{if(!r)return;const{onChange:e}=r;"radio"===r.type&&p.current.setClickedValues(y.length?[y[0],""]:[]),k(M(y)),null==e||e(y,c.current.selectionRows),S&&C.some((e=>e.summation.sumBySelection))&&B()}),[y]),De((()=>{if(!i)return;const{allTableData:e,allRowKeys:t}=c.current,{onChange:n}=i;null==n||n(v,v.map((n=>e[t.findIndex((e=>e===n))])))}),[v]),De((()=>{const{allTableData:e,allRowKeys:t}=c.current;var n;N&&L(j()),o&&(p.current.setClickedValues(x?[x,""]:[]),null===(n=o.onChange)||void 0===n||n.call(o,x,e[t.findIndex((e=>e===x))]??null))}),[x]),De((()=>{var e;(0,J.isEqual)(E,Z.current)||(Z.current=E,S&&a&&(null===(e=a.onChange)||void 0===e||e.call(a,E)))}),[E]),De((()=>{const e=V(r.selectedRowKeys);(0,J.isEqual)(e,y)||(F(e),N&&L(j()))}),[null==r?void 0:r.selectedRowKeys]),De((()=>{const e=j(i.expandedRowKeys);(0,J.isEqual)(e,v)||L(e)}),[null==i?void 0:i.expandedRowKeys]),De((()=>{const{currentRowKey:e}=o;e!==x&&q(e??"")}),[null==o?void 0:o.currentRowKey]),De((()=>{const{insert:e,remove:t}=X;e&&(w&&("after"===e?T():R()),P("","after"===e?1e5:0)),t&&b.current>O()&&T(),(e||t)&&A({insert:null,remove:!1})}),[b.total]),De((()=>{Q&&U(Y.$tableBody.parentNode.scrollTop)}),[Q]),De((()=>{D(f)}),[f]),De((()=>{K()}),[m]),De((()=>{_(s),p.current.forceUpdate()}),[s]),De((()=>{Q&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),I&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Q,I]);const ee=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&($(Object.assign({},e,{winHeight:n})),K())};t().useEffect((()=>(z({$toper:d.current,$table:u.current,$resizableBar:h.current}),H(ce(l)),W(),_(s),window.addEventListener("resize",ee,!1),K(),()=>{G(),window.removeEventListener("resize",ee)})),[])})(e,{tableRef:P,topElementRef:w,tableElementRef:I,tableBodyRef:N,resizableBarRef:R,$size:S,scrollX:Ie,pagination:se,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,showSummary:Ge,summationRows:ut,summationColumns:ze,isWebPagination:qe,isScrollPagination:$e,isTreeTable:ct,toLastPage:Kt,toFirstPage:Vt,getPageCount:Mt,setHandleState:z,scrollYToRecord:xt,setOriginColumns:k,setSelectionKeys:pe,setSelectionRows:B,setRowExpandedKeys:me,setHighlightKey:ge,setResizeState:j,setMergeCells:K,setPingRight:Fe,calcTableHeight:Ct,createSelectionKeys:Pt,createSelectionRows:Ft,createRowExpandedKeys:Ht,createElementStore:mt,triggerScrollYEvent:zt,forceUpdate:O,initialTable:It,destroy:Zt});const Jt=t().useMemo((()=>({getRowKey:A,tableProps:e,tableRef:P,tableBodyRef:N,$size:S,flattenColumns:Me,editableColumns:je,leftFixedColumns:Ue,rightFixedColumns:Be,firstDataIndex:We,sorter:ae,filters:ne,superFilters:ie,layout:be,bordered:Qe,showFooter:Ye,showSummary:Ge,summationRows:ut,scrollX:Ie,scrollY:Te,pagination:se,fetchParams:pt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,isFetch:Le,isPingLeft:Oe,isPingRight:Pe,isHeadSorter:Ze,isHeadFilter:Je,isFullScreen:He,isTableEmpty:dt,isHeadGroup:Xe,isTreeTable:ct,isGroupSubtotal:ot,isWebPagination:qe,isDragMergeCell:st,dataChange:_t,tableChange:Dt,getTableData:Tt,setElementStore:H,createTableFullData:Nt,setSorter:re,setFilters:le,setSuperFilters:oe,setSelectionKeys:pe,setHighlightKey:ge,setRowExpandedKeys:me,setSelectionRows:B,getSpan:gt,getStickyLeft:bt,getStickyRight:yt,scrollXToColumn:vt,scrollYToRecord:xt,rowInViewport:Et,setPagination:de,setPingLeft:Ae,setPingRight:Fe,setSpinning:we,setFullScreen:ke,setShouldToTop:W,setOverlay:Y,doFieldValidate:qt,createTableData:Ot,createGroupData:At,findParentRowKeys:kt,getAllChildRowKeys:Lt,triggerScrollYEvent:zt,scrollBottomDebouncer:Ut,resetTableScroll:St,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearRowSelection:Yt,clearRowHighlight:Xt})),[e,S,Me,je,Ue,Be,We,ae,ne,ie,be,Qe,Ye,Ge,ut,Ie,Te,se,pt,ue,he,fe,Le,Oe,Pe,Ze,Je,He,dt,Xe,ct,ot,qe,st]);((e,n)=>{const{getRowKey:l,tableProps:a,tableRef:r,toolBoxRef:i,flattenColumns:o,editableColumns:s,pagination:c,fetchParams:d,selectionKeys:u,rowExpandedKeys:p,highlightKey:h,isFetch:m,dataChange:f,getTableData:b,handleTableData:y,createTableData:v,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:C,doFieldValidate:S,setHandleState:w,setSelectionKeys:I,setRowExpandedKeys:N,setHighlightKey:T,setSelectionRows:R,setOriginColumns:O,forceUpdate:A,getTableLog:P,clearRowSelection:F,clearRowHighlight:H,clearTableSorter:k,clearTableFilter:L,clearSuperFilters:q,clearTableLog:$}=n,{columns:_,columnsChange:D}=a,K=(e,t,n)=>{for(let a=0;a<e.length;a++){const r=e[a],i=l(r,r.index);Array.isArray(r.children)&&K(r.children,t,n),t.includes(i)&&(null==n||n(r,i),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:async e=>{m&&(await b(),null==e||e())},GET_LOG:()=>P(),GET_FETCH_PARAMS:()=>{const e={};for(const t in d)Object.keys(c).includes(t)||(e[t]=d[t]);return e},CLEAR_TABLE_DATA:()=>{m||(F(),H(),k(),L(),q(),$(),v([]))},CLEAR_LOG:()=>{$()},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:e=>{I(e)},SET_HIGHLIGHT:e=>{T(e)},SET_EXPANDABLE:e=>{N(e)},SET_SELECTION_ROWS:e=>{R(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{O(e)},SET_TABLE_COLUMN:(e,t,n)=>{const l=Ki(_,e);if(!l)return g("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(l.noAuth)return g("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,J.set)(l,e,t[e]);n&&(D?D([..._]):g("Table","需要设置 `columnsChange` 参数"))},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:a}=r.current,i=(Array.isArray(e)?e:[e]).filter((e=>(0,J.isPlainObject)(e)));if(!i.length)return;i.forEach((e=>{o.forEach((t=>{const{dataIndex:n}=t;[mo.expandableColumn,mo.selectionColumn,mo.operationColumn].includes(n)||Zi(e,n,Qi(e,n))})),n.addToInserted(e)}));const s="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey);let d=a;if(c)d=s?[...i,...d]:d.concat(i);else{const e=co(a,(e=>t.parentRowKey===l(e,e.index)));e&&(Array.isArray(e.children)?s?e.children.unshift(...i):e.children.push(...i):e.children=i)}v(d),c&&w(Object.assign({},r.current.handleState,{insert:s?"before":"after"})),f()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=r.current,a=(Array.isArray(e)?e:[e]).map((e=>(0,J.isPlainObject)(e)?l(e,e.index):e));if(!a.length)return;let i=!1;K(n,a,((e,n)=>{t.addToRemoved(e),s.forEach((l=>{const{dataIndex:a,editRender:r}=l,i=null==r?void 0:r(e,l);if(!i)return;const{rules:o=[],disabled:s}=i;!s&&o.length&&(t.removeFromRequired({x:n,y:a}),t.removeFromValidate({x:n,y:a}),t.removeFromEdited({x:n,y:a}))})),i=!0})),i&&(v(n),I(u.filter((e=>!a.includes(e)))),a.includes(h)&&H(),N(p.filter((e=>!a.includes(e)))),w(Object.assign({},r.current.handleState,{remove:!0})),f())},VALIDATE_FIELDS:(e,t)=>{r.current.allTableData.forEach((n=>{s.forEach((a=>{const{dataIndex:r,editRender:i}=a,o=null==i?void 0:i(n,a);if(!o)return;const s=l(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(r))return;const{rules:c=[],disabled:d}=o;!d&&c.length&&S(c,Qi(n,r),s,r)}))}));const{required:n,validate:a}=P(),i=[...n,...a];return i.length&&C(i[0].rowKey),A(),{required:n,validate:a}}})))})(n,{getRowKey:A,tableProps:e,tableRef:P,toolBoxRef:T,flattenColumns:Me,editableColumns:je,pagination:se,fetchParams:pt,selectionKeys:ue,rowExpandedKeys:he,highlightKey:fe,isFetch:Le,dataChange:_t,getTableData:Tt,handleTableData:Rt,createTableData:Ot,calcTableHeight:Ct,scrollXToColumn:vt,scrollYToRecord:xt,doFieldValidate:qt,setHandleState:z,setSelectionKeys:pe,setRowExpandedKeys:me,setHighlightKey:ge,setSelectionRows:B,setOriginColumns:k,forceUpdate:O,getTableLog:$t,clearRowSelection:Yt,clearRowHighlight:Xt,clearTableSorter:Bt,clearTableFilter:Wt,clearSuperFilters:Gt,clearTableLog:Qt}),t().useEffect((()=>{Ci.register(P.current.uid,n??{current:null})}),[]);const en=Se("table"),tn={[`${en}--wrapper`]:!0,[`${en}--lg`]:"large"===S,[`${en}--sm`]:"small"===S,[`${en}--maximize`]:He,[c]:!!c},nn={[en]:!0,"is--border":Qe,"is--striped":o,"is--fixed":Ue.length||Be.length,"is--sortable":Ze,"is--filterable":Je,"is--head-group":Xe,"is--merge-cell":st,"is--empty":dt,"show--head":E,"show--foot":Ye,"ping--left":Oe,"ping--right":Pe,"scroll--x":Ie,"scroll--y":Te};return t().createElement(ui.Provider,{value:Jt},t().createElement("div",{className:Ce()(tn)},f&&t().createElement("div",{ref:w,className:`${en}-top`},t().createElement("div",{className:`${en}-top__space`},"bottom"!==(null==h?void 0:h.position)&&t().createElement(Co,{total:se.total}),t().createElement("div",{className:`${en}-top__space-slot`,style:{justifyContent:xi[m]}},e.children)),t().createElement("div",{className:`${en}-top__actions`},t().createElement(ms,{ref:T,showFullScreen:b,showReload:y&&Le,showPrint:ve.print&&!!u,showImport:ve.import&&nt,showExport:ve.export&&!!p,showClipboard:lt,showCollection:tt,showFastSearch:rt,showSuperSearch:at,showGroupSummary:it,showToolBox:v,tableColumns:Ve}),x&&t().createElement(fs,{columns:a}))),t().createElement(ht,{spinning:r??Ee},t().createElement("div",{ref:I,className:Ce()(nn),style:ft},t().createElement("div",{className:`${en}--main-wrapper`},E&&t().createElement(ws,{tableColumns:Ve,flattenColumns:Me,sorter:ae,filters:ne}),t().createElement(Ds,{ref:N,tableData:Z,flattenColumns:Me}),Ye&&t().createElement(Ks,{summationRows:ut,flattenColumns:Me})),Qe&&t().createElement("div",{className:`${en}--border-line`}),dt&&t().createElement(js,null),s&&t().createElement("div",{ref:R,className:`${en}--resizable-bar`}))),_e&&t().createElement(Ms,zs({},se,{config:d,onChange:(e,t)=>jt({current:e,pageSize:t})}))))}));Us.defaultProps={columns:[],dataSource:[],rowKey:"id",border:!0,resizable:!0,showHeader:!0,ellipsis:!0,multipleSort:!0,topSpaceAlign:"right",showFullScreen:!0,showRefresh:!0,showClipboard:!0,showSelectCollection:!0,showSuperSearch:!0,showFastSearch:!0,showGroupSummary:!0,showColumnDefine:!0,showTableInfo:!0},Us.displayName="QmTable";const Bs=Us,Ws=Bs;function Gs(){return Gs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Gs.apply(this,arguments)}const Ys=e=>{var n;const{uniqueKey:l,multiple:a,initialValue:r,selectionRows:o,defaultSelectedKeys:s=[],filters:c=[],table:d={},onClose:u}=e,{size:h}=t().useContext(i),m=t().useMemo((()=>e.size??h??""),[e.size,h]),f=t().useRef(null),g=t().useRef(null),b=t().useRef(null),y=ei(f),[v,x]=t().useState(d),[E,C]=t().useState(),[S,w]=t().useState(s),[I,N]=t().useState(!1),[T,R]=t().useState(300),[O,A]=t().useState(c),[P,F]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...d.columns||[]]),[H,k]=t().useState((0,J.merge)({},null===(n=d.fetch)||void 0===n?void 0:n.params,r)),[L,q]=t().useState([]),$=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Wn[m]-30)},_=(0,J.debounce)($,5);De((()=>{_()}),[y.width]),De((()=>{(0,J.isEqual)(c,O)||A(c)}),[c]),t().useEffect((()=>{D()}),[H]),t().useEffect((()=>{o&&b.current.SET_SELECTION_ROWS(o)}),[o]),t().useEffect((()=>{var e;r&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(r))}),[]);const D=async()=>{const{webPagination:e,fetch:t}=v;if(!e||null==t||!t.api)return;const{api:n,dataKey:l,beforeFetch:a=ae}=t;if(a(H)){N(!0);try{const e=await n(H);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,l)??[];w([]),await re(0),q(t)}}catch(e){}N(!1)}},K=e=>{a||(C(e),u(e))},V=e=>{k(Object.assign({},H,e))},M=Se("search-helper"),j=v.webPagination?{dataSource:L,loading:I,webPagination:!0}:{fetch:{...v.fetch,params:H}};return t().createElement("div",{ref:f,className:`${M}--wrapper`},t().createElement("div",{className:"form-wrap"},O.length?t().createElement(br,{ref:g,items:O,uniqueKey:l,formType:"search",isAutoFocus:!1,fieldsChange:e=>A(e),onCollapse:()=>$(),onFinish:e=>V(e),onReset:async()=>{const[e,t]=await g.current.GET_FORM_DATA();e||V(t)}}):null),t().createElement("div",null,t().createElement(Ws,Gs({ref:b,uniqueKey:l,height:T,columns:P,rowKey:v.rowKey||"pageIndex"},j,{rowSelection:{type:a?"checkbox":"radio",clearableAfterFetched:!a,selectFirstRowOnChange:!0,selectedRowKeys:S,onChange:(e,t)=>{w(e),C(a?t:t[0])}},columnsChange:e=>F(e),onRowDblclick:K,onRowEnter:K}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Wn[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(me,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(me,{type:"primary",disabled:!E,onClick:()=>u(E,a?S:void 0)},p("qm.dialog.confirm"))))};Ys.displayName="SearchHelper";const Xs=Ys;function Qs(){return Qs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},Qs.apply(this,arguments)}const Zs=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Zs(e.children)),e.children&&t.push(e.value)})),t},Js=(e,t)=>{let n=null;for(let l=0;l<e.length;l++){if(Array.isArray(e[l].children)&&(n=Js(e[l].children,t)),n)return n;if(t(e[l]))return e[l]}return n},ec=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&ec(e.children,t),t(e)||e.children&&e.children.length))),tc=e=>{var n;const{uniqueKey:l,multiple:a,initialValue:r,selectionRows:o,defaultSelectedKeys:s=[],filters:c=[],table:d={},tree:u={},onClose:h}=e,{size:m}=t().useContext(i),f=t().useMemo((()=>e.size??m??""),[e.size,m]),b=t().useRef(null),y=t().useRef(null),v=t().useRef(null),x=ei(b),[E,C]=t().useState(d),[S,w]=t().useState(),[I,N]=t().useState(s),[T,R]=t().useState(!1),[O,P]=t().useState(300),[F,H]=t().useState(300),[k,L]=t().useState(c),[q,$]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...d.columns||[]]),[_,D]=t().useState((0,J.merge)({},null===(n=d.fetch)||void 0===n?void 0:n.params,r)),[K,V]=t().useState([]),M=()=>{const e=b.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");P(e.offsetHeight-n.offsetHeight-10),H(e.offsetHeight-t.offsetHeight-2*Wn[f]-30)},j=(0,J.debounce)(M,5);De((()=>{j()}),[x.width]),De((()=>{(0,J.isEqual)(c,k)||L(c)}),[c]),t().useEffect((()=>{z()}),[_]),t().useEffect((()=>{o&&v.current.SET_SELECTION_ROWS(o)}),[o]),t().useEffect((()=>{var e;r&&(null===(e=y.current)||void 0===e||e.SET_FIELDS_VALUE(r)),ne()}),[]);const z=async()=>{const{webPagination:e,fetch:t}=E;if(!e||null==t||!t.api)return;const{api:n,dataKey:l,beforeFetch:a=ae}=t;if(a(_)){R(!0);try{const e=await n(_);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,l)??[];N([]),await re(0),V(t)}}catch(e){}R(!1)}},U=e=>{a||(w(e),h(e))},B=e=>{D(Object.assign({},_,e))},[W,G]=t().useState([]),[Y,X]=t().useState([]),[Q,Z]=t().useState(""),ee=t().useRef(W),te=t().useRef([]);De((()=>{X(Zs(W))}),[W]);const ne=async()=>{if(!u.fetch)return;const{api:e,params:t,dataKey:n,valueKey:l="value",textKey:a="text"}=u.fetch;try{const r=await e(t);if(200===r.code){const e=Array.isArray(r.data)?r.data:(0,J.get)(r.data,n)??[],t=En(e,l,a);G(t),ee.current=t,te.current=e}}catch(e){}},le=e=>`${e}|${ya.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ie=Se("tree-table-helper"),oe=E.webPagination?{dataSource:K,loading:T,webPagination:!0}:{fetch:{...E.fetch,params:_}};return t().createElement("div",{ref:b,className:`${ie}--wrapper`},t().createElement(tt,{defaultValue:200,style:{height:"100%"}},t().createElement(tt.Pane,{min:100,style:{overflowY:"auto"}},t().createElement(A.Input.Search,{className:"input-wrap",value:Q,style:{marginBottom:8},placeholder:p("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=ec(ee.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==le(n).indexOf(e)}));Z(e),G(t)})(e.target.value)}),t().createElement(A.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:O,defaultExpandAll:!0,expandedKeys:Y,treeData:W,filterTreeNode:e=>{if(!Q)return!1;const t=e.text||"";return-1!==le(t).indexOf(Q)},onExpand:e=>{X(e)},onSelect:e=>{const{valueKey:t="value"}=u.fetch;(e=>{if(!u.tableParamsMap)return g("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof u.tableParamsMap?u.tableParamsMap():u.tableParamsMap,n={};for(const l in t)n[l]=(0,J.get)(e,t[l]);B(n)})(Js(te.current,(n=>(0,J.get)(n,t)===e[0]))||{})}})),t().createElement(tt.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},k.length?t().createElement(br,{ref:y,items:k,uniqueKey:l,formType:"search",isAutoFocus:!1,fieldsChange:e=>L(e),onCollapse:()=>M(),onFinish:e=>B(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||B(t)}}):null),t().createElement("div",null,t().createElement(Ws,Qs({ref:v,uniqueKey:l,height:F,columns:q,rowKey:E.rowKey||"pageIndex"},oe,{rowSelection:{type:a?"checkbox":"radio",clearableAfterFetched:!a,selectFirstRowOnChange:!0,selectedRowKeys:I,onChange:(e,t)=>{N(e),w(a?t:t[0])}},columnsChange:e=>$(e),onRowDblclick:U,onRowEnter:U}))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Wn[f]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(me,{onClick:()=>h(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(me,{type:"primary",disabled:!S,onClick:()=>h(S,a?I:void 0)},p("qm.dialog.confirm"))))};tc.displayName="TreeTableHelper";const nc=tc,lc=e=>{var n,l,a;const{multiple:r,tree:o={},defaultSelectedKeys:s,onClose:c}=e,{size:d}=t().useContext(i),u=t().useMemo((()=>e.size??d??""),[e.size,d]),[h,m]=t().useState(),[f]=t().useState(null===(n=o.fetch)||void 0===n?void 0:n.params),g=Se("tree-helper"),b=o.fetch?{...Z()(o.fetch,["params","valueKey","textKey"]),params:f}:void 0;return t().createElement("div",{className:`${g}--wrapper`},t().createElement(di,{multiple:r,fetch:b,fieldsDefine:{valueKey:null===(l=o.fetch)||void 0===l?void 0:l.valueKey,textKey:null===(a=o.fetch)||void 0===a?void 0:a.textKey},asyncLoad:o.asyncLoad,checkStrictly:o.checkStrictly,checkStrategy:o.checkStrategy,defaultSelectedKeys:s,defaultExpandAll:o.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Wn[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(me,{onClick:()=>c(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(me,{type:"primary",disabled:!h,onClick:()=>c(h)},p("qm.dialog.confirm"))))};lc.displayName="TreeHelper";const ac=lc;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 l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},rc.apply(this,arguments)}const ic="_startSign",oc="_endSign",sc=e=>{var n;const{uniqueKey:l,initialValue:a,filters:r=[],table:o={},onClose:s}=e,{size:c}=t().useContext(i),d=t().useMemo((()=>e.size??c??""),[e.size,c]),u=t().useRef(null),h=t().useRef(null),m=t().useRef(null),f=ei(u),[g,b]=t().useState(o),[y,v]=t().useState(!1),[x,E]=t().useState([]),[C,S]=t().useState(300),[w,I]=t().useState(r),[N,T]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},{title:p("qm.form.rangeSearchHelper")[0],dataIndex:ic,width:80,align:"right",render:(e,n)=>t().createElement("span",{className:"icon-sign"},e)},...o.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:oc,fixed:"right",width:80,render:(e,n)=>t().createElement("span",{className:"icon-sign"},e)}]),[R,O]=t().useState((0,J.merge)({},null===(n=o.fetch)||void 0===n?void 0:n.params,a)),[P,F]=t().useState([]),H=t().useMemo((()=>x.map((e=>null==e?void 0:e.pageIndex))),[x]),k=t().useMemo((()=>2===H.length&&H.every((e=>void 0!==e))),[H]),L=()=>{const e=u.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*Wn[d]-30)},q=(0,J.debounce)(L,5);De((()=>{q()}),[f.width]),De((()=>{(0,J.isEqual)(r,w)||I(r)}),[r]),t().useEffect((()=>{$()}),[R]);const $=async()=>{const{webPagination:e,fetch:t}=g;if(!e||null==t||!t.api)return;const{api:n,dataKey:l,beforeFetch:a=ae}=t;if(a(R)){v(!0);try{const e=await n(R);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,l)??[];F(t)}}catch(e){}v(!1)}},_=(e,t)=>{delete e[t]},D=()=>{x.forEach((e=>{e&&(_(e,ic),_(e,oc))})),E([])},K=e=>{D(),O(Object.assign({},R,e))},V=Se("range-helper"),M=g.webPagination?{dataSource:P,loading:y,webPagination:!0}:{fetch:{...g.fetch,params:R}};return t().createElement("div",{ref:u,className:`${V}--wrapper`},t().createElement("div",{className:"form-wrap"},w.length?t().createElement(br,{ref:h,items:w,initialValues:a,uniqueKey:l,formType:"search",isAutoFocus:!1,fieldsChange:e=>I(e),onCollapse:()=>L(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await h.current.GET_FORM_DATA();e||K(t)}}):null),t().createElement("div",null,t().createElement(Ws,rc({ref:m,height:C,columns:N,rowKey:g.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=H[0]&&e.pageIndex<=H[1]?{backgroundColor:"#f5f5f5"}:{}},M,{columnsChange:e=>T(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[ic,oc].includes(n)&&(n===ic&&(e[n]?(_(e,n),E([void 0,x[1]])):e.pageIndex>H[1]?A.message.warning(p("qm.searchHelper.rangeStartTip")):(x[0]&&_(x[0],n),e[n]="[",E([e,x[1]]))),n===oc&&(e[n]?(_(e,n),E([x[0],void 0])):e.pageIndex<H[0]?A.message.warning(p("qm.searchHelper.rangeEndTip")):(x[1]&&_(x[1],n),e[n]="]",E([x[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===H[0]&&(e[ic]="["),e.pageIndex===H[1]&&(e[oc]="]")}))}}),t().createElement(me,{type:"primary",icon:t().createElement(we.ClearOutlined,null),title:p("qm.table.alert.clear"),onClick:()=>D()}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Wn[d]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(me,{onClick:()=>s(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(me,{type:"primary",disabled:!k,onClick:()=>s(x.map((e=>(e=>{const t={};for(const n in e)[ic,oc].includes(n)||(t[n]=e[n]);return t})(e))))},p("qm.dialog.confirm"))))};sc.displayName="RangeTableHelper";const cc=sc,dc={previewWidth:1100,defaultDistance:.45,logoHeight:60},uc=(0,e.createContext)(void 0);var pc=null;function hc(){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),l=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),r=e.match(/x64/i);if(!t&&!n&&r)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||r)return!0}else if(l){if((l=l[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var i=e.match(/Chrome\D?\d+/i);if(i&&(i=i[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function mc(e,t){var n;try{var l=navigator.userAgent,a=!!l.match(/MSIE/i)||!!l.match(/Trident/i);if(hc()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void A.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&l.match(/x64/i),e||t?n=a?e:t:pc?n=pc:((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),pc=n),!n||!n.VERSION)return l.indexOf("Chrome"),l.indexOf("Firefox"),n;return n.VERSION<"6.2.2.6"&&hc(),n}catch(e){A.message.error("getLodop 出错:"+e)}}hc();const fc=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:n}=window.screen;if(t&&n)e[0]=t,e[1]=n;else{var l;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()),null===(l=t.parentNode)||void 0===l||l.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},gc=t().forwardRef(((e,n)=>{const{templateRender:l,directPrint:a}=e,{global:r}=t().useContext(i),{$$preview:o}=t().useContext(uc),{state:s,isWindowsPrinter:c,pageSize:d}=o,u=t().useRef(null),p=t().useRef({}),h=t().useRef([]),m=t().useRef([]),f=t().useRef([]),[b,y]=t().useState(!0);t().useImperativeHandle(n,(()=>({createPreviewDom:P,createExportHtml:H,createPrintHtml:F,SHOW_PREVIEW:k,DIRECT_PRINT:L}))),De((()=>{A()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),t().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const v=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*dc.defaultDistance+10*dc.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[s,c,d]),x=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*dc.defaultDistance+10*dc.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return fc(v-10*(e.left-dc.defaultDistance)-10*(e.right-dc.defaultDistance))}),[s,v]),C=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return fc(x-10*(e.top-dc.defaultDistance)-10*(e.bottom-dc.defaultDistance))}),[s,x]),S=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:fc(10*e.left),right:fc(10*e.right),top:fc(10*e.top),bottom:fc(10*e.bottom)}}),[s]),I=t().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:n,top:l,bottom:a}=w,r=E+t+n,i=dc.previewWidth-r<=0?0:(dc.previewWidth-r)/2,o=Math.abs((1-S)*r/2);let c=0;return S>1&&(c=o>i?-1*i:-1*o),S<1&&(c=r-2*o>dc.previewWidth?0:i>0?o:(dc.previewWidth-(r-2*o))/2),{width:`${E}px`,height:"stylus"===e?"auto":C+"px",paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${l}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${S})`,opacity:b?0:1}}),[s,b,w,S,C,E]),N=(h.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{var e,t;const n=(null==r||null===(e=r.print)||void 0===e?void 0:e.leftLogo)??"",l=(null==r||null===(t=r.print)||void 0===t?void 0:t.rightLogo)??"";return[`<tr style="height: ${dc.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',n?`<img src="${n}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',l?`<img src="${l}" 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},R=()=>{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=p.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},O=()=>{const e=p.current.templateEl.children[0].children,t=[],n=[];for(let l=0;l<e.length;l++){if("template-cols"===e[l].getAttribute("type"))continue;const a=e[l].clientHeight;e[l].style.height=a+"px",n.push(a),t.push(e[l].outerHTML)}m.current=n,h.current=t},A=()=>{if(!h.current.length)return;const{form:{setting:e,printerType:t}}=s;if(a)return f.current.push([T(),N(),...h.current]);const n=e.fixedLogo?C-dc.logoHeight:C;let l=[];if(f.current=[],"stylus"===t)f.current.push([T(),...e.fixedLogo?[N()]:[],...h.current]);else{let t=0;for(let a=0,r=m.current.length;a<r;a++){const i=h.current[a],o=m.current[a];e.fixedLogo||0!==a||(t+=dc.logoHeight),t+=o,t<=n?l.push(i):(f.current.push([T(),...e.fixedLogo?[N()]:[],...l]),l=[],t=0,a-=1),a===r-1&&l.length&&f.current.push([T(),...e.fixedLogo?[N()]:[],...l])}}var r;e.fixedLogo||null===(r=f.current[0])||void 0===r||r.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');o.setState({currentPage:1,totalPage:f.current.length}),P()},P=()=>{var e;const{currentPage:t}=s;let n=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;n+=(null===(e=f.current[t-1])||void 0===e?void 0:e.join(""))??"",n+="</table>",p.current.previewEl.innerHTML=n,p.current.previewEl.parentNode.scrollTop=0},F=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},H=()=>{const e=[];for(let t=0;t<h.current.length;t++)e[t]=h.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+T()+e.join("")+"</table>"},k=async()=>{var e;if("TABLE"!==(null===(e=p.current.templateEl)||void 0===e?void 0:e.tagName))return q();p.current.previewEl.innerHTML||(R(),await re(0),O(),A(),y(!1))},L=async()=>{var e;if("TABLE"!==(null===(e=p.current.templateEl)||void 0===e?void 0:e.tagName))return q();R(),await re(0),O(),A(),y(!1),o.doPrint(F()),await re(0),o.doClose()},q=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},$={[Se("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:u,className:Ce()($)},t().createElement(ht,{wrapperClassName:"spin",spinning:b,tip:"Loading..."},t().createElement("div",{className:"preview"},t().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},null==l?void 0:l()),t().createElement("div",{className:"workspace",style:I}))))}));gc.displayName="Container";const bc=gc;function yc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class vc extends e.Component{constructor(){super(...arguments),yc(this,"formRef",t().createRef()),yc(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:dc.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:dc.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:dc.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:dc.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),yc(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})})),yc(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")}))),yc(this,"state",{formList:this.createFormList()}),yc(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())})),yc(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return t().createElement(t().Fragment,null,t().createElement(br,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(me,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),t().createElement(me,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}yc(vc,"contextType",i);const xc=vc;function Ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Cc extends e.Component{constructor(){var e,n,l;super(...arguments),Ec(this,"provide",{$$preview:this}),Ec(this,"containRef",t().createRef()),Ec(this,"state",{visible:!1,form:{printerName:-1,printerType:(null===(e=this.props.defaultConfig)||void 0===e?void 0:e.printerType)||"laser",copies:(null===(n=this.props.defaultConfig)||void 0===n?void 0:n.copies)||1,scale:1,setting:{distance:{left:dc.defaultDistance,right:dc.defaultDistance,top:dc.defaultDistance,bottom:dc.defaultDistance},pageSize:"210*297",direction:(null===(l=this.props.defaultConfig)||void 0===l?void 0:l.direction)||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Ec(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Ec(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Ec(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 ts().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Ec(this,"doClose",(()=>{var e,t;null===(e=(t=this.props).onClose)||void 0===e||e.call(t)})),Ec(this,"getPrintConfig",(async e=>{const t=this.context.global,n=null==t?void 0:t.getComponentConfigApi;if(n)try{const t=await n({key:e});if(200===t.code)return t.data}catch(e){}})),Ec(this,"savePrintConfig",(async(e,t)=>{const n=this.context.global,l=null==n?void 0:n.saveComponentConfigApi;if(l)try{await l({[e]:t})}catch(e){}})),Ec(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 ')),Ec(this,"doPrint",(e=>{const t=mc();if(!t)return;const{uniqueKey:n,closeAfterPrint:l}=this.props,{form:{setting:a,printerName:r,printerType:i,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=dc,{left:d,right:u,top:h,bottom:m}=a.distance;t.PRINT_INIT(n??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(r),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"===i&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===i&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*m*2,""),t.ADD_PRINT_TABLE(10*(h-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==i?10*(m-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?l&&this.doClose():A.message.error(p("qm.print.printError"))},t.PRINT()})),Ec(this,"doExport",(e=>{const t=mc();if(!t)return;const{uniqueKey:n,closeAfterPrint:l}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(n??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?l&&this.doClose():A.message.error(p("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===a.direction?1:2),t.SAVE_TO_FILE(`${s()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:p("qm.print.laserPrinter"),value:"laser"},{text:p("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=mc(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const n=e.GET_PRINTER_COUNT();for(let l=0;l<n;l++)t.push({text:e.GET_PRINTER_NAME(l),value:l})}catch(e){g("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let t=await ts().getItem(this.printerKey);var e;t||(t=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(t)&&await ts().setItem(this.printerKey,t)),(0,J.isPlainObject)(t)&&Object.keys(t).length&&(0,J.merge)(this.state.form,{...t,printerName:(null===(e=this.printerItems.find((e=>e.text===t.printerName)))||void 0===e?void 0:e.value)??-1})}catch(e){}}render(){const{preview:e,templateRender:n}=this.props,{visible:l,form:a,currentPage:r,totalPage:i,printPage:o}=this.state,s=Se("print-preview"),c={visible:l,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?t().createElement(t().Fragment,null,t().createElement("div",{className:Ce()(d)},t().createElement("div",{className:"outer"},t().createElement("div",{className:"header"},t().createElement("span",null,p("qm.print.printer"),":",t().createElement(A.Select,{value:a.printerName,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t().createElement(A.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.type"),":",t().createElement(A.Select,{value:a.printerType,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t().createElement(A.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.copies"),":",t().createElement(A.InputNumber,{value:a.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),t().createElement("span",null,p("qm.print.printPage.0"),t().createElement(A.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")),t().createElement("span",null,t().createElement(A.Pagination,{size:"small",current:r,pageSize:1,total:i,onChange:this.pageChangeHandle})),t().createElement("span",null,t().createElement(me,{type:"text",icon:t().createElement(we.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),t().createElement("span",null,t().createElement(me,{type:"text",icon:t().createElement(we.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),t().createElement("span",null,t().createElement(me,{icon:t().createElement(we.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),t().createElement("div",{className:"main"},t().createElement(uc.Provider,{value:this.provide},t().createElement(bc,{ref:this.containRef,templateRender:n,directPrint:!1}))),t().createElement("div",{className:"footer"},t().createElement("span",null,p("qm.print.scale"),":",t().createElement(A.Slider,{value:a.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{scale:e}})))}}),t().createElement("em",{className:"scale-text"},`${Math.floor(100*a.scale)}%`)),t().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:r,totalPage:i}))))),t().createElement(Gt,c,t().createElement(xc,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(uc.Provider,{value:this.provide},t().createElement(bc,{ref:this.containRef,templateRender:n,directPrint:!0}))}}Ec(Cc,"contextType",i);const Sc=Cc;function wc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ic extends e.Component{constructor(){super(...arguments),wc(this,"previewRef",t().createRef()),wc(this,"state",{visible:!1,loading:!1}),wc(this,"clickHandle",(async()=>{this.setState({loading:!0});try{var e,t;const n=await(null===(e=(t=this.props).click)||void 0===e?void 0:e.call(t));if(this.setState({loading:!1}),"boolean"==typeof n&&!n)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),wc(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:n,uniqueKey:l,defaultConfig:a,preview:r,closeAfterPrint:i}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${dc.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:l,defaultConfig:a,preview:r,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return r?t().createElement(Gt,o,t().createElement(Sc,s)):e?t().createElement(Sc,s):null})),wc(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await re(0),this.setState({visible:!0}),await re(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:n,icon:l,type:a,disabled:r,shape:i}=this.props,o={size:n||this.context.size||"",type:a,shape:i,icon:l,loading:e,disabled:r,click:this.clickHandle};return t().createElement(t().Fragment,null,this.props.children&&t().createElement(me,o,this.props.children),this.createRender())}}wc(Ic,"propTypes",{size:(e,t,n)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:r().elementType}),wc(Ic,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),wc(Ic,"contextType",i);const Nc=Ic,Tc="1.6.3"})(),a})()));